2
* Copyright (C) 2013-2014 Canonical Ltd
4
* This file is part of Ubuntu Calendar App
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.
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.
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/>.
2
import "dateExt.js" as DateExt
19
4
import QtOrganizer 5.0
6
//http://qt.gitorious.org/qt/qtpim/blobs/master/examples/organizer/qmlorganizerlistview/qmlorganizerlistview.qml
25
property var listeners:[];
26
property bool isLoading: false
28
function addModelChangeListener(listener){
29
listeners.push(listener);
32
function removeModelChangeListener(listener) {
33
var i = listeners.indexOf(listener);
35
listeners.splice(i, 1);
39
function getItems(startDate, endDate){
40
return itemsByTimePeriod(startDate,endDate);
43
function startLoadingTimer() {
44
var newObject = Qt.createQmlObject("import QtQuick 2.3; Timer {interval: 1000; running: true; repeat: false;}",
45
eventModel, "EventListMode.qml");
46
newObject.onTriggered.connect( function(){
47
var items = getItems(eventModel.startPeriod, eventModel.endPeriod);
48
if( isLoading == true && items.length === 0) {
59
if(listeners === undefined){
62
for(var i=0; i < listeners.length ;++i){
67
function getCollections(){
69
var collections = eventModel.collections;
70
for(var i = 0 ; i < collections.length ; ++i) {
71
var cal = collections[i];
72
if( cal.extendedMetaData("collection-type") === "Calendar" ) {
79
onStartPeriodChanged: {