Commit f1971f52 authored by Karel Slaný's avatar Karel Slaný
Browse files

Show lock screen on inactivity time-out or when application suspended.

parent 7dd5c43c
...@@ -277,6 +277,13 @@ ApplicationWindow { ...@@ -277,6 +277,13 @@ ApplicationWindow {
pinCodeInput.text = "" pinCodeInput.text = ""
} }
} }
Connections {
target: locker
onLockApp: {
mainPage.visible = false
pinScreen.visible = true
}
}
} }
Item { Item {
id: backButton id: backButton
......
...@@ -263,6 +263,7 @@ Component { ...@@ -263,6 +263,7 @@ Component {
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
onClicked: { onClicked: {
locker.ignoreNextSuspension()
files.openAttachment(gUserName, gMsgId, rFileId) files.openAttachment(gUserName, gMsgId, rFileId)
} }
} }
......
...@@ -135,6 +135,13 @@ int main(int argc, char *argv[]) ...@@ -135,6 +135,13 @@ int main(int argc, char *argv[])
QObject::connect(&accounts, SIGNAL(removeIsdsCtx(QString)), QObject::connect(&accounts, SIGNAL(removeIsdsCtx(QString)),
&isds, SLOT(removeIsdsCtx(QString))); &isds, SLOT(removeIsdsCtx(QString)));
/* Register application state changes. */
class Locker locker;
QObject::connect(&app,
SIGNAL(applicationStateChanged(Qt::ApplicationState)),
&locker, SLOT(processNewState(Qt::ApplicationState)));
app.installEventFilter(&locker);
/* Create and init account model. */ /* Create and init account model. */
globAccountsModelPtr = new (std::nothrow) AccountListModel; globAccountsModelPtr = new (std::nothrow) AccountListModel;
if (0 == globAccountsModelPtr) { if (0 == globAccountsModelPtr) {
...@@ -163,6 +170,7 @@ int main(int argc, char *argv[]) ...@@ -163,6 +170,7 @@ int main(int argc, char *argv[])
ctx->setContextProperty("accounts", &accounts); ctx->setContextProperty("accounts", &accounts);
ctx->setContextProperty("files", &files); ctx->setContextProperty("files", &files);
ctx->setContextProperty("settings", &settings); ctx->setContextProperty("settings", &settings);
ctx->setContextProperty("locker", &locker);
/* register and set models in QML */ /* register and set models in QML */
ctx->setContextProperty(globAccountsModelPtr->objectName(), ctx->setContextProperty(globAccountsModelPtr->objectName(),
...@@ -242,12 +250,6 @@ int main(int argc, char *argv[]) ...@@ -242,12 +250,6 @@ int main(int argc, char *argv[])
/* show PIN screen if needed */ /* show PIN screen if needed */
emit settings.showPinScreen(!globSet.pinCode.isEmpty()); emit settings.showPinScreen(!globSet.pinCode.isEmpty());
/* Register application state changes. */
class Locker locker;
QObject::connect(&app,
SIGNAL(applicationStateChanged(Qt::ApplicationState)),
&locker, SLOT(processNewState(Qt::ApplicationState)));
/* Run app main event loop */ /* Run app main event loop */
int ret = app.exec(); int ret = app.exec();
......
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