~pkunal-parmar/ubuntu-calendar-app/Minor-Performance

7.2.1 by Frank Mertens
Work in progress: building up a "data service"
1
import QtQuick 2.0
7.2.2 by Frank Mertens
Added test application calendarTests.qml and improved the data service.
2
import "dateExt.js" as DateExt
7.2.1 by Frank Mertens
Work in progress: building up a "data service"
3
import "dataService.js" as DataService
4
5
ListModel {
7.2.3 by Frank Mertens
Added the EventListModel to support the display of event lists.
6
    id: model
7
8
    property var termStart: new Date()
9
    property var termLength: Date.msPerDay
10
7.2.1 by Frank Mertens
Work in progress: building up a "data service"
11
    signal reload
7.2.3 by Frank Mertens
Added the EventListModel to support the display of event lists.
12
7.2.1 by Frank Mertens
Work in progress: building up a "data service"
13
    onReload: {
7.2.3 by Frank Mertens
Added the EventListModel to support the display of event lists.
14
        var t0 = termStart.getTime()
15
        var t1 = t0 + termLength
16
        model.clear()
17
        DataService.getEvents(t0, t1, model)
18
        console.log("termStart, t0, t1, count =", termStart, t0, t1, count)
7.2.4 by Frank Mertens
Added more complex test case in preparation for integration of the diary view.
19
        // for (var i = 0; i < model.count; ++i)
20
        //     DataService.printEvent(model.get(i))
7.2.1 by Frank Mertens
Work in progress: building up a "data service"
21
    }
22
    Component.onCompleted: {
23
        reload()
24
        DataService.eventsNotifier.dataChanged.connect(reload)
7.2.3 by Frank Mertens
Added the EventListModel to support the display of event lists.
25
        termStartChanged.connect(reload)
7.2.1 by Frank Mertens
Work in progress: building up a "data service"
26
    }
27
}