Commit b85c9891 authored by Karel Slaný's avatar Karel Slaný

Replaced MsgEnvelope with QmlIsdsEnvelope.

parent 4b0c0217
......@@ -140,7 +140,6 @@ SOURCES += \
src/qml_interaction/image_provider.cpp \
src/qml_interaction/interaction_filesystem.cpp \
src/qml_interaction/interaction_zfo_file.cpp \
src/qml_interaction/message_envelope.cpp \
src/qml_interaction/message_info.cpp \
src/qml_interaction/string_manipulation.cpp \
src/qml_isds/message_interface.cpp \
......@@ -244,7 +243,6 @@ HEADERS += \
src/qml_interaction/image_provider.h \
src/qml_interaction/interaction_filesystem.h \
src/qml_interaction/interaction_zfo_file.h \
src/qml_interaction/message_envelope.h \
src/qml_interaction/message_info.h \
src/qml_interaction/string_manipulation.h \
src/qml_isds/message_interface.h \
......
......@@ -60,54 +60,54 @@ Item {
}
/* Set mandate fields in QML */
function setMandate(msgEnvelope) {
dmLegalTitleLaw.text = msgEnvelope.dmLegalTitleLaw
dmLegalTitleYear.text = msgEnvelope.dmLegalTitleYear
dmLegalTitleSect.text = msgEnvelope.dmLegalTitleSect
dmLegalTitlePar.text = msgEnvelope.dmLegalTitlePar
dmLegalTitlePoint.text = msgEnvelope.dmLegalTitlePoint
function setMandate(isdsEnvelope) {
dmLegalTitleLaw.text = isdsEnvelope.dmLegalTitleLawStr
dmLegalTitleYear.text = isdsEnvelope.dmLegalTitleYearStr
dmLegalTitleSect.text = isdsEnvelope.dmLegalTitleSect
dmLegalTitlePar.text = isdsEnvelope.dmLegalTitlePar
dmLegalTitlePoint.text = isdsEnvelope.dmLegalTitlePoint
}
/* Set reply message data and add recipient to model */
function setReplyData(userName, msgId) {
headerBar.title = qsTr("Reply %1").arg(msgId)
// get some message envelope data and add recipient to recipient model
var msgEnvelope = messages.getMsgEnvelopeDataAndSetRecipient(userName, msgId, recipBoxModel)
dmAnnotation.text = "Re: " + msgEnvelope.dmAnnotation
var isdsEnvelope = messages.getMsgEnvelopeDataAndSetRecipient(userName, msgId, recipBoxModel)
dmAnnotation.text = "Re: " + isdsEnvelope.dmAnnotation
// swap sender ref and ident data to recipient (reply)
dmSenderRefNumber.text = msgEnvelope.dmRecipientRefNumber
dmSenderIdent.text = msgEnvelope.dmRecipientIdent
dmRecipientRefNumber.text = msgEnvelope.dmSenderRefNumber
dmRecipientIdent.text = msgEnvelope.dmSenderIdent
if (msgEnvelope.dmType === "I") {
dmSenderRefNumber.text = isdsEnvelope.dmRecipientRefNumber
dmSenderIdent.text = isdsEnvelope.dmRecipientIdent
dmRecipientRefNumber.text = isdsEnvelope.dmSenderRefNumber
dmRecipientIdent.text = isdsEnvelope.dmSenderIdent
if (isdsEnvelope.dmType === "I") {
replyPDZ.visible = true
dmType = "O"
} else {
replyPDZ.visible = false
dmType = ""
}
setMandate(msgEnvelope)
setMandate(isdsEnvelope)
}
/* Set message envelope data and files to attachment model*/
function setTemplateData(userName, msgId) {
headerBar.title = qsTr("Forward %1").arg(msgId)
// get some message envelope data, recipient model must be null (no recipient)
var msgEnvelope = messages.getMsgEnvelopeDataAndSetRecipient(userName, msgId, null)
dmAnnotation.text = msgEnvelope.dmAnnotation
dmSenderRefNumber.text = msgEnvelope.dmSenderRefNumber
dmSenderIdent.text = msgEnvelope.dmSenderIdent
dmRecipientRefNumber.text = msgEnvelope.dmRecipientRefNumber
dmRecipientIdent.text = msgEnvelope.dmRecipientIdent
setMandate(msgEnvelope)
var isdsEnvelope = messages.getMsgEnvelopeDataAndSetRecipient(userName, msgId, null)
dmAnnotation.text = isdsEnvelope.dmAnnotation
dmSenderRefNumber.text = isdsEnvelope.dmSenderRefNumber
dmSenderIdent.text = isdsEnvelope.dmSenderIdent
dmRecipientRefNumber.text = isdsEnvelope.dmRecipientRefNumber
dmRecipientIdent.text = isdsEnvelope.dmRecipientIdent
setMandate(isdsEnvelope)
sendMsgAttachmentModel.setFromDb(userName, msgId)
}
/* Set message forward data and add ZFO file to model */
function setForwardZfoData(userName, msgId) {
headerBar.title = qsTr("Forward ZFO %1").arg(msgId)
var msgEnvelope = messages.getMsgEnvelopeDataAndSetRecipient(userName, msgId, null)
dmAnnotation.text = "Fwd: " + msgEnvelope.dmAnnotation
var isdsEnvelope = messages.getMsgEnvelopeDataAndSetRecipient(userName, msgId, null)
dmAnnotation.text = "Fwd: " + isdsEnvelope.dmAnnotation
var fileName = (msgType == MessageType.TYPE_SENT) ? "ODZ_" + msgId + ".zfo" : "DDZ_" + msgId + ".zfo"
var zfoSize = zfo.getZfoSizeFromDb(userName, msgId)
// Zfo file must exist in the local database so zfoSize must be > 0
......
......@@ -36,7 +36,6 @@
#include "src/global.h"
#include "src/io/filesystem.h"
#include "src/models/accountmodel.h"
#include "src/qml_interaction/message_envelope.h"
#include "src/settings.h"
#include "src/sqlite/dbs.h"
#include "src/sqlite/file_db_container.h"
......
......@@ -56,7 +56,6 @@
#include "src/qml_interaction/image_provider.h"
#include "src/qml_interaction/interaction_filesystem.h"
#include "src/qml_interaction/interaction_zfo_file.h"
#include "src/qml_interaction/message_envelope.h"
#include "src/qml_interaction/string_manipulation.h"
#include "src/qml_isds/message_interface.h"
#include "src/records_management/models/upload_hierarchy_list_model.h"
......@@ -374,7 +373,6 @@ int main(int argc, char *argv[])
ListSortFilterProxyModel::declareQML();
MessageListModel::declareQML();
Messages::declareQML();
MsgEnvelope::declareQML();
MsgInfo::declareQML();
UploadHierarchyListModel::declareQML();
UploadHierarchyQmlProxyModel::declareQML();
......
......@@ -167,7 +167,7 @@ QString Messages::getMessageDetail(const QString &userName,
return msgDb->getMessageDetailHtmlFromDb(msgId);
}
MsgEnvelope *Messages::getMsgEnvelopeDataAndSetRecipient(
QmlIsdsEnvelope *Messages::getMsgEnvelopeDataAndSetRecipient(
const QString &userName, qint64 msgId, const QVariant &dbModelVariant)
{
qDebug("%s()", __func__);
......@@ -201,26 +201,7 @@ MsgEnvelope *Messages::getMsgEnvelopeDataAndSetRecipient(
}
// Return message envelope data into QML
return new (std::nothrow) MsgEnvelope(envelope.dmId(),
envelope.dmAnnotation(), envelope.dbIDSender(), envelope.dmSender(),
envelope.dmSenderAddress(), envelope.dmSenderType(),
envelope.dmSenderOrgUnit(), envelope.dmSenderOrgUnitNumStr(),
envelope.dmSenderRefNumber(), envelope.dmSenderIdent(),
envelope.dbIDRecipient(), envelope.dmRecipient(),
envelope.dmRecipientAddress(), envelope.dmRecipientOrgUnit(),
envelope.dmRecipientOrgUnitNumStr(),
envelope.dmAmbiguousRecipient() == Isds::Type::BOOL_TRUE,
envelope.dmRecipientRefNumber(), envelope.dmRecipientIdent(),
envelope.dmLegalTitleLawStr(), envelope.dmLegalTitleYearStr(),
envelope.dmLegalTitleSect(), envelope.dmLegalTitlePar(),
envelope.dmLegalTitlePoint(), envelope.dmToHands(),
envelope.dmPersonalDelivery() == Isds::Type::BOOL_TRUE,
envelope.dmAllowSubstDelivery() == Isds::Type::BOOL_TRUE,
envelope.dmQTimestamp(),
utcDateTimeToDbFormatStr(envelope.dmDeliveryTime()),
utcDateTimeToDbFormatStr(envelope.dmAcceptanceTime()),
Isds::dmState2Variant(envelope.dmMessageStatus()).toInt(),
envelope.dmAttachmentSize(), envelope.dmType());
return new (std::nothrow) QmlIsdsEnvelope(envelope);
}
void Messages::markMessageAsLocallyRead(const QVariant &msgModelVariant,
......
......@@ -21,12 +21,11 @@
* the two.
*/
#ifndef MESSAGES_H
#define MESSAGES_H
#pragma once
#include <QObject>
#include "src/qml_interaction/message_envelope.h"
#include "src/qml_isds/message_interface.h"
/*
* Class Messages provides interface between QML and message database.
......@@ -103,7 +102,7 @@ public:
* @return Pointer to message envelope data object.
*/
Q_INVOKABLE
MsgEnvelope *getMsgEnvelopeDataAndSetRecipient(const QString &userName,
QmlIsdsEnvelope *getMsgEnvelopeDataAndSetRecipient(const QString &userName,
qint64 msgId, const QVariant &dbModelVariant);
/*!
......@@ -245,5 +244,3 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(Messages::MessageTypes)
/* QML passes its arguments via QVariant. */
Q_DECLARE_METATYPE(Messages::MessageType)
#endif // MESSAGES_H
......@@ -40,7 +40,6 @@
#include "src/net/db_wrapper.h"
#include "src/net/isds_const.h"
#include "src/net/isds_wrapper.h"
#include "src/qml_interaction/message_envelope.h"
#include "src/settings.h"
#include "src/sqlite/zfo_db.h"
#include "src/worker/emitter.h"
......
This diff is collapsed.
This diff is collapsed.
......@@ -30,7 +30,6 @@
#include "src/datovka_shared/isds/message_interface.h"
#include "src/messages.h"
#include "src/models/databoxmodel.h"
#include "src/qml_interaction/message_envelope.h"
class MessageListModel; /* Forward declaration. */
......
......@@ -29,7 +29,6 @@
#include "src/messages.h"
#include "src/net/db_wrapper.h"
#include "src/net/isds_const.h"
#include "src/qml_interaction/message_envelope.h"
#include "src/worker/emitter.h"
#include "src/worker/task_download_message.h"
#include "src/sqlite/message_db_container.h"
......
......@@ -28,7 +28,6 @@
#include "src/log/log.h"
#include "src/net/db_wrapper.h"
#include "src/net/isds_const.h"
#include "src/qml_interaction/message_envelope.h"
#include "src/worker/emitter.h"
#include "src/worker/task_download_message.h"
#include "src/worker/task_download_message_list.h"
......
......@@ -26,7 +26,6 @@
#include "src/datovka_shared/isds/message_interface.h"
#include "src/net/isds_session.h"
#include "src/net/net_layer.h"
#include "src/qml_interaction/message_envelope.h"
#include "src/worker/task.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