~mihirsoni/ubuntu-calendar-app/dateSelectNewEventTest

« back to all changes in this revision

Viewing changes to calendar.qml

  • Committer: Tarmac
  • Author(s): Frank Mertens
  • Date: 2013-04-01 23:47:20 UTC
  • mfrom: (12.1.3 eventview-merged)
  • Revision ID: tarmac-20130401234720-rlokamymmmfw61t6
Added the NewEvent component from the EventAPI_EventView branch.

Approved by Ubuntu Phone Apps Jenkins Bot, Kunal Parmar.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
import QtQuick 2.0
2
2
import Ubuntu.Components 0.1
 
3
import Ubuntu.Components.Popups 0.1
3
4
 
4
5
MainView {
5
6
    id: mainView
9
10
 
10
11
    width: units.gu(45)
11
12
    height: units.gu(80)
12
 
        // FIXME: 80/45 = aspect ration of Galaxy Nexus
13
13
 
14
 
    Tabs { // preliminary HACK, needs rewrite when NewTabBar is finalized!
 
14
    Tabs {
15
15
        id: tabs
16
16
        anchors.fill: parent
17
17
 
18
 
        Tab { id: pageArea; title: i18n.tr("January"); page: Item { anchors.fill: parent } }
19
 
        Tab { title: i18n.tr("February") }
20
 
        Tab { title: i18n.tr("March") }
21
 
        Tab { title: i18n.tr("April") }
22
 
        Tab { title: i18n.tr("May") }
23
 
        Tab { title: i18n.tr("June") }
24
 
        Tab { title: i18n.tr("July") }
25
 
        Tab { title: i18n.tr("August") }
26
 
        Tab { title: i18n.tr("September") }
27
 
        Tab { title: i18n.tr("October") }
28
 
        Tab { title: i18n.tr("November") }
29
 
        Tab { title: i18n.tr("December") }
 
18
        Tab { title: Qt.locale(i18n.language).monthName(0) }
 
19
        Tab { title: Qt.locale(i18n.language).monthName(1) }
 
20
        Tab { title: Qt.locale(i18n.language).monthName(2) }
 
21
        Tab { title: Qt.locale(i18n.language).monthName(3) }
 
22
        Tab { title: Qt.locale(i18n.language).monthName(4) }
 
23
        Tab { title: Qt.locale(i18n.language).monthName(5) }
 
24
        Tab { title: Qt.locale(i18n.language).monthName(6) }
 
25
        Tab { title: Qt.locale(i18n.language).monthName(7) }
 
26
        Tab { title: Qt.locale(i18n.language).monthName(8) }
 
27
        Tab { title: Qt.locale(i18n.language).monthName(9) }
 
28
        Tab { title: Qt.locale(i18n.language).monthName(10) }
 
29
        Tab { title: Qt.locale(i18n.language).monthName(11) }
30
30
 
31
31
        onSelectedTabIndexChanged: monthView.gotoNextMonth(selectedTabIndex)
 
32
 
 
33
        tools: ToolbarActions {
 
34
            Action {
 
35
                iconSource: Qt.resolvedUrl("avatar.png")
 
36
                text: i18n.tr("To-do")
 
37
                onTriggered:; // FIXME
 
38
            }
 
39
            Action {
 
40
                iconSource: Qt.resolvedUrl("avatar.png")
 
41
                text: i18n.tr("New Event")
 
42
                onTriggered: mainView.newEvent()
 
43
            }
 
44
            Action {
 
45
                iconSource: Qt.resolvedUrl("avatar.png")
 
46
                text: i18n.tr("Timeline")
 
47
                onTriggered:; // FIXME
 
48
            }
 
49
        }
32
50
    }
33
51
 
34
52
    Rectangle {
39
57
    MonthView {
40
58
        id: monthView
41
59
        onMonthStartChanged: tabs.selectedTabIndex = monthStart.getMonth()
42
 
        y: pageArea.y
 
60
        y: units.gu(9.5) // FIXME
43
61
        onMovementEnded: eventView.currentDayStart = currentDayStart
44
62
        onCurrentDayStartChanged: if (!(dragging || flicking)) eventView.currentDayStart = currentDayStart
45
63
        Component.onCompleted: eventView.currentDayStart = currentDayStart
48
66
    EventView {
49
67
        id: eventView
50
68
 
51
 
        property real minY: pageArea.y + monthView.compressedHeight
52
 
        property real maxY: pageArea.y + monthView.expandedHeight
 
69
        property real minY: monthView.y + monthView.compressedHeight
 
70
        property real maxY: monthView.y + monthView.expandedHeight
53
71
 
54
72
        y: maxY
55
73
        width: mainView.width
77
95
            enabled: false
78
96
            NumberAnimation { duration: 100 }
79
97
        }
 
98
 
 
99
        onNewEvent: mainView.newEvent()
80
100
    }
81
101
 
82
 
    tools: ToolbarActions {
83
 
        Action {
84
 
            iconSource: Qt.resolvedUrl("avatar.png")
85
 
            text: i18n.tr("To-do")
86
 
            onTriggered:; // FIXME
87
 
        }
88
 
        Action {
89
 
            iconSource: Qt.resolvedUrl("avatar.png")
90
 
            text: i18n.tr("New Event")
91
 
            onTriggered:; // FIXME
92
 
        }
93
 
        Action {
94
 
            iconSource: Qt.resolvedUrl("avatar.png")
95
 
            text: i18n.tr("Timeline")
96
 
            onTriggered:; // FIXME
97
 
        }
 
102
    signal newEvent
 
103
    onNewEvent: PopupUtils.open(newEventComponent, mainView, {"defaultDate": monthView.currentDayStart})
 
104
 
 
105
    Component {
 
106
        id: newEventComponent
 
107
        NewEvent {}
98
108
    }
99
109
}