Commit d6effb27 authored by Martin Straka's avatar Martin Straka

First Gov services prototype

parent c496322f
......@@ -91,6 +91,18 @@ SOURCES += \
src/accounts.cpp \
src/auxiliaries/attachment_helper.cpp \
src/auxiliaries/email_helper.cpp \
src/datovka_shared/gov_services/model/gov_model.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.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 +141,7 @@ SOURCES += \
src/dialogues/widget_message_dialogue.cpp \
src/files.cpp \
src/global.cpp \
src/gov.cpp \
src/io/filesystem.cpp \
src/isds/isds_conversion.cpp \
src/isds/isds_type_conversion.cpp \
......@@ -197,6 +210,18 @@ HEADERS += \
src/auxiliaries/attachment_helper.h \
src/auxiliaries/email_helper.h \
src/common.h \
src/datovka_shared/gov_services/model/gov_model.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.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 +262,7 @@ HEADERS += \
src/dialogues/widget_message_dialogue.h \
src/files.h \
src/global.h \
src/gov.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 QtGraphicalEffects 1.0
import QtQuick 2.7
import QtQuick.Layouts 1.3
import QtQuick.Controls 2.2
ScrollableListView {
id: root
delegateHeight: listItemHeight
/* These signals should be captured to implement message interaction. */
signal govServiceClicked(string gsId, string gsName, string gsGovName, string gsReqField)
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: gsName
color: headerColor
font.bold: true
width: parent.width
wrapMode: Text.Wrap
}
Text {
id: govName
text: "DS: " + gsBoxId + " -- " + gsGovName
color: datovkaPalette.text
font.pointSize: textFontSizeSmall
width: parent.width
wrapMode: Text.Wrap
}
}
} // Item
Rectangle {
visible: (gsReqField !== "")
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(gsId, gsName, govName.text.toString(), gsReqField)
}
}
Rectangle {
anchors.top: parent.bottom
height: 1
width: parent.width
color: datovkaPalette.dark
}
} // Rectangle
ScrollIndicator.vertical: ScrollIndicator {}
} // ListView
......@@ -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.Layouts 1.3
import QtQuick.Controls 2.2
import cz.nic.mobileDatovka 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 gsId
property string gsName
property string gsGovName
property string gsReqField
Component.onCompleted: {
if (gsReqField === "ic") {
icoLabel.visible = true
icoText.visible = icoLabel.visible
} else if (gsReqField === "date") {
fromDateLabel.visible = true
toDateLabel.visible = fromDateLabel.visible
fromDateText.visible = fromDateLabel.visible
toDateText.visible = fromDateLabel.visible
} else if (gsReqField === "rpid") {
drvlicLabel.visible = true
drvlicText.visible = drvlicLabel.visible
}
}
PageHeader {
id: headerBar
title: qsTr("Service:") + " " + gsId
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: {
isds.doIsdsAction("sendGovMessage", userName)
}
}
}
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: 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:") + " " + gsName
}
AccessibleText {
font.bold: false
width: parent.width
wrapMode: Text.Wrap
text: gsGovName
}
Text {
font.bold: false
text: " "
}
AccessibleText {
font.bold: false
width: parent.width
wrapMode: Text.Wrap
text: qsTr("Follow information must be filled.")
}
Text {
font.bold: false
text: " "
}
//---IČ field---
AccessibleText {
id: icoLabel
visible: false
font.bold: true
text: qsTr("Subject ID (IČ)")
}
AccessibleTextField {
id: icoText
visible: false
height: inputItemHeight
maximumLength: 8
font.pointSize: defaultTextFont.font.pointSize
placeholderText: qsTr("Enter subject ID (IČ)")
width: parent.width
InputLineMenu {
id: icox
inputTextControl: icoText
isPassword: false
}
onPressAndHold: {
if (settings.useExplicitClipboardOperations()) {
icox.implicitWidth = computeMenuWidth(icox)
icox.open()
}
}
}
//---Date fields---
AccessibleText {
id: fromDateLabel
visible: false
font.bold: true
text: qsTr("From")
}
AccessibleTextField {
id: fromDateText
visible: false
height: inputItemHeight
font.pointSize: defaultTextFont.font.pointSize
placeholderText: qsTr("Enter date (YYYY-MM-DD)")
width: parent.width
enabled: false
InputLineMenu {
id: fromDateX
inputTextControl: fromDateText
isPassword: false
}
onPressAndHold: {
if (settings.useExplicitClipboardOperations()) {
fromDateX.implicitWidth = computeMenuWidth(fromDateX)
fromDateX.open()
}
}
}
AccessibleText {
id: toDateLabel
visible: false
font.bold: true
text: qsTr("To")
}
AccessibleTextField {
visible: false
id: toDateText
height: inputItemHeight
font.pointSize: defaultTextFont.font.pointSize
placeholderText: qsTr("Enter date (YYYY-MM-DD)")
width: parent.width
enabled: false
InputLineMenu {
id: toDateX
inputTextControl: toDateText
isPassword: false
}
onPressAndHold: {
if (settings.useExplicitClipboardOperations()) {
toDateX.implicitWidth = computeMenuWidth(toDateX)
toDateX.open()
}
}
}
//---Driver license field---
AccessibleText {
id: drvlicLabel
visible: false
font.bold: true
text: qsTr("Driver license ID")
}
AccessibleTextField {
id: drvlicText
visible: false
height: inputItemHeight
font.pointSize: defaultTextFont.font.pointSize
placeholderText: qsTr("Enter driver license ID without space")
width: parent.width
InputLineMenu {
id: drvlicx
inputTextControl: drvlicText
isPassword: false
}
onPressAndHold: {
if (settings.useExplicitClipboardOperations()) {
drvlicx.implicitWidth = computeMenuWidth(drvlicx)
drvlicx.open()
}
}
}
} // Column
Connections {
target: isds
onRunSendGovMessageSig: {
actionButton.enabled = false
if (gov.sendGovRequest(userName, gsId, icoText.text, drvlicText.text, fromDateText.text, toDateText.text)) {
pageView.pop(StackView.Immediate)
}
}
}
} // Pane
ScrollIndicator.vertical: ScrollIndicator {}
} // Flickable
} // 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 gsIdSelected
Component.onCompleted: {
gov.loadGovServicesToModel(govServiceModel)
proxyGovServiceModel.setSourceModel(govServiceModel)
}
Component.onDestruction: {
statusBar.visible = false
gov.deleteGovServices()
}
GovListModel {
id: govServiceModel
Component.onCompleted: {
}
}
ListSortFilterProxyModel {
id: proxyGovServiceModel
Component.onCompleted: {
setFilterRoles([GovListModel.ROLE_GOV_SRVC_NAME,
GovListModel.ROLE_GOV_SRVC_GOVNAME,
GovListModel.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
visible: false
color: datovkaPalette.text
anchors.centerIn: parent
width: parent.width
horizontalAlignment: Text.AlignHCenter
wrapMode: Text.Wrap
text: (filterBar.filterField.text.length === 0) ?
qsTr("No Gov service.") :
qsTr("No Gov service found that matches filter text '%1'.").arg(filterBar.filterField.text)
}
GovServiceList {
id: govServiceList
anchors.top: headerBar.bottom
anchors.bottom: parent.bottom
clip: true
spacing: 1
opacity: 1
visible: true
width: parent.width
interactive: true
model: proxyGovServiceModel
onCountChanged: {
emptyList.visible = (govServiceList.count === 0)
}
onGovServiceClicked: {
if (gsReqField !== "") {
pageView.push(pageGovService, {
"pageView": pageView,
"statusBar": statusBar,
"acntName" : acntName,
"userName": userName,
"gsId": gsId,
"gsName": gsName,
"gsGovName": gsGovName,
"gsReqField": gsReqField
}, StackView.Immediate)
} else {
gsIdSelected = gsId
isds.doIsdsAction("sendGovMessage", userName)
}
}
Connections {
target: isds
onRunSendGovMessageSig: {
if (gov.sendGovRequest(userName, gsIdSelected, "","","","")) {
pageView.pop(StackView.Immediate)
}
}
}
}
}
}
......@@ -73,6 +73,14 @@ Component {
"action": "new"
}, StackView.Immediate)
},
"govServiceList": function callGovServiceList() {
pageView.replace(pageGovServiceList, {
"pageView": pageView,
"statusBar": statusBar,
"acntName" : acntName,
"userName": userName,
}, StackView.Immediate)
},
"importMsg": function callImportMsg() {
pageView.replace(pageImportMessage, {
"pageView": pageView,
......@@ -132,6 +140,13 @@ Component {
name: qsTr("Create message")
funcName: "createMsg"
}
ListElement {
image: "qrc:/ui/timer.svg"
showEntry: true
showNext: true
name: qsTr("Send GOV request")
funcName: "govServiceList"
}
ListElement {
image: "qrc:/ui/file-import.svg"
showEntry: true
......@@ -177,7 +192,6 @@ Component {
clip: true
spacing: 1
opacity: 1
funcArr: funcs
model: accountMenuListModel
}
......
......@@ -117,6 +117,7 @@
<file>../qml/components/AccessibleTextField.qml</file>
<file>../qml/components/DataboxList.qml</file>
<file>../qml/components/FilterBar.qml</file>
<file>../qml/components/GovServiceList.qml</file>
<file>../qml/components/InputLineMenu.qml</file>
<file>../qml/components/LogBar.qml</file>
<file>../qml/components/MessageList.qml</file>
......@@ -135,6 +136,8 @@
<file>../qml/pages/PageContactList.qml</file>
<file>../qml/pages/PageDataboxDetail.qml</file>
<file>../qml/pages/PageDataboxSearch.qml</file>
<file>../qml/pages/PageGovService.qml</file>
<file>../qml/pages/PageGovServiceList.qml</file>
<file>../qml/pages/PageImportMessage.qml</file>
<file>../qml/pages/PageLog.qml</file>
<file>../qml/pages/PageMenuAccount.qml</file>
......
/*
* 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.
*/
#include <QQmlEngine> /* qmlRegisterType */
#include "src/datovka_shared/gov_services/model/gov_model.h"
#include "src/global.h"
GovListModel::Entry::Entry(const Entry &sme)
: m_srvcId(sme.m_srvcId),
m_srvcName(sme.m_srvcName),
m_srvcGov(sme.m_srvcGov),
m_srvcBoxId(sme.m_srvcBoxId),
m_srvcReqField(sme.m_srvcReqField)
{
}
GovListModel::Entry::Entry(const QString &srvcId, const QString &srvcName,
const QString &srvcGov, const QString &srvcBoxId,
const QString &srvcReqField)
: m_srvcId(srvcId),
m_srvcName(srvcName),
m_srvcGov(srvcGov),
m_srvcBoxId(srvcBoxId),
m_srvcReqField(srvcReqField)
{
}
QString GovListModel::Entry::srvcId(void) const
{
return m_srvcId;
}
QString GovListModel::Entry::srvcName(void) const
{
return m_srvcName;
}
void GovListModel::Entry::setSrvcName(const QString &srvcName)
{
m_srvcName = srvcName;
}
QString GovListModel::Entry::srvcGov(void) const
{
return m_srvcGov;
}
void GovListModel::Entry::setSrvcGov(const QString &srvcGov)
{
m_srvcGov = srvcGov;
}
QString GovListModel::Entry::srvcBoxId(void) const
{
return m_srvcBoxId;
}
void GovListModel::Entry::setSrvcBoxId(const QString &srvcBoxId)
{
m_srvcBoxId = srvcBoxId;
}
QString GovListModel::Entry::srvcReqField(void) const
{
return m_srvcReqField;
}