Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
mobile Datovka
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
12
Issues
12
List
Boards
Labels
Service Desk
Milestones
Merge Requests
3
Merge Requests
3
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Datovka projects
mobile Datovka
Commits
32da0826
Commit
32da0826
authored
Jan 22, 2018
by
Karel Slaný
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Experimenting with accessible combo boxes.
parent
dbfb4930
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
100 additions
and
23 deletions
+100
-23
qml/components/AccessibleComboBox.qml
qml/components/AccessibleComboBox.qml
+91
-0
qml/pages/PageSettingsAccount.qml
qml/pages/PageSettingsAccount.qml
+7
-23
res/qml.qrc
res/qml.qrc
+1
-0
src/main.cpp
src/main.cpp
+1
-0
No files found.
qml/components/AccessibleComboBox.qml
0 → 100644
View file @
32da0826
/*
* 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.2
import
cz
.
nic
.
mobileDatovka
1.0
/*
* Accessible combo box component.
*/
ComboBox
{
id
:
root
/* These properties must be set by caller. */
property
string
accessibleDescription
:
""
/*
* The model entries must contain these properties.
* label - (string with item description)
* item description
* key - (string holding one of the keys)
* unique string identifying an item
* e.g.:
ListModel {
id: listModel
ListElement {
label: qsTr("Some selection")
key: "some"
}
}
*/
currentIndex
:
0
textRole
:
"
label
"
height
:
inputItemHeight
font.pointSize
:
defaultTextFont
.
font
.
pointSize
/*
* Return current key value.
*/
function
currentKey
()
{
return
root
.
model
.
get
(
root
.
currentIndex
).
key
}
delegate
:
ItemDelegate
{
width
:
root
.
width
height
:
inputItemHeight
contentItem
:
AccessibleTextButton
{
text
:
label
color
:
datovkaPalette
.
text
font.pointSize
:
defaultTextFont
.
font
.
pointSize
elide
:
Text
.
ElideRight
verticalAlignment
:
Text
.
AlignVCenter
onClicked
:
{
console
.
log
(
"
Clicked
"
+
label
)
root
.
currentIndex
=
index
root
.
popup
.
close
()
}
}
highlighted
:
root
.
highlightedIndex
==
index
}
Accessible.role
:
Accessible
.
ComboBox
Accessible.description
:
accessibleDescription
Accessible.name
:
root
.
currentText
Accessible.onPressAction
:
{
console
.
log
(
"
Accessible combo box pressed
"
)
root
.
popup
.
open
()
}
}
qml/pages/PageSettingsAccount.qml
View file @
32da0826
...
...
@@ -156,35 +156,19 @@ Item {
color
:
datovkaPalette
.
text
text
:
qsTr
(
"
Login method
"
)
}
ComboBox
{
Accessible
ComboBox
{
id
:
loginMethodComboBox
currentIndex
:
0
width
:
parent
.
width
height
:
inputItemHeight
textRole
:
"
label
"
font.pointSize
:
defaultTextFont
.
font
.
pointSize
delegate
:
ItemDelegate
{
width
:
loginMethodComboBox
.
width
height
:
inputItemHeight
contentItem
:
Text
{
text
:
label
color
:
datovkaPalette
.
text
font.pointSize
:
defaultTextFont
.
font
.
pointSize
elide
:
Text
.
ElideRight
verticalAlignment
:
Text
.
AlignVCenter
}
highlighted
:
loginMethodComboBox
.
highlightedIndex
==
index
}
accessibleDescription
:
qsTr
(
"
Select login method
"
)
model
:
ListModel
{
id
:
loginMethodModel
// Don't change position of list elements, keys and values.
ListElement
{
label
:
qsTr
(
"
Username + Password
"
);
value
:
"
pwd
"
}
ListElement
{
label
:
qsTr
(
"
Certificate + Password
"
);
value
:
"
cert
"
}
ListElement
{
label
:
qsTr
(
"
Password + Security code
"
);
value
:
"
hotp
"
}
ListElement
{
label
:
qsTr
(
"
Password + Security SMS
"
);
value
:
"
totp
"
}
ListElement
{
label
:
qsTr
(
"
Username + Password
"
);
key
:
"
pwd
"
}
ListElement
{
label
:
qsTr
(
"
Certificate + Password
"
);
key
:
"
cert
"
}
ListElement
{
label
:
qsTr
(
"
Password + Security code
"
);
key
:
"
hotp
"
}
ListElement
{
label
:
qsTr
(
"
Password + Security SMS
"
);
key
:
"
totp
"
}
}
onCurrentIndexChanged
:
{
sLoginMethod
=
loginMethodModel
.
get
(
currentIndex
).
value
sLoginMethod
=
currentKey
()
if
(
sLoginMethod
===
"
cert
"
)
{
certificateLabel
.
visible
=
true
certPathButtonId
.
visible
=
true
...
...
res/qml.qrc
View file @
32da0826
...
...
@@ -101,6 +101,7 @@
<file>cznic.png</file>
<file>ui/datovka@2x.png</file>
<file>../qml/components/AccessibleButton.qml</file>
<file>../qml/components/AccessibleComboBox.qml</file>
<file>../qml/components/AccessibleImageButton.qml</file>
<file>../qml/components/AccessibleMenu.qml</file>
<file>../qml/components/AccessibleOverlaidImageButton.qml</file>
...
...
src/main.cpp
View file @
32da0826
...
...
@@ -124,6 +124,7 @@ const struct QmlTypeEntry qmlPages[] = {
static
const
struct
QmlTypeEntry
qmlComponents
[]
=
{
{
"AccessibleButton"
,
1
,
0
},
{
"AccessibleComboBox"
,
1
,
0
},
{
"AccessibleImageButton"
,
1
,
0
},
{
"AccessibleMenu"
,
1
,
0
},
{
"AccessibleOverlaidImageButton"
,
1
,
0
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment