Commit f23d705b authored by Martin Straka's avatar Martin Straka

Added zfo import qml page.

parent 31933226
......@@ -68,6 +68,7 @@ ApplicationWindow {
property Component pageContactList: PageContactList {}
property Component pageDataboxDetail: PageDataboxDetail {}
property Component pageDataboxSearch: PageDataboxSearch {}
property Component pageImportMessage: PageImportMessage {}
property Component pageMenuAccount: PageMenuAccount {}
property Component pageMenuDatovkaSettings: PageMenuDatovkaSettings {}
property Component pageMenuMessage: PageMenuMessage {}
......
/*
* Copyright (C) 2014-2018 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.
*/
import QtQuick 2.7
import QtQuick.Controls 2.1
import QtGraphicalEffects 1.0
import cz.nic.mobileDatovka 1.0
Component {
id: importMessage
Item {
id: mainLayout
/* These properties must be set by caller. */
property var pageView
property var statusBar
property string acntName
property string userName
property var accountModel: null
/* Clear import info and import results */
function clearInfo() {
infoText.text = ""
progressText.text = ""
}
Component.onCompleted: {
clearInfo()
}
Component.onDestruction: {
//accounts.updateAccountCounters(accountModel)
statusBar.visible = false
}
/* File dialog for choose of files/folder from the storage */
FileDialogue {
id: fileDialogue
multiSelect: true
onFinished: {
var files = []
for (var j = 0; j < pathListModel.count; ++j) {
files.push(pathListModel.get(j).path)
}
clearInfo()
infoText.text = isds.importZfoMessages(userName, files, verifyMessage.checked)
pathListModel.clear()
}
}
PageHeader {
id: headerBar
title: qsTr("ZFO message import")
onBackClicked: {
pageView.pop(StackView.Immediate)
}
}
Flickable {
id: flickable
z: 0
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: 1
Text {
text: " "
}
AccessibleText {
color: datovkaPalette.mid
wrapMode: Text.Wrap
horizontalAlignment: Text.AlignHCenter
width: parent.width
text: qsTr("Here you can import messages from ZFO files or selected directory into the local database. You can enabled the message validation on the ISDS server (working connection to server is required).")
}
Text {
text: " "
}
AccessibleSwitch {
id: verifyMessage
text: qsTr("Verify message in the ISDS server")
font.pointSize: defaultTextFont.font.pointSize
checked: false
}
Rectangle {
color: datovkaPalette.base
height: headerHeight
width: parent.width
Image {
id: menuImage
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
anchors.leftMargin: defaultMargin
sourceSize.height: imgHeight
source: "qrc:/ui/datovka-file-zfo.svg"
}
ColorOverlay {
anchors.fill: menuImage
source: menuImage
color: datovkaPalette.text
}
AccessibleText {
anchors.verticalCenter: parent.verticalCenter
anchors.left: menuImage.right
anchors.leftMargin: defaultMargin
color: datovkaPalette.text
text: qsTr("Import selected ZFO files")
}
Rectangle {
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
height: parent.height
width: parent.width * 0.07
color: parent.color
Image {
id: nextImage
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
anchors.rightMargin: defaultMargin
sourceSize.height: navImgHeight
source: "qrc:/ui/next.svg"
}
ColorOverlay {
anchors.fill: nextImage
source: nextImage
color: datovkaPalette.text
}
}
MouseArea {
anchors.fill: parent
onClicked: {
clearInfo()
fileDialogue.raise(qsTr("Select ZFO files"), "*.zfo", true)
}
}
}
Rectangle {
color: datovkaPalette.base
height: headerHeight
width: parent.width
Image {
id: menuImage2
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
anchors.leftMargin: defaultMargin
sourceSize.height: imgHeight
source: "qrc:/ui/datovka-folder-open.svg"
}
ColorOverlay {
anchors.fill: menuImage2
source: menuImage2
color: datovkaPalette.text
}
AccessibleText {
anchors.verticalCenter: parent.verticalCenter
anchors.left: menuImage2.right
anchors.leftMargin: defaultMargin
color: datovkaPalette.text
text: qsTr("Import ZFO files from folder")
}
Rectangle {
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
height: parent.height
width: parent.width * 0.07
color: parent.color
Image {
id: nextImage2
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
anchors.rightMargin: defaultMargin
sourceSize.height: navImgHeight
source: "qrc:/ui/next.svg"
}
ColorOverlay {
anchors.fill: nextImage2
source: nextImage2
color: datovkaPalette.text
}
}
MouseArea {
anchors.fill: parent
onClicked: {
clearInfo()
fileDialogue.raise(qsTr("Select import folder"), "*.*", false)
}
}
}
Text {
text: " "
}
AccessibleText {
id: infoText
color: datovkaPalette.text
wrapMode: Text.Wrap
horizontalAlignment: Text.AlignHCenter
width: parent.width
font.bold: true
text: ""
}
AccessibleText {
id: progressText
color: datovkaPalette.text
wrapMode: Text.Wrap
width: parent.width
font.pointSize: textFontSizeSmall
textFormat: TextEdit.RichText
text: ""
}
} // Column layout
} // Pane
ScrollIndicator.vertical: ScrollIndicator {}
} // Flickable
Connections {
target: isds
onZfoImportFinishedSig: {
infoText.text = txt
}
}
Connections {
target: isds
onZfoImportProgressSig: {
progressText.text = progressText.text + "<br/>" + txt
}
}
}
}
......@@ -73,6 +73,15 @@ Component {
"action": "new"
}, StackView.Immediate)
},
"importMsg": function callImportMsg() {
pageView.replace(pageImportMessage, {
"pageView": pageView,
"statusBar": statusBar,
"acntName" : acntName,
"userName": userName,
"accountModel": accountModel
}, StackView.Immediate)
},
"findBox": function callFindBox() {
pageView.replace(pageDataboxSearch, {
"pageView": pageView,
......@@ -123,6 +132,13 @@ Component {
name: qsTr("Create message")
funcName: "createMsg"
}
ListElement {
image: "qrc:/ui/file-import.svg"
showEntry: true
showNext: true
name: qsTr("Import message")
funcName: "importMsg"
}
ListElement {
image: "qrc:/ui/account-search.svg"
showEntry: true
......
......@@ -68,6 +68,15 @@ Component {
"statusBar": statusBar
}, StackView.Immediate)
},
"importMsg": function callImportMsg() {
pageView.replace(pageImportMessage, {
"pageView": pageView,
"statusBar": statusBar,
"acntName" : "",
"userName": "",
"accountModel": accountModel
}, StackView.Immediate)
},
"settGeneral": function callSettGeneral() {
pageView.replace(pageSettingsGeneral, {
"pageView": pageView,
......@@ -118,6 +127,13 @@ Component {
name: qsTr("Search message")
funcName: "searchMsg"
}
ListElement {
image: "qrc:/ui/file-import.svg"
showEntry: true
showNext: true
name: qsTr("Import message")
funcName: "importMsg"
}
ListElement {
image: "qrc:/ui/settings.svg"
showEntry: true
......
......@@ -131,6 +131,7 @@
<file>../qml/pages/PageContactList.qml</file>
<file>../qml/pages/PageDataboxDetail.qml</file>
<file>../qml/pages/PageDataboxSearch.qml</file>
<file>../qml/pages/PageImportMessage.qml</file>
<file>../qml/pages/PageMenuAccount.qml</file>
<file>../qml/pages/PageMenuDatovkaSettings.qml</file>
<file>../qml/pages/PageMenuMessage.qml</file>
......
......@@ -100,6 +100,7 @@ const struct QmlTypeEntry qmlPages[] = {
{ "PageContactList", 1, 0 },
{ "PageDataboxDetail", 1, 0 },
{ "PageDataboxSearch", 1, 0 },
{ "PageImportMessage", 1, 0 },
{ "PageMenuAccount", 1, 0 },
{ "PageMenuDatovkaSettings", 1, 0 },
{ "PageMenuMessage", 1, 0 },
......
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