X-Git-Url: https://www.flypig.org.uk/git/?p=harbour-pedalo.git;a=blobdiff_plain;f=qml%2Fpages%2FJourneyList.qml;h=1708d2021a7c0054876ba59384ae83219a09efcf;hp=8c6998f0422e454b3aba131e1be6d784fce5559d;hb=41bb8de4779e59d272f753bc53033bd467bff811;hpb=e917baa52e7157c7c41424527c3881c22ff65588 diff --git a/qml/pages/JourneyList.qml b/qml/pages/JourneyList.qml index 8c6998f..1708d20 100644 --- a/qml/pages/JourneyList.qml +++ b/qml/pages/JourneyList.qml @@ -15,8 +15,9 @@ Page { header: PageHeader { title: qsTr("Journey list") } - delegate: BackgroundItem { + delegate: ListItem { id: delegate + menu: journeyMenuComponent Row { spacing: Theme.paddingLarge @@ -34,11 +35,31 @@ Page { } 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 {} }