diff options
Diffstat (limited to 'framework/src/domain/daylongeventmodel.cpp')
-rw-r--r-- | framework/src/domain/daylongeventmodel.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/framework/src/domain/daylongeventmodel.cpp b/framework/src/domain/daylongeventmodel.cpp index cd26b5c4..cb9769c6 100644 --- a/framework/src/domain/daylongeventmodel.cpp +++ b/framework/src/domain/daylongeventmodel.cpp | |||
@@ -27,7 +27,9 @@ | |||
27 | 27 | ||
28 | #include "entitycache.h" | 28 | #include "entitycache.h" |
29 | 29 | ||
30 | DayLongEventModel::DayLongEventModel(QObject *parent) : QSortFilterProxyModel(parent) | 30 | DayLongEventModel::DayLongEventModel(QObject *parent) |
31 | : QSortFilterProxyModel(parent), | ||
32 | mCalendarCache{EntityCache<Calendar, Calendar::Color>::Ptr::create()} | ||
31 | { | 33 | { |
32 | setDynamicSortFilter(true); | 34 | setDynamicSortFilter(true); |
33 | 35 | ||
@@ -43,8 +45,6 @@ DayLongEventModel::DayLongEventModel(QObject *parent) : QSortFilterProxyModel(pa | |||
43 | 45 | ||
44 | mModel = Sink::Store::loadModel<Event>(query); | 46 | mModel = Sink::Store::loadModel<Event>(query); |
45 | 47 | ||
46 | mCalendarCache = EntityCache<Calendar, Calendar::Color>::Ptr::create(); | ||
47 | |||
48 | setSourceModel(mModel.data()); | 48 | setSourceModel(mModel.data()); |
49 | } | 49 | } |
50 | 50 | ||
@@ -61,7 +61,11 @@ QHash<int, QByteArray> DayLongEventModel::roleNames() const | |||
61 | 61 | ||
62 | QByteArray DayLongEventModel::getColor(const QByteArray &calendar) const | 62 | QByteArray DayLongEventModel::getColor(const QByteArray &calendar) const |
63 | { | 63 | { |
64 | return mCalendarCache->getProperty(calendar, "color").toByteArray(); | 64 | const auto color = mCalendarCache->getProperty(calendar, "color").toByteArray(); |
65 | if (color.isEmpty()) { | ||
66 | qWarning() << "Failed to get color for calendar " << calendar; | ||
67 | } | ||
68 | return color; | ||
65 | } | 69 | } |
66 | 70 | ||
67 | QVariant DayLongEventModel::data(const QModelIndex &idx, int role) const | 71 | QVariant DayLongEventModel::data(const QModelIndex &idx, int role) const |