~renatofilho/ubuntu-calendar-app/optimize

« back to all changes in this revision

Viewing changes to TimeLineBaseComponent.qml

  • Committer: Renato Araujo Oliveira Filho
  • Date: 2016-02-24 12:53:33 UTC
  • Revision ID: renato.filho@canonical.com-20160224125333-frk6dsnncxj8oihq
Wait 1sec before do the model query in week view and day view.

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
    property bool isActive: false
35
35
    property alias contentY: timeLineView.contentY
36
36
    property alias contentInteractive: timeLineView.interactive
37
 
    property alias modelFilter: mainModel.filter
 
37
    property var modelFilter: invalidFilter
38
38
    property var selectedDay;
39
39
 
40
40
    readonly property real hourItemHeight: units.gu(8)
116
116
        }
117
117
    }
118
118
 
 
119
    Timer {
 
120
        id: idleRefresh
 
121
 
 
122
        function reset()
 
123
        {
 
124
            mainModel.filter = invalidFilter
 
125
            restart()
 
126
        }
 
127
 
 
128
        interval: 1000
 
129
        repeat: false
 
130
        onTriggered: {
 
131
            mainModel.filter = Qt.binding(function() { return root.modelFilter} )
 
132
        }
 
133
    }
 
134
 
 
135
    InvalidFilter {
 
136
        id: invalidFilter
 
137
    }
 
138
 
119
139
    EventListModel {
120
140
        id: mainModel
121
141
 
122
142
        startPeriod: startDay.midnight();
123
143
        endPeriod: type == ViewType.ViewTypeWeek ? startPeriod.addDays(7).endOfDay(): startPeriod.endOfDay()
124
 
    }
 
144
        filter: invalidFilter
 
145
        onStartPeriodChanged: idleRefresh.reset()
 
146
        onEndPeriodChanged: idleRefresh.reset()
 
147
   }
125
148
 
126
149
    ActivityIndicator {
127
150
        id: activityLoader