Commit 4c8205fa authored by Karel Slaný's avatar Karel Slaný

Using AccessibleComboBox instead of plain ComboBox components.

parent 11e23813
......@@ -97,33 +97,33 @@ Dialog {
contentItem: ColumnLayout {
spacing: formItemVerticalSpacing
ComboBox {
AccessibleComboBox {
anchors {
left: parent.left;
right: parent.right;
}
textRole: "label"
accessibleDescription: qsTr("Select location type")
model: ListModel {
ListElement { label: qsTr("Desktop"); value: "desktop" }
ListElement { label: qsTr("Documents"); value: "document" }
ListElement { label: qsTr("Downloads"); value: "download" }
ListElement { label: qsTr("Pictures"); value: "picture" }
ListElement { label: qsTr("Temp"); value: "temp" }
ListElement { label: qsTr("Desktop"); key: "desktop" }
ListElement { label: qsTr("Documents"); key: "document" }
ListElement { label: qsTr("Downloads"); key: "download" }
ListElement { label: qsTr("Pictures"); key: "picture" }
ListElement { label: qsTr("Temp"); key: "temp" }
}
onActivated: {
var location = InteractionFilesystem.DESKTOP_LOCATION
if (model.get(currentIndex).value === "document") {
if (currentKey() === "document") {
location = InteractionFilesystem.DOCUMENTS_LOCATION
} else if (model.get(currentIndex).value === "download") {
} else if (currentKey() === "download") {
location = InteractionFilesystem.DOWNLOAD_LOCATION
} else if (model.get(currentIndex).value === "picture") {
} else if (currentKey() === "picture") {
location = InteractionFilesystem.PICTURE_LOCATION
} else if (model.get(currentIndex).value === "temp") {
} else if (currentKey() === "temp") {
location = InteractionFilesystem.TEMP_LOCATION
}
folderModel.folder = standardLocationUrl(location)
}
} // ComboBox
}
RowLayout {
anchors {
left: parent.left;
......
......@@ -124,62 +124,32 @@ Item {
anchors.right: parent.right
anchors.left: parent.left
spacing: formItemVerticalSpacing
ComboBox {
AccessibleComboBox {
id: searchScopeComboBox
currentIndex: 0
width: parent.width
height: inputItemHeight
textRole: "label"
font.pointSize: defaultTextFont.font.pointSize
delegate: ItemDelegate {
width: searchScopeComboBox.width
height: inputItemHeight
contentItem: Text {
text: label
color: datovkaPalette.text
font.pointSize: defaultTextFont.font.pointSize
elide: Text.ElideRight
verticalAlignment: Text.AlignVCenter
}
highlighted: searchScopeComboBox.highlightedIndex == index
}
accessibleDescription: qsTr("Select type of sought data box")
model: ListModel {
id: searchScopeComboBoxModel
ListElement { label: qsTr("All databoxes"); value: "ALL" }
ListElement { label: qsTr("OVM"); value: "OVM" }
ListElement { label: qsTr("PO"); value: "PO" }
ListElement { label: qsTr("PFO"); value: "PFO" }
ListElement { label: qsTr("FO"); value: "FO" }
ListElement { label: qsTr("All databoxes"); key: "ALL" }
ListElement { label: qsTr("OVM"); key: "OVM" }
ListElement { label: qsTr("PO"); key: "PO" }
ListElement { label: qsTr("PFO"); key: "PFO" }
ListElement { label: qsTr("FO"); key: "FO" }
}
onCurrentIndexChanged: searchScope = searchScopeComboBoxModel.get(currentIndex).value
onCurrentIndexChanged: searchScope = currentKey()
}
ComboBox {
AccessibleComboBox {
id: searchTypeComboBox
currentIndex: 0
width: parent.width
height: inputItemHeight
textRole: "label"
font.pointSize: defaultTextFont.font.pointSize
delegate: ItemDelegate {
width: searchTypeComboBox.width
height: inputItemHeight
contentItem: Text {
text: label
color: datovkaPalette.text
font.pointSize: defaultTextFont.font.pointSize
elide: Text.ElideRight
verticalAlignment: Text.AlignVCenter
}
highlighted: searchTypeComboBox.highlightedIndex == index
}
accessibleDescription: qsTr("Select entries to search in")
model: ListModel {
id: searchTypeComboBoxModel
ListElement { label: qsTr("All fields"); value: "GENERAL" }
ListElement { label: qsTr("Address"); value: "ADDRESS" }
ListElement { label: qsTr(""); value: "ICO" }
ListElement { label: qsTr("Databox ID"); value: "DBID" }
ListElement { label: qsTr("All fields"); key: "GENERAL" }
ListElement { label: qsTr("Address"); key: "ADDRESS" }
ListElement { label: qsTr(""); key: "ICO" }
ListElement { label: qsTr("Databox ID"); key: "DBID" }
}
onCurrentIndexChanged: searchType = searchTypeComboBoxModel.get(currentIndex).value
onCurrentIndexChanged: searchType = currentKey()
}
AccessibleTextField {
id: searchPhraseText
......
......@@ -92,38 +92,22 @@ Item {
anchors.right: parent.right
anchors.left: parent.left
spacing: formItemVerticalSpacing
ComboBox {
AccessibleComboBox {
id: searchOptionComboBox
currentIndex: 0
width: parent.width
height: inputItemHeight
textRole: "label"
font.pointSize: defaultTextFont.font.pointSize
delegate: ItemDelegate {
width: searchOptionComboBox.width
height: inputItemHeight
contentItem: Text {
text: label
color: datovkaPalette.text
font.pointSize: defaultTextFont.font.pointSize
elide: Text.ElideRight
verticalAlignment: Text.AlignVCenter
}
highlighted: searchOptionComboBox.highlightedIndex == index
}
accessibleDescription: qsTr("Select type of sought messages")
model: ListModel {
id: searchOptionComboBoxModel
// Don't change position of list elements and keys.
/* Cannot have an expression here becacuse QML complains that it cannot use script for property value. */
ListElement { label: qsTr("All messages"); value: -1 }
ListElement { label: qsTr("Received messages"); value: MessageType.TYPE_RECEIVED }
ListElement { label: qsTr("Sent messages"); value: MessageType.TYPE_SENT }
/* Cannot have an expression here because QML complains that it cannot use script for property key. */
ListElement { label: qsTr("All messages"); key: -1 }
ListElement { label: qsTr("Received messages"); key: MessageType.TYPE_RECEIVED }
ListElement { label: qsTr("Sent messages"); key: MessageType.TYPE_SENT }
}
onCurrentIndexChanged: {
if (searchOptionComboBoxModel.get(currentIndex).value == -1) {
if (currentKey() == -1) {
soughtMsgType = MessageType.TYPE_RECEIVED | MessageType.TYPE_SENT
} else {
soughtMsgType = searchOptionComboBoxModel.get(currentIndex).value
soughtMsgType = currentKey()
}
}
}
......
......@@ -35,14 +35,7 @@ Item {
property var accountModel: null
Component.onCompleted: {
var lang = settings.language()
var langugeComboBoxIndex = 0;
if (lang === "cs") {
langugeComboBoxIndex = 1;
} else if (lang === "en") {
langugeComboBoxIndex = 2;
}
languageComboBoxId.currentIndex = langugeComboBoxIndex
languageComboBox.selectCurrentKey(settings.language())
fontSizeSpinBox.setVal(settings.fontSize())
}
......@@ -77,33 +70,18 @@ Item {
color: datovkaPalette.text
text: qsTr("Language")
}
ComboBox {
id: languageComboBoxId
currentIndex: 0
AccessibleComboBox {
id: languageComboBox
width: parent.width
height: inputItemHeight
textRole: "label"
font.pointSize: defaultTextFont.font.pointSize
delegate: ItemDelegate {
width: languageComboBoxId.width
height: inputItemHeight
contentItem: Text {
text: label
color: datovkaPalette.text
font.pointSize: defaultTextFont.font.pointSize
elide: Text.ElideRight
verticalAlignment: Text.AlignVCenter
}
highlighted: languageComboBoxId.highlightedIndex == index
}
accessibleDescription: qsTr("Select language")
model: ListModel {
id: langMethodModel
// Don't change position of list elements, keys and values.
ListElement { label: qsTr("System"); value: "system" }
ListElement { label: qsTr("Czech"); value: "cs" }
ListElement { label: qsTr("English"); value: "en" }
/* Don't change keys and labels. */
ListElement { label: qsTr("System"); key: "system" }
ListElement { label: qsTr("Czech"); key: "cs" }
ListElement { label: qsTr("English"); key: "en" }
}
onCurrentIndexChanged: settings.setLanguage(langMethodModel.get(currentIndex).value)
onCurrentIndexChanged: settings.setLanguage(currentKey())
}
AccessibleText {
color: datovkaPalette.mid
......
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