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
4
Merge Requests
4
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
11e23813
Commit
11e23813
authored
Jan 22, 2018
by
Karel Slaný
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Setting combo box in account settings page according to the key value.
parent
32da0826
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
24 additions
and
26 deletions
+24
-26
qml/components/AccessibleComboBox.qml
qml/components/AccessibleComboBox.qml
+15
-2
qml/components/AccessibleMenu.qml
qml/components/AccessibleMenu.qml
+1
-1
qml/pages/PageSettingsAccount.qml
qml/pages/PageSettingsAccount.qml
+6
-5
src/accounts.cpp
src/accounts.cpp
+1
-17
src/accounts.h
src/accounts.h
+1
-1
No files found.
qml/components/AccessibleComboBox.qml
View file @
11e23813
...
...
@@ -63,6 +63,21 @@ ComboBox {
return
root
.
model
.
get
(
root
.
currentIndex
).
key
}
/*
* Selects entry with given key.
*/
function
selectCurrentKey
(
key
)
{
for
(
var
i
=
0
;
i
<
root
.
model
.
count
;
++
i
)
{
//root.model.get(i)["key"]
if
(
root
.
model
.
get
(
i
).
key
===
key
)
{
root
.
currentIndex
=
i
;
return
;
}
}
/* Not found. */
console
.
log
(
"
No entry found for key '
"
+
key
+
"
'.
"
);
}
delegate
:
ItemDelegate
{
width
:
root
.
width
height
:
inputItemHeight
...
...
@@ -73,7 +88,6 @@ ComboBox {
elide
:
Text
.
ElideRight
verticalAlignment
:
Text
.
AlignVCenter
onClicked
:
{
console
.
log
(
"
Clicked
"
+
label
)
root
.
currentIndex
=
index
root
.
popup
.
close
()
}
...
...
@@ -85,7 +99,6 @@ ComboBox {
Accessible.description
:
accessibleDescription
Accessible.name
:
root
.
currentText
Accessible.onPressAction
:
{
console
.
log
(
"
Accessible combo box pressed
"
)
root
.
popup
.
open
()
}
}
qml/components/AccessibleMenu.qml
View file @
11e23813
...
...
@@ -77,7 +77,7 @@ ListView {
* Returns -1 if nothing found.
*/
function
get_model_index
(
model
,
property
,
value
)
{
for
(
var
i
=
0
;
i
<
model
.
count
;
++
i
)
{
for
(
var
i
=
0
;
i
<
model
.
count
;
++
i
)
{
if
(
model
.
get
(
i
)[
property
]
===
value
)
{
return
i
;
}
...
...
qml/pages/PageSettingsAccount.qml
View file @
11e23813
...
...
@@ -162,10 +162,11 @@ Item {
accessibleDescription
:
qsTr
(
"
Select login method
"
)
model
:
ListModel
{
id
:
loginMethodModel
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
"
}
/* Key values must be equivalent to constants defined in C++ code! */
ListElement
{
label
:
qsTr
(
"
Username + Password
"
);
key
:
"
pwd
"
}
// USERNAME_PWD_ONLY
ListElement
{
label
:
qsTr
(
"
Certificate + Password
"
);
key
:
"
cert
"
}
// USERNAME_PWD_CERT
ListElement
{
label
:
qsTr
(
"
Password + Security code
"
);
key
:
"
hotp
"
}
// USERNAME_PWD_HOTP
ListElement
{
label
:
qsTr
(
"
Password + Security SMS
"
);
key
:
"
totp
"
}
// USERNAME_PWD_TOTP
}
onCurrentIndexChanged
:
{
sLoginMethod
=
currentKey
()
...
...
@@ -316,7 +317,7 @@ Item {
testAccount
.
checked
=
isTestAccount
useLS
.
checked
=
storeToDisk
certPathLabelId
.
text
=
certPath
loginMethodComboBox
.
currentIndex
=
loginMethod
loginMethodComboBox
.
selectCurrentKey
(
loginMethod
)
userNameTextField
.
enabled
=
false
testAccount
.
enabled
=
false
headerBar
.
title
=
qsTr
(
"
Account settings
"
)
...
...
src/accounts.cpp
View file @
11e23813
...
...
@@ -90,24 +90,8 @@ void Accounts::getAccountData(const QString &userName)
const
AcntData
&
acntData
(
AccountListModel
::
globAccounts
[
userName
]);
/* Set login method model index for combobox in QML page.
* See AccountSettingsPage.qml for logim method order. Default is:
* 0 .. Username + Password
* 1 .. Certificate + Password
* 2 .. Password + Security code
* 3 .. Password + Security SMS
*/
int
qmlLoginMethodIndex
=
0
;
if
(
acntData
.
loginMethod
()
==
USERNAME_PWD_CERT
)
{
qmlLoginMethodIndex
=
1
;
}
else
if
(
acntData
.
loginMethod
()
==
USERNAME_PWD_HOTP
)
{
qmlLoginMethodIndex
=
2
;
}
else
if
(
acntData
.
loginMethod
()
==
USERNAME_PWD_TOTP
)
{
qmlLoginMethodIndex
=
3
;
}
emit
sendAccountData
(
acntData
.
accountName
(),
userName
,
qmlLoginMethodIndex
,
acntData
.
password
(),
acntData
.
isTestAccount
(),
acntData
.
loginMethod
()
,
acntData
.
password
(),
acntData
.
isTestAccount
(),
acntData
.
rememberPwd
(),
acntData
.
storeToDisk
(),
acntData
.
certPath
());
}
...
...
src/accounts.h
View file @
11e23813
...
...
@@ -156,7 +156,7 @@ signals:
* @param[in] certPath Certificate path (can be null).
*/
void
sendAccountData
(
QString
acntName
,
QString
userName
,
int
loginMethod
,
QString
password
,
bool
isTestAccount
,
QString
loginMethod
,
QString
password
,
bool
isTestAccount
,
bool
rememberPwd
,
bool
storeToDisk
,
QString
certPath
);
/*!
...
...
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