Commit d163c2dc authored by Karel Slaný's avatar Karel Slaný Committed by Martin Straka

Added torso of upload hierarchy list model.

parent aa337e8c
......@@ -136,6 +136,7 @@ SOURCES += \
src/qml_interaction/message_envelope.cpp \
src/qml_interaction/message_info.cpp \
src/qml_interaction/string_manipulation.cpp \
src/records_management/models/upload_hierarchy_list_model.cpp \
src/records_management.cpp \
src/settings.cpp \
src/setwrapper.cpp \
......@@ -217,6 +218,7 @@ HEADERS += \
src/qml_interaction/message_envelope.h \
src/qml_interaction/message_info.h \
src/qml_interaction/string_manipulation.h \
src/records_management/models/upload_hierarchy_list_model.h \
src/records_management.h \
src/settings.h \
src/setwrapper.h \
......
......@@ -50,9 +50,8 @@ Component {
statusBar.visible = false
}
ListModel {
/* TODO */
id: uploadHierarchyModel
UploadHierarchyListModel {
id: uploadHierarchyListModel
Component.onCompleted: {
}
}
......@@ -65,61 +64,94 @@ Component {
}
}
Flickable {
id: flickable
z: 0
AccessibleText {
id: topText
anchors.top: headerBar.bottom
anchors.right: parent.right
anchors.left: parent.left
anchors.bottom: parent.bottom
contentHeight: flickContent.implicitHeight
Pane {
id: flickContent
anchors.fill: parent
Column {
anchors.right: parent.right
anchors.left: parent.left
spacing: formItemVerticalSpacing
AccessibleText {
color: datovkaPalette.mid
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.")
}
AccessibleButton {
id: hierarchyButton
anchors.horizontalCenter: parent.horizontalCenter
height: inputItemHeight
font.pointSize: defaultTextFont.font.pointSize
text: qsTr("Update upload hierarchy")
onClicked: {
recordsManagement.callUploadHierarchy()
}
color: datovkaPalette.mid
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.")
}
Row {
id: buttonRow
spacing: formItemVerticalSpacing * 5
anchors.top: topText.bottom
anchors.horizontalCenter: parent.horizontalCenter
AccessibleButton {
id: hierarchyButton
height: inputItemHeight
font.pointSize: defaultTextFont.font.pointSize
text: qsTr("Update upload hierarchy")
onClicked: {
recordsManagement.callUploadHierarchy(uploadHierarchyListModel)
}
}
AccessibleButton {
id: uplaodButton
height: inputItemHeight
font.pointSize: defaultTextFont.font.pointSize
text: qsTr("Upload message")
onClicked: {
recordsManagement.uploadMessage(userName, msgId, msgType, uploadIds)
}
}
}
ScrollableListView {
id: uploadHierarchyList
delegateHeight: headerHeight
anchors.top: buttonRow.bottom
anchors.bottom: bottomText.top
/* TODO */
width: parent.width
model: uploadHierarchyListModel
delegate: Rectangle {
id: uploadItem
width: parent.width
height: uploadHierarchyList.delegateHeight
color: datovkaPalette.base
Text {
id: uploadText
anchors.fill: parent
text: rName
color: datovkaPalette.mid
font.pointSize: textFontSizeSmall
renderType: Text.NativeRendering
}
MouseArea {
function handleClick() {
console.log("Clicked hierarchy item '" + index + "'.")
}
TreeView {
/* TODO */
width: parent.width
TableViewColumn {
title: "Records management hierarchy"
role: "folderName"
width: parent.width
}
model: uploadHierarchyModel
anchors.fill: parent
Accessible.role: Accessible.Button
Accessible.name: qsTr("Open attachment '%1'.").arg(rName)
Accessible.onScrollDownAction: uploadHierarchyList.scrollDown()
Accessible.onScrollUpAction: uploadHierarchyList.scrollUp()
Accessible.onPressAction: {
handleClick()
}
AccessibleButton {
id: uplaodButton
anchors.horizontalCenter: parent.horizontalCenter
height: inputItemHeight
font.pointSize: defaultTextFont.font.pointSize
text: qsTr("Upload message")
onClicked: {
recordsManagement.uploadMessage(userName, msgId, msgType, uploadIds)
}
onClicked: {
handleClick()
}
} // Column layout
} // Pane
ScrollIndicator.vertical: ScrollIndicator {}
} // Flickable
}
}
}
AccessibleText {
id: bottomText
anchors.bottom: parent.bottom
color: datovkaPalette.mid
wrapMode: Text.Wrap
horizontalAlignment: Text.AlignHCenter
width: parent.width
text: "Test text"
}
}
}
......@@ -54,6 +54,7 @@
#include "src/qml_interaction/interaction_zfo_file.h"
#include "src/qml_interaction/message_envelope.h"
#include "src/qml_interaction/string_manipulation.h"
#include "src/records_management/models/upload_hierarchy_list_model.h"
#include "src/records_management.h"
#include "src/settings.h"
#include "src/setwrapper.h"
......@@ -338,6 +339,7 @@ int main(int argc, char *argv[])
Messages::declareQML();
MsgEnvelope::declareQML();
MsgInfo::declareQML();
UploadHierarchyListModel::declareQML();
InteractionZfoFile interactionZfoFile;
......
......@@ -29,6 +29,7 @@
#include "src/datovka_shared/records_management/json/upload_file.h"
#include "src/datovka_shared/records_management/json/upload_hierarchy.h"
#include "src/models/accountmodel.h"
#include "src/records_management/models/upload_hierarchy_list_model.h"
#include "src/records_management.h"
#include "src/settings.h"
#include "src/worker/emitter.h"
......@@ -145,7 +146,8 @@ fail:
QMessageBox::critical(Q_NULLPTR, errTitle, errDesctiption);
}
void RecordsManagement::callUploadHierarchy(void)
void RecordsManagement::callUploadHierarchy(
const QVariant &hirerachyModelVariant)
{
QByteArray response;
QString errTitle = tr("Communication error");
......@@ -153,8 +155,16 @@ void RecordsManagement::callUploadHierarchy(void)
emit statusBarTextChanged(tr("Upload hierarchy"), true, true);
UploadHierarchyListModel *hierarchyModel =
UploadHierarchyListModel::fromVariant(hirerachyModelVariant);
if (hierarchyModel == Q_NULLPTR) {
Q_ASSERT(0);
qCritical("%s", "Cannot access upload hierarchy model.");
return;
}
/* Clear model. */
m_uploadModel.setHierarchy(UploadHierarchyResp());
hierarchyModel->setHierarchy(UploadHierarchyResp());
m_rmc.setConnection(globRecordsManagementSet.url(),
globRecordsManagementSet.token());
......@@ -168,7 +178,7 @@ void RecordsManagement::callUploadHierarchy(void)
if (!ok || !uhRes.isValid()) {
goto fail;
}
m_uploadModel.setHierarchy(uhRes);
hierarchyModel->setHierarchy(uhRes);
} else {
errDesctiption = tr("Received empty response.");
goto fail;
......
......@@ -60,7 +60,7 @@ public:
* @brief Download upload hierarchy and set model.
*/
Q_INVOKABLE
void callUploadHierarchy(void);
void callUploadHierarchy(const QVariant &hirerachyModelVariant);
/*!
* @brief Obtain information about stored messages from records managnt.
......
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