~mihirsoni/ubuntu-calendar-app/dateSelectNewEventTest

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import QtQuick 2.0
import "dateExt.js" as DateExt
import "dataService.js" as DataService

ListModel {
    id: model

    property var termStart: new Date()
    property var termLength: Date.msPerDay

    signal reload

    onReload: {
        var t0 = termStart.getTime()
        var t1 = t0 + termLength
        model.clear()
        DataService.getEvents(t0, t1, model)
        // for (var i = 0; i < model.count; ++i)
        //     DataService.printEvent(model.get(i))
    }
    Component.onCompleted: {
        reload()
        DataService.eventsNotifier().dataChanged.connect(reload)
        termStartChanged.connect(reload)
    }
}