Fix PlasmaCalendar widget to not mark days with minor events
ClosedPublic

Authored by kossebau on Apr 22 2018, 10:20 AM.

Details

Summary

CalendarEvents::EventData (in KDeclarative) has a property isMinor, which is
described as "If set to true, it won't be marked in the calendar grid".

This patch fulfils that promise, by introducing separate roles on the model
which explicitly report the existance of any major or any minor events at a
given day, so that the marker loader can concentrate on the major events.

Test Plan

Using a plasmacalendar plugin which feeds events with isMinor=true the
widget now only marks days which have major events.

Diff Detail

Repository
R242 Plasma Framework (Library)
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
kossebau created this revision.Apr 22 2018, 10:20 AM
Restricted Application added a project: Frameworks. · View Herald TranscriptApr 22 2018, 10:20 AM
Restricted Application added a subscriber: Frameworks. · View Herald Transcript
kossebau requested review of this revision.Apr 22 2018, 10:20 AM
broulik accepted this revision.May 2 2018, 12:14 PM
broulik added a subscriber: broulik.

address comment then ship it

src/declarativeimports/calendar/daysmodel.cpp
223

std::find_if

This revision is now accepted and ready to land.May 2 2018, 12:14 PM
davidedmundson accepted this revision.May 2 2018, 12:15 PM
davidedmundson added a subscriber: davidedmundson.
davidedmundson added inline comments.
src/declarativeimports/calendar/qml/DayDelegate.qml
105

surely this should be model !== undefined && model.contains

otherwise we're doing a filter twice.

kossebau marked an inline comment as done.May 2 2018, 3:25 PM
kossebau added inline comments.
src/declarativeimports/calendar/daysmodel.cpp
223

Tried, but seems there is no simple way to use std::find_if or std::any_of algorithms here for the usecase of checking all values for a given key in a QMultiHash. The algorithms all only take fixed first and last iterators, so one first has to estimate the last iterator by something like std::equal_range, which as result means iterating 2x over the entries and does not make the code more comprehensible to the reader.
So as discussed on irc staying with current code for now.

src/declarativeimports/calendar/qml/DayDelegate.qml
105

Haven't got the complete picture on this code, the purpose of 18af8703039390de8b803a7a9b3c5cfe48f70b7a leaves me slightly puzzled, so better to be done separately, cannot yet oversee the potential side effects.

This revision was automatically updated to reflect the committed changes.
kossebau marked an inline comment as done.