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

Created AccessibleButton component.

parent ff7f0727
/*
* 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
/*
* Accessible button component.
*/
Button {
id: root
/* These properties must be set by caller. */
property string accessibleDescription: ""
property string accessibleName: ""
MouseArea {
function handleClick() {
root.clicked()
}
anchors.fill: parent
Accessible.role: Accessible.Button
Accessible.description: root.accessibleDescription
Accessible.name: (root.accessibleName !== "") ? root.accessibleName : root.text
Accessible.onPressAction: {
handleClick()
}
onClicked: {
handleClick()
}
}
}
......@@ -25,6 +25,7 @@ import QtQuick 2.7
import QtQuick.Controls 2.1
import QtQuick.Layouts 1.3
import Qt.labs.folderlistmodel 2.1
import cz.nic.mobileDatovka 1.0
import cz.nic.mobileDatovka.qmlInteraction 1.0
Dialog {
......@@ -129,10 +130,10 @@ Dialog {
right: parent.right;
}
spacing: formItemVerticalSpacing
Button {
AccessibleButton {
id: upButton
text: "<"
Accessible.name: sqTr("Up") /* Needs to be specified as "<" is not read. */
accessibleName: sqTr("Up") /* Needs to be specified as "<" is not read. */
onClicked: {
/* Navigate to parent folder. */
if (folderModel.parentFolder !== "") {
......
......@@ -212,7 +212,7 @@ ApplicationWindow {
anchors.horizontalCenter: parent.horizontalCenter
text: qsTr("Wrong PIN code!")
}
Button {
AccessibleButton {
text: qsTr("Enter")
anchors.horizontalCenter: parent.horizontalCenter
font.pointSize: defaultTextFont.font.pointSize
......
......@@ -190,7 +190,7 @@ Item {
horizontalAlignment: Text.AlignHCenter
wrapMode: Text.Wrap
}
Button {
AccessibleButton {
id: sendSmsButton
visible: false
enabled: false
......
......@@ -391,7 +391,7 @@ Item {
Row {
spacing: formItemVerticalSpacing * 5
anchors.horizontalCenter: parent.horizontalCenter
Button {
AccessibleButton {
id: addContact
height: inputItemHeight
font.pointSize: defaultTextFont.font.pointSize
......@@ -405,7 +405,7 @@ Item {
}, StackView.Immediate)
}
}
Button {
AccessibleButton {
id: findDS
height: inputItemHeight
font.pointSize: defaultTextFont.font.pointSize
......@@ -446,7 +446,7 @@ Item {
//----ATTACHMENT SECTION------------
Item {
id: tabAttachments
Button {
AccessibleButton {
id: addFile
height: inputItemHeight
anchors.horizontalCenter: parent.horizontalCenter
......
......@@ -210,7 +210,7 @@ Item {
wrapMode: Text.WrapAnywhere
text: ""
}
Button {
AccessibleButton {
id: certPathButtonId
visible: false
text: qsTr("Choose file")
......
......@@ -240,7 +240,7 @@ Item {
horizontalAlignment: Text.AlignHCenter
wrapMode: Text.Wrap
}
Button {
AccessibleButton {
id: setPinButton
height: inputItemHeight
font.pointSize: defaultTextFont.font.pointSize
......@@ -250,7 +250,7 @@ Item {
actionName = "new"
}
}
Button {
AccessibleButton {
id: changePinButton
height: inputItemHeight
font.pointSize: defaultTextFont.font.pointSize
......@@ -260,7 +260,7 @@ Item {
actionName = "change"
}
}
Button {
AccessibleButton {
id: disablePinButton
height: inputItemHeight
font.pointSize: defaultTextFont.font.pointSize
......
......@@ -169,7 +169,7 @@ Item {
wrapMode: Text.Wrap
text: ""
}
Button {
AccessibleButton {
id: dbPathButton
font.pointSize: defaultTextFont.font.pointSize
height: inputItemHeight
......@@ -187,7 +187,7 @@ Item {
}
}
}
Button {
AccessibleButton {
id: dbResetPathButton
text: qsTr("Set default")
font.pointSize: defaultTextFont.font.pointSize
......@@ -210,7 +210,7 @@ Item {
color: datovkaPalette.text
text: qsTr("Clean up all databases")
}
Button {
AccessibleButton {
id: vacuumButton
font.pointSize: defaultTextFont.font.pointSize
height: inputItemHeight
......
......@@ -100,6 +100,7 @@
<file>datovka.png</file>
<file>cznic.png</file>
<file>ui/datovka@2x.png</file>
<file>../qml/components/AccessibleButton.qml</file>
<file>../qml/components/AccessibleImageButton.qml</file>
<file>../qml/components/AccessibleMenu.qml</file>
<file>../qml/components/AccessibleOverlaidImageButton.qml</file>
......
......@@ -123,6 +123,7 @@ const struct QmlTypeEntry qmlPages[] = {
*/
static
const struct QmlTypeEntry qmlComponents[] = {
{ "AccessibleButton", 1, 0 },
{ "AccessibleImageButton", 1, 0 },
{ "AccessibleMenu", 1, 0 },
{ "AccessibleOverlaidImageButton", 1, 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