Commit 4f746e5e authored by Martin Straka's avatar Martin Straka

Added attahment data class

parent 5c08cab6
......@@ -110,6 +110,7 @@ SOURCES += \
src/net/isds_wrapper.cpp \
src/net/net_layer.cpp \
src/net/xml_layer.cpp \
src/qml_interaction/attachment_data.cpp \
src/qml_interaction/interaction_filesystem.cpp \
src/qml_interaction/interaction_zfo_file.cpp \
src/qml_interaction/message_envelope.cpp \
......@@ -168,6 +169,7 @@ HEADERS += \
src/net/isds_wrapper.h \
src/net/net_layer.h \
src/net/xml_layer.h \
src/qml_interaction/attachment_data.h \
src/qml_interaction/interaction_filesystem.h \
src/qml_interaction/interaction_zfo_file.h \
src/qml_interaction/message_envelope.h \
......@@ -196,7 +198,6 @@ HEADERS += \
src/worker/task_send_message.h \
src/worker/task_send_sms.h \
src/zfo.h
android {
SOURCES += \
src/os_android.cpp
......
......@@ -47,6 +47,7 @@
#if defined(Q_OS_ANDROID)
#include "src/os_android.h"
#endif /* defined(Q_OS_ANDROID) */
#include "src/qml_interaction/attachment_data.h"
#include "src/qml_interaction/interaction_filesystem.h"
#include "src/qml_interaction/interaction_zfo_file.h"
#include "src/qml_interaction/message_envelope.h"
......@@ -294,6 +295,7 @@ int main(int argc, char *argv[])
/* Register types into QML. */
AccountListModel::declareQML();
AttachmentData::declareQML();
DataboxListModel::declareQML();
DataboxModelEntry::declareQML();
Dialogues::declareQML();
......@@ -302,8 +304,8 @@ int main(int argc, char *argv[])
ListSortFilterProxyModel::declareQML();
MessageListModel::declareQML();
Messages::declareQML();
MsgInfo::declareQML();
MsgEnvelope::declareQML();
MsgInfo::declareQML();
InteractionZfoFile interactionZfoFile;
......
/*
* Copyright (C) 2014-2017 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 <QQmlEngine> /* qmlRegisterType */
#include "src/qml_interaction/attachment_data.h"
void AttachmentData::declareQML(void)
{
qmlRegisterType<AttachmentData>("cz.nic.mobileDatovka.attachmentData", 1, 0, "AttachmentData");
qRegisterMetaType<AttachmentData>();
}
AttachmentData::AttachmentData(QObject *parent)
: QObject(parent),
m_fileId(0),
m_dmId(0),
m_dmFileDescr(),
m_dmUpFileGuid(),
m_dmFileGuid(),
m_dmMimeType(),
m_dmFormat(),
m_dmFileMetaType(),
m_dmEncodedContent(),
m_dmFileSize(),
m_dmDownloadDate(),
m_icon()
{
}
AttachmentData::AttachmentData(const AttachmentData &data)
: QObject(),
m_fileId(data.m_fileId),
m_dmId(data.m_dmId),
m_dmFileDescr(data.m_dmFileDescr),
m_dmUpFileGuid(data.m_dmUpFileGuid),
m_dmFileGuid(data.m_dmFileGuid),
m_dmMimeType(data.m_dmMimeType),
m_dmFormat(data.m_dmFormat),
m_dmFileMetaType(data.m_dmFileMetaType),
m_dmEncodedContent(data.m_dmEncodedContent),
m_dmFileSize(data.m_dmFileSize),
m_dmDownloadDate(data.m_dmDownloadDate),
m_icon(data.m_icon)
{
}
AttachmentData::AttachmentData(int fileId, qint64 dmId,
const QString &dmFileDescr, const QString &dmUpFileGuid,
const QString &dmFileGuid, const QString &dmMimeType, const QString &dmFormat,
const QString &dmFileMetaType, const QString &dmEncodedContent,
const QString &_dmFileSize, const QString &_dmDownloadDate,
const QString &_icon, QObject *parent)
: QObject(parent),
m_fileId(fileId),
m_dmId(dmId),
m_dmFileDescr(dmFileDescr),
m_dmUpFileGuid(dmUpFileGuid),
m_dmFileGuid(dmFileGuid),
m_dmMimeType(dmMimeType),
m_dmFormat(dmFormat),
m_dmFileMetaType(dmFileMetaType),
m_dmEncodedContent(dmEncodedContent),
m_dmFileSize(_dmFileSize),
m_dmDownloadDate(_dmDownloadDate),
m_icon(_icon)
{
}
int AttachmentData::fileId(void) const
{
return m_fileId;
}
void AttachmentData::setFileId(int fileId)
{
m_fileId = fileId;
}
qint64 AttachmentData::dmId(void) const
{
return m_dmId;
}
void AttachmentData::setDmId(qint64 dmId)
{
m_dmId = dmId;
}
QString AttachmentData::dmFileDescr(void) const
{
return m_dmFileDescr;
}
void AttachmentData::setDmFileDescr(const QString &dmFileDescr)
{
m_dmFileDescr = dmFileDescr;
}
QString AttachmentData::dmUpFileGuid(void) const
{
return m_dmUpFileGuid;
}
void AttachmentData::setDmUpFileGuid(const QString &dmUpFileGuid)
{
m_dmUpFileGuid = dmUpFileGuid;
}
QString AttachmentData::dmFileGuid(void) const
{
return m_dmFileGuid;
}
void AttachmentData::setDmFileGuid(const QString &dmFileGuid)
{
m_dmFileGuid = dmFileGuid;
}
QString AttachmentData::dmMimeType(void) const
{
return m_dmMimeType;
}
void AttachmentData::setDmMimeType(const QString &dmMimeType)
{
m_dmMimeType = dmMimeType;
}
QString AttachmentData::dmFormat(void) const
{
return m_dmFormat;
}
void AttachmentData::setDmFormat(const QString &dmFormat)
{
m_dmFormat = dmFormat;
}
QString AttachmentData::dmFileMetaType(void) const
{
return m_dmFileMetaType;
}
void AttachmentData::setDmFileMetaType(const QString &dmFileMetaType)
{
m_dmFileMetaType = dmFileMetaType;
}
QString AttachmentData::dmEncodedContent(void) const
{
return m_dmEncodedContent;
}
void AttachmentData::setDmEncodedContent(const QString &dmEncodedContent)
{
m_dmEncodedContent = dmEncodedContent;
}
QString AttachmentData::_dmFileSize(void) const
{
return m_dmFileSize;
}
void AttachmentData::_setDmFileSize(const QString &_dmFileSize)
{
m_dmFileSize = _dmFileSize;
}
QString AttachmentData::_dmDownloadDate(void) const
{
return m_dmDownloadDate;
}
void AttachmentData::_setDmDownloadDate(const QString &_dmDownloadDate)
{
m_dmDownloadDate = _dmDownloadDate;
}
QString AttachmentData::_icon(void) const
{
return m_icon;
}
void AttachmentData::_setIcon(const QString &_icon)
{
m_icon = _icon;
}
/*
* Copyright (C) 2014-2017 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.
*/
#ifndef _ATTACHMENT_DATA_H_
#define _ATTACHMENT_DATA_H_
#include <QObject>
#include <QString>
/*!
* @brief Class holds attachment data.
*/
class AttachmentData : public QObject {
Q_OBJECT
Q_PROPERTY(int fileId READ fileId WRITE setFileId)
Q_PROPERTY(qint64 dmId READ dmId WRITE setDmId)
Q_PROPERTY(QString dmFileDescr READ dmFileDescr WRITE setDmFileDescr)
Q_PROPERTY(QString dmUpFileGuid READ dmUpFileGuid WRITE setDmUpFileGuid)
Q_PROPERTY(QString dmFileGuid READ dmFileGuid WRITE setDmFileGuid)
Q_PROPERTY(QString dmMimeType READ dmMimeType WRITE setDmMimeType)
Q_PROPERTY(QString dmFormat READ dmFormat WRITE setDmFormat)
Q_PROPERTY(QString dmFileMetaType READ dmFileMetaType WRITE setDmFileMetaType)
Q_PROPERTY(QString dmEncodedContent READ dmEncodedContent WRITE setDmEncodedContent)
Q_PROPERTY(QString _dmFileSize READ _dmFileSize WRITE _setDmFileSize)
Q_PROPERTY(QString _dmDownloadDate READ _dmDownloadDate WRITE _setDmDownloadDate)
Q_PROPERTY(QString _icon READ _icon WRITE _setIcon)
public:
/* Don't forget to declare various properties to the QML system. */
static
void declareQML(void);
/*!
* @brief Constructor.
*
* @param[in] parent Parent object.
*/
explicit AttachmentData(QObject *parent = Q_NULLPTR);
/*!
* @brief Copy constructor.
*
* @note Needed for QVariant conversion.
*
* @param[in] info Attachment data to be copied.
*/
AttachmentData(const AttachmentData &data);
AttachmentData(int fileId, qint64 dmId, const QString &dmFileDescr,
const QString &dmUpFileGuid, const QString &dmFileGuid,
const QString &dmMimeType, const QString &dmFormat,
const QString &dmFileMetaType, const QString &dmEncodedContent,
const QString &_dmFileSize, const QString &_dmDownloadDate,
const QString &_icon, QObject *parent = Q_NULLPTR);
int fileId(void) const;
void setFileId(int fileId);
qint64 dmId(void) const;
void setDmId(qint64 dmId);
QString dmFileDescr(void) const;
void setDmFileDescr(const QString &dmFileDescr);
QString dmUpFileGuid(void) const;
void setDmUpFileGuid(const QString &dmUpFileGuid);
QString dmFileGuid(void) const;
void setDmFileGuid(const QString &dmFileGuid);
QString dmMimeType(void) const;
void setDmMimeType(const QString &dmMimeType);
QString dmFormat(void) const;
void setDmFormat(const QString &dmFormat);
QString dmFileMetaType(void) const;
void setDmFileMetaType(const QString &dmFileMetaType);
QString dmEncodedContent(void) const;
void setDmEncodedContent(const QString &dmEncodedContent);
QString _dmFileSize(void) const;
void _setDmFileSize(const QString &_dmFileSize);
QString _dmDownloadDate(void) const;
void _setDmDownloadDate(const QString &_dmDownloadDate);
QString _icon(void) const;
void _setIcon(const QString &_icon);
private:
int m_fileId; /*!< File identifier. */
qint64 m_dmId; /*!< Message identifier. */
QString m_dmFileDescr; /*!< File name. */
QString m_dmUpFileGuid; /*!< ISDS guid. */
QString m_dmFileGuid; /*!< File guid. */
QString m_dmMimeType; /*!< File mime type. */
QString m_dmFormat; /*!< File format. */
QString m_dmFileMetaType; /*!< File meta mime type. */
QString m_dmEncodedContent; /*!< Base64 file content. */
QString m_dmFileSize; /*!< File size string in KB. */
QString m_dmDownloadDate; /*!< File download date. */
QString m_icon; /*!< File icon resource. */
};
/* QML passes its arguments via QVariant. */
Q_DECLARE_METATYPE(AttachmentData)
#endif /* _ATTACHMENT_DATA_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