Commit 1358c874 authored by Karel Slaný's avatar Karel Slaný

Found boxes are automatically selected if already listed as recipients.

parent f7c123e6
......@@ -40,8 +40,8 @@ Item {
property var pageView
property var statusBar
property string userName
// sendMsgRecipientModel holds recipient list from send message page (can be NULL)
property var sendMsgRecipientModel: null
// recipBoxModel (if not null) holds recipient list of send message page
property var recipBoxModel: null
/* These properties remember choice of ComboBoxes */
property string searchType: "GENERAL"
......@@ -55,10 +55,10 @@ Item {
Component.onCompleted: {
searchPhraseText.forceActiveFocus()
proxyDataboxModel.setSourceModel(databoxModel)
proxyDataboxModel.setSourceModel(foundBoxModel)
}
DataboxListModel {
id: databoxModel
id: foundBoxModel
Component.onCompleted: {
}
}
......@@ -249,7 +249,10 @@ Item {
if (page > 0) {
page = page-1
}
isds.findDataboxFulltext(userName, databoxModel, searchTextTmp, searchTypeTmp, searchScopeTmp, page)
isds.findDataboxFulltext(userName, foundBoxModel, searchTextTmp, searchTypeTmp, searchScopeTmp, page)
if (recipBoxModel != null) {
foundBoxModel.selectEntries(recipBoxModel.boxIds(), true)
}
}
}
}
......@@ -283,7 +286,10 @@ Item {
anchors.fill: parent
onClicked: {
page = page+1
isds.findDataboxFulltext(userName, databoxModel, searchTextTmp, searchTypeTmp, searchScopeTmp, page)
isds.findDataboxFulltext(userName, foundBoxModel, searchTextTmp, searchTypeTmp, searchScopeTmp, page)
if (recipBoxModel != null) {
foundBoxModel.selectEntries(recipBoxModel.boxIds(), true)
}
}
}
} // Rectangle
......@@ -309,30 +315,30 @@ Item {
width: parent.width
interactive: true
model: proxyDataboxModel
canDetailBoxes: sendMsgRecipientModel == null
canSelectBoxes: sendMsgRecipientModel != null
canDeselectBoxes: sendMsgRecipientModel != null
canDetailBoxes: recipBoxModel == null
canSelectBoxes: recipBoxModel != null
canDeselectBoxes: recipBoxModel != null
onBoxSelect: {
var boxEntry = databoxModel.entry(boxId)
var boxEntry = foundBoxModel.entry(boxId)
statusBar.visible = false
if (sendMsgRecipientModel != null) {
databoxModel.selectEntry(boxEntry.dbID, true)
sendMsgRecipientModel.addEntry(boxEntry)
if (recipBoxModel != null) {
foundBoxModel.selectEntry(boxEntry.dbID, true)
recipBoxModel.addEntry(boxEntry)
}
}
onBoxDeselect: {
statusBar.visible = false
if (sendMsgRecipientModel != null) {
databoxModel.selectEntry(boxId, false)
sendMsgRecipientModel.removeEntry(boxId)
if (recipBoxModel != null) {
foundBoxModel.selectEntry(boxId, false)
recipBoxModel.removeEntry(boxId)
}
}
onBoxDetail: {
var boxEntry = databoxModel.entry(boxId)
var boxEntry = foundBoxModel.entry(boxId)
statusBar.visible = false
if (sendMsgRecipientModel == null) {
if (recipBoxModel == null) {
pageView.push(pageDataboxDetail, {
"pageView": pageView,
"statusBar": statusBar,
......@@ -354,7 +360,10 @@ Item {
searchTextTmp = searchPhraseText.text
searchTypeTmp = searchType
searchScopeTmp = searchScope
emptyList.visible = (isds.findDataboxFulltext(userName, databoxModel, searchPhraseText.text, searchType, searchScope, page) <= 0)
emptyList.visible = (isds.findDataboxFulltext(userName, foundBoxModel, searchPhraseText.text, searchType, searchScope, page) <= 0)
if (recipBoxModel != null) {
foundBoxModel.selectEntries(recipBoxModel.boxIds(), true)
}
}
}
Connections {
......
......@@ -99,7 +99,7 @@ Item {
/* Holds send message recipent list model */
DataboxListModel {
id: sendMsgRecipientModel
id: recipBoxModel
Component.onCompleted: {
}
}
......@@ -163,7 +163,7 @@ Item {
/* Enable send message button if all required fields are filled */
function areReguiredFieldsFilled() {
actionButton.enabled = (dmAnnotation.text.toString() != "" && (sendMsgRecipientModel.rowCount() > 0) && (sendMsgAttachmentModel.rowCount() > 0))
actionButton.enabled = (dmAnnotation.text.toString() != "" && (recipBoxModel.rowCount() > 0) && (sendMsgAttachmentModel.rowCount() > 0))
}
TabBar {
......@@ -270,7 +270,7 @@ Item {
"pageView": pageView,
"statusBar": statusBar,
"userName": userName,
"sendMsgRecipientModel": sendMsgRecipientModel
"recipBoxModel": recipBoxModel
}, StackView.Immediate)
}
}
......@@ -287,13 +287,13 @@ Item {
width: parent.width
height: 600
interactive: true
model: sendMsgRecipientModel
model: recipBoxModel
canRemoveBoxes: true
onCountChanged: {
mainPanel.areReguiredFieldsFilled()
}
onBoxRemove: {
sendMsgRecipientModel.removeEntry(boxId)
recipBoxModel.removeEntry(boxId)
}
} // DataboxList
}
......
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