2015-07-21 12:00:29 +00:00
|
|
|
import QtQuick 2.3
|
2015-12-04 02:38:58 +00:00
|
|
|
import QtQuick.Controls 1.4
|
2015-07-27 16:55:18 +00:00
|
|
|
import QtQuick.Controls.Styles 1.2
|
2015-07-21 12:00:29 +00:00
|
|
|
import QtQuick.Dialogs 1.2
|
|
|
|
import QtQuick.Layouts 1.1
|
|
|
|
import org.subsurfacedivelog.mobile 1.0
|
2015-11-29 20:13:57 +00:00
|
|
|
import org.kde.plasma.mobilecomponents 0.2 as MobileComponents
|
2015-07-21 12:00:29 +00:00
|
|
|
|
2015-11-29 20:13:57 +00:00
|
|
|
MobileComponents.Page {
|
2015-07-21 12:00:29 +00:00
|
|
|
id: diveDetailsWindow
|
|
|
|
width: parent.width
|
2015-08-20 08:44:01 +00:00
|
|
|
objectName: "DiveDetails"
|
2015-11-29 20:13:57 +00:00
|
|
|
flickable: flick
|
2015-07-21 12:00:29 +00:00
|
|
|
|
|
|
|
property string location
|
2015-12-04 01:28:48 +00:00
|
|
|
property string depth
|
2015-07-21 12:00:29 +00:00
|
|
|
property string dive_id
|
2015-12-04 01:28:48 +00:00
|
|
|
property string diveNumber
|
|
|
|
property string duration
|
2015-07-21 12:00:29 +00:00
|
|
|
property string airtemp
|
|
|
|
property string watertemp
|
|
|
|
property string suit
|
2015-12-04 01:28:48 +00:00
|
|
|
property int rating
|
2015-07-21 12:00:29 +00:00
|
|
|
property string buddy
|
|
|
|
property string divemaster;
|
|
|
|
property string notes;
|
2015-07-27 19:26:51 +00:00
|
|
|
property string date
|
|
|
|
property string number
|
2015-12-04 01:28:48 +00:00
|
|
|
property string weight
|
|
|
|
|
|
|
|
state: "view"
|
2015-07-21 12:00:29 +00:00
|
|
|
|
2015-12-04 00:38:04 +00:00
|
|
|
states: [
|
|
|
|
State {
|
|
|
|
name: "view"
|
|
|
|
PropertyChanges { target: detailsView; opacity: 1 }
|
|
|
|
PropertyChanges { target: detailsEdit; opacity: 0 }
|
|
|
|
},
|
|
|
|
State {
|
|
|
|
name: "edit"
|
|
|
|
PropertyChanges { target: detailsView; opacity: 0 }
|
|
|
|
PropertyChanges { target: detailsEdit; opacity: 1 }
|
|
|
|
}
|
|
|
|
]
|
2015-07-21 12:00:29 +00:00
|
|
|
|
2015-12-04 02:32:52 +00:00
|
|
|
contextualActions: [
|
|
|
|
Action {
|
|
|
|
text: checked ? "View" : "Edit"
|
|
|
|
checkable: true
|
|
|
|
iconName: checked ? "view-readermode" : "document-edit"
|
|
|
|
onTriggered: {
|
2015-12-08 06:24:56 +00:00
|
|
|
if (diveDetailsWindow.state == "edit") {
|
|
|
|
manager.commitChanges(dive_id, suit, buddy, divemaster, notes);
|
|
|
|
}
|
2015-12-07 17:10:55 +00:00
|
|
|
diveDetailsWindow.state = checked ? "edit" : "view";
|
|
|
|
contextDrawer.close();
|
|
|
|
// close drawer?
|
2015-12-04 02:32:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
]
|
|
|
|
|
2015-11-30 00:12:47 +00:00
|
|
|
ScrollView {
|
2015-11-11 23:40:13 +00:00
|
|
|
anchors.fill: parent
|
2015-11-30 00:12:47 +00:00
|
|
|
Flickable {
|
|
|
|
id: flick
|
|
|
|
anchors.fill: parent
|
|
|
|
contentHeight: content.height
|
2015-12-07 17:10:55 +00:00
|
|
|
interactive: contentHeight > height
|
2015-11-30 00:12:47 +00:00
|
|
|
clip: true
|
|
|
|
Item {
|
|
|
|
id: content
|
|
|
|
width: flick.width
|
|
|
|
height: childrenRect.height + MobileComponents.Units.smallSpacing * 2
|
|
|
|
|
2015-12-04 00:38:04 +00:00
|
|
|
DiveDetailsEdit {
|
|
|
|
id: detailsEdit
|
|
|
|
anchors {
|
|
|
|
left: parent.left
|
|
|
|
right: parent.right
|
|
|
|
top: parent.top
|
2015-12-07 17:10:55 +00:00
|
|
|
margins: MobileComponents.Units.gridUnit / 2
|
2015-12-04 00:38:04 +00:00
|
|
|
}
|
2015-12-07 17:10:55 +00:00
|
|
|
visible: opacity > 0
|
2015-12-04 00:38:04 +00:00
|
|
|
|
|
|
|
Behavior on opacity {
|
|
|
|
NumberAnimation { duration: MobileComponents.Units.shortDuration }
|
|
|
|
}
|
|
|
|
}
|
2015-12-04 01:28:48 +00:00
|
|
|
DiveDetailsView {
|
2015-12-04 00:38:04 +00:00
|
|
|
id: detailsView
|
2015-11-30 00:12:47 +00:00
|
|
|
anchors {
|
|
|
|
left: parent.left
|
|
|
|
right: parent.right
|
|
|
|
top: parent.top
|
2015-12-07 17:10:55 +00:00
|
|
|
margins: MobileComponents.Units.gridUnit / 2
|
2015-11-30 00:12:47 +00:00
|
|
|
}
|
2015-12-07 17:10:55 +00:00
|
|
|
visible: opacity > 0
|
2015-11-30 00:12:47 +00:00
|
|
|
|
2015-12-04 00:38:04 +00:00
|
|
|
Behavior on opacity {
|
|
|
|
NumberAnimation { duration: MobileComponents.Units.shortDuration }
|
|
|
|
}
|
|
|
|
|
2015-07-21 12:00:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|