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
50
opacity : parent.opacity
69
opacity : parent.opacity
71
delegate : hourDelegate
72
highlight: hourHighlight
73
preferredHighlightBegin: hourList.height * 0.5
74
preferredHighlightEnd: preferredHighlightBegin
75
highlightFollowsCurrentItem : true
76
highlightMoveSpeed : 2000
77
keyNavigationWraps : true
79
onCurrentIndexChanged : {
80
if (timelineView.opacity > 0) {
81
calendar.currentDate = new Date(timelineView.year, timelineView.month, currentIndex + 1);
82
monthList.currentIndex = timelineView.month;
83
currentIndex = timelineView.day - 1;
91
width: hourList.width;
92
height: hourList.height /7 ;
93
color: "lightsteelblue" ;radius: 5
102
width : hourList.width
103
height : childrenRect.height
104
property int rowIndex : index
105
id:hourDelegateInstanceItem
108
// Draw a line under the previous Hour list tiem
111
width : hourList.width
121
// List all, if any, of the events within this hour.
126
// Simple fetch ALL events on this day...and we will filter them bu hour.
127
model: calendar.organizer.items? calendar.organizer.itemsByTimePeriod(new Date(calendar.year, calendar.month, calendar.day)
128
, new Date(calendar.year, calendar.month, calendar.day+1))
138
// Only display a link when the event starts within this hour......
139
text: (hourDelegateInstanceItem.rowIndex == Qt.formatTime(modelData.itemStartTime, "hh")) ? "<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";
150
width: 15; height: 15
151
anchors { verticalCenter: parent.verticalCenter }
152
border { color: "black"; width: 1; }
153
visible: (hourDelegateInstanceItem.rowIndex == Qt.formatTime(modelData.itemStartTime, "hh")) ? true : false
154
color: calendar.organizer.collection(modelData.collectionId)? calendar.organizer.collection(modelData.collectionId).color : "red"
165
ListElement {hour : "0:00"}
166
ListElement {hour : "1:00"}
167
ListElement {hour : "2:00"}
168
ListElement {hour : "3:00"}
169
ListElement {hour : "4:00"}
170
ListElement {hour : "5:00"}
171
ListElement {hour : "6:00"}
172
ListElement {hour : "7:00"}
173
ListElement {hour : "8:00"}
174
ListElement {hour : "9:00"}
175
ListElement {hour : "10:00"}
176
ListElement {hour : "11:00"}
177
ListElement {hour : "12:00"}
178
ListElement {hour : "13:00"}
179
ListElement {hour : "14:00"}
180
ListElement {hour : "15:00"}
181
ListElement {hour : "16:00"}
182
ListElement {hour : "17:00"}
183
ListElement {hour : "18:00"}
184
ListElement {hour : "19:00"}
185
ListElement {hour : "20:00"}
186
ListElement {hour : "21:00"}
187
ListElement {hour : "22:00"}
188
ListElement {hour : "23:00"}