400.1.1
by mihirsoni-123
Added copyright header comments in all the pages |
1 |
/*
|
400.1.2
by mihirsoni-123
updated copyright year |
2 |
* Copyright (C) 2013-2014 Canonical Ltd
|
400.1.1
by mihirsoni-123
Added copyright header comments in all the pages |
3 |
*
|
4 |
* This file is part of Ubuntu Calendar App
|
|
5 |
*
|
|
6 |
* Ubuntu Calendar App is free software: you can redistribute it and/or modify
|
|
7 |
* it under the terms of the GNU General Public License version 3 as
|
|
8 |
* published by the Free Software Foundation.
|
|
9 |
*
|
|
10 |
* Ubuntu Calendar App is distributed in the hope that it will be useful,
|
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13 |
* GNU General Public License for more details.
|
|
14 |
*
|
|
15 |
* You should have received a copy of the GNU General Public License
|
|
16 |
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17 |
*/
|
|
96.2.1
by Kunal Parmar
initial version |
18 |
import QtQuick 2.0 |
422.5.1
by Akiva Avraham
Upgraded component library imports |
19 |
import Ubuntu.Components 1.1 |
20 |
import Ubuntu.Components.Popups 1.0 |
|
191.4.1
by Kunal Parmar
Applying changes |
21 |
import QtOrganizer 5.0 |
96.2.1
by Kunal Parmar
initial version |
22 |
|
23 |
import "dateExt.js" as DateExt |
|
191.4.1
by Kunal Parmar
Applying changes |
24 |
import "ViewType.js" as ViewType |
96.2.1
by Kunal Parmar
initial version |
25 |
|
96.2.2
by Kunal Parmar
final weekview and dayview |
26 |
Item { |
96.2.1
by Kunal Parmar
initial version |
27 |
id: root
|
28 |
||
29 |
property var startDay: DateExt.today(); |
|
295.1.1
by Kunal Parmar
Parallex fix for EventBubble |
30 |
property bool isActive: false |
151.1.1
by Kunal Parmar
Day view all component act as one |
31 |
property alias contentY: timeLineView.contentY |
32 |
property alias contentInteractive: timeLineView.interactive |
|
96.2.1
by Kunal Parmar
initial version |
33 |
|
191.4.1
by Kunal Parmar
Applying changes |
34 |
property int type: ViewType.ViewTypeWeek |
96.2.1
by Kunal Parmar
initial version |
35 |
|
183.1.1
by Kunal Parmar
Key Navigation implemented |
36 |
//visible hour
|
183.1.9
by Kunal Parmar
Merge issue resolved |
37 |
property int scrollHour; |
183.1.1
by Kunal Parmar
Key Navigation implemented |
38 |
|
216.1.2
by Kunal Parmar
Refactoring |
39 |
function scrollToCurrentTime() { |
40 |
var currentTime = new Date(); |
|
183.1.9
by Kunal Parmar
Merge issue resolved |
41 |
scrollHour = currentTime.getHours(); |
216.1.2
by Kunal Parmar
Refactoring |
42 |
|
183.1.9
by Kunal Parmar
Merge issue resolved |
43 |
timeLineView.contentY = scrollHour * units.gu(10); |
216.1.2
by Kunal Parmar
Refactoring |
44 |
if(timeLineView.contentY >= timeLineView.contentHeight - timeLineView.height) { |
45 |
timeLineView.contentY = timeLineView.contentHeight - timeLineView.height |
|
216.1.1
by Kunal Parmar
scroll to currnt time |
46 |
}
|
96.2.2
by Kunal Parmar
final weekview and dayview |
47 |
}
|
48 |
||
183.1.1
by Kunal Parmar
Key Navigation implemented |
49 |
Connections{ |
50 |
target: parent |
|
51 |
onScrollUp:{ |
|
52 |
scrollHour--; |
|
53 |
if( scrollHour < 0) { |
|
54 |
scrollHour =0; |
|
55 |
}
|
|
183.1.9
by Kunal Parmar
Merge issue resolved |
56 |
scrollToHour(); |
183.1.1
by Kunal Parmar
Key Navigation implemented |
57 |
}
|
58 |
||
59 |
onScrollDown:{ |
|
60 |
scrollHour++; |
|
61 |
var visibleHour = root.height / units.gu(10); |
|
183.1.9
by Kunal Parmar
Merge issue resolved |
62 |
if( scrollHour > (25 -visibleHour)) { |
63 |
scrollHour = 25 - visibleHour; |
|
183.1.1
by Kunal Parmar
Key Navigation implemented |
64 |
}
|
183.1.9
by Kunal Parmar
Merge issue resolved |
65 |
scrollToHour(); |
183.1.1
by Kunal Parmar
Key Navigation implemented |
66 |
}
|
67 |
}
|
|
68 |
||
69 |
function scrollToHour() { |
|
70 |
timeLineView.contentY = scrollHour * units.gu(10); |
|
71 |
if(timeLineView.contentY >= timeLineView.contentHeight - timeLineView.height) { |
|
72 |
timeLineView.contentY = timeLineView.contentHeight - timeLineView.height |
|
73 |
}
|
|
74 |
}
|
|
75 |
||
233.1.1
by Kunal Parmar
EventView performance improvement |
76 |
EventListModel { |
77 |
id: mainModel
|
|
78 |
startPeriod: startDay.midnight(); |
|
79 |
endPeriod: type == ViewType.ViewTypeWeek ? startPeriod.addDays(7).endOfDay(): startPeriod.endOfDay() |
|
212.4.10
by Kunal Parmar
merge from trunk |
80 |
filter: eventModel.filter |
233.1.1
by Kunal Parmar
EventView performance improvement |
81 |
}
|
82 |
||
253.2.1
by Kunal Parmar
Spinner on events loading |
83 |
ActivityIndicator { |
84 |
visible: running |
|
391.1.6
by mihirsoni-123
fixed autopilot break by adding activity monitor wait |
85 |
objectName : "activityIndicator" |
253.2.1
by Kunal Parmar
Spinner on events loading |
86 |
running: mainModel.isLoading |
87 |
anchors.centerIn: parent |
|
88 |
z:2 |
|
89 |
}
|
|
233.1.1
by Kunal Parmar
EventView performance improvement |
90 |
|
191.4.1
by Kunal Parmar
Applying changes |
91 |
Column { |
114.2.1
by Kunal Parmar
dayview weekview transition added |
92 |
anchors.top: parent.top |
191.4.1
by Kunal Parmar
Applying changes |
93 |
|
96.2.1
by Kunal Parmar
initial version |
94 |
width: parent.width |
114.2.1
by Kunal Parmar
dayview weekview transition added |
95 |
height: parent.height |
96.2.1
by Kunal Parmar
initial version |
96 |
|
222.3.5
by Bartosz Kosiorek
Implementation of the quick add for Day and Week view |
97 |
AllDayEventComponent { |
191.4.1
by Kunal Parmar
Applying changes |
98 |
id: allDayContainer
|
99 |
type: root.type |
|
100 |
startDay: root.startDay |
|
233.1.1
by Kunal Parmar
EventView performance improvement |
101 |
model: mainModel |
102 |
Component.onCompleted: { |
|
253.1.1
by Kunal Parmar
remove listener on destruction |
103 |
mainModel.addModelChangeListener(createAllDayEvents); |
104 |
}
|
|
105 |
Component.onDestruction: { |
|
106 |
mainModel.removeModelChangeListener(createAllDayEvents); |
|
233.1.1
by Kunal Parmar
EventView performance improvement |
107 |
}
|
191.4.1
by Kunal Parmar
Applying changes |
108 |
}
|
109 |
||
222.3.5
by Bartosz Kosiorek
Implementation of the quick add for Day and Week view |
110 |
Flickable { |
191.4.1
by Kunal Parmar
Applying changes |
111 |
id: timeLineView
|
112 |
||
96.2.1
by Kunal Parmar
initial version |
113 |
width: parent.width |
191.4.1
by Kunal Parmar
Applying changes |
114 |
height: parent.height - allDayContainer.height |
115 |
||
116 |
contentHeight: units.gu(10) * 24 |
|
117 |
contentWidth: width |
|
118 |
||
119 |
clip: true |
|
120 |
||
222.3.9
by Bartosz Kosiorek
Move MouseArea into TimeLineBase |
121 |
TimeLineBackground { |
122 |
}
|
|
123 |
||
124 |
Row { |
|
191.4.1
by Kunal Parmar
Applying changes |
125 |
id: week
|
126 |
width: parent.width |
|
127 |
height: parent.height |
|
128 |
anchors.top: parent.top |
|
129 |
||
222.3.5
by Bartosz Kosiorek
Implementation of the quick add for Day and Week view |
130 |
Repeater { |
191.4.1
by Kunal Parmar
Applying changes |
131 |
model: type == ViewType.ViewTypeWeek ? 7 : 1 |
132 |
||
133 |
delegate: TimeLineBase { |
|
134 |
property int idx: index |
|
135 |
anchors.top: parent.top |
|
136 |
width: { |
|
137 |
if( type == ViewType.ViewTypeWeek ) { |
|
222.3.5
by Bartosz Kosiorek
Implementation of the quick add for Day and Week view |
138 |
parent.width / 7 |
191.4.1
by Kunal Parmar
Applying changes |
139 |
} else { |
140 |
(parent.width) |
|
141 |
}
|
|
96.2.1
by Kunal Parmar
initial version |
142 |
}
|
222.3.9
by Bartosz Kosiorek
Move MouseArea into TimeLineBase |
143 |
|
191.4.1
by Kunal Parmar
Applying changes |
144 |
height: parent.height |
145 |
delegate: comp |
|
146 |
day: startDay.addDays(index) |
|
233.1.1
by Kunal Parmar
EventView performance improvement |
147 |
|
330.1.1
by Kunal Parmar
Caching the creation of event bubbles |
148 |
Connections{ |
149 |
target: mainModel |
|
150 |
onStartPeriodChanged:{ |
|
151 |
destroyAllChildren(); |
|
152 |
}
|
|
153 |
}
|
|
154 |
||
233.1.1
by Kunal Parmar
EventView performance improvement |
155 |
model: mainModel |
156 |
Component.onCompleted: { |
|
347.2.1
by Jason
Ensure events are removed from DayView upon deletion |
157 |
model.addModelChangeListener(destroyAllChildren); |
233.1.1
by Kunal Parmar
EventView performance improvement |
158 |
model.addModelChangeListener(createEvents); |
159 |
}
|
|
253.1.1
by Kunal Parmar
remove listener on destruction |
160 |
Component.onDestruction: { |
347.2.1
by Jason
Ensure events are removed from DayView upon deletion |
161 |
model.removeModelChangeListener(destroyAllChildren); |
253.1.1
by Kunal Parmar
remove listener on destruction |
162 |
model.removeModelChangeListener(createEvents); |
163 |
}
|
|
96.2.1
by Kunal Parmar
initial version |
164 |
}
|
165 |
}
|
|
166 |
}
|
|
167 |
}
|
|
168 |
}
|
|
169 |
||
222.3.10
by Bartosz Kosiorek
Fix indentation |
170 |
Component { |
96.2.1
by Kunal Parmar
initial version |
171 |
id: comp
|
222.3.5
by Bartosz Kosiorek
Implementation of the quick add for Day and Week view |
172 |
EventBubble { |
295.1.1
by Kunal Parmar
Parallex fix for EventBubble |
173 |
type: root.type == ViewType.ViewTypeWeek ? narrowType : wideType |
174 |
flickable: root.isActive ? timeLineView : null |
|
191.4.1
by Kunal Parmar
Applying changes |
175 |
clip: true |
96.2.1
by Kunal Parmar
initial version |
176 |
}
|
177 |
}
|
|
178 |
}
|