tangled
alpha
login
or
join now
dzming.li
/
noctalia-plugins
0
fork
atom
Personal noctalia plugins collection
0
fork
atom
overview
issues
pulls
pipelines
Reduce calendar flicker and widen EDS fetch window
Dzming Li
2 weeks ago
45fa65b4
e3b99279
+18
-7
1 changed file
expand all
collapse all
unified
split
weekly-calendar
Main.qml
+18
-7
weekly-calendar/Main.qml
···
15
15
property var overlappingEventsData: ({})
16
16
property bool isLoading: false
17
17
property bool hasLoadedOnce: false
18
18
+
// Defer UI refresh until CalendarService finishes loading to avoid flicker
19
19
+
property bool pendingEventsUpdate: false
18
20
property string syncStatus: ""
19
21
property int lastKnownEventCount: 0
20
22
···
80
82
return
81
83
}
82
84
lastKnownEventCount = Math.max(lastKnownEventCount, count)
83
83
-
Qt.callLater(updateEventsFromService)
85
85
+
if (CalendarService.loading) {
86
86
+
pendingEventsUpdate = true
87
87
+
} else {
88
88
+
Qt.callLater(updateEventsFromService)
89
89
+
}
84
90
}
85
91
function onLoadingChanged() {
86
92
if (!CalendarService.loading && isLoading) {
93
93
+
pendingEventsUpdate = false
94
94
+
Qt.callLater(updateEventsFromService)
95
95
+
} else if (!CalendarService.loading && pendingEventsUpdate) {
96
96
+
pendingEventsUpdate = false
87
97
Qt.callLater(updateEventsFromService)
88
98
}
89
99
}
···
177
187
}
178
188
179
189
isLoading = true
190
190
+
pendingEventsUpdate = false
180
191
syncStatus = pluginApi.tr("panel.loading")
181
192
182
182
-
// Request a wide range: 180 days behind, 60 days ahead
183
183
-
// This covers ~6 months of past events and ~2 months of future events
184
184
-
var daysAhead = 60
185
185
-
var daysBehind = 180
193
193
+
// Request a wider range: 365 days behind, 365 days ahead
194
194
+
// Covers roughly a full year in both directions so future months stay populated
195
195
+
var daysAhead = 365
196
196
+
var daysBehind = 365
186
197
187
198
CalendarService.loadEvents(daysAhead, daysBehind)
188
199
···
239
250
var overlapsWeek = eventStart < weekEndDate && eventEnd > weekStartDate
240
251
241
252
if (overlapsWeek) {
242
242
-
var key = event.uid + "-" + event.start + "-" + event.end + i
253
253
+
var key = event.uid + "-" + event.start + "-" + event.end
243
254
if (eventObj.allDay) {
244
255
if (!uniqueAllDayEvents[key]) {
245
256
uniqueAllDayEvents[key] = true
···
837
848
"--task-list", taskListUid, "--uid", todoUid, "--action", "delete"]
838
849
updateTodoProcess.running = true
839
850
}
840
840
-
}
851
851
+
}