summaryrefslogtreecommitdiffstats
path: root/mobile-widgets
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2016-04-15 14:42:08 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2016-04-15 14:42:08 -0700
commitecf44bb2faccf080215ccb2f660b36316169ec60 (patch)
treef59e3dd2c5291fceae95405cc585b62f14c8c36f /mobile-widgets
parent71d74f9e3c7cb49ab93aef035dbf7735b5ae3454 (diff)
downloadsubsurface-ecf44bb2faccf080215ccb2f660b36316169ec60.tar.gz
QML UI: quit on back key while showing dive list
Make sure you save first, though. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'mobile-widgets')
-rw-r--r--mobile-widgets/qml/DiveList.qml5
-rw-r--r--mobile-widgets/qmlmanager.cpp7
-rw-r--r--mobile-widgets/qmlmanager.h1
3 files changed, 13 insertions, 0 deletions
diff --git a/mobile-widgets/qml/DiveList.qml b/mobile-widgets/qml/DiveList.qml
index 906eb9445..a89b05c8b 100644
--- a/mobile-widgets/qml/DiveList.qml
+++ b/mobile-widgets/qml/DiveList.qml
@@ -278,5 +278,10 @@ Kirigami.ScrollablePage {
manager.credentialStatus = oldStatus
event.accepted = true;
}
+ if (!startPageWrapper.visible) {
+ manager.quit()
+ // we shouldn't come back from there, but just in case
+ event.accepted = true
+ }
}
}
diff --git a/mobile-widgets/qmlmanager.cpp b/mobile-widgets/qmlmanager.cpp
index 05490ab42..3c2f8d311 100644
--- a/mobile-widgets/qmlmanager.cpp
+++ b/mobile-widgets/qmlmanager.cpp
@@ -1198,3 +1198,10 @@ void QMLManager::screenChanged(QScreen *screen)
m_lastDevicePixelRatio = screen->devicePixelRatio();
emit sendScreenChanged(screen);
}
+
+void QMLManager::quit()
+{
+ if (unsaved_changes())
+ saveChangesCloud(false);
+ QApplication::quit();
+}
diff --git a/mobile-widgets/qmlmanager.h b/mobile-widgets/qmlmanager.h
index af81368f3..7d1fc4a6b 100644
--- a/mobile-widgets/qmlmanager.h
+++ b/mobile-widgets/qmlmanager.h
@@ -132,6 +132,7 @@ public slots:
void screenChanged(QScreen *screen);
qreal lastDevicePixelRatio();
void appendTextToLog(const QString &newText);
+ void quit();
private:
QString m_cloudUserName;