mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
b158d55474
commit
9b1d142f3a
1 changed files with 22 additions and 18 deletions
|
@ -46,6 +46,27 @@ Kirigami.ApplicationWindow {
|
||||||
diveList.scrollToTop()
|
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 {
|
globalDrawer: Kirigami.GlobalDrawer {
|
||||||
title: "Subsurface"
|
title: "Subsurface"
|
||||||
titleIcon: "qrc:/qml/subsurface-mobile-icon.png"
|
titleIcon: "qrc:/qml/subsurface-mobile-icon.png"
|
||||||
|
@ -97,24 +118,7 @@ Kirigami.ApplicationWindow {
|
||||||
Kirigami.Action {
|
Kirigami.Action {
|
||||||
text: "Add dive manually"
|
text: "Add dive manually"
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
detailsWindow.state = "add"
|
startAddDive()
|
||||||
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)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Kirigami.Action {
|
Kirigami.Action {
|
||||||
|
|
Loading…
Add table
Reference in a new issue