Corrently add, edit and list journey details
[harbour-pedalo.git] / qml / pages / JourneyList.qml
1 import QtQuick 2.0
2 import Sailfish.Silica 1.0
3
4 Page {
5     id: page
6
7     // The effective value will be restricted by ApplicationWindow.allowedOrientations
8     allowedOrientations: Orientation.All
9     property int columnwidth: page.width - 2 * Theme.horizontalPageMargin
10
11     SilicaListView {
12         id: listView
13         model: journeymodel
14         anchors.fill: parent
15         header: PageHeader {
16             title: qsTr("Journey list")
17         }
18         delegate: BackgroundItem {
19             id: delegate
20
21             Row {
22                 spacing: Theme.paddingLarge
23                 x: Theme.horizontalPageMargin
24
25                 Label {
26                     width: columnwidth / 3.0
27                     text: Qt.formatDate(journeymodel.epochToDate(start), "d MMM yyyy")
28                     color: delegate.highlighted ? Theme.highlightColor : Theme.primaryColor
29                 }
30                 Label {
31                     width: columnwidth / 3.0
32                     text: Qt.formatTime(journeymodel.epochToTime(start), "hh:mm")
33                     color: delegate.highlighted ? Theme.highlightColor : Theme.primaryColor
34                 }
35                 Label {
36                     width: columnwidth / 3.0
37                     text: Qt.formatTime(new Date(0, 0, 0, 0, 0, duration), 'hh:mm')
38                     color: delegate.highlighted ? Theme.highlightColor : Theme.primaryColor
39                 }
40             }
41             onClicked: pageStack.push(Qt.resolvedUrl("AddJourney.qml"), {title: "Edit journey", index: index, start: journeymodel.epochToDateTime(start), duration: duration, overtook: overtook, overtakenby: overtakenby})
42         }
43         VerticalScrollDecorator {}
44     }
45 }