Commit d54fe9c3 authored by Martin Straka's avatar Martin Straka

Send hierarchy model to upload message method

parent e49ba1c2
......@@ -40,8 +40,6 @@ Component {
property string userName
property int msgType
property string msgId
/* Holsd selected folder ids */
property var uploadIds: []
Component.onCompleted: {
uploadHierarchyProxyModel.setSourceModel(uploadHierarchyListModel)
......@@ -120,7 +118,7 @@ Component {
wrapMode: Text.Wrap
horizontalAlignment: Text.AlignHCenter
width: parent.width
text: qsTr("Here you can upload message into chosen folder in the records management. Update folder hierarchy and select target folder.")
text: qsTr("Here you can upload message into chosen folders in the records management. Update folder hierarchy and select target folders.")
}
Row {
id: buttonRow
......@@ -142,7 +140,7 @@ Component {
font.pointSize: defaultTextFont.font.pointSize
text: qsTr("Upload message")
onClicked: {
recordsManagement.uploadMessage(userName, msgId, msgType, uploadIds)
recordsManagement.uploadMessage(userName, msgId, msgType, uploadHierarchyListModel)
}
}
}
......
......@@ -151,8 +151,6 @@ void RecordsManagement::callUploadHierarchy(
return;
}
emit statusBarTextChanged(tr("Upload hierarchy"), true, true);
UploadHierarchyListModel *hierarchyModel =
UploadHierarchyListModel::fromVariant(hirerachyModelVariant);
if (hierarchyModel == Q_NULLPTR) {
......@@ -161,6 +159,8 @@ void RecordsManagement::callUploadHierarchy(
return;
}
emit statusBarTextChanged(tr("Upload hierarchy"), true, true);
/* Clear model. */
hierarchyModel->setHierarchy(UploadHierarchyResp());
......@@ -266,7 +266,7 @@ void RecordsManagement::loadStoredServiceInfo(void)
bool RecordsManagement::uploadMessage(const QString &userName,
const QString &dmId, enum Messages::MessageType messageType,
const QStringList &uploadIds)
const QVariant &hirerachyModelVariant)
{
bool ok = false;
qint64 msgId = dmId.toLongLong(&ok);
......@@ -297,10 +297,18 @@ bool RecordsManagement::uploadMessage(const QString &userName,
QString msgFileName = QString("%1_%2.zfo").arg(msgType).arg(dmId);
UploadHierarchyListModel *hierarchyModel =
UploadHierarchyListModel::fromVariant(hirerachyModelVariant);
if (hierarchyModel == Q_NULLPTR) {
Q_ASSERT(0);
qCritical("%s", "Cannot access upload hierarchy model.");
return false;
}
/* TODO - removed this return */
return true;
return uploadFile(msgId, msgFileName, msgData, uploadIds);
return uploadFile(msgId, msgFileName, msgData, hierarchyModel->selectedIds());
}
bool RecordsManagement::updateServiceInfo(const QString &newUrlStr,
......
......@@ -57,6 +57,8 @@ public:
/*!
* @brief Download upload hierarchy and set model.
*
* @param[in] hirerachyModelVariant Model for hierarchy update.
*/
Q_INVOKABLE
void callUploadHierarchy(const QVariant &hirerachyModelVariant);
......@@ -91,12 +93,13 @@ public:
* @param[in] userName Account user name identifier.
* @param[in] dmId Message identifier.
* @param[in] messageType Message orientation.
* @param[in] uploadIds List of records management location ids.
* @param[in] hirerachyModelVariant Model for hierarchy selection.
* @return True when data have been updated, false else.
*/
Q_INVOKABLE
bool uploadMessage(const QString &userName, const QString &dmId,
enum Messages::MessageType messageType, const QStringList &uploadIds);
enum Messages::MessageType messageType,
const QVariant &hirerachyModelVariant);
/*!
* @brief Update record management settings.
......
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