1
/****************************************************************************
3
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
4
** Contact: http://www.qt-project.org/legal
6
** This file is part of the examples of the Qt Mobility Components.
8
** $QT_BEGIN_LICENSE:BSD$
9
** You may use this file under the terms of the BSD license as follows:
11
** "Redistribution and use in source and binary forms, with or without
12
** modification, are permitted provided that the following conditions are
14
** * Redistributions of source code must retain the above copyright
15
** notice, this list of conditions and the following disclaimer.
16
** * Redistributions in binary form must reproduce the above copyright
17
** notice, this list of conditions and the following disclaimer in
18
** the documentation and/or other materials provided with the
20
** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
21
** of its contributors may be used to endorse or promote products derived
22
** from this software without specific prior written permission.
25
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
39
****************************************************************************/
42
import QtOrganizer 5.0
43
import "timeline.js" as Timeline
48
opacity : parent.opacity
49
property int year:calendar.year
50
property int month:calendar.month
51
property int day:calendar.day
54
onCurrentDateChanged : {
55
dayList.currentIndex = day - 1;
56
monthList.currentIndex = month;
57
yearList.currentIndex = year - yearModel.start;
75
anchors.right : parent.right
76
anchors.left : monthView.right
77
anchors.top : parent.top
78
anchors.bottom : parent.bottom
79
opacity : parent.opacity
87
opacity : parent.opacity
89
delegate : dayDelegate
90
highlight: dayHighlight
91
preferredHighlightBegin: dayList.height * 0.5
92
preferredHighlightEnd: preferredHighlightBegin
93
highlightFollowsCurrentItem : true
94
highlightMoveSpeed : 2000
95
keyNavigationWraps : true
97
onCurrentIndexChanged : {
98
if (timelineView.opacity > 0) {
99
calendar.currentDate = new Date(timelineView.year, timelineView.month, currentIndex + 1);
100
monthList.currentIndex = timelineView.month;
101
currentIndex = timelineView.day - 1;
110
width: dayList.width;
111
height: dayList.height /7 ;
112
color: "lightsteelblue" ;radius: 5
119
width : dayList.width
120
height : childrenRect.height
124
width : dayList.width
132
model:calendar.organizer.items? calendar.organizer.itemsByTimePeriod(new Date(timelineView.year,timelineView.month, index + 1),
133
new Date(timelineView.year,timelineView.month, index + 2))
139
text: "<a href=\"#\">" + modelData.displayLabel + "</a>"
141
detailsView.isNewItem = false
142
detailsView.item = modelData;
143
if (detailsView.item.itemType == Type.EventOccurrence || detailsView.item.itemType == Type.TodoOccurrence)
144
calendar.state = "OccurrenceDialogView";
146
calendar.state = "DetailsView";
156
ListElement {day : "1"}
157
ListElement {day : "2"}
158
ListElement {day : "3"}
159
ListElement {day : "4"}
160
ListElement {day : "5"}
161
ListElement {day : "6"}
162
ListElement {day : "7"}
163
ListElement {day : "8"}
164
ListElement {day : "9"}
165
ListElement {day : "10"}
166
ListElement {day : "11"}
167
ListElement {day : "12"}
168
ListElement {day : "13"}
169
ListElement {day : "14"}
170
ListElement {day : "15"}
171
ListElement {day : "16"}
172
ListElement {day : "17"}
173
ListElement {day : "18"}
174
ListElement {day : "19"}
175
ListElement {day : "20"}
176
ListElement {day : "21"}
177
ListElement {day : "22"}
178
ListElement {day : "23"}
179
ListElement {day : "24"}
180
ListElement {day : "25"}
181
ListElement {day : "26"}
182
ListElement {day : "27"}
183
ListElement {day : "28"}
184
ListElement {day : "29"}
185
ListElement {day : "30"}
186
ListElement {day : "31"}
195
anchors.left : yearView.right
196
anchors.top : parent.top
197
anchors.bottom : parent.bottom
204
delegate : monthDelegate
205
highlight: monthHighlight
206
preferredHighlightBegin: monthList.height * 0.5
207
preferredHighlightEnd: preferredHighlightBegin
208
highlightFollowsCurrentItem : true
209
highlightMoveSpeed : 1000
210
Component.onCompleted : {
211
var now = new Date();
212
var month = now.getMonth();
213
monthList.currentIndex = month;
214
var d = Date.parse("Feb 31, 2010");
216
onCurrentIndexChanged : {
217
if (timelineView.opacity > 0) {
218
calendar.currentDate = new Date(timelineView.year, currentIndex, timelineView.day);
219
currentIndex = timelineView.month;
220
dayList.currentIndex = timelineView.day - 1;
228
width: monthList.width; height: monthList.height / 12 ; color: "lightsteelblue" ;radius: 5
235
width : monthList.width
236
height : monthList.height / 12
240
width : monthList.width
249
onClicked : monthList.currentIndex = index
256
ListElement {month : "Jan"}
257
ListElement {month : "Feb"}
258
ListElement {month : "Mar"}
259
ListElement {month : "Apr"}
260
ListElement {month : "May"}
261
ListElement {month : "Jun"}
262
ListElement {month : "Jul"}
263
ListElement {month : "Aug"}
264
ListElement {month : "Sep"}
265
ListElement {month : "Oct"}
266
ListElement {month : "Nov"}
267
ListElement {month : "Dec"}
275
anchors.top : parent.top
276
anchors.bottom : parent.bottom
277
anchors.left : parent.left
284
width: yearList.width; height: yearList.height / 10; color: "lightsteelblue" ;radius: 5
292
width : yearList.width
293
height : yearList.height / 10
297
width : yearList.width
306
onClicked : yearList.currentIndex = index
315
delegate : yearDelegate
318
highlight: yearHighlight
320
preferredHighlightBegin: yearList.height * 0.5
321
preferredHighlightEnd: preferredHighlightBegin
322
highlightRangeMode: "StrictlyEnforceRange"
323
highlightFollowsCurrentItem : true
325
Component.onCompleted: Timeline.extendYearModel(true);
326
onCurrentIndexChanged: {
327
Timeline.extendYearModel(false);
328
if (timelineView.opacity > 0) {
329
calendar.currentDate = new Date(yearModel.start + currentIndex, timelineView.month, timelineView.day);
330
monthList.currentIndex = timelineView.month;
331
dayList.currentIndex = timelineView.day - 1;
337
property int start : 0;
338
property int end : 0;