Commit 0fb0bf43 authored by Karel Slaný's avatar Karel Slaný

Merge branch 'gov-services-interface-modifications' into 'develop'

E-Gov Services Interface

See merge request !131
parents c496322f 31bbb5c1
......@@ -91,6 +91,19 @@ SOURCES += \
src/accounts.cpp \
src/auxiliaries/attachment_helper.cpp \
src/auxiliaries/email_helper.cpp \
src/datovka_shared/gov_services/helper.cpp \
src/datovka_shared/gov_services/service/gov_mv_crr_vbh.cpp \
src/datovka_shared/gov_services/service/gov_mv_ir_vp.cpp \
src/datovka_shared/gov_services/service/gov_mv_rt_vt.cpp \
src/datovka_shared/gov_services/service/gov_mv_rtpo_vt.cpp \
src/datovka_shared/gov_services/service/gov_mv_skd_vp.cpp \
src/datovka_shared/gov_services/service/gov_mv_vr_vp.cpp \
src/datovka_shared/gov_services/service/gov_mv_zr_vp.cpp \
src/datovka_shared/gov_services/service/gov_service_form_field.cpp \
src/datovka_shared/gov_services/service/gov_service.cpp \
src/datovka_shared/gov_services/service/gov_szr_rob_vu.cpp \
src/datovka_shared/gov_services/service/gov_szr_rob_vvu.cpp \
src/datovka_shared/gov_services/service/gov_szr_ros_vv.cpp \
src/datovka_shared/graphics/graphics.cpp \
src/datovka_shared/io/records_management_db.cpp \
src/datovka_shared/io/sqlite/db.cpp \
......@@ -129,6 +142,9 @@ SOURCES += \
src/dialogues/widget_message_dialogue.cpp \
src/files.cpp \
src/global.cpp \
src/gov_services/models/gov_form_list_model.cpp \
src/gov_services/models/gov_service_list_model.cpp \
src/gov_wrapper.cpp \
src/io/filesystem.cpp \
src/isds/isds_conversion.cpp \
src/isds/isds_type_conversion.cpp \
......@@ -197,6 +213,19 @@ HEADERS += \
src/auxiliaries/attachment_helper.h \
src/auxiliaries/email_helper.h \
src/common.h \
src/datovka_shared/gov_services/helper.h \
src/datovka_shared/gov_services/service/gov_mv_crr_vbh.h \
src/datovka_shared/gov_services/service/gov_mv_ir_vp.h \
src/datovka_shared/gov_services/service/gov_mv_rt_vt.h \
src/datovka_shared/gov_services/service/gov_mv_rtpo_vt.h \
src/datovka_shared/gov_services/service/gov_mv_skd_vp.h \
src/datovka_shared/gov_services/service/gov_mv_vr_vp.h \
src/datovka_shared/gov_services/service/gov_mv_zr_vp.h \
src/datovka_shared/gov_services/service/gov_service_form_field.h \
src/datovka_shared/gov_services/service/gov_service.h \
src/datovka_shared/gov_services/service/gov_szr_rob_vu.h \
src/datovka_shared/gov_services/service/gov_szr_rob_vvu.h \
src/datovka_shared/gov_services/service/gov_szr_ros_vv.h \
src/datovka_shared/graphics/graphics.h \
src/datovka_shared/io/records_management_db.h \
src/datovka_shared/io/sqlite/db.h \
......@@ -237,6 +266,9 @@ HEADERS += \
src/dialogues/widget_message_dialogue.h \
src/files.h \
src/global.h \
src/gov_services/models/gov_form_list_model.h \
src/gov_services/models/gov_service_list_model.h \
src/gov_wrapper.h \
src/io/db_tables.h \
src/io/filesystem.h \
src/isds/isds_conversion.h \
......
/*
* 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.2
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
/*
* Provides a calendar interface.
* It is defined as a separate component in order not to pollute the namespace
* with the import of QtQuick.Controls 1.
*/
Calendar {
id: root
anchors.centerIn: parent
focus: true
style: CalendarStyle {
gridVisible: true
dayDelegate: Rectangle {
Rectangle {
anchors.fill: parent
border.color: "transparent"
color: styleData.date !== undefined && styleData.selected ? datovkaPalette.highlight : "transparent"
anchors.margins: styleData.selected ? -1 : 0
}
Label {
text: styleData.date.getDate()
anchors.centerIn: parent
font.bold: styleData.selected
color: styleData.valid ? datovkaPalette.text : datovkaPalette.mid
}
}
}
}
/*
* 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.2
import cz.nic.mobileDatovka 1.0
ScrollableListView {
id: root
delegateHeight: listItemHeight
signal calendarClicked(int index, string dateKey, string dateVal, string dateDescr)
/*
* Return asterisks.
*/
function asterisks(mandatory, userInput, boxInput) {
if (mandatory && userInput) {
return " *"
} else if (boxInput) {
return " **"
} else {
return ""
}
}
delegate: Rectangle {
id: formItem
height: root.delegateHeight
width: parent.width
enabled: gsUserInput
color: enabled ? datovkaPalette.base : readBgColor
Item {
anchors.fill: parent
anchors.margins: defaultMargin
Column {
anchors.right: parent.right
anchors.left: parent.left
spacing: formItemVerticalSpacing
anchors.verticalCenter: parent.verticalCenter
Text {
text: gsDescr + asterisks(gsMandatory, gsUserInput, gsBoxInput)
color: enabled ? datovkaPalette.text : datovkaPalette.mid // dark
font.bold: true
width: parent.width
wrapMode: Text.Wrap
}
AccessibleTextField {
id: textField
height: inputItemHeight
font.pointSize: defaultTextFont.font.pointSize
text: gsVal
placeholderText: gsPlacehold
width: parent.width
/*
* TODO: Wrong focus on text field when editing date or
* close calendar dialogue. Virtual keyboard is
* always activated. Probably is bug in form model.
* Temporary solution is readonly text field for date.
*/
readOnly: actionButton.visible
InputLineMenu {
id: icox
inputTextControl: textField
isPassword: false
}
onPressAndHold: {
if (settings.useExplicitClipboardOperations()) {
icox.implicitWidth = computeMenuWidth(icox)
icox.open()
}
}
onTextEdited: { // onTextChanged cannot be used here; onEditingFinished ?
root.model.setProperty(index, "gsVal", textField.text)
}
AccessibleOverlaidImageButton {
id: actionButton
anchors.right: parent.right
anchors.top: parent.top
anchors.rightMargin: defaultMargin
image.sourceSize.height: imgHeightHeader
image.source: "qrc:/ui/calendar.svg"
accessibleName: qsTr("Open calendar")
visible: gsTypeDate
onClicked: {
calendarClicked(index, gsKey, gsVal, gsDescr)
}
}
}
} // Column
} // Item
} // Rectangle
ScrollIndicator.vertical: ScrollIndicator {}
}
/*
* 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 QtGraphicalEffects 1.0
import QtQuick 2.7
import QtQuick.Controls 2.2
ScrollableListView {
id: root
delegateHeight: listItemHeight
/* These signals should be captured to implement message interaction. */
signal govServiceClicked(string gsInternId, string gsFullName, string gsInstName)
delegate: Rectangle {
height: root.delegateHeight
width: parent.width
color: datovkaPalette.base
Item {
anchors.fill: parent
anchors.margins: defaultMargin
Column {
anchors.right: parent.right
anchors.left: parent.left
spacing: formItemVerticalSpacing
anchors.verticalCenter: parent.verticalCenter
Text {
text: gsFullName
color: headerColor
font.bold: true
width: parent.width
wrapMode: Text.Wrap
}
Text {
id: instName
text: "DS: " + gsBoxId + " -- " + gsInstName
color: datovkaPalette.text
font.pointSize: textFontSizeSmall
width: parent.width
wrapMode: Text.Wrap
}
}
} // Item
Rectangle {
visible: (gsInternId !== "")
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.windowText
}
} // Rectangle
MouseArea {
anchors.fill: parent
onClicked: {
govServiceClicked(gsInternId, gsFullName, instName.text.toString())
}
}
Rectangle {
anchors.top: parent.bottom
height: 1
width: parent.width
color: datovkaPalette.dark
}
} // Rectangle
ScrollIndicator.vertical: ScrollIndicator {}
} // ListView
/*
* 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 cz.nic.mobileDatovka 1.0
/*
* Date input dialogue.
*/
Dialog {
id: root
property var fieldIndex: null
signal finished(int index, date selectedDate)
function isValidDate(d) {
return d instanceof Date && !isNaN(d);
}
function openCalendarDialogue(index, selDate, title) {
root.title = title
root.fieldIndex = index
var locale = Qt.locale()
var today = new Date()
var filledDate = Date.fromLocaleDateString(locale, selDate, "yyyy-MM-dd")
if (isValidDate(today)) {
calendar.maximumDate = today
}
calendar.selectedDate = (isValidDate(filledDate)) ? filledDate : today
root.open()
}
// center dialogue
x: parent.width / 2 - width / 2
y: parent.height / 2 - height / 2
width: parent.width - 4*defaultMargin
focus: true
modal: true
title: qsTr("Calendar dialog")
standardButtons: Dialog.Ok | Dialog.Cancel
contentItem: Calendar {
id: calendar
}
onAccepted: finished(fieldIndex, calendar.selectedDate)
}
......@@ -68,6 +68,8 @@ ApplicationWindow {
property Component pageContactList: PageContactList {}
property Component pageDataboxDetail: PageDataboxDetail {}
property Component pageDataboxSearch: PageDataboxSearch {}
property Component pageGovService: PageGovService {}
property Component pageGovServiceList: PageGovServiceList {}
property Component pageImportMessage: PageImportMessage {}
property Component pageLog: PageLog {}
property Component pageMenuAccount: PageMenuAccount {}
......
/*
* 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.2
import cz.nic.mobileDatovka 1.0
import cz.nic.mobileDatovka.models 1.0
Item {
id: pageGovService
/* These properties must be set by caller. */
property var pageView
property var statusBar
property string acntName
property string userName
property string gsInternId
property string gsFullName
property string gsInstName
Component.onCompleted: {
gov.loadFormToModel(userName, gsInternId, govFormModel)
actionButton.enabled = govFormModel.haveAllMandatory()
userMandatoryText.visible = govFormModel.containsMandatoryUser()
fromDataBoxText.visible = govFormModel.containsBoxOwnerData()
}
GovFormListModel {
id: govFormModel
onDataChanged: {
actionButton.enabled = govFormModel.haveAllMandatory()
userMandatoryText.visible = govFormModel.containsMandatoryUser()
fromDataBoxText.visible = govFormModel.containsBoxOwnerData()
}
onValidityNotification: {
validityNotification.text = message
actionButton.enabled = govFormModel.haveAllMandatory()
}
}
/* Makes date selection easier. */
CalendarDialogue {
id: calendarDialogue
onFinished: {
var locale = Qt.locale()
var value = selectedDate.toLocaleDateString(locale, "yyyy-MM-dd")
govFormModel.setProperty(index, "gsVal", value)
}
}
PageHeader {
id: headerBar
title: qsTr("Service:") + " " + gsInternId
onBackClicked: {
pageView.pop(StackView.Immediate)
}
AccessibleOverlaidImageButton {
id: actionButton
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
anchors.rightMargin: defaultMargin
image.sourceSize.height: imgHeightHeader
image.source: "qrc:/ui/send-msg.svg"
accessibleName: qsTr("Send request")
onClicked: {
if (govFormModel.haveAllValid()) {
isds.doIsdsAction("sendGovMessage", userName)
}
}
}
}
Pane {
id: formPane
anchors.top: headerBar.bottom
anchors.right: parent.right
anchors.left: parent.left
Column {
anchors.right: parent.right
anchors.left: parent.left
spacing: formItemVerticalSpacing
AccessibleText {
font.bold: false
width: parent.width
wrapMode: Text.Wrap
text: qsTr("Account:") + " " + acntName
}
AccessibleText {
font.bold: false
width: parent.width
wrapMode: Text.Wrap
text: qsTr("Request:") + " " + gsFullName
}
AccessibleText {
font.bold: false
width: parent.width
wrapMode: Text.Wrap
text: gsInstName
}
Text {
font.bold: false
text: " "
}
AccessibleText {
id: validityNotification
font.bold: false
color: "#ffff0000" // Red
width: parent.width
wrapMode: Text.Wrap
text: ""
visible: validityNotification.text !== ""
}
AccessibleText {
id: userMandatoryText
font.bold: false
width: parent.width
wrapMode: Text.Wrap
text: "(*) " + qsTr("Required information")
}
AccessibleText {
id: fromDataBoxText
font.bold: false
width: parent.width
wrapMode: Text.Wrap
text: "(**) " + qsTr("Acquired from data box")
}
}
}
AccessibleText {
id: emptyList
visible: false
color: datovkaPalette.text
anchors.centerIn: parent
width: parent.width
horizontalAlignment: Text.AlignHCenter
wrapMode: Text.Wrap
text: qsTr("No user data needed.")
}
GovFormList {
id: formList
anchors.top: formPane.bottom
anchors.bottom: parent.bottom
clip: true
spacing: 1
opacity: 1
visible: true
width: parent.width
interactive: true
model: govFormModel
onCountChanged: {
emptyList.visible = (formList.count === 0)
}
onCalendarClicked: {
calendarDialogue.openCalendarDialogue(index, dateVal, qsTr("Select date") + " " + dateDescr)
}
}
Connections {
target: isds
onRunSendGovMessageSig: {
actionButton.enabled = false
if (gov.sendGovRequest(userName, gsInternId, govFormModel)) {
pageView.pop(null, StackView.Immediate) // back to account list
} else {
actionButton.enabled = govFormModel.haveAllMandatory()
}
}
}
} // Item
/*
* 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 cz.nic.mobileDatovka 1.0
import cz.nic.mobileDatovka.models 1.0
Component {
id: pageGovServiceList
Item {
id: srvcListPage
/* These properties must be set by caller. */
property var pageView
property var statusBar
property string acntName
property string userName
property string gsInternIdSelected
Component.onCompleted: {
gov.loadServicesToModel(userName, govServiceModel)
proxyGovServiceModel.setSourceModel(govServiceModel)
}
Component.onDestruction: {
statusBar.visible = false
}
GovServiceListModel {
id: govServiceModel
}
ListSortFilterProxyModel {
id: proxyGovServiceModel
Component.onCompleted: {
setFilterRoles([GovServiceListModel.ROLE_GOV_SRVC_FULL_NAME,
GovServiceListModel.ROLE_GOV_SRVC_INST_NAME,
GovServiceListModel.ROLE_GOV_SRVC_BOXID])
}
}
PageHeader {
id: headerBar
title: qsTr("GOV Services");
onBackClicked: {
pageView.pop()
}
Row {
anchors.verticalCenter: parent.verticalCenter
spacing: defaultMargin
anchors.right: parent.right
anchors.rightMargin: defaultMargin
AccessibleImageButton {
id: searchButton
anchors.verticalCenter: parent.verticalCenter
sourceSize.height: imgHeightHeader
source: "qrc:/ui/magnify.svg"
accessibleName: qsTr("Filter service.")
onClicked: {
govServiceList.anchors.top = filterBar.bottom
filterBar.visible = true
filterBar.filterField.forceActiveFocus()
Qt.inputMethod.show()
}
}
}
}
FilterBar {
id: filterBar
visible: false
z: 1
anchors.top: headerBar.bottom
width: parent.width
height: filterField.height
color: (filterField.text.length === 0) ? datovkaPalette.alternateBase :
(govServiceList.count > 0) ? "#afffaf" : "#ffafaf"
border.color: filterField.activeFocus ? "#0066ff" : "#bdbebf"
placeholderText: qsTr("Set filter")
fontPointSize: defaultTextFont.font.pointSize
buttonImageHeight: imgHeight
buttonAccessibleName: qsTr("Clear and hide filter field")
onTextChanged: {
proxyGovServiceModel.setFilterRegExpStr(text)
}
onClearClicked: {
filterBar.visible = false
govServiceList.anchors.top = headerBar.bottom
Qt.inputMethod.hide()
}
}
AccessibleText {
id: emptyList