summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2016-04-01 22:29:39 -0500
committerGravatar Dirk Hohndel <dirk@hohndel.org>2016-04-01 22:29:39 -0500
commit9b1d142f3a75c39ca65e7ccdf5d1716d9e3936fd (patch)
treedd06a8e1d737a5a00bc1955b7741772f7847bc87
parentb158d554744540eec7d9a506eeccb3a36e22a287 (diff)
downloadsubsurface-9b1d142f3a75c39ca65e7ccdf5d1716d9e3936fd.tar.gz
QML UI: put add dive action in a function
This way we can call this from a button as well as the menu. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--qt-mobile/qml/main.qml40
1 files changed, 22 insertions, 18 deletions
diff --git a/qt-mobile/qml/main.qml b/qt-mobile/qml/main.qml
index bcfc3f7b8..76696ba1e 100644
--- a/qt-mobile/qml/main.qml
+++ b/qt-mobile/qml/main.qml
@@ -46,6 +46,27 @@ Kirigami.ApplicationWindow {
diveList.scrollToTop()
}
+ function startAddDive() {
+ detailsWindow.state = "add"
+ detailsWindow.dive_id = manager.addDive();
+ detailsWindow.number = manager.getNumber(detailsWindow.dive_id)
+ detailsWindow.date = manager.getDate(detailsWindow.dive_id)
+ detailsWindow.airtemp = ""
+ detailsWindow.watertemp = ""
+ detailsWindow.buddy = ""
+ detailsWindow.depth = ""
+ detailsWindow.divemaster = ""
+ detailsWindow.notes = ""
+ detailsWindow.location = ""
+ detailsWindow.duration = ""
+ detailsWindow.suit = ""
+ detailsWindow.weight = ""
+ detailsWindow.gasmix = ""
+ detailsWindow.startpressure = ""
+ detailsWindow.endpressure = ""
+ stackView.push(detailsWindow)
+ }
+
globalDrawer: Kirigami.GlobalDrawer {
title: "Subsurface"
titleIcon: "qrc:/qml/subsurface-mobile-icon.png"
@@ -97,24 +118,7 @@ Kirigami.ApplicationWindow {
Kirigami.Action {
text: "Add dive manually"
onTriggered: {
- detailsWindow.state = "add"
- detailsWindow.dive_id = manager.addDive();
- detailsWindow.number = manager.getNumber(detailsWindow.dive_id)
- detailsWindow.date = manager.getDate(detailsWindow.dive_id)
- detailsWindow.airtemp = ""
- detailsWindow.watertemp = ""
- detailsWindow.buddy = ""
- detailsWindow.depth = ""
- detailsWindow.divemaster = ""
- detailsWindow.notes = ""
- detailsWindow.location = ""
- detailsWindow.duration = ""
- detailsWindow.suit = ""
- detailsWindow.weight = ""
- detailsWindow.gasmix = ""
- detailsWindow.startpressure = ""
- detailsWindow.endpressure = ""
- stackView.push(detailsWindow)
+ startAddDive()
}
}
Kirigami.Action {