~ubuntu-calendar-dev/ubuntu-calendar-app/ViewRedisign

« back to all changes in this revision

Viewing changes to AgendaView.qml

  • Committer: Akiva Avraham
  • Date: 2014-09-08 10:21:19 UTC
  • mfrom: (436 ubuntu-calendar-app)
  • mto: This revision was merged to the branch mainline in revision 437.
  • Revision ID: akiva@linux.com-20140908102119-gi68852t59kd5ep8
MergeĀ fromĀ trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
        eventList.positionViewAtBeginning();
36
36
    }
37
37
 
 
38
    function hasEnabledCalendars() {
 
39
        var enabled_calendars = eventListModel.getCollections().filter( function( item ) {
 
40
            return item.extendedMetaData( "collection-selected" );
 
41
        } );
 
42
 
 
43
        return !!enabled_calendars.length;
 
44
    }
 
45
 
38
46
    EventListModel {
39
47
        id: eventListModel
40
48
        startPeriod: currentDay.midnight();
58
66
        z:2
59
67
    }
60
68
 
61
 
    Label{
62
 
        text: i18n.tr("No upcoming events")
63
 
        visible: eventListModel.itemCount === 0
 
69
    Label {
 
70
        id: noEventsOrCalendarsLabel
 
71
        text: {
 
72
            var default_title = i18n.tr( "No upcoming events" );
 
73
 
 
74
            if ( !root.hasEnabledCalendars() ) {
 
75
                default_title = i18n.tr("You have no calendars enabled")
 
76
            }
 
77
 
 
78
            return default_title;
 
79
        }
 
80
        visible: !root.hasEnabledCalendars() || !eventListModel.itemCount
64
81
        anchors.centerIn: parent
65
82
    }
66
83
 
 
84
    Button {
 
85
        text: i18n.tr( "Enbale calendars" )
 
86
        visible: !root.hasEnabledCalendars()
 
87
        anchors.top: noEventsOrCalendarsLabel.bottom
 
88
        anchors.horizontalCenter: noEventsOrCalendarsLabel.horizontalCenter
 
89
        anchors.topMargin: units.gu( 1.5 )
 
90
        color: UbuntuColors.orange
 
91
 
 
92
        onClicked: {
 
93
            pageStack.push(Qt.resolvedUrl("CalendarChoicePopup.qml"),{"model":eventModel});
 
94
            pageStack.currentPage.collectionUpdated.connect(eventModel.delayedApplyFilter);
 
95
        }
 
96
    }
 
97
 
67
98
    ListView{
68
99
        id: eventList
69
100
        model: eventListModel
162
193
 
163
194
                UbuntuShape{
164
195
                    id: detailsContainer
165
 
                    color: "white"
 
196
                    color: backgroundColor
166
197
 
167
198
                    anchors.horizontalCenter: parent.horizontalCenter
168
199
                    width: parent.width - units.gu(4)
169
200
                    height: detailsColumn.height + units.gu(1)
170
201
 
 
202
                    states: [
 
203
                        State {
 
204
                            name: "selected"
 
205
 
 
206
                            PropertyChanges {
 
207
                                target: detailsContainer
 
208
                                color: UbuntuColors.orange
 
209
                            }
 
210
 
 
211
                            PropertyChanges {
 
212
                                target: timeLabel
 
213
                                color: "white"
 
214
                            }
 
215
                        }
 
216
 
 
217
                    ]
 
218
 
 
219
                    Behavior on color {
 
220
                        ColorAnimation {
 
221
                            duration: 50
 
222
                        }
 
223
                    }
 
224
 
171
225
                    Column{
172
226
                        id: detailsColumn
173
227
 
198
252
                            color:"black"
199
253
                            wrapMode: Text.WrapAtWordBoundaryOrAnywhere
200
254
                            width: parent.width
 
255
 
 
256
                            Behavior on color {
 
257
                                ColorAnimation {
 
258
                                    duration: 50
 
259
                                }
 
260
                            }
201
261
                        }
202
262
                    }
203
263
 
206
266
                        onClicked: {
207
267
                            pageStack.push(Qt.resolvedUrl("EventDetails.qml"), {"event":event,"model":eventListModel});
208
268
                        }
 
269
 
 
270
                        onPressed: {
 
271
                            parent.state = "selected"
 
272
                        }
 
273
 
 
274
                        onReleased: {
 
275
                            parent.state = ""
 
276
                        }
209
277
                    }
210
278
                }
211
279
            }