aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--qt-mobile/qml/DiveDetails.qml85
-rw-r--r--qt-mobile/qml/mobile-resources.qrc1
-rw-r--r--qt-mobile/qml/mobilecomponents/icons/dialog-cancel.svg122
3 files changed, 177 insertions, 31 deletions
diff --git a/qt-mobile/qml/DiveDetails.qml b/qt-mobile/qml/DiveDetails.qml
index 27a8996da..c464551db 100644
--- a/qt-mobile/qml/DiveDetails.qml
+++ b/qt-mobile/qml/DiveDetails.qml
@@ -27,8 +27,6 @@ MobileComponents.Page {
property string date
property string number
property string weight
- property alias viewEditText: viewEditSelector.text
-
state: "view"
states: [
@@ -43,41 +41,66 @@ MobileComponents.Page {
PropertyChanges { target: detailsEdit; opacity: 1 }
}
]
-
- contextualActions: [
+ property list<Action> viewActions: [
Action {
- id: viewEditSelector
- text: checked ? "View" : "Edit"
- checkable: true
- iconName: checked ? "view-readermode" : "document-edit"
+ id: editSelector
+ text: "Edit"
+ iconName: "document-edit"
onTriggered: {
- if (diveDetailsWindow.state == "edit") {
- manager.commitChanges(dive_id, detailsEdit.dateText, detailsEdit.locationText, detailsEdit.gpsText, detailsEdit.durationText,
- detailsEdit.depthText, detailsEdit.airtempText, detailsEdit.watertempText, detailsEdit.suitText,
- detailsEdit.buddyText, detailsEdit.divemasterText, detailsEdit.notesText)
- date = detailsEdit.dateText
- location = detailsEdit.locationText
- // gps = detailsEdit.gps
- duration = detailsEdit.durationText
- depth = detailsEdit.depthText
- airtemp = detailsEdit.airtempText
- watertemp = detailsEdit.watertempText
- suit = detailsEdit.suitText
- buddy = detailsEdit.buddyText
- divemaster = detailsEdit.divemasterText
- notes = detailsEdit.notesText
- diveDetailsWindow.viewEditText = "Edit"
- diveDetailsWindow.state = "view"
- } else {
- diveDetailsWindow.viewEditText = "Save"
- diveDetailsWindow.state = "edit"
- }
+ diveDetailsWindow.state = "edit"
+ contextDrawer.close()
+ }
+ }
+ ]
+ property list<Action> editActions: [
+ Action {
+ id: cancelSelector
+ text: "Cancel"
+ iconName: "dialog-cancel"
+ onTriggered: {
+ // reset the fields in the edit screen
+ detailsEdit.dateText = date
+ detailsEdit.locationText = location
+ detailsEdit.durationText = duration
+ detailsEdit.depthText = depth
+ detailsEdit.airtempText = airtemp
+ detailsEdit.watertempText = watertemp
+ detailsEdit.suitText = suit
+ detailsEdit.buddyText = buddy
+ detailsEdit.divemasterText = divemaster
+ detailsEdit.notesText = notes
+ // back to view state and close the drawer
+ diveDetailsWindow.state = "view"
+ contextDrawer.close()
+ }
+ },
+ Action {
+ id: saveSelector
+ text: "Save"
+ iconName: "document-save"
+ onTriggered: {
+ // apply the changes to the dive_table
+ manager.commitChanges(dive_id, detailsEdit.dateText, detailsEdit.locationText, detailsEdit.gpsText, detailsEdit.durationText,
+ detailsEdit.depthText, detailsEdit.airtempText, detailsEdit.watertempText, detailsEdit.suitText,
+ detailsEdit.buddyText, detailsEdit.divemasterText, detailsEdit.notesText)
+ // apply the changes to the dive detail view
+ date = detailsEdit.dateText
+ location = detailsEdit.locationText
+ duration = detailsEdit.durationText
+ depth = detailsEdit.depthText
+ airtemp = detailsEdit.airtempText
+ watertemp = detailsEdit.watertempText
+ suit = detailsEdit.suitText
+ buddy = detailsEdit.buddyText
+ divemaster = detailsEdit.divemasterText
+ notes = detailsEdit.notesText
+ // back to view state and close the drawer
+ diveDetailsWindow.state = "view"
contextDrawer.close()
- // close drawer?
}
}
-
]
+ contextualActions: diveDetailsWindow.state === "view" ? viewActions : editActions
ScrollView {
anchors.fill: parent
diff --git a/qt-mobile/qml/mobile-resources.qrc b/qt-mobile/qml/mobile-resources.qrc
index effb112f0..b6393fc91 100644
--- a/qt-mobile/qml/mobile-resources.qrc
+++ b/qt-mobile/qml/mobile-resources.qrc
@@ -45,5 +45,6 @@
<file alias="org/kde/plasma/mobilecomponents/icons/document-edit.svg">mobilecomponents/icons/document-edit.svg</file>
<file alias="org/kde/plasma/mobilecomponents/icons/document-save.svg">mobilecomponents/icons/document-save.svg</file>
<file alias="org/kde/plasma/mobilecomponents/icons/view-readermode.svg">mobilecomponents/icons/view-readermode.svg</file>
+ <file alias="org/kde/plasma/mobilecomponents/icons/dialog-cancel.svg">mobilecomponents/icons/dialog-cancel.svg</file>
</qresource>
</RCC>
diff --git a/qt-mobile/qml/mobilecomponents/icons/dialog-cancel.svg b/qt-mobile/qml/mobilecomponents/icons/dialog-cancel.svg
new file mode 100644
index 000000000..a2b022a9d
--- /dev/null
+++ b/qt-mobile/qml/mobilecomponents/icons/dialog-cancel.svg
@@ -0,0 +1,122 @@
+<?xml version="1.0"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" width="24" height="24" id="svg3869" version="1.1" inkscape:version="0.91 r13725" sodipodi:docname="dialog-cancel.svg">
+ <defs id="defs3871">
+ <style type="text/css" id="current-color-scheme">
+ .ColorScheme-Text {
+ color:#4d4d4d;
+ }
+ .ColorScheme-Background {
+ color:#eff0f1;
+ }
+ .ColorScheme-Highlight {
+ color:#3daee9;
+ }
+ .ColorScheme-ViewText {
+ color:#31363b;
+ }
+ .ColorScheme-ViewBackground {
+ color:#fcfcfc;
+ }
+ .ColorScheme-ViewHover {
+ color:#93cee9;
+ }
+ .ColorScheme-ViewFocus{
+ color:#3daee9;
+ }
+ .ColorScheme-ButtonText {
+ color:#31363b;
+ }
+ .ColorScheme-ButtonBackground {
+ color:#eff0f1;
+ }
+ .ColorScheme-ButtonHover {
+ color:#93cee9;
+ }
+ .ColorScheme-ButtonFocus{
+ color:#3daee9;
+ }
+ </style>
+ <inkscape:perspective sodipodi:type="inkscape:persp3d" inkscape:vp_x="0 : 12 : 1" inkscape:vp_y="0 : 1000 : 0" inkscape:vp_z="24 : 12 : 1" inkscape:persp3d-origin="12 : 8 : 1" id="perspective4146"/>
+ <inkscape:perspective sodipodi:type="inkscape:persp3d" inkscape:vp_x="0 : 12 : 1" inkscape:vp_y="0 : 1000 : 0" inkscape:vp_z="24 : 12 : 1" inkscape:persp3d-origin="12 : 8 : 1" id="perspective4090"/>
+ <clipPath clipPathUnits="userSpaceOnUse" id="clipPath16">
+ <path d="m 0,706.465 1490.926,0 L 1490.926,0 0,0 0,706.465 Z" id="path18"/>
+ </clipPath>
+ <clipPath clipPathUnits="userSpaceOnUse" id="clipPath24">
+ <path d="m 22.1953,686.117 1447.7347,0 0,-667.1902 -1447.7347,0 L 22.1953,686.117 Z" id="path26"/>
+ </clipPath>
+ <clipPath clipPathUnits="userSpaceOnUse" id="clipPath4534">
+ <rect ry="15.999986" y="8.0000038" x="8.0000114" height="31.999971" width="31.999989" id="rect4536" style="fill:url(#linearGradient4538);fill-opacity:1;stroke:none"/>
+ </clipPath>
+ <clipPath clipPathUnits="userSpaceOnUse" id="clipPath4584">
+ <rect ry="15.999986" y="507.798" x="392.57144" height="31.999971" width="31.999989" id="rect4586" style="fill:url(#linearGradient4588);fill-opacity:1;stroke:none"/>
+ </clipPath>
+ <clipPath clipPathUnits="userSpaceOnUse" id="clipPath4550">
+ <rect ry="15.999986" y="507.798" x="392.57144" height="31.999971" width="31.999989" id="rect4552" style="fill:url(#linearGradient4554);fill-opacity:1;stroke:none"/>
+ </clipPath>
+ <clipPath clipPathUnits="userSpaceOnUse" id="clipPath4568">
+ <rect ry="15.999986" y="507.798" x="392.57144" height="31.999971" width="31.999989" id="rect4570" style="fill:url(#linearGradient4572);fill-opacity:1;stroke:none"/>
+ </clipPath>
+ <clipPath clipPathUnits="userSpaceOnUse" id="clipPath4528">
+ <rect ry="15.999986" y="8.0000038" x="8.0000114" height="31.999971" width="31.999989" id="rect4530" style="fill:url(#linearGradient4532);fill-opacity:1;stroke:none"/>
+ </clipPath>
+ <clipPath clipPathUnits="userSpaceOnUse" id="clipPath4578">
+ <rect ry="15.999986" y="507.798" x="392.57144" height="31.999971" width="31.999989" id="rect4580" style="fill:url(#linearGradient4582);fill-opacity:1;stroke:none"/>
+ </clipPath>
+ <clipPath clipPathUnits="userSpaceOnUse" id="clipPath4562">
+ <rect ry="15.999986" y="507.798" x="392.57144" height="31.999971" width="31.999989" id="rect4564" style="fill:url(#linearGradient4566);fill-opacity:1;stroke:none"/>
+ </clipPath>
+ <clipPath clipPathUnits="userSpaceOnUse" id="clipPath4544">
+ <rect ry="15.999986" y="507.798" x="392.57144" height="31.999971" width="31.999989" id="rect4546" style="fill:url(#linearGradient4548);fill-opacity:1;stroke:none"/>
+ </clipPath>
+ <clipPath clipPathUnits="userSpaceOnUse" id="clipPath4390">
+ <rect ry="15.999986" y="8.0000038" x="8.0000114" height="31.999971" width="31.999989" id="rect4392" style="fill:url(#linearGradient4532);fill-opacity:1;stroke:none"/>
+ </clipPath>
+ <clipPath clipPathUnits="userSpaceOnUse" id="clipPath4407">
+ <rect ry="15.999986" y="507.798" x="392.57144" height="31.999971" width="31.999989" id="rect4409" style="fill:url(#linearGradient4582);fill-opacity:1;stroke:none"/>
+ </clipPath>
+ <clipPath clipPathUnits="userSpaceOnUse" id="clipPath4424">
+ <rect ry="15.999986" y="507.798" x="392.57144" height="31.999971" width="31.999989" id="rect4426" style="fill:url(#linearGradient4566);fill-opacity:1;stroke:none"/>
+ </clipPath>
+ <clipPath clipPathUnits="userSpaceOnUse" id="clipPath4441">
+ <rect ry="15.999986" y="507.798" x="392.57144" height="31.999971" width="31.999989" id="rect4443" style="fill:url(#linearGradient4548);fill-opacity:1;stroke:none"/>
+ </clipPath>
+ <clipPath id="clipPath4528-1" clipPathUnits="userSpaceOnUse">
+ <rect style="fill:url(#linearGradient4532);fill-opacity:1;stroke:none" id="rect4530-7" width="31.999989" height="31.999971" x="8.0000114" y="8.0000038" ry="15.999986"/>
+ </clipPath>
+ <clipPath id="clipPath4578-8" clipPathUnits="userSpaceOnUse">
+ <rect style="fill:url(#linearGradient4582);fill-opacity:1;stroke:none" id="rect4580-7" width="31.999989" height="31.999971" x="392.57144" y="507.798" ry="15.999986"/>
+ </clipPath>
+ <clipPath id="clipPath4562-8" clipPathUnits="userSpaceOnUse">
+ <rect style="fill:url(#linearGradient4566);fill-opacity:1;stroke:none" id="rect4564-8" width="31.999989" height="31.999971" x="392.57144" y="507.798" ry="15.999986"/>
+ </clipPath>
+ <clipPath id="clipPath4544-1" clipPathUnits="userSpaceOnUse">
+ <rect style="fill:url(#linearGradient4548);fill-opacity:1;stroke:none" id="rect4546-1" width="31.999989" height="31.999971" x="392.57144" y="507.798" ry="15.999986"/>
+ </clipPath>
+ </defs>
+ <sodipodi:namedview id="base" pagecolor="#ffffff" bordercolor="#666666" borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:zoom="22.627416" inkscape:cx="11.061087" inkscape:cy="12.032563" inkscape:document-units="px" inkscape:current-layer="layer1" showgrid="true" fit-margin-top="0" fit-margin-left="0" fit-margin-right="0" fit-margin-bottom="0" inkscape:window-width="1366" inkscape:window-height="709" inkscape:window-x="-4" inkscape:window-y="0" inkscape:window-maximized="1" inkscape:showpageshadow="false" inkscape:object-nodes="true" inkscape:snap-bbox="true">
+ <inkscape:grid type="xygrid" id="grid4132"/>
+ <sodipodi:guide position="4,18" orientation="18,0" id="guide4138"/>
+ <sodipodi:guide position="5,3" orientation="0,18" id="guide4140"/>
+ <sodipodi:guide position="20,2.0000174" orientation="-18,0" id="guide4142"/>
+ <sodipodi:guide position="2,21" orientation="0,-18" id="guide4144"/>
+ <sodipodi:guide position="3,19.000017" orientation="16,0" id="guide4146"/>
+ <sodipodi:guide position="2,4" orientation="0,16" id="guide4148"/>
+ <sodipodi:guide position="21,20" orientation="-16,0" id="guide4150"/>
+ <sodipodi:guide position="2,20" orientation="0,-16" id="guide4152"/>
+ </sodipodi:namedview>
+ <metadata id="metadata3874">
+ <rdf:RDF>
+ <cc:Work rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
+ <dc:title/>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g inkscape:label="Capa 1" inkscape:groupmode="layer" id="layer1" transform="translate(-326,-532.3622)">
+ <g transform="translate(-224.28572,-74.2857)" id="layer1-6" inkscape:label="Capa 1">
+ <path id="rect4203" transform="translate(550.28572,606.6479)" d="M 12,4 C 9.9724023,4 8.1286798,4.7566937 6.71875,6 6.592511,6.1113202 6.4627201,6.2247799 6.34375,6.34375 L 6,6.71875 C 4.7566937,8.1286798 4,9.9724023 4,12 c 0,4.41828 3.58172,8 8,8 2.027598,0 3.87132,-0.756694 5.28125,-2 l 0.375,-0.34375 C 17.77522,17.53728 17.88868,17.407489 18,17.28125 19.243306,15.87132 20,14.027598 20,12 20,7.58172 16.41828,4 12,4 Z m 0,1 c 3.86599,0 7,3.13401 7,7 0,1.75366 -0.653215,3.334268 -1.71875,4.5625 L 7.4375,6.71875 C 8.6657315,5.6532151 10.24634,5 12,5 Z M 6.71875,7.4375 16.5625,17.28125 C 15.334268,18.346785 13.75366,19 12,19 8.13401,19 5,15.86599 5,12 5,10.24634 5.6532151,8.6657315 6.71875,7.4375 Z" style="fill:currentColor;fill-opacity:1;stroke:none" inkscape:connector-curvature="0" class="ColorScheme-Text"/>
+ </g>
+ </g>
+</svg>