~pkunal-parmar/ubuntu-calendar-app/ICalImport

« back to all changes in this revision

Viewing changes to AgendaView.qml

  • Committer: Kunal Parmar
  • Date: 2014-11-06 13:14:06 UTC
  • mfrom: (535 trunk)
  • mto: This revision was merged to the branch mainline in revision 541.
  • Revision ID: pkunal.parmar@gmail.com-20141106131406-1pb50y9k2ivo5nhh
mergeĀ fromĀ trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
import QtQuick 2.3
20
20
import QtOrganizer 5.0
21
21
import Ubuntu.Components 1.1
 
22
import Ubuntu.Components.ListItems 1.0 as ListItem
22
23
import "dateExt.js" as DateExt
23
24
 
24
25
Page{
64
65
    EventListModel {
65
66
        id: eventListModel
66
67
        startPeriod: currentDay.midnight();
67
 
        endPeriod: currentDay.addDays(30).endOfDay()
 
68
        endPeriod: currentDay.addDays(7).endOfDay()
68
69
        filter: eventModel.filter
69
70
 
70
71
        sortOrders: [
119
120
        anchors.fill: parent
120
121
        visible: eventListModel.itemCount > 0
121
122
 
122
 
        delegate: listDelegate
 
123
        delegate:listDelegate
 
124
 
123
125
    }
124
126
 
125
127
    Scrollbar{
146
148
                    return;
147
149
                }
148
150
 
149
 
                headerContainer.visible = false;
 
151
                headerList.visible = false;
150
152
                if( index == 0 ) {
151
 
                    headerContainer.visible = true;
 
153
                    headerList.visible = true;
152
154
                } else {
153
155
                    var prevEvent = eventListModel.items[index-1];
154
156
                    if( prevEvent.startDateTime.midnight() < event.startDateTime.midnight()) {
155
 
                        headerContainer.visible = true;
 
157
                        headerList.visible = true;
156
158
                    }
157
159
                }
158
160
 
167
169
                header.text = date
168
170
                timeLabel.text = timeString
169
171
                header.color = event.startDateTime.toLocaleDateString() === new Date().toLocaleDateString() ? UbuntuColors.orange : UbuntuColors.darkGrey
170
 
                detailsContainer.color = eventListModel.collection(event.collectionId).color
 
172
                calendarColorCode.color = eventListModel.collection(event.collectionId).color
171
173
 
172
174
                if( event.displayLabel) {
173
175
                    titleLabel.text = event.displayLabel;
178
180
                id: container
179
181
 
180
182
                width: parent.width
181
 
                height: detailsContainer.height + headerContainer.height +
182
 
                        (headerContainer.visible ? units.gu(2) : units.gu(0.5))
183
 
 
184
 
                spacing: headerContainer.visible ? units.gu(1) : 0
185
 
 
186
183
                anchors.top: parent.top
187
 
                anchors.topMargin: headerContainer.visible ? units.gu(1.5) : units.gu(1)
188
 
 
189
 
                DayHeaderBackground{
190
 
                    id: headerContainer
191
 
 
192
 
                    height: visible ? header.height + units.gu(1) : 0
193
 
                    width: parent.width
194
 
 
 
184
 
 
185
                ListItem.Header{
 
186
                    id:headerList
195
187
                    Label{
196
 
                        id: header
197
 
 
198
 
                        fontSize: "small"
199
 
                        width: parent.width
200
 
                        elide: Text.ElideRight
201
 
 
 
188
                        id:header
202
189
                        anchors {
203
190
                            left: parent.left
204
 
                            leftMargin: units.gu(1)
 
191
                            leftMargin : units.gu(1)
205
192
                            verticalCenter: parent.verticalCenter
206
193
                        }
207
194
                    }
208
195
 
209
 
                    MouseArea{
210
 
                        anchors.fill: parent
211
 
                        onClicked: {
212
 
                            dateSelected(event.startDateTime);
213
 
                        }
214
 
                    }
215
 
                }
216
 
 
217
 
                UbuntuShape{
218
 
                    id: detailsContainer
219
 
 
220
 
                    anchors {
221
 
                        left: parent.left
222
 
                        right: parent.right
223
 
                        margins: units.gu(2)
224
 
                    }
225
 
 
226
 
                    height: detailsColumn.height + units.gu(1)
227
 
                    borderSource: "radius_ide.sci"
228
 
 
229
196
                    states: [
230
197
                        State {
231
 
                            name: "selected"
232
 
                            when: mouseArea.pressed
233
 
 
 
198
                            name: "headerDateClicked"
 
199
                            when:testClick.pressed
234
200
                            PropertyChanges {
235
 
                                target: detailsContainer
236
 
                                borderSource: "radius_pressed.sci"
 
201
                                target: header
 
202
                                color :  header.color == UbuntuColors.orange
 
203
                                         ? UbuntuColors.darkGrey
 
204
                                         : UbuntuColors.orange
237
205
                            }
238
206
                        }
239
207
                    ]
240
208
 
 
209
                    MouseArea{
 
210
                        id:testClick
 
211
                        anchors.fill: parent
 
212
                        onClicked: {
 
213
                            dateSelected(event.startDateTime);
 
214
                        }
 
215
                    }
 
216
 
 
217
                }
 
218
 
 
219
                ListItem.Standard {
 
220
                    id:eventDetails
 
221
                    showDivider: false
 
222
                    Rectangle {
 
223
                        id: calendarColorCode
 
224
 
 
225
                        width: parent.height- units.gu(2)
 
226
                        height: width
 
227
 
 
228
                        anchors {
 
229
                            left: parent.left
 
230
                            leftMargin: units.gu(2)
 
231
                            verticalCenter: parent.verticalCenter
 
232
                        }
 
233
                    }
241
234
                    Column{
242
235
                        id: detailsColumn
243
236
 
244
237
                        anchors {
245
238
                            top: parent.top
246
 
                            left: parent.left
 
239
                            left: calendarColorCode.right
247
240
                            right: parent.right
248
 
                            margins: units.gu(0.5)
 
241
                            margins: units.gu(1)
249
242
                        }
250
243
 
251
244
                        Label{
252
245
                            id: timeLabel
253
 
                            color:"White"
254
246
                            font.bold: true
255
247
                            fontSize: "small"
256
248
                            width: parent.width
258
250
 
259
251
                        Label{
260
252
                            id: titleLabel
261
 
 
262
 
                            color:"White"
263
253
                            fontSize: "small"
264
254
                            width: parent.width
265
255
                            maximumLineCount: 2
266
256
                            elide: Text.ElideRight
267
257
                            wrapMode: Text.WrapAtWordBoundaryOrAnywhere
268
 
 
269
 
                            Behavior on color {
270
 
                                ColorAnimation {
271
 
                                    duration: 50
272
 
                                }
273
 
                            }
274
258
                        }
275
259
                    }
276
 
 
277
 
                    MouseArea{
278
 
                        id: mouseArea
279
 
                        anchors.fill: parent
280
 
                        onClicked: {
281
 
                            pageStack.push(Qt.resolvedUrl("EventDetails.qml"), {"event":event,"model":eventListModel});
282
 
                        }
 
260
                    onClicked: {
 
261
                        pageStack.push(Qt.resolvedUrl("EventDetails.qml"), {"event":event,"model":eventListModel});
283
262
                    }
284
263
                }
 
264
 
285
265
            }
286
266
        }
287
267
    }