Merge lp:~frankencode/ubuntu-calendar-app/data-service into lp:ubuntu-calendar-app
- data-service
- Merge into trunk
Status: | Merged |
---|---|
Merged at revision: | 11 |
Proposed branch: | lp:~frankencode/ubuntu-calendar-app/data-service |
Merge into: | lp:ubuntu-calendar-app |
Diff against target: |
907 lines (+729/-50) (has conflicts) 8 files modified
DiaryView.qml (+82/-0) EventListModel.qml (+26/-0) EventView.qml (+19/-13) MonthView.qml (+9/-3) calendar.qml (+26/-34) calendarTests.qml (+14/-0) dataService.js (+361/-0) dataServiceTests.js (+192/-0) Text conflict in MonthView.qml |
To merge this branch: | bzr merge lp:~frankencode/ubuntu-calendar-app/data-service |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ubuntu Phone Apps Jenkins Bot | continuous-integration | Needs Fixing | |
Frank Mertens | Pending | ||
Review via email:
|
Commit message
Added a data model for the local store, some simulation data and thin API on top, which is called DataService.
Description of the change
Added a data model for the local store, some simulation data and thin API on top, which is called DataService. The idea behind: abstract away the access to events, contacts and places. Especially the last two will be delivered by some system service in a later version. For now this is only simulated. But the user of the DataService API shouldn't need to worry about.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
- 11. By Frank Mertens
-
Added more complex test case in preparation for integration of the diary view.
To run the tests and load the test data run 'qmlscene calendarTest.qml' once.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
PASSED: Continuous integration, rev:11
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 12. By Frank Mertens
-
Use singleton pattern to improve startup performance
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
PASSED: Continuous integration, rev:12
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 13. By Frank Mertens
-
Extended the database model by an events category and added a basic diary view.
The events category allows to use section headers.
The basic diary view uses the standard Ubuntu component ListItem.Standard to show
the events of the current day. - 14. By Frank Mertens
-
Removed testing icon and added new icons needed for the diary view.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
PASSED: Continuous integration, rev:14
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 15. By Frank Mertens
-
Missing file.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
PASSED: Continuous integration, rev:15
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 16. By Frank Mertens
-
Allow proper interactions with the compressed event view.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
FAILED: Continuous integration, rev:16
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
Preview Diff
1 | === added file 'DiaryView.qml' | |||
2 | --- DiaryView.qml 1970-01-01 00:00:00 +0000 | |||
3 | +++ DiaryView.qml 2013-03-27 23:13:20 +0000 | |||
4 | @@ -0,0 +1,82 @@ | |||
5 | 1 | import QtQuick 2.0 | ||
6 | 2 | import Ubuntu.Components 0.1 | ||
7 | 3 | import Ubuntu.Components.ListItems 0.1 as ListItem | ||
8 | 4 | import "dateExt.js" as DateExt | ||
9 | 5 | import "colorUtils.js" as Color | ||
10 | 6 | |||
11 | 7 | ListView { | ||
12 | 8 | id: diaryView | ||
13 | 9 | |||
14 | 10 | property var dayStart: new Date() | ||
15 | 11 | |||
16 | 12 | property bool expanded: false | ||
17 | 13 | |||
18 | 14 | property bool expanding: false | ||
19 | 15 | property bool compressing: false | ||
20 | 16 | |||
21 | 17 | signal expand() | ||
22 | 18 | signal compress() | ||
23 | 19 | |||
24 | 20 | clip: true | ||
25 | 21 | |||
26 | 22 | model: EventListModel { | ||
27 | 23 | termStart: dayStart | ||
28 | 24 | termLength: Date.msPerDay | ||
29 | 25 | } | ||
30 | 26 | |||
31 | 27 | section { | ||
32 | 28 | property: "category" | ||
33 | 29 | // labelPositioning: ViewSection.CurrentLabelAtStart // FIXME, unreliable | ||
34 | 30 | delegate: ListItem.Header { | ||
35 | 31 | text: i18n.tr(section) | ||
36 | 32 | MouseArea { | ||
37 | 33 | anchors.fill: parent | ||
38 | 34 | onClicked: { | ||
39 | 35 | if (expanded) | ||
40 | 36 | compress() | ||
41 | 37 | else | ||
42 | 38 | expand() | ||
43 | 39 | } | ||
44 | 40 | } | ||
45 | 41 | } | ||
46 | 42 | } | ||
47 | 43 | |||
48 | 44 | delegate: ListItem.Standard { | ||
49 | 45 | text: startTime.toLocaleTimeString(Qt.locale(i18n.language), Locale.ShortFormat) + " " + title | ||
50 | 46 | } | ||
51 | 47 | |||
52 | 48 | footer: ListItem.Standard { | ||
53 | 49 | text: i18n.tr("(+) New Event / Todo") | ||
54 | 50 | } | ||
55 | 51 | |||
56 | 52 | onContentYChanged: { | ||
57 | 53 | // console.log(expanded, expanding, compressing, dragging, flicking, moving, contentY) | ||
58 | 54 | if (expanding || compressing || !dragging) return | ||
59 | 55 | |||
60 | 56 | if (expanded) { | ||
61 | 57 | if (contentY < -units.gu(0.5)) { | ||
62 | 58 | compressing = true | ||
63 | 59 | expanding = false | ||
64 | 60 | } | ||
65 | 61 | } | ||
66 | 62 | else { | ||
67 | 63 | if (contentY < -units.gu(0.5)) { | ||
68 | 64 | expanding = true | ||
69 | 65 | compressing = false | ||
70 | 66 | } | ||
71 | 67 | } | ||
72 | 68 | } | ||
73 | 69 | |||
74 | 70 | onDraggingChanged: { | ||
75 | 71 | if (dragging) return | ||
76 | 72 | |||
77 | 73 | if (expanding) { | ||
78 | 74 | expanding = false | ||
79 | 75 | expand() | ||
80 | 76 | } | ||
81 | 77 | else if (compressing) { | ||
82 | 78 | compressing = false | ||
83 | 79 | compress() | ||
84 | 80 | } | ||
85 | 81 | } | ||
86 | 82 | } | ||
87 | 0 | 83 | ||
88 | === added file 'EventListModel.qml' | |||
89 | --- EventListModel.qml 1970-01-01 00:00:00 +0000 | |||
90 | +++ EventListModel.qml 2013-03-27 23:13:20 +0000 | |||
91 | @@ -0,0 +1,26 @@ | |||
92 | 1 | import QtQuick 2.0 | ||
93 | 2 | import "dateExt.js" as DateExt | ||
94 | 3 | import "dataService.js" as DataService | ||
95 | 4 | |||
96 | 5 | ListModel { | ||
97 | 6 | id: model | ||
98 | 7 | |||
99 | 8 | property var termStart: new Date() | ||
100 | 9 | property var termLength: Date.msPerDay | ||
101 | 10 | |||
102 | 11 | signal reload | ||
103 | 12 | |||
104 | 13 | onReload: { | ||
105 | 14 | var t0 = termStart.getTime() | ||
106 | 15 | var t1 = t0 + termLength | ||
107 | 16 | model.clear() | ||
108 | 17 | DataService.getEvents(t0, t1, model) | ||
109 | 18 | // for (var i = 0; i < model.count; ++i) | ||
110 | 19 | // DataService.printEvent(model.get(i)) | ||
111 | 20 | } | ||
112 | 21 | Component.onCompleted: { | ||
113 | 22 | reload() | ||
114 | 23 | DataService.eventsNotifier().dataChanged.connect(reload) | ||
115 | 24 | termStartChanged.connect(reload) | ||
116 | 25 | } | ||
117 | 26 | } | ||
118 | 0 | 27 | ||
119 | === modified file 'EventView.qml' | |||
120 | --- EventView.qml 2013-03-07 00:13:06 +0000 | |||
121 | +++ EventView.qml 2013-03-27 23:13:20 +0000 | |||
122 | @@ -1,6 +1,6 @@ | |||
123 | 1 | import QtQuick 2.0 | 1 | import QtQuick 2.0 |
124 | 2 | import Ubuntu.Components 0.1 | 2 | import Ubuntu.Components 0.1 |
126 | 3 | import "DateLib.js" as DateLib | 3 | import "dateExt.js" as DateExt |
127 | 4 | 4 | ||
128 | 5 | PathView { | 5 | PathView { |
129 | 6 | id: eventView | 6 | id: eventView |
130 | @@ -10,6 +10,11 @@ | |||
131 | 10 | signal incrementCurrentDay | 10 | signal incrementCurrentDay |
132 | 11 | signal decrementCurrentDay | 11 | signal decrementCurrentDay |
133 | 12 | 12 | ||
134 | 13 | property bool expanded: false | ||
135 | 14 | |||
136 | 15 | signal compress() | ||
137 | 16 | signal expand() | ||
138 | 17 | |||
139 | 13 | readonly property real visibleHeight: parent.height - y | 18 | readonly property real visibleHeight: parent.height - y |
140 | 14 | 19 | ||
141 | 15 | QtObject { | 20 | QtObject { |
142 | @@ -43,7 +48,7 @@ | |||
143 | 43 | 48 | ||
144 | 44 | path: Path { | 49 | path: Path { |
145 | 45 | startX: -eventView.width; startY: eventView.height / 2 | 50 | startX: -eventView.width; startY: eventView.height / 2 |
147 | 46 | PathLine { relativeX: eventView.width; relativeY: 0 } | 51 | PathLine { relativeX: eventView.width; relativeY: 0 } |
148 | 47 | PathLine { relativeX: eventView.width; relativeY: 0 } | 52 | PathLine { relativeX: eventView.width; relativeY: 0 } |
149 | 48 | PathLine { relativeX: eventView.width; relativeY: 0 } | 53 | PathLine { relativeX: eventView.width; relativeY: 0 } |
150 | 49 | } | 54 | } |
151 | @@ -52,21 +57,22 @@ | |||
152 | 52 | 57 | ||
153 | 53 | model: 3 | 58 | model: 3 |
154 | 54 | 59 | ||
157 | 55 | delegate: Rectangle { | 60 | delegate: DiaryView { |
158 | 56 | property var dayStart: { | 61 | id: diaryView |
159 | 62 | |||
160 | 63 | width: eventView.width | ||
161 | 64 | height: eventView.height | ||
162 | 65 | |||
163 | 66 | dayStart: { | ||
164 | 57 | if (index == intern.currentIndex) return intern.currentDayStart | 67 | if (index == intern.currentIndex) return intern.currentDayStart |
165 | 58 | var previousIndex = intern.currentIndex > 0 ? intern.currentIndex - 1 : 2 | 68 | var previousIndex = intern.currentIndex > 0 ? intern.currentIndex - 1 : 2 |
166 | 59 | if (index == previousIndex) return intern.currentDayStart.addDays(-1) | 69 | if (index == previousIndex) return intern.currentDayStart.addDays(-1) |
167 | 60 | return intern.currentDayStart.addDays(1) | 70 | return intern.currentDayStart.addDays(1) |
168 | 61 | } | 71 | } |
178 | 62 | width: eventView.width | 72 | |
179 | 63 | height: eventView.height | 73 | expanded: eventView.expanded |
180 | 64 | color: index == 0 ? "#FFFFFF" : index == 1 ? "#EEEEEE" : "#DDDDDD" | 74 | |
181 | 65 | Label { | 75 | onExpand: eventView.expand() |
182 | 66 | anchors.horizontalCenter: parent.horizontalCenter | 76 | onCompress: eventView.compress() |
174 | 67 | y: units.gu(4) | ||
175 | 68 | text: i18n.tr("No events for") + "\n" + Qt.formatDate(dayStart) | ||
176 | 69 | fontSize: "large" | ||
177 | 70 | } | ||
183 | 71 | } | 77 | } |
184 | 72 | } | 78 | } |
185 | 73 | 79 | ||
186 | === modified file 'MonthView.qml' | |||
187 | --- MonthView.qml 2013-03-18 20:39:06 +0000 | |||
188 | +++ MonthView.qml 2013-03-27 23:13:20 +0000 | |||
189 | @@ -1,6 +1,6 @@ | |||
190 | 1 | import QtQuick 2.0 | 1 | import QtQuick 2.0 |
191 | 2 | import Ubuntu.Components 0.1 | 2 | import Ubuntu.Components 0.1 |
193 | 3 | import "DateLib.js" as DateLib | 3 | import "dateExt.js" as DateExt |
194 | 4 | import "colorUtils.js" as Color | 4 | import "colorUtils.js" as Color |
195 | 5 | 5 | ||
196 | 6 | ListView { | 6 | ListView { |
197 | @@ -11,7 +11,8 @@ | |||
198 | 11 | readonly property var currentDayStart: intern.currentDayStart | 11 | readonly property var currentDayStart: intern.currentDayStart |
199 | 12 | 12 | ||
200 | 13 | property bool compressed: false | 13 | property bool compressed: false |
202 | 14 | property real compressedHeight: intern.squareUnit + intern.verticalMargin * 2 | 14 | readonly property real compressedHeight: intern.squareUnit + intern.verticalMargin * 2 |
203 | 15 | readonly property real expandedHeight: intern.squareUnit * 6 + intern.verticalMargin * 2 | ||
204 | 15 | 16 | ||
205 | 16 | signal incrementCurrentDay | 17 | signal incrementCurrentDay |
206 | 17 | signal decrementCurrentDay | 18 | signal decrementCurrentDay |
207 | @@ -90,7 +91,7 @@ | |||
208 | 90 | 91 | ||
209 | 91 | property int squareUnit: monthView.width / 8 | 92 | property int squareUnit: monthView.width / 8 |
210 | 92 | property int verticalMargin: units.gu(1) | 93 | property int verticalMargin: units.gu(1) |
212 | 93 | property int weekstartDay: Qt.locale().firstDayOfWeek | 94 | property int weekstartDay: Qt.locale(i18n.language).firstDayOfWeek |
213 | 94 | property int monthCount: 49 // months for +-2 years | 95 | property int monthCount: 49 // months for +-2 years |
214 | 95 | 96 | ||
215 | 96 | property var today: (new Date()).midnight() // TODO: update at midnight | 97 | property var today: (new Date()).midnight() // TODO: update at midnight |
216 | @@ -99,8 +100,13 @@ | |||
217 | 99 | property var monthStart0: today.monthStart() | 100 | property var monthStart0: today.monthStart() |
218 | 100 | } | 101 | } |
219 | 101 | 102 | ||
220 | 103 | <<<<<<< TREE | ||
221 | 102 | width: parent.width > 0 ? parent.width : 1 | 104 | width: parent.width > 0 ? parent.width : 1 |
222 | 103 | height: intern.squareUnit * 6 + intern.verticalMargin * 2 | 105 | height: intern.squareUnit * 6 + intern.verticalMargin * 2 |
223 | 106 | ======= | ||
224 | 107 | width: parent.width | ||
225 | 108 | height: compressed ? compressedHeight : expandedHeight | ||
226 | 109 | >>>>>>> MERGE-SOURCE | ||
227 | 104 | 110 | ||
228 | 105 | interactive: !compressed | 111 | interactive: !compressed |
229 | 106 | clip: true | 112 | clip: true |
230 | 107 | 113 | ||
231 | === added file 'avatar@8.png' | |||
232 | 108 | Binary files avatar@8.png 1970-01-01 00:00:00 +0000 and avatar@8.png 2013-03-27 23:13:20 +0000 differ | 114 | Binary files avatar@8.png 1970-01-01 00:00:00 +0000 and avatar@8.png 2013-03-27 23:13:20 +0000 differ |
233 | === removed file 'avatar@8.png' | |||
234 | 109 | Binary files avatar@8.png 2013-02-12 16:18:48 +0000 and avatar@8.png 1970-01-01 00:00:00 +0000 differ | 115 | Binary files avatar@8.png 2013-02-12 16:18:48 +0000 and avatar@8.png 1970-01-01 00:00:00 +0000 differ |
235 | === modified file 'calendar.qml' | |||
236 | --- calendar.qml 2013-03-18 11:39:23 +0000 | |||
237 | +++ calendar.qml 2013-03-27 23:13:20 +0000 | |||
238 | @@ -31,55 +31,47 @@ | |||
239 | 31 | onSelectedTabIndexChanged: monthView.gotoNextMonth(selectedTabIndex) | 31 | onSelectedTabIndexChanged: monthView.gotoNextMonth(selectedTabIndex) |
240 | 32 | } | 32 | } |
241 | 33 | 33 | ||
242 | 34 | Rectangle { | ||
243 | 35 | anchors.fill: monthView | ||
244 | 36 | color: "white" | ||
245 | 37 | } | ||
246 | 38 | |||
247 | 34 | MonthView { | 39 | MonthView { |
248 | 35 | id: monthView | 40 | id: monthView |
249 | 36 | onMonthStartChanged: tabs.selectedTabIndex = monthStart.getMonth() | 41 | onMonthStartChanged: tabs.selectedTabIndex = monthStart.getMonth() |
250 | 37 | y: pageArea.y | 42 | y: pageArea.y |
251 | 43 | onMovementEnded: eventView.currentDayStart = currentDayStart | ||
252 | 44 | onCurrentDayStartChanged: if (!(dragging || flicking)) eventView.currentDayStart = currentDayStart | ||
253 | 45 | Component.onCompleted: eventView.currentDayStart = currentDayStart | ||
254 | 38 | } | 46 | } |
255 | 39 | 47 | ||
256 | 40 | EventView { | 48 | EventView { |
257 | 41 | id: eventView | 49 | id: eventView |
258 | 50 | |||
259 | 42 | property real minY: pageArea.y + monthView.compressedHeight | 51 | property real minY: pageArea.y + monthView.compressedHeight |
261 | 43 | property real maxY: pageArea.y + monthView.height | 52 | property real maxY: pageArea.y + monthView.expandedHeight |
262 | 53 | |||
263 | 44 | y: maxY | 54 | y: maxY |
264 | 45 | width: mainView.width | 55 | width: mainView.width |
267 | 46 | height: parent.height - monthView.compressedHeight | 56 | height: parent.height - y |
268 | 47 | currentDayStart: monthView.currentDayStart | 57 | |
269 | 58 | expanded: monthView.compressed | ||
270 | 59 | |||
271 | 48 | Component.onCompleted: { | 60 | Component.onCompleted: { |
272 | 49 | incrementCurrentDay.connect(monthView.incrementCurrentDay) | 61 | incrementCurrentDay.connect(monthView.incrementCurrentDay) |
273 | 50 | decrementCurrentDay.connect(monthView.decrementCurrentDay) | 62 | decrementCurrentDay.connect(monthView.decrementCurrentDay) |
274 | 51 | } | 63 | } |
306 | 52 | MouseArea { | 64 | |
307 | 53 | id: drawer | 65 | onExpand: { |
308 | 54 | property bool compression: true | 66 | monthView.compressed = true |
309 | 55 | anchors.fill: parent | 67 | yBehavior.enabled = true |
310 | 56 | drag { | 68 | y = minY |
311 | 57 | axis: Drag.YAxis | 69 | } |
312 | 58 | target: eventView | 70 | onCompress: { |
313 | 59 | minimumY: monthView.y + monthView.compressedHeight | 71 | monthView.compressed = false |
314 | 60 | maximumY: monthView.y + monthView.height | 72 | y = maxY |
315 | 61 | onActiveChanged: { | 73 | } |
316 | 62 | if (compression) { | 74 | |
286 | 63 | if (drag.active) { | ||
287 | 64 | monthView.compressed = true | ||
288 | 65 | } | ||
289 | 66 | else { | ||
290 | 67 | yBehavior.enabled = true | ||
291 | 68 | eventView.y = Qt.binding(function() { return eventView.minY }) | ||
292 | 69 | compression = false | ||
293 | 70 | } | ||
294 | 71 | } | ||
295 | 72 | else { | ||
296 | 73 | if (drag.active) {} | ||
297 | 74 | else{ | ||
298 | 75 | eventView.y = Qt.binding(function() { return eventView.maxY }) | ||
299 | 76 | monthView.compressed = false | ||
300 | 77 | compression = true | ||
301 | 78 | } | ||
302 | 79 | } | ||
303 | 80 | } | ||
304 | 81 | } | ||
305 | 82 | } | ||
317 | 83 | Behavior on y { | 75 | Behavior on y { |
318 | 84 | id: yBehavior | 76 | id: yBehavior |
319 | 85 | enabled: false | 77 | enabled: false |
320 | 86 | 78 | ||
321 | === added file 'calendarTests.qml' | |||
322 | --- calendarTests.qml 1970-01-01 00:00:00 +0000 | |||
323 | +++ calendarTests.qml 2013-03-27 23:13:20 +0000 | |||
324 | @@ -0,0 +1,14 @@ | |||
325 | 1 | import QtQuick 2.0 | ||
326 | 2 | import Ubuntu.Components 0.1 | ||
327 | 3 | import "dataServiceTests.js" as DataServiceTests | ||
328 | 4 | |||
329 | 5 | MainView { | ||
330 | 6 | width: units.gu(20) | ||
331 | 7 | height: units.gu(20) | ||
332 | 8 | Button { | ||
333 | 9 | anchors.fill: parent | ||
334 | 10 | anchors.margins: units.gu(5) | ||
335 | 11 | text: "Close" | ||
336 | 12 | onClicked: Qt.quit() | ||
337 | 13 | } | ||
338 | 14 | } | ||
339 | 0 | 15 | ||
340 | === added file 'dataService.js' | |||
341 | --- dataService.js 1970-01-01 00:00:00 +0000 | |||
342 | +++ dataService.js 2013-03-27 23:13:20 +0000 | |||
343 | @@ -0,0 +1,361 @@ | |||
344 | 1 | .pragma library | ||
345 | 2 | |||
346 | 3 | .import QtQuick.LocalStorage 2.0 as LS | ||
347 | 4 | |||
348 | 5 | Array.prototype.append = function(x) { this.push(x) } | ||
349 | 6 | |||
350 | 7 | var CATEGORY_EVENT = 0 | ||
351 | 8 | var CATEGORY_TODO = 1 | ||
352 | 9 | |||
353 | 10 | function getEvents(termStart, termEnd, events) | ||
354 | 11 | { | ||
355 | 12 | var result = null | ||
356 | 13 | |||
357 | 14 | db().readTransaction( | ||
358 | 15 | function(tx) { | ||
359 | 16 | result = tx.executeSql('\ | ||
360 | 17 | select * from Event \ | ||
361 | 18 | where (? <= startTime and startTime < ?) or \ | ||
362 | 19 | (? < endTime and endTime <= ?) or \ | ||
363 | 20 | (startTime <= ? and ? <= endTime) \ | ||
364 | 21 | order by startTime', | ||
365 | 22 | [ termStart, termEnd, termStart, termEnd, termStart, termEnd ] | ||
366 | 23 | ) | ||
367 | 24 | } | ||
368 | 25 | ) | ||
369 | 26 | |||
370 | 27 | events = events || [] | ||
371 | 28 | |||
372 | 29 | for (var i = 0; i < result.rows.length; ++i) { | ||
373 | 30 | var e = result.rows.item(i) | ||
374 | 31 | e.startTime = new Date(e.startTime) | ||
375 | 32 | e.endTime = new Date(e.endTime) | ||
376 | 33 | events.append(e) | ||
377 | 34 | } | ||
378 | 35 | |||
379 | 36 | return events | ||
380 | 37 | } | ||
381 | 38 | |||
382 | 39 | function getAttendees(event, attendees) | ||
383 | 40 | { | ||
384 | 41 | var result = null; | ||
385 | 42 | |||
386 | 43 | db().readTransaction( | ||
387 | 44 | function(tx) { | ||
388 | 45 | result = tx.executeSql('\ | ||
389 | 46 | select c.* from Attendance a, Contact c \ | ||
390 | 47 | where a.eventId = ? and a.contactId = c.id \ | ||
391 | 48 | order by c.name', | ||
392 | 49 | [ event.id ] | ||
393 | 50 | ) | ||
394 | 51 | } | ||
395 | 52 | ) | ||
396 | 53 | |||
397 | 54 | attendees = attendees || [] | ||
398 | 55 | |||
399 | 56 | for (var i = 0; i < result.rows.length; ++i) | ||
400 | 57 | attendees.append(result.rows.item(i)) | ||
401 | 58 | |||
402 | 59 | return attendees | ||
403 | 60 | } | ||
404 | 61 | |||
405 | 62 | function addEvent(event) | ||
406 | 63 | { | ||
407 | 64 | var result = null | ||
408 | 65 | |||
409 | 66 | db().transaction( | ||
410 | 67 | function(tx) { | ||
411 | 68 | result = tx.executeSql('\ | ||
412 | 69 | insert into Event(title, message, startTime, endTime) \ | ||
413 | 70 | values (?, ?, ?, ?)', | ||
414 | 71 | [ event.title, event.message, event.startTime, event.endTime ] | ||
415 | 72 | ) | ||
416 | 73 | } | ||
417 | 74 | ) | ||
418 | 75 | |||
419 | 76 | event.id = result.insertId | ||
420 | 77 | |||
421 | 78 | eventsNotifier().dataChanged() | ||
422 | 79 | |||
423 | 80 | return event | ||
424 | 81 | } | ||
425 | 82 | |||
426 | 83 | function removeEvent(event) | ||
427 | 84 | { | ||
428 | 85 | db().transaction( | ||
429 | 86 | function(tx) { | ||
430 | 87 | tx.executeSql( | ||
431 | 88 | 'delete from Event where id = ?', | ||
432 | 89 | [ event.id ] | ||
433 | 90 | ) | ||
434 | 91 | tx.executeSql( | ||
435 | 92 | 'delete from Attendance where eventId = ?', | ||
436 | 93 | [ event.id ] | ||
437 | 94 | ) | ||
438 | 95 | tx.executeSql( | ||
439 | 96 | 'delete from Venue where eventId = ?', | ||
440 | 97 | [ event.id ] | ||
441 | 98 | ) | ||
442 | 99 | } | ||
443 | 100 | ) | ||
444 | 101 | |||
445 | 102 | delete event.id | ||
446 | 103 | |||
447 | 104 | eventsNotifier().dataChanged() | ||
448 | 105 | } | ||
449 | 106 | |||
450 | 107 | function getContacts(contacts) | ||
451 | 108 | { | ||
452 | 109 | var result = null | ||
453 | 110 | |||
454 | 111 | db().readTransaction( | ||
455 | 112 | function(tx) { | ||
456 | 113 | result = tx.executeSql('select * from Contact order by name') | ||
457 | 114 | } | ||
458 | 115 | ) | ||
459 | 116 | |||
460 | 117 | contacts = contacts || [] | ||
461 | 118 | |||
462 | 119 | for (var i = 0; i < result.rows.length; ++i) | ||
463 | 120 | contacts.append(result.rows.item(i)) | ||
464 | 121 | |||
465 | 122 | return contacts | ||
466 | 123 | } | ||
467 | 124 | |||
468 | 125 | function addAttendee(event, contact) | ||
469 | 126 | { | ||
470 | 127 | db().transaction( | ||
471 | 128 | function(tx) { | ||
472 | 129 | tx.executeSql( | ||
473 | 130 | 'insert into Attendance(eventId, contactId) values (?, ?)', | ||
474 | 131 | [ event.id, contact.id ] | ||
475 | 132 | ) | ||
476 | 133 | } | ||
477 | 134 | ) | ||
478 | 135 | } | ||
479 | 136 | |||
480 | 137 | function removeAttendee(event, contact) | ||
481 | 138 | { | ||
482 | 139 | db().transaction( | ||
483 | 140 | function(tx) { | ||
484 | 141 | tx.executeSql( | ||
485 | 142 | 'delete from Attendance where eventId = ? and contactId = ?', | ||
486 | 143 | [ event.id, contact.id ] | ||
487 | 144 | ) | ||
488 | 145 | } | ||
489 | 146 | ) | ||
490 | 147 | } | ||
491 | 148 | |||
492 | 149 | function getPlaces(places) | ||
493 | 150 | { | ||
494 | 151 | var result = null | ||
495 | 152 | |||
496 | 153 | db().readTransaction( | ||
497 | 154 | function(tx) { | ||
498 | 155 | result = tx.executeSql('select * from Place') | ||
499 | 156 | } | ||
500 | 157 | ) | ||
501 | 158 | |||
502 | 159 | places = places || [] | ||
503 | 160 | |||
504 | 161 | for (var i = 0; i < result.rows.length; ++i) | ||
505 | 162 | places.append(result.rows.item(i)) | ||
506 | 163 | |||
507 | 164 | return places | ||
508 | 165 | } | ||
509 | 166 | |||
510 | 167 | function addPlace(place) | ||
511 | 168 | { | ||
512 | 169 | var result = null | ||
513 | 170 | |||
514 | 171 | if (typeof place.address == 'undefined') place.address = null | ||
515 | 172 | if (typeof place.latitude == 'undefined') place.latitude = null | ||
516 | 173 | if (typeof place.longitude == 'undefined') place.longitude = null | ||
517 | 174 | |||
518 | 175 | db().transaction( | ||
519 | 176 | function(tx) { | ||
520 | 177 | result = tx.executeSql( | ||
521 | 178 | 'insert into Place(name, address, latitude, longitude) values(?, ?, ?, ?)', | ||
522 | 179 | [ place.name, place.address, place.latitude, place.longitude ] | ||
523 | 180 | ) | ||
524 | 181 | } | ||
525 | 182 | ) | ||
526 | 183 | |||
527 | 184 | place.id = result.insertId | ||
528 | 185 | |||
529 | 186 | return place | ||
530 | 187 | } | ||
531 | 188 | |||
532 | 189 | function removePlace(place) | ||
533 | 190 | { | ||
534 | 191 | db().transaction( | ||
535 | 192 | function(tx) { | ||
536 | 193 | tx.executeSql( | ||
537 | 194 | 'delete from Place where id = ?', | ||
538 | 195 | [ place.id ] | ||
539 | 196 | ) | ||
540 | 197 | tx.executeSql( | ||
541 | 198 | 'delete from Venue where placeId = ?', | ||
542 | 199 | [ place.id ] | ||
543 | 200 | ) | ||
544 | 201 | } | ||
545 | 202 | ) | ||
546 | 203 | |||
547 | 204 | delete place.id | ||
548 | 205 | } | ||
549 | 206 | |||
550 | 207 | function addVenue(event, place) | ||
551 | 208 | { | ||
552 | 209 | db().transaction( | ||
553 | 210 | function(tx) { | ||
554 | 211 | tx.executeSql( | ||
555 | 212 | 'insert into Venue(eventId, placeId) values(?, ?)', | ||
556 | 213 | [ event.id, place.id ] | ||
557 | 214 | ) | ||
558 | 215 | } | ||
559 | 216 | ) | ||
560 | 217 | } | ||
561 | 218 | |||
562 | 219 | function removeVenue(event, place) | ||
563 | 220 | { | ||
564 | 221 | db().transaction( | ||
565 | 222 | function(tx) { | ||
566 | 223 | tx.executeSql( | ||
567 | 224 | 'delete from Venue where eventId = ? and placeId = ?', | ||
568 | 225 | [ event.id, place.id ] | ||
569 | 226 | ) | ||
570 | 227 | } | ||
571 | 228 | ) | ||
572 | 229 | } | ||
573 | 230 | |||
574 | 231 | function getVenues(event, venues) | ||
575 | 232 | { | ||
576 | 233 | var result = null | ||
577 | 234 | |||
578 | 235 | db().readTransaction( | ||
579 | 236 | function(tx) { | ||
580 | 237 | result = tx.executeSql('\ | ||
581 | 238 | select p.* \ | ||
582 | 239 | from Venue v, Place p \ | ||
583 | 240 | where v.eventId = ? and p.id = v.placeId \ | ||
584 | 241 | order by p.name', | ||
585 | 242 | [ event.id ] | ||
586 | 243 | ) | ||
587 | 244 | } | ||
588 | 245 | ) | ||
589 | 246 | |||
590 | 247 | venues = venues || [] | ||
591 | 248 | |||
592 | 249 | for (var i = 0; i < result.rows.length; ++i) | ||
593 | 250 | venues.append(result.rows.item(i)) | ||
594 | 251 | |||
595 | 252 | return venues | ||
596 | 253 | } | ||
597 | 254 | |||
598 | 255 | function printEvent(event) | ||
599 | 256 | { | ||
600 | 257 | console.log('Event', event) | ||
601 | 258 | console.log(' id:', event.id) | ||
602 | 259 | console.log(' title:', event.title) | ||
603 | 260 | console.log(' message:', event.message) | ||
604 | 261 | console.log(' startTime:', new Date(event.startTime).toLocaleString()) | ||
605 | 262 | console.log(' endTime:', new Date(event.endTime).toLocaleString()) | ||
606 | 263 | |||
607 | 264 | var attendees = [] | ||
608 | 265 | var venues = [] | ||
609 | 266 | getAttendees(event, attendees) | ||
610 | 267 | getVenues(event, venues) | ||
611 | 268 | for (var j = 0; j < attendees.length; ++j) | ||
612 | 269 | printContact(attendees[j]) | ||
613 | 270 | for (var j = 0; j < venues.length; ++j) | ||
614 | 271 | printPlace(venues[j]) | ||
615 | 272 | console.log('') | ||
616 | 273 | } | ||
617 | 274 | |||
618 | 275 | function printContact(contact) | ||
619 | 276 | { | ||
620 | 277 | console.log('Contact', contact) | ||
621 | 278 | console.log(' id:', contact.id) | ||
622 | 279 | console.log(' name:', contact.name) | ||
623 | 280 | console.log(' surname:', contact.surname) | ||
624 | 281 | console.log(' avatar:', contact.avatar) | ||
625 | 282 | } | ||
626 | 283 | |||
627 | 284 | function printPlace(place) | ||
628 | 285 | { | ||
629 | 286 | console.log('Place', place) | ||
630 | 287 | console.log(' name:', place.name) | ||
631 | 288 | console.log(' address:', place.address) | ||
632 | 289 | console.log(' latitude:', place.latitude) | ||
633 | 290 | console.log(' longitude:', place.longitude) | ||
634 | 291 | } | ||
635 | 292 | |||
636 | 293 | function __createFirstTime(tx) | ||
637 | 294 | { | ||
638 | 295 | var schema = '\ | ||
639 | 296 | create table Event(\ | ||
640 | 297 | id integer primary key,\ | ||
641 | 298 | title text,\ | ||
642 | 299 | message text,\ | ||
643 | 300 | startTime integer,\ | ||
644 | 301 | endTime integer,\ | ||
645 | 302 | category text default "Events"\ | ||
646 | 303 | );\ | ||
647 | 304 | \ | ||
648 | 305 | create index EventStartTimeIndex on Event(startTime);\ | ||
649 | 306 | create index EventEndTimeIndex on Event(endTime);\ | ||
650 | 307 | \ | ||
651 | 308 | create table Place(\ | ||
652 | 309 | id integer primary key,\ | ||
653 | 310 | name text,\ | ||
654 | 311 | address text,\ | ||
655 | 312 | latitude real,\ | ||
656 | 313 | longitude real\ | ||
657 | 314 | );\ | ||
658 | 315 | \ | ||
659 | 316 | create table Contact(\ | ||
660 | 317 | id integer primary key,\ | ||
661 | 318 | name text,\ | ||
662 | 319 | surname text,\ | ||
663 | 320 | avatar text\ | ||
664 | 321 | );\ | ||
665 | 322 | \ | ||
666 | 323 | create table Attendance(\ | ||
667 | 324 | id integer primary key,\ | ||
668 | 325 | eventId integer references Event(id) on delete cascade,\ | ||
669 | 326 | contactId integer references Contact(id) on delete cascade,\ | ||
670 | 327 | placeId integer references Place(id) on delete set null\ | ||
671 | 328 | );\ | ||
672 | 329 | \ | ||
673 | 330 | create table Venue(\ | ||
674 | 331 | id integer primary key,\ | ||
675 | 332 | eventId integer references Event(id) on delete cascade,\ | ||
676 | 333 | placeId integer references Place(id) on delete cascade\ | ||
677 | 334 | );\ | ||
678 | 335 | \ | ||
679 | 336 | '.split(';') | ||
680 | 337 | |||
681 | 338 | for (var i = 0; i < schema.length; ++i) { | ||
682 | 339 | var sql = schema[i] | ||
683 | 340 | if (sql != "") { | ||
684 | 341 | console.log(sql) | ||
685 | 342 | tx.executeSql(sql) | ||
686 | 343 | } | ||
687 | 344 | } | ||
688 | 345 | } | ||
689 | 346 | |||
690 | 347 | function eventsNotifier() | ||
691 | 348 | { | ||
692 | 349 | if (!eventsNotifier.hasOwnProperty("instance")) | ||
693 | 350 | eventsNotifier.instance = Qt.createQmlObject('import QtQuick 2.0; QtObject { signal dataChanged }', Qt.application, 'DataService.eventsNotifier()') | ||
694 | 351 | return eventsNotifier.instance | ||
695 | 352 | } | ||
696 | 353 | |||
697 | 354 | function db() | ||
698 | 355 | { | ||
699 | 356 | if (!db.hasOwnProperty("instance")) { | ||
700 | 357 | db.instance = LS.LocalStorage.openDatabaseSync("Calendar", "", "Offline Calendar", 100000) | ||
701 | 358 | if (db.instance.version == "") db.instance.changeVersion("", "0.1", __createFirstTime) | ||
702 | 359 | } | ||
703 | 360 | return db.instance | ||
704 | 361 | } | ||
705 | 0 | 362 | ||
706 | === added file 'dataServiceTests.js' | |||
707 | --- dataServiceTests.js 1970-01-01 00:00:00 +0000 | |||
708 | +++ dataServiceTests.js 2013-03-27 23:13:20 +0000 | |||
709 | @@ -0,0 +1,192 @@ | |||
710 | 1 | .pragma library | ||
711 | 2 | .import "dateExt.js" as DateExt | ||
712 | 3 | .import "dataService.js" as DataService | ||
713 | 4 | |||
714 | 5 | function clearData(tx) { | ||
715 | 6 | var deletes = '\ | ||
716 | 7 | delete from Event;\ | ||
717 | 8 | delete from Place;\ | ||
718 | 9 | delete from Contact;\ | ||
719 | 10 | delete from Attendance;\ | ||
720 | 11 | delete from Venue\ | ||
721 | 12 | '.split(';') | ||
722 | 13 | for (var i = 0; i < deletes.length; ++i) | ||
723 | 14 | tx.executeSql(deletes[i]) | ||
724 | 15 | } | ||
725 | 16 | |||
726 | 17 | function loadTestDataSimple(tx) | ||
727 | 18 | { | ||
728 | 19 | clearData(tx) | ||
729 | 20 | |||
730 | 21 | var inserts = '\ | ||
731 | 22 | insert into Contact(id, name, surname) values (1, "John", "Smith");\ | ||
732 | 23 | insert into Contact(id, name, surname) values (2, "Jane", "Smith");\ | ||
733 | 24 | insert into Contact(id, name, surname, avatar) values (3, "Frank", "Mertens", "http://www.gravatar.com/avatar/6d96fd4a98bba7b8779661d5db391ab6");\ | ||
734 | 25 | insert into Contact(id, name, surname) values (4, "Kunal", "Parmar");\ | ||
735 | 26 | insert into Contact(id, name, surname) values (5, "Mario", "Boikov");\ | ||
736 | 27 | insert into Place(id, name, address) values (1, "Quan Sen", "Pasing Arcaden, München");\ | ||
737 | 28 | insert into Place(id, name, address) values (2, "Jashan", "Landsberger Straße 84, 82110 Germering");\ | ||
738 | 29 | insert into Place(id, name, latitude, longitude) values (3, "Café Moskau", 52.521339, 13.42279);\ | ||
739 | 30 | insert into Place(id, name, address) values (4, "Santa Clara Marriott", "2700 Mission College Boulevard, Santa Clara, California");\ | ||
740 | 31 | insert into Place(id, name, address) values (5, "embeddedworld", "Messezentrum, 90471 Nürnberg");\ | ||
741 | 32 | insert into Event(id, title, message, startTime, endTime) values (1, "Team Meeting", "Bring your gear...", 1364648400000, 1364650200000);\ | ||
742 | 33 | insert into Event(id, title, message, startTime, endTime) values (2, "Jane\'s Birthday Party", "this year: southern wine", 1364061600000, 1364068800000);\ | ||
743 | 34 | insert into Event(id, title, startTime, endTime) values (3, "embeddedworld 2013", 1361836800000, 1362009600000);\ | ||
744 | 35 | insert into Attendance(eventId, contactId, placeId) values (1, 1, 1);\ | ||
745 | 36 | insert into Attendance(eventId, contactId, placeId) values (1, 2, 1);\ | ||
746 | 37 | insert into Attendance(eventId, contactId, placeId) values (1, 3, 1);\ | ||
747 | 38 | insert into Attendance(eventId, contactId, placeId) values (1, 4, 3);\ | ||
748 | 39 | insert into Attendance(eventId, contactId, placeId) values (1, 5, 3);\ | ||
749 | 40 | insert into Attendance(eventId, contactId) values (2, 1);\ | ||
750 | 41 | insert into Attendance(eventId, contactId) values (2, 2);\ | ||
751 | 42 | insert into Attendance(eventId, contactId) values (2, 3);\ | ||
752 | 43 | insert into Venue(eventId, placeId) values (2, 3);\ | ||
753 | 44 | insert into Venue(eventId, placeId) values (3, 5)\ | ||
754 | 45 | '.split(';') | ||
755 | 46 | |||
756 | 47 | for (var i = 0; i < inserts.length; ++i) { | ||
757 | 48 | var sql = inserts[i] | ||
758 | 49 | if (sql != "") { | ||
759 | 50 | console.log(sql) | ||
760 | 51 | tx.executeSql(sql) | ||
761 | 52 | } | ||
762 | 53 | } | ||
763 | 54 | } | ||
764 | 55 | |||
765 | 56 | function loadTestDataComplex(tx) | ||
766 | 57 | { | ||
767 | 58 | clearData(tx) | ||
768 | 59 | |||
769 | 60 | function t(d, h, m) { | ||
770 | 61 | if (typeof t.today == "undefined") t.today = new Date().midnight() | ||
771 | 62 | return t.today.addDays(d).setHours(h, m) | ||
772 | 63 | } | ||
773 | 64 | |||
774 | 65 | var places = [ | ||
775 | 66 | { id: 1, name: "Moskau A" }, | ||
776 | 67 | { id: 2, name: "Moskau B" }, | ||
777 | 68 | { id: 3, name: "Bischkek" }, | ||
778 | 69 | { id: 4, name: "Asgabat A" }, | ||
779 | 70 | { id: 5, name: "Asgabat B" }, | ||
780 | 71 | { id: 6, name: "Vilnius" }, | ||
781 | 72 | { id: 7, name: "Riga" } | ||
782 | 73 | ] | ||
783 | 74 | |||
784 | 75 | var speaker = [ | ||
785 | 76 | { id: 1, name: "Sean", surname: "Harmer" }, | ||
786 | 77 | { id: 2, name: "Marc", surname: "Lutz" }, | ||
787 | 78 | { id: 3, name: "David", surname: "Faure" }, | ||
788 | 79 | { id: 4, name: "Volker", surname: "Krause" }, | ||
789 | 80 | { id: 5, name: "Kevin", surname: "Krammer" }, | ||
790 | 81 | { id: 6, name: "Tobias", surname: "Nätterlund" }, | ||
791 | 82 | { id: 7, name: "Steffen", surname: "Hansen" }, | ||
792 | 83 | { id: 8, name: "Tommi", surname: "Laitinen" }, | ||
793 | 84 | { id: 9, name: "Lars", surname: "Knoll" }, | ||
794 | 85 | { id: 10, name: "Roland", surname: "Krause" }, | ||
795 | 86 | { id: 11, name: "Jens", surname: "Bache-Wiig" }, | ||
796 | 87 | { id: 12, name: "Michael", surname: "Wagner" }, | ||
797 | 88 | { id: 13, name: "Helmut", surname: "Sedding" }, | ||
798 | 89 | { id: 14, name: "Jeff", surname: "Tranter" }, | ||
799 | 90 | { id: 15, name: "Simon", surname: "Hausmann" }, | ||
800 | 91 | { id: 16, name: "Stephen", surname: "Kelly" }, | ||
801 | 92 | { id: 17, name: "Tam", surname: "Hanna" }, | ||
802 | 93 | { id: 18, name: "Mirko", surname: "Boehm" }, | ||
803 | 94 | { id: 19, name: "Till", surname: "Adam" }, | ||
804 | 95 | { id: 20, name: "Thomas", surname: "Senyk" } | ||
805 | 96 | ] | ||
806 | 97 | |||
807 | 98 | var events = [ | ||
808 | 99 | { id: 1, room: 1, speaker: [ 1 ], title: "Modern OpenGL with Qt5", message: "hands-on training", startTime: t(0, 10, 00), endTime: t(0, 12 ,00) }, | ||
809 | 100 | { id: 2, room: 2, speaker: [ 2 ], title: "What's new in C++11", message: "focus on Qt5", startTime: t(0, 13, 00), endTime: t(0, 14, 30) }, | ||
810 | 101 | { id: 3, room: 3, speaker: [ 3 ], title: "Model/view Programming using Qt", message: "hands-on training", startTime: t(0, 14, 45), endTime: t(0, 16, 15) }, | ||
811 | 102 | { id: 4, room: 4, speaker: [ 4 ], title: "Introduction to Qt Quick", message: "hands-on training", startTime: t(0, 16, 30), endTime: t(0, 17, 45) }, | ||
812 | 103 | { id: 5, room: 1, speaker: [ 8 ], title: "Keynote: Qt – Gearing up for the Future", message: "", startTime: t(1, 9, 15), endTime: t(1, 9, 30) }, | ||
813 | 104 | { id: 6, room: 1, speaker: [ 9 ], title: "Keynote: Qt 5 Roadmap", message: "", startTime: t(1, 9, 30), endTime: t(1, 10, 30) }, | ||
814 | 105 | { id: 7, room: 3, speaker: [ 10 ], title: "Qt and the Google APIs", message: "", startTime: t(1, 10, 45), endTime: t(1, 11, 45) }, | ||
815 | 106 | { id: 8, room: 7, speaker: [ 11 ], title: "Desktop Components for QtQuick", message: "", startTime: t(1, 10, 45), endTime: t(1, 11, 45) }, | ||
816 | 107 | { id: 9, room: 2, speaker: [ 9 ], title: "The Future of Qt on Embedded Linux", message: "", startTime: t(1, 12, 45), endTime: t(1, 13, 45) }, | ||
817 | 108 | { id: 10, room: 7, speaker: [ 12, 13 ], title: "QML for desktop apps", message: "", startTime: t(1, 12, 45), endTime: t(1, 13, 34) }, | ||
818 | 109 | { id: 11, room: 2, speaker: [ 14 ], title: "Qt on Raspberry Pi", message: "", startTime: t(1, 14, 00), endTime: t(1, 15, 00) }, | ||
819 | 110 | { id: 12, room: 3, speaker: [ 15 ], title: "What's new in QtWebKit in 5.0", message: "", startTime: t(1, 14, 00), endTime: t(1, 15, 00) }, | ||
820 | 111 | { id: 13, room: 1, speaker: [ 16 ], title: "In Depth – QMetaType and QMetaObject", message: "", startTime: t(1, 15, 30), endTime: t(1, 16, 30) }, | ||
821 | 112 | { id: 14, room: 2, speaker: [ 17 ], title: "Using Qt as mobile cross-platform system", message: "", startTime: t(1, 15, 30), endTime: t(1, 16, 30) }, | ||
822 | 113 | { id: 15, room: 1, speaker: [ 18, 19 ], title: "Intentions good, warranty void: Using Qt in unexpected ways", message: "", startTime: t(1, 16, 45), endTime: t(1, 17, 45) }, | ||
823 | 114 | { id: 16, room: 2, speaker: [ 20 ], title: "Porting Qt 5 to embedded hardware", message: "", startTime: t(1, 16, 45), endTime: t(1, 17, 45) } | ||
824 | 115 | ] | ||
825 | 116 | |||
826 | 117 | for (var i = 0; i < places.length; ++i) { | ||
827 | 118 | var p = places[i] | ||
828 | 119 | tx.executeSql( | ||
829 | 120 | 'insert into Place(id, name, address) values (?, ?, ?)', | ||
830 | 121 | [ p.id, p.name, "Cafe Moskau, Berlin, Germany" ] | ||
831 | 122 | ) | ||
832 | 123 | } | ||
833 | 124 | |||
834 | 125 | for (var i = 0; i < speaker.length; ++i) { | ||
835 | 126 | var s = speaker[i] | ||
836 | 127 | tx.executeSql( | ||
837 | 128 | 'insert into Contact(id, name, surname) values (?, ?, ?)', | ||
838 | 129 | [ s.id, s.name, s.surname ] | ||
839 | 130 | ) | ||
840 | 131 | } | ||
841 | 132 | |||
842 | 133 | for (var i = 0; i < events.length; ++i) { | ||
843 | 134 | var e = events[i] | ||
844 | 135 | tx.executeSql( | ||
845 | 136 | 'insert into Event(id, title, message, startTime, endTime) values (?, ?, ?, ?, ?)', | ||
846 | 137 | [ e.id, e.title, e.message, e.startTime, e.endTime ] | ||
847 | 138 | ) | ||
848 | 139 | tx.executeSql( | ||
849 | 140 | 'insert into Venue(eventId, placeId) values (?, ?)', | ||
850 | 141 | [ e.id, e.room ] | ||
851 | 142 | ) | ||
852 | 143 | for (var j = 0; j < e.speaker.length; ++j) { | ||
853 | 144 | tx.executeSql( | ||
854 | 145 | 'insert into Attendance(eventId, contactId) values (?, ?)', | ||
855 | 146 | [ e.id, e.speaker[j] ] | ||
856 | 147 | ) | ||
857 | 148 | } | ||
858 | 149 | } | ||
859 | 150 | } | ||
860 | 151 | |||
861 | 152 | function runTestSimple(tx) | ||
862 | 153 | { | ||
863 | 154 | loadTestDataSimple(tx) | ||
864 | 155 | |||
865 | 156 | var contacts = [] | ||
866 | 157 | DataService.getContacts(contacts) | ||
867 | 158 | for (var i = 0; i < contacts.length; ++i) | ||
868 | 159 | DataService.printContact(contacts[i]) | ||
869 | 160 | console.log('') | ||
870 | 161 | |||
871 | 162 | var testEvent = DataService.addEvent({ | ||
872 | 163 | title: 'Critical Review', | ||
873 | 164 | message: '', | ||
874 | 165 | startTime: new Date(2013, 2, 30, 10, 00).getTime(), | ||
875 | 166 | endTime: new Date(2013, 2, 30, 10, 30).getTime() | ||
876 | 167 | }) | ||
877 | 168 | DataService.addAttendee(testEvent, contacts[1]) | ||
878 | 169 | DataService.addAttendee(testEvent, contacts[2]) | ||
879 | 170 | DataService.addAttendee(testEvent, contacts[0]) | ||
880 | 171 | DataService.removeAttendee(testEvent, contacts[0]) | ||
881 | 172 | var testPlace = DataService.addPlace({ name: 'Jane\'s bar' }) | ||
882 | 173 | DataService.addVenue(testEvent, testPlace) | ||
883 | 174 | console.log('Added new event with id', testEvent.id) | ||
884 | 175 | console.log('') | ||
885 | 176 | |||
886 | 177 | var events = [] | ||
887 | 178 | var dayStart = new Date(2013, 2, 30) | ||
888 | 179 | DataService.getEvents(dayStart.getTime(), dayStart.addDays(1).getTime(), events) | ||
889 | 180 | for (var i = 0; i < events.length; ++i) | ||
890 | 181 | DataService.printEvent(events[i]) | ||
891 | 182 | |||
892 | 183 | DataService.removeEvent(testEvent) | ||
893 | 184 | DataService.removePlace(testPlace) | ||
894 | 185 | } | ||
895 | 186 | |||
896 | 187 | DataService.db().transaction( | ||
897 | 188 | function (tx) { | ||
898 | 189 | runTestSimple(tx) | ||
899 | 190 | loadTestDataComplex(tx) | ||
900 | 191 | } | ||
901 | 192 | ) | ||
902 | 0 | 193 | ||
903 | === renamed file 'DateLib.js' => 'dateExt.js' | |||
904 | === added file 'icon-contacts@8.png' | |||
905 | 1 | Binary files icon-contacts@8.png 1970-01-01 00:00:00 +0000 and icon-contacts@8.png 2013-03-27 23:13:20 +0000 differ | 194 | Binary files icon-contacts@8.png 1970-01-01 00:00:00 +0000 and icon-contacts@8.png 2013-03-27 23:13:20 +0000 differ |
906 | === added file 'icon-location@18.png' | |||
907 | 2 | Binary files icon-location@18.png 1970-01-01 00:00:00 +0000 and icon-location@18.png 2013-03-27 23:13:20 +0000 differ | 195 | Binary files icon-location@18.png 1970-01-01 00:00:00 +0000 and icon-location@18.png 2013-03-27 23:13:20 +0000 differ |
PASSED: Continuous integration, rev:10 91.189. 93.125: 8080/job/ ubuntu- calendar- app-ci/ 4/ 91.189. 93.125: 8080/job/ ubuntu- calendar- app-quantal- amd64-ci/ 4/console 91.189. 93.125: 8080/job/ ubuntu- calendar- app-raring- amd64-ci/ 4/console
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild: 91.189. 93.125: 8080/job/ ubuntu- calendar- app-ci/ 4/rebuild
http://