Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
mobile Datovka
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
14
Issues
14
List
Boards
Labels
Service Desk
Milestones
Merge Requests
4
Merge Requests
4
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Datovka projects
mobile Datovka
Commits
7698015e
Commit
7698015e
authored
Nov 28, 2018
by
Karel Slaný
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed icon column from files database.
parent
4ae34b4d
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
20 additions
and
102 deletions
+20
-102
mobile-datovka.pro
mobile-datovka.pro
+0
-2
src/auxiliaries/attachment_helper.cpp
src/auxiliaries/attachment_helper.cpp
+0
-50
src/auxiliaries/attachment_helper.h
src/auxiliaries/attachment_helper.h
+0
-34
src/files.cpp
src/files.cpp
+13
-2
src/net/isds_wrapper.cpp
src/net/isds_wrapper.cpp
+0
-1
src/sqlite/db_tables.cpp
src/sqlite/db_tables.cpp
+2
-4
src/sqlite/file_db.cpp
src/sqlite/file_db.cpp
+5
-8
src/worker/task_send_message.cpp
src/worker/task_send_message.cpp
+0
-1
No files found.
mobile-datovka.pro
View file @
7698015e
...
...
@@ -89,7 +89,6 @@ TRANSLATIONS_FILES += \
SOURCES += \
src/accounts.cpp \
src/auxiliaries/attachment_helper.cpp \
src/auxiliaries/email_helper.cpp \
src/datovka_shared/gov_services/helper.cpp \
src/datovka_shared/gov_services/service/gov_mv_crr_vbh.cpp \
...
...
@@ -211,7 +210,6 @@ SOURCES += \
HEADERS += \
src/accounts.h \
src/auxiliaries/attachment_helper.h \
src/auxiliaries/email_helper.h \
src/common.h \
src/datovka_shared/gov_services/helper.h \
...
...
src/auxiliaries/attachment_helper.cpp
deleted
100644 → 0
View file @
4ae34b4d
/*
* Copyright (C) 2014-2018 CZ.NIC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* In addition, as a special exception, the copyright holders give
* permission to link the code of portions of this program with the
* OpenSSL library under certain conditions as described in each
* individual source file, and distribute linked combinations including
* the two.
*/
#include <QFileInfo>
#include <QSet>
#include "src/auxiliaries/attachment_helper.h"
/*
* There is list of know file extension sufixes. For these we have png images.
*/
const
QSet
<
QString
>
knowExp
=
QSet
<
QString
>
()
<<
"avi"
<<
"bmp"
<<
"doc"
<<
"docx"
<<
"dwg"
<<
"gif"
<<
"html"
<<
"htm"
<<
"jpeg"
<<
"jpg"
<<
"mpeg"
<<
"mpg"
<<
"mp3"
<<
"ods"
<<
"odt"
<<
"pdf"
<<
"png"
<<
"ppt"
<<
"pptx"
<<
"rtf"
<<
"tiff"
<<
"txt"
<<
"wav"
<<
"xls"
<<
"xlsx"
<<
"xml"
<<
"zfo"
;
QString
getAttachmentFileIconFromFileExtension
(
const
QString
&
fileName
)
{
QString
img
(
"qrc:/fileicons/fileicon_blank.png"
);
QFileInfo
fi
(
fileName
);
QString
ext
=
fi
.
suffix
();
ext
=
ext
.
toLower
();
if
(
!
ext
.
isNull
())
{
if
(
knowExp
.
contains
(
ext
))
{
img
=
"qrc:/fileicons/fileicon_"
+
ext
+
".png"
;
}
}
return
img
;
}
src/auxiliaries/attachment_helper.h
deleted
100644 → 0
View file @
4ae34b4d
/*
* Copyright (C) 2014-2018 CZ.NIC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* In addition, as a special exception, the copyright holders give
* permission to link the code of portions of this program with the
* OpenSSL library under certain conditions as described in each
* individual source file, and distribute linked combinations including
* the two.
*/
#pragma once
#include <QString>
/*!
* @brief Get attachment icon from attachment file extension.
*
* @param[in] fileName Attachment filename with extension.
* @return Attachment icon filename string.
*/
QString
getAttachmentFileIconFromFileExtension
(
const
QString
&
fileName
);
src/files.cpp
View file @
7698015e
...
...
@@ -24,9 +24,9 @@
#include <QDesktopServices>
#include <QFileInfo>
#include <QQmlEngine>
#include <QStringBuilder>
#include "ios/src/url_opener.h"
#include "src/auxiliaries/attachment_helper.h"
#include "src/auxiliaries/email_helper.h"
#include "src/common.h"
#include "src/crypto/crypto.h"
...
...
@@ -118,7 +118,18 @@ void Files::deleteExpiredFilesFromDbs(int days)
QString
Files
::
getAttachmentFileIcon
(
const
QString
&
fileName
)
{
return
getAttachmentFileIconFromFileExtension
(
fileName
);
/* List of know file extension sufixes. For these we have png images. */
static
const
QSet
<
QString
>
knowExp
(
QSet
<
QString
>
()
<<
"avi"
<<
"bmp"
<<
"doc"
<<
"docx"
<<
"dwg"
<<
"gif"
<<
"html"
<<
"htm"
<<
"jpeg"
<<
"jpg"
<<
"mpeg"
<<
"mpg"
<<
"mp3"
<<
"ods"
<<
"odt"
<<
"pdf"
<<
"png"
<<
"ppt"
<<
"pptx"
<<
"rtf"
<<
"tiff"
<<
"txt"
<<
"wav"
<<
"xls"
<<
"xlsx"
<<
"xml"
<<
"zfo"
);
const
QString
ext
(
QFileInfo
(
fileName
).
suffix
().
toLower
());
if
((
!
ext
.
isEmpty
())
&&
knowExp
.
contains
(
ext
))
{
return
QStringLiteral
(
"qrc:/fileicons/fileicon_"
)
%
ext
%
QStringLiteral
(
".png"
);
}
return
QStringLiteral
(
"qrc:/fileicons/fileicon_blank.png"
);
}
qint64
Files
::
getAttachmentSizeInBytes
(
const
QString
&
filePath
)
...
...
src/net/isds_wrapper.cpp
View file @
7698015e
...
...
@@ -23,7 +23,6 @@
#include <QFileInfo>
#include "src/auxiliaries/attachment_helper.h"
#include "src/datovka_shared/isds/message_interface.h"
#include "src/datovka_shared/isds/type_conversion.h"
#include "src/datovka_shared/isds/types.h"
...
...
src/sqlite/db_tables.cpp
View file @
7698015e
...
...
@@ -319,8 +319,7 @@ namespace FlsTbl {
{
"dmFileMetaType"
,
DB_TEXT
},
{
"dmEncodedContent"
,
DB_TEXT
},
{
"_dmFileSize"
,
DB_INTEGER
},
{
"_dmDownloadDate"
,
DB_DATETIME
},
{
"_icon"
,
DB_TEXT
}
{
"_dmDownloadDate"
,
DB_DATETIME
}
/*
* PRIMARY KEY (id),
* FOREIGN KEY(dmID) REFERENCES messages ("dmID")
...
...
@@ -349,8 +348,7 @@ namespace FlsTbl {
{
"dmFileMetaType"
,
{
DB_TEXT
,
""
}},
{
"dmEncodedContent"
,
{
DB_TEXT
,
""
}},
{
"_dmFileSize"
,
{
DB_INTEGER
,
""
}},
{
"_dmDownloadDate"
,
{
DB_DATETIME
,
""
}},
{
"_icon"
,
{
DB_TEXT
,
""
}}
{
"_dmDownloadDate"
,
{
DB_DATETIME
,
""
}}
};
}
/* namespace FlsTbl */
SQLiteTbl
flsTbl
(
FlsTbl
::
tabName
,
FlsTbl
::
knownAttrs
,
FlsTbl
::
attrProps
,
...
...
src/sqlite/file_db.cpp
View file @
7698015e
...
...
@@ -29,7 +29,6 @@
#include <QSqlQuery>
#include <QSqlRecord>
#include "src/auxiliaries/attachment_helper.h"
#include "src/common.h"
#include "src/datovka_shared/isds/type_conversion.h"
#include "src/datovka_shared/log/log.h"
...
...
@@ -249,17 +248,17 @@ bool FileDb::insertUpdateFileIntoDb(qint64 dmId, const Isds::Document &document)
"dmFileGuid = :dmFileGuid, dmMimeType = :dmMimeType, "
"dmFormat = :dmFormat, dmFileMetaType = :dmFileMetaType, "
"dmEncodedContent = :dmEncodedContent, _dmFileSize = :_dmFileSize, "
"_dmDownloadDate = :_dmDownloadDate
, _icon = :_icon
"
"_dmDownloadDate = :_dmDownloadDate "
"WHERE id = :id"
;
}
else
{
queryStr
=
"INSERT INTO files ("
"dmID, dmFileDescr, dmUpFileGuid, dmFileGuid, dmMimeType, "
"dmFormat, dmFileMetaType, dmEncodedContent, _dmFileSize, "
"_dmDownloadDate
, _icon
"
"_dmDownloadDate"
") VALUES ("
":dmID, :dmFileDescr, :dmUpFileGuid, :dmFileGuid, :dmMimeType, "
":dmFormat, :dmFileMetaType, :dmEncodedContent, :_dmFileSize, "
":_dmDownloadDate
, :_icon
)"
;
":_dmDownloadDate)"
;
}
if
(
!
query
.
prepare
(
queryStr
))
{
...
...
@@ -280,8 +279,6 @@ bool FileDb::insertUpdateFileIntoDb(qint64 dmId, const Isds::Document &document)
query
.
bindValue
(
":_dmFileSize"
,
document
.
binaryContent
().
size
());
query
.
bindValue
(
":_dmDownloadDate"
,
QDate
::
currentDate
().
toString
(
DATE_DB_FORMAT
));
query
.
bindValue
(
":_icon"
,
getAttachmentFileIconFromFileExtension
(
document
.
fileDescr
()));
if
(
-
1
!=
id
)
{
query
.
bindValue
(
":id"
,
id
);
}
...
...
@@ -481,8 +478,8 @@ bool fileSizeColMakeInt(FileDb &fDb, QSqlDatabase &db)
}
queryStr
=
"INSERT INTO files "
"(id, dmID, dmFileDescr, dmUpFileGuid, dmFileGuid, dmMimeType, dmFormat, dmFileMetaType, dmEncodedContent, _dmFileSize, _dmDownloadDate
, _icon
) "
"SELECT id, dmID, dmFileDescr, dmUpFileGuid, dmFileGuid, dmMimeType, dmFormat, dmFileMetaType, dmEncodedContent, null, _dmDownloadDate
, _icon
"
"(id, dmID, dmFileDescr, dmUpFileGuid, dmFileGuid, dmMimeType, dmFormat, dmFileMetaType, dmEncodedContent, _dmFileSize, _dmDownloadDate) "
"SELECT id, dmID, dmFileDescr, dmUpFileGuid, dmFileGuid, dmMimeType, dmFormat, dmFileMetaType, dmEncodedContent, null, _dmDownloadDate "
"FROM _files_old"
;
if
(
!
query
.
prepare
(
queryStr
)
||
!
query
.
exec
())
{
logErrorNL
(
"Cannot prepare or execute SQL query: %s"
,
...
...
src/worker/task_send_message.cpp
View file @
7698015e
...
...
@@ -23,7 +23,6 @@
#include <QThread>
#include "src/auxiliaries/attachment_helper.h"
#include "src/datovka_shared/log/log.h"
#include "src/global.h"
#include "src/net/db_wrapper.h"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment