Commit 48f69c65 authored by Karel Slaný's avatar Karel Slaný

Replaced Files::EmailAttachType with Files::EmailAttachFlags.

parent 152c36e6
......@@ -121,11 +121,11 @@ Component {
}, StackView.Immediate)
},
"sendAttachEmail": function callSendAttachEmail() {
files.sendMsgFilesWithEmail(userName, msgId, EmailAttachType.SEND_EMAIL_ATTACHMENT_ONLY)
files.sendMsgFilesWithEmail(userName, msgId, EmailAttachFlag.MSG_ATTACHS)
pageView.pop(StackView.Immediate)
},
"sendZfoEmail": function callSendZfoEmail() {
files.sendMsgFilesWithEmail(userName, msgId, EmailAttachType.SEND_EMAIL_ZFO_ONLY)
files.sendMsgFilesWithEmail(userName, msgId, EmailAttachFlag.MSG_ZFO)
pageView.pop(StackView.Immediate)
},
"saveAttachs": function callSaveAttachs() {
......
......@@ -48,9 +48,9 @@
void Files::declareQML(void)
{
qmlRegisterType<Files>("cz.nic.mobileDatovka.files", 1, 0, "FileIdType");
qmlRegisterType<Files>("cz.nic.mobileDatovka.files", 1, 0, "EmailAttachType");
qmlRegisterType<Files>("cz.nic.mobileDatovka.files", 1, 0, "EmailAttachFlag");
qRegisterMetaType<Files::FileIdType>();
qRegisterMetaType<Files::EmailAttachType>();
qRegisterMetaType<Files::EmailAttachFlag>();
}
Files::Files(QObject *parent)
......@@ -240,7 +240,7 @@ void Files::openAttachmentFromPath(const QString &filePath)
}
void Files::sendMsgFilesWithEmail(const QString &userName, qint64 msgId,
enum Files::EmailAttachType attachType)
EmailAttachFlags attachFlags)
{
qDebug("%s()", __func__);
......@@ -276,8 +276,7 @@ void Files::sendMsgFilesWithEmail(const QString &userName, qint64 msgId,
QList<FileDb::FileData> filelist;
/* Get attachment files from database if needed */
if (Files::SEND_EMAIL_ZFO_ATTACHMENT == attachType
|| Files::SEND_EMAIL_ATTACHMENT_ONLY == attachType ) {
if (attachFlags & MSG_ATTACHS) {
FileDb *fDb = GlobInstcs::fileDbsPtr->accessFileDb(
GlobInstcs::setPtr->dbsLocation, userName,
(*GlobInstcs::acntMapPtr)[userName].storeToDisk());
......@@ -294,8 +293,7 @@ void Files::sendMsgFilesWithEmail(const QString &userName, qint64 msgId,
}
/* Get zfo file from database if needed */
if (Files::SEND_EMAIL_ZFO_ATTACHMENT == attachType
|| Files::SEND_EMAIL_ZFO_ONLY == attachType ) {
if (attachFlags & MSG_ZFO) {
FileDb::FileData msgData;
msgData.content = GlobInstcs::zfoDbPtr->getZfoContentFromDb(msgId,
(*GlobInstcs::acntMapPtr)[userName].isTestAccount());
......
......@@ -39,12 +39,18 @@ class Files : public QObject {
public:
/* Defines attachment type to be sent via email */
enum EmailAttachType {
SEND_EMAIL_ZFO_ATTACHMENT = 0,
SEND_EMAIL_ZFO_ONLY,
SEND_EMAIL_ATTACHMENT_ONLY
enum EmailAttachFlag {
NO_FILES = 0x00,
MSG_ZFO = 0x01, /* Complete message in zfo format. */
MSG_ATTACHS = 0x02 /* Attachments of the data message. */
};
Q_ENUM(EmailAttachType)
Q_ENUM(EmailAttachFlag)
/*
* Flags inside QML:
* https://forum.qt.io/topic/10060/q_enums-q_declare_metatype-and-qml/2
*/
Q_DECLARE_FLAGS(EmailAttachFlags, EmailAttachFlag)
Q_FLAG(EmailAttachFlags)
/* Defines missing file id vaule and zfo id */
enum FileIdType {
......@@ -139,15 +145,15 @@ public:
/*!
* @brief Send message attachments or complete zfo message
* from database with email application.
* from database with email application.
*
* @param[in] userName User name of account.
* @param[in] msgId Message id.
* @param[in] attachType Email attachment type to be sent.
* @param[in] attachFlags Specifies which attachments to send.
*/
Q_INVOKABLE
void sendMsgFilesWithEmail(const QString &userName,
qint64 msgId, enum EmailAttachType attachType);
qint64 msgId, EmailAttachFlags attachFlags);
/*!
* @brief Delete file database.
......@@ -367,8 +373,11 @@ private:
QByteArray &xmlData);
};
Q_DECLARE_OPERATORS_FOR_FLAGS(Files::EmailAttachFlags)
/* Declare FileIdType to QML. */
Q_DECLARE_METATYPE(Files::FileIdType)
Q_DECLARE_METATYPE(Files::EmailAttachType)
Q_DECLARE_METATYPE(Files::EmailAttachFlag)
Q_DECLARE_METATYPE(Files::EmailAttachFlags)
#endif // FILES_H
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment