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
49
property date currentDate:new Date()
50
property int year:currentDate.getFullYear()
51
property int month:currentDate.getMonth()
52
property int day:currentDate.getDate()
53
property int hour:currentDate.getHours()
54
property int weekDay:currentDate.getDay()
55
property string status:currentDate.toDateString()
56
property string preState: "MonthView"
57
property alias storageLocationModel: storageLocationModel
58
property alias contentArea : contentArea
61
Image { source: "contents/images/stripes.png"; fillMode: Image.Tile; anchors.fill: parent; opacity: 1 }
66
id: modelCollectionFilter
69
var list = organizer.collections;
70
for (var i = 0; i< list.length; i++) {
71
idList.push(list[i].collectionId);
79
detail: Detail.ItemType
85
id: intersectionFilter
86
filters: [modelCollectionFilter]
89
SystemPalette { id: activePalette }
90
property OrganizerModel organizer:OrganizerModel{
92
manager:"qtorganizer:jsondb:id=qml"
93
//manager:"qtorganizer:memory:id=qml"
94
startPeriod:'2009-01-01'
95
endPeriod:'2012-12-31'
97
filter: intersectionFilter
98
Component.onCompleted : {
99
if (managerName == "memory")
100
organizer.importItems(Qt.resolvedUrl("contents/test.ics"));
103
// this is for occurrenceDialog
104
console.log("QML --- ITEMS FETCHED" + fetchedItems[0].displayLabel + fetchedItems[0].itemStartTime);
105
if (fetchedItems.length == 1) {
106
detailsView.isNewItem = false;
107
detailsView.item = fetchedItems[0];
108
calendar.state = "DetailsView";
114
id: storageLocationModel
115
ListElement{name: "UserDataStorage"}
116
ListElement{name: "SystemStorage"}
122
left: parent.left; right: parent.right; top: parent.top
130
left: parent.left; right: parent.right; top: infoBar.bottom
132
height: 35; opacity: 0.9
133
info: organizer.error + "\nTotal:" + organizer.itemCount
137
id: statusBar; status:calendar.status; width: parent.width; height: 35; opacity: 0.9; anchors.bottom: calendar.bottom
139
if (calendar.state == "MonthView") {
140
calendar.currentDate = new Date(calendar.year, calendar.month - 1, calendar.day);
141
} else if (calendar.state == "WeekView") {
142
calendar.currentDate = new Date(calendar.year, calendar.month , calendar.day - 7);
143
} else if (calendar.state == "DayView" || calendar.state == "TimelineView") {
144
calendar.currentDate = new Date(calendar.year, calendar.month , calendar.day - 1);
151
if (calendar.state == "MonthView") {
152
calendar.currentDate = new Date(calendar.year, calendar.month + 1, calendar.day);
153
} else if (calendar.state == "WeekView") {
154
calendar.currentDate = new Date(calendar.year, calendar.month , calendar.day + 7);
155
} else if (calendar.state == "DayView" || calendar.state == "TimelineView") {
156
calendar.currentDate = new Date(calendar.year, calendar.month , calendar.day + 1);
160
//add new item clicked
162
calendar.preState = calendar.state;
163
if (calendar.state == "SettingsView" && settingsView.state == "CollectionManagerView") {
164
settingsView.collectionManagerView.addCollection();
166
calendar.state = "AddNewItemSelectView";
172
State {name: "MonthView"; PropertyChanges { target: monthView; opacity: 1; }},
173
State {name: "TimelineView"; PropertyChanges { target: timelineView; opacity: 1; }},
174
State {name: "WeekView"; PropertyChanges { target: weekView; opacity: 1; }},
175
State {name: "DayView"; PropertyChanges { target: dayView; opacity: 1; }},
176
State {name: "AgenderView"; PropertyChanges { target: agenderView; opacity: 1; }},
179
PropertyChanges { target: detailsView; opacity: 1;}
180
PropertyChanges { target: statusBar; opacity: 0; }
182
State {name: "AddNewItemSelectView"; PropertyChanges { target: addNewItemview; opacity: 0.8; }},
183
State {name: "OccurrenceDialogView"; PropertyChanges { target: occurrenceDialog; opacity: 0.8; }},
184
State {name: "TodoView"; PropertyChanges { target: todoView; opacity: 1; }},
185
State {name: "AttendeeDetailsView"; PropertyChanges { target: attendeeDetailsView; opacity: 1; }},
186
State {name: "SettingsView"; PropertyChanges { target: settingsView; opacity: 1; }}
191
properties: "opacity"
192
easing.type: "Linear"
198
// some views are based on certain filters
200
if (state == "TodoView") {
201
intersectionFilter.filters = [todoFilter, modelCollectionFilter];
202
} else if (intersectionFilter.filters.length != 1) {
203
// No need to change the filter if filter is the same
204
// (Currently changing the filter triggers also a full update.)
205
intersectionFilter.filters = [modelCollectionFilter];
211
anchors.top: menuBar.bottom;
212
anchors.left: calendar.left;
213
anchors.right: calendar.right;
214
anchors.bottom: (statusBar.opacity != 0) ? statusBar.top : statusBar.bottom;
218
width: calendar.width;
219
height: calendar.height - menuBar.height - statusBar.height;
223
anchors.fill: contentArea;
227
width: calendar.width;
228
height: calendar.height - menuBar.height - statusBar.height;
230
anchors.fill: contentArea;
234
width: calendar.width;
235
height: calendar.height - menuBar.height - statusBar.height;
237
anchors.fill: contentArea;
241
width: calendar.width;
242
height: calendar.height - menuBar.height - statusBar.height;
244
anchors.fill: contentArea;
249
width: calendar.width;
250
height: calendar.height - menuBar.height - statusBar.height;
252
anchors.fill: contentArea;
256
width: calendar.width;
257
height: calendar.height - menuBar.height - statusBar.height;
259
anchors.fill: contentArea;
263
title: "Select type:"
265
model: VisualItemModel {
268
width: addNewItemview.width / 2
270
detailsView.isNewItem = true;
271
detailsView.item = createEmptyItem(Type.Event);
272
detailsView.item.displayLabel = "Event"+(organizer.itemCount+1)
273
calendar.state = "DetailsView";
277
text: "New todo-item"
278
width: addNewItemview.width / 2
280
detailsView.isNewItem = true;
281
detailsView.item = createEmptyItem(Type.Todo);
282
detailsView.item.displayLabel = "Todo"+(organizer.itemCount+1)
283
calendar.state = "DetailsView";
288
width: addNewItemview.width / 2
290
calendar.state = calendar.preState;
297
id: occurrenceDialog;
298
//title: "This is a recurring item. Open this instance or whole series?"
299
title: "Recurring item"
301
model: VisualItemModel {
303
text: "Open this instance"
304
width: addNewItemview.width / 2
306
calendar.state = "DetailsView";
310
text: "Open whole series"
311
width: addNewItemview.width / 2
313
var parentDetail = detailsView.item.detail(Detail.Parent);
314
organizer.fetchItems([parentDetail.parentId]);
322
AttendeeDetailsView {
323
id: attendeeDetailsView;
330
function createEmptyItem(type)
332
if (type == Type.Event) {
333
return Qt.createQmlObject("import QtOrganizer 5.0; Event { }", organizer);
334
} else if (type == Type.Todo) {
335
return Qt.createQmlObject("import QtOrganizer 5.0; Todo { }", organizer);
336
// } else if (type == Type.EventOccurrence) {
337
// return Qt.createQmlObject("import QtOrganizer 5.0; EventOccurrence { }", organizer);
338
// } else if (type == Type.TodoOccurrence) {
339
// return Qt.createQmlObject("import QtOrganizer 5.0; TodoOccurrence { }", organizer);
341
return Qt.createQmlObject("import QtOrganizer 5.0; Event { }", organizer);