header: PageHeader {
title: qsTr("Journey list")
}
- delegate: BackgroundItem {
+ delegate: ListItem {
id: delegate
+ menu: journeyMenuComponent
Row {
spacing: Theme.paddingLarge
}
Label {
width: columnwidth / 3.0
- text: parseInt(duration / (60 * 60)) + ":" + (parseInt(duration / 60) % 60)
+ text: Qt.formatTime(new Date(0, 0, 0, 0, 0, duration), 'hh:mm')
color: delegate.highlighted ? Theme.highlightColor : Theme.primaryColor
}
}
- onClicked: pageStack.push(Qt.resolvedUrl("AddJourney.qml"), {title: "Edit journey"})
+ onClicked: pageStack.push(Qt.resolvedUrl("JourneyInfo.qml"), {title: "Journey info", index: index, start: journeymodel.epochToDateTime(start), duration: duration, overtook: overtook, overtakenby: overtakenby})
+
+ Component {
+ id: journeyMenuComponent
+ ContextMenu {
+ MenuItem {
+ text: qsTr("Edit")
+ onClicked: pageStack.push(Qt.resolvedUrl("JourneyEdit.qml"), {title: "Edit journey", index: index, start: journeymodel.epochToDateTime(start), duration: duration, overtook: overtook, overtakenby: overtakenby})
+ }
+ MenuItem {
+ text: qsTr("Delete")
+ onClicked: remove(index)
+ }
+ }
+ }
+
+ function remove(index) {
+ remorseAction(qsTr("Deleting journey"), function() {
+ onClicked: journeymodel.deleteJourney(index)
+ })
+ }
}
VerticalScrollDecorator {}
}