Commit 24651587 authored by Martin Straka's avatar Martin Straka

Updated DataboxList qml for send message

parent df31ea63
......@@ -29,8 +29,14 @@ import QtQuick.Controls 2.1
ListView {
id: root
/* These signals should be captured to implement databox interaction. */
signal dbClicked(string dbID, string dbType, string dbName, string dbAddress, string dbEffectiveOvm)
/* These properties must be set by caller. */
// sendMsgRecipientListModel holds recipient list from send message page (can be NULL)
property var sendMsgRecipientListModel: null
// isSendMsgAddRecipent says that we can add a databox to sendMsgRecipientListModel
property bool isSendMsgAddRecipent: false
/* This signal should be captured to implement find databox or add to recipient. */
signal dbClicked(string dbType, string dbID, string dbName, string dbAddress, string dbIc, string dbEffectiveOvm, string dbSendOption)
delegate: Rectangle {
id: dbItem
......@@ -42,7 +48,7 @@ ListView {
anchors.fill: parent
anchors.margins: defaultMargin
GridLayout {
id: grid
id: gridSearchDatabox
columns: 2
rows: 3
rowSpacing: defaultMargin * 0.6
......@@ -75,7 +81,7 @@ ListView {
Text {
id: r3c2
font.pointSize: textFontSizeSmall
text: (rDbIc == "") ? rDbIc : "IČ:" + rDbIc
text: (rDbIc == "") ? rDbIc : "IČ: " + rDbIc
}
Text {
id: hiddenText
......@@ -83,8 +89,15 @@ ListView {
font.pointSize: textFontSizeSmall
text: rDbEffectiveOvm
}
}
} // GridLayout
} // Item
MouseArea {
anchors.fill: parent
onClicked: {
dbItem.color = readBgColor
root.dbClicked(rDbType, rDbID, rDbName, rDbAddress, rDbIc, rDbEffectiveOvm, rDbSendOption)
}
}
Rectangle {
id: next
anchors.verticalCenter: parent.verticalCenter
......@@ -97,21 +110,40 @@ ListView {
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
anchors.rightMargin: defaultMargin
sourceSize.height: navImgHeight
source: "qrc:/ui/next.svg"
}
sourceSize.height: (sendMsgRecipientListModel == null) ? navImgHeight : imgHeight
source: {
// set icon based on the databox list operation
if (sendMsgRecipientListModel == null) {
// we can view databox detail only
"qrc:/ui/next.svg"
} else if (isSendMsgAddRecipent) {
// we can add databox into send message recipient list
"qrc:/ui/add.svg"
} else {
// we can remove databox from send message recipient list
"qrc:/ui/remove.svg"
}
}
} // Image
ColorOverlay {
anchors.fill: nextImage
source: nextImage
color: datovkaPalette.windowText
}
MouseArea {
// visible only if model is sendMsgRecipientListModel
visible: ((sendMsgRecipientListModel != null) && !isSendMsgAddRecipent)
anchors.fill: parent
onClicked: {
// if sendMsgRecipientListModel is set and
// we don't add new databox into send recipient list,
// we must allow remove exist recipients from model.
if ((sendMsgRecipientListModel != null) && !isSendMsgAddRecipent) {
sendMsgRecipientListModel.remove(index)
}
}
} // MouseArea
} // Rectangle
MouseArea {
anchors.fill: parent
onClicked: {
root.dbClicked(rDbID, rDbType, rDbName, rDbAddress, rDbEffectiveOvm)
}
}
Rectangle {
anchors.top: parent.bottom
height: 1
......
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