Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
mobile Datovka
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
8
Issues
8
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Packages
Packages
Container Registry
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Datovka projects
mobile Datovka
Commits
44893201
Commit
44893201
authored
Jan 06, 2017
by
Karel Slaný
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Inactivity period can be set from PIN settings page.
parent
d21fda68
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
104 additions
and
1 deletion
+104
-1
qml/pages/PinPage.qml
qml/pages/PinPage.qml
+99
-1
src/main.cpp
src/main.cpp
+5
-0
No files found.
qml/pages/PinPage.qml
View file @
44893201
...
...
@@ -53,6 +53,13 @@ Component {
pinConfirmField1
.
visible
=
false
pinConfirmField2
.
visible
=
false
errLineText
.
visible
=
false
lockIntervalLabel
.
visible
=
true
lockIntervalSpinBox
.
visible
=
true
lockIntervalLabel
.
enabled
=
currentPIN
!=
""
lockIntervalSpinBox
.
enabled
=
currentPIN
!=
""
lockIntervalSpinBox
.
setVal
(
settings
.
inactivityInterval
())
}
else
if
(
actionName
==
"
new
"
)
{
acceptElement
.
visible
=
true
topLineText
.
text
=
qsTr
(
"
Enter a new PIN code into both text fields:
"
)
...
...
@@ -64,6 +71,9 @@ Component {
pinConfirmField2
.
visible
=
true
errLineText
.
visible
=
false
lockIntervalLabel
.
visible
=
false
lockIntervalSpinBox
.
visible
=
false
pinConfirmField1
.
focus
=
true
}
else
if
(
actionName
==
"
change
"
)
{
acceptElement
.
visible
=
true
...
...
@@ -77,6 +87,9 @@ Component {
pinConfirmField2
.
visible
=
true
errLineText
.
visible
=
false
lockIntervalLabel
.
visible
=
false
lockIntervalSpinBox
.
visible
=
false
pinValueField
.
focus
=
true
}
else
if
(
actionName
==
"
disable
"
)
{
acceptElement
.
visible
=
true
...
...
@@ -89,6 +102,9 @@ Component {
pinConfirmField2
.
visible
=
false
errLineText
.
visible
=
false
lockIntervalLabel
.
visible
=
false
lockIntervalSpinBox
.
visible
=
false
pinValueField
.
focus
=
true
}
else
{
/* This line should not be reached. */
...
...
@@ -148,8 +164,17 @@ Component {
MouseArea
{
anchors.fill
:
parent
onClicked
:
{
if
(
actionName
==
"
unspecified
"
)
{
if
(
currentPIN
==
""
)
{
settings
.
setInactivityInterval
(
0
)
locker
.
setInactivityInterval
(
0
)
}
else
{
settings
.
setInactivityInterval
(
lockIntervalSpinBox
.
val
())
locker
.
setInactivityInterval
(
lockIntervalSpinBox
.
val
())
}
pageView
.
pop
(
StackView
.
Immediate
)
/* set new pin code */
if
(
actionName
==
"
new
"
)
{
}
else
if
(
actionName
==
"
new
"
)
{
if
(
pinConfirmField1
.
text
==
""
||
pinConfirmField2
.
text
==
""
)
{
errLineText
.
text
=
qsTr
(
"
Error: Both new PIN code fields must be filled in!
"
)
errLineText
.
visible
=
true
...
...
@@ -199,6 +224,10 @@ Component {
if
(
pinValueField
.
text
==
currentPIN
)
{
errLineText
.
visible
=
false
settings
.
updatePinSettings
(
""
)
settings
.
setInactivityInterval
(
0
)
locker
.
setInactivityInterval
(
0
)
pageView
.
pop
(
StackView
.
Immediate
)
}
else
{
pinValueField
.
text
=
""
...
...
@@ -293,6 +322,75 @@ Component {
horizontalAlignment
:
Text
.
AlignHCenter
wrapMode
:
Text
.
Wrap
}
Label
{
id
:
lockIntervalLabel
color
:
datovkaPalette
.
text
anchors.horizontalCenter
:
parent
.
horizontalCenter
width
:
myWidht
*
0.5
text
:
qsTr
(
"
Lock after seconds of inactivity
"
)
horizontalAlignment
:
Text
.
AlignHCenter
}
SpinBox
{
/* Holds value in seconds. */
id
:
lockIntervalSpinBox
anchors.horizontalCenter
:
parent
.
horizontalCenter
/* Must be a non-decreasing list ending with infinity. */
property
var
items
:
[
15
,
30
,
60
,
90
,
120
,
150
,
180
,
qsTr
(
"
don't lock
"
)]
property
int
dfltIdx
:
0
from
:
0
to
:
items
.
length
-
1
/* Last is infinite. */
//stepSize: 1
textFromValue
:
function
(
value
)
{
return
items
[
value
];
}
valueFromText
:
function
(
text
)
{
for
(
var
i
=
0
;
i
<
items
.
length
;
++
i
)
{
if
(
items
[
i
].
toLowerCase
().
indexOf
(
text
.
toLowerCase
())
===
0
)
{
return
i
}
}
return
sb
.
value
}
function
val
()
{
if
(
value
<
to
)
{
/* Last is infinite. */
return
items
[
value
]
}
else
{
return
0
/* Infinity is treated as zero. */
}
}
function
setVal
(
v
)
{
if
(
v
<=
0
)
{
/* infinite */
value
=
to
}
else
if
(
v
<
items
[
0
])
{
/* less than minimal */
value
=
from
}
else
if
(
v
>
items
[
to
-
1
])
{
/* more than maximal */
value
=
to
}
else
{
for
(
var
i
=
0
;
i
<
(
items
.
length
-
1
);
++
i
)
{
if
(
v
==
items
[
i
])
{
value
=
i
return
}
else
if
(
v
<
items
[
i
])
{
value
=
i
-
1
return
}
}
value
=
from
}
}
onValueChanged
:
{
/* Enable accept button. Always visible? */
acceptElement
.
visible
=
val
()
!=
settings
.
inactivityInterval
()
}
}
}
}
}
...
...
src/main.cpp
View file @
44893201
...
...
@@ -244,6 +244,11 @@ int main(int argc, char *argv[])
files
.
deleteExpiredFilesFromDbs
(
globSet
.
fileLifeTimeInDays
);
}
/* Inactivity locking is disabled when equal to 0. */
if
(
globSet
.
pinInactTimeoutInSecs
>
0
)
{
locker
.
setInactivityInterval
(
globSet
.
pinInactTimeoutInSecs
);
}
/* Load counters. */
Accounts
::
loadModelCounters
();
...
...
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