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

Created AccessibleSpinBoxZeroMax component.

parent be02e087
......@@ -23,8 +23,11 @@
import QtQuick 2.7
import QtQuick.Controls 2.2
import cz.nic.mobileDatovka 1.0
AccessibleSpinBox {
id: root
SpinBox {
/* Must be a non-decreasing list ending with infinity. */
property var items: [1, qsTr("max")]
property int dfltIdx: 0
......@@ -75,8 +78,56 @@ SpinBox {
}
}
Accessible.role: Accessible.SpinBox
Accessible.description: "" /* Tell what the item does. */
Accessible.name: textFromValue(value)
/* TODO -- Need to export buttons. */
MouseArea {
anchors.fill: root.down.indicator
function handleClick() {
root.decrease()
root.valueModified()
}
Accessible.role: Accessible.Button
Accessible.description: root.accessibleDescription
//Accessible.focusable: true
Accessible.name: qsTr("Decrease value '%1'.").arg(root.textFromValue(root.value))
Accessible.onPressAction: {
handleClick()
}
onClicked: {
handleClick()
}
}
MouseArea {
anchors.top: root.top
anchors.bottom: root.bottom
anchors.left: (root.down.indicator.x < root.up.indicator.x) ? root.down.indicator.right : root.up.indicator.right
anchors.right: (root.down.indicator.x < root.up.indicator.x) ? root.up.indicator.left : root.up.indicator.left
Accessible.role: root.editable ? Accessible.EditableText : Accessible.StaticText
Accessible.description: root.accessibleDescription
Accessible.editable: root.editable
Accessible.focusable: true
Accessible.multiLine: false
Accessible.name: root.textFromValue(root.value)
Accessible.readOnly: !root.editable
}
MouseArea {
anchors.fill: root.up.indicator
function handleClick() {
root.increase()
root.valueModified()
}
Accessible.role: Accessible.Button
Accessible.description: root.accessibleDescription
//Accessible.focusable: true
Accessible.name: qsTr("Increase value '%1'.").arg(root.textFromValue(root.value))
Accessible.onPressAction: {
handleClick()
}
onClicked: {
handleClick()
}
}
}
......@@ -324,20 +324,22 @@ Item {
text: qsTr("Lock after seconds of inactivity")
horizontalAlignment: Text.AlignHCenter
}
SpinBoxZeroMax {
AccessibleSpinBoxZeroMax {
/* Holds value in seconds. */
id: lockIntervalSpinBox
anchors.horizontalCenter: parent.horizontalCenter
height: inputItemHeight
font.pointSize: defaultTextFont.font.pointSize
/* Must be a non-decreasing list ending with infinity. */
items: [15, 30, 60, 90, 120, 150, 180, qsTr("don't lock")]
dfltIdx: 0
accessibleDescription: qsTr("Select the number of seconds after which the application is going to be locked.")
onValueModified: {
/* Enable accept button. Always visible? */
acceptElement.visible = val() != settings.inactivityInterval()
}
Accessible.description: qsTr("Select the number of seconds after which the application is going to be locked.")
}
} // Column layout
} // Pane
......
......@@ -84,16 +84,17 @@ Item {
color: datovkaPalette.text
text: qsTr("Number of days to keep messages")
}
SpinBoxZeroMax {
AccessibleSpinBoxZeroMax {
/* Holds value in days. */
id: messageLifeSpinBox
height: inputItemHeight
font.pointSize: defaultTextFont.font.pointSize
/* Must be a non-decreasing list ending with infinity. */
items: [90, 95, 100, 105, 110, 115, 120, 125, 130, 135, 140, 145, 150, 155, 160, 165, 170, 175, 180, qsTr("don't delete")]
dfltIdx: 0
accessibleDescription: qsTr("Select the number of days how long downloaded messages are kept in local storage after download.")
onValueModified: settings.setMessageLifeDays(messageLifeSpinBox.val())
Accessible.description: qsTr("Select the number of days how long downloaded messages are kept in local storage after download.")
}
AccessibleText {
color: datovkaPalette.mid
......@@ -110,16 +111,17 @@ Item {
color: datovkaPalette.text
text: qsTr("Number of days to keep attachments")
}
SpinBoxZeroMax {
AccessibleSpinBoxZeroMax {
/* Holds value in days. */
id: attachLifeSpinBox
height: inputItemHeight
font.pointSize: defaultTextFont.font.pointSize
/* Must be a non-decreasing list ending with infinity. */
items: [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, qsTr("like messages")]
dfltIdx: 1
accessibleDescription: qsTr("Select the number of days how long message content is kept in local storage after download.")
onValueModified: settings.setAttachmentLifeDays(attachLifeSpinBox.val())
Accessible.description: qsTr("Select the number of days how long message content is kept in local storage after download.")
}
AccessibleText {
color: datovkaPalette.mid
......
......@@ -106,6 +106,7 @@
<file>../qml/components/AccessibleMenu.qml</file>
<file>../qml/components/AccessibleOverlaidImageButton.qml</file>
<file>../qml/components/AccessibleSpinBox.qml</file>
<file>../qml/components/AccessibleSpinBoxZeroMax.qml</file>
<file>../qml/components/AccessibleSwitch.qml</file>
<file>../qml/components/AccessibleText.qml</file>
<file>../qml/components/AccessibleTextButton.qml</file>
......@@ -117,7 +118,6 @@
<file>../qml/components/OverlaidImage.qml</file>
<file>../qml/components/PageHeader.qml</file>
<file>../qml/components/ProgressBar.qml</file>
<file>../qml/components/SpinBoxZeroMax.qml</file>
<file>../qml/dialogues/InputDialogue.qml</file>
<file>../qml/dialogues/FileDialogue.qml</file>
<file>../qml/dialogues/MessageDialogue.qml</file>
......
......@@ -129,6 +129,7 @@ const struct QmlTypeEntry qmlComponents[] = {
{ "AccessibleMenu", 1, 0 },
{ "AccessibleOverlaidImageButton", 1, 0 },
{ "AccessibleSpinBox", 1, 0 },
{ "AccessibleSpinBoxZeroMax", 1, 0 },
{ "AccessibleSwitch", 1, 0 },
{ "AccessibleText", 1, 0 },
{ "AccessibleTextButton", 1, 0 },
......@@ -140,7 +141,6 @@ const struct QmlTypeEntry qmlComponents[] = {
{ "OverlaidImage", 1, 0 },
{ "PageHeader", 1, 0 },
{ "ProgressBar", 1, 0 },
{ "SpinBoxZeroMax", 1, 0 },
{ NULL, 0, 0 }
};
......
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