blob: 705daf65b4b357b6832eb7bd0e704a904a7dd589 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
commit 44a9c26b9eb27df8297618764f988972d476dc84
Author: David E. Narváez <david.narvaez@computer.org>
Date: Sun Nov 20 16:31:15 2011 -0500
Drop InvisibleCollectionFetch in Favor of KDescendantsProxyModel
As the InvisibleCollectionFetch fetch strategy is currently broken, I
implemented a suggestion by Christian Mollekopf of working around the
issues by flatting the model through a KDescendantsProxyModel to fix
crashes in Plasma related to calendars.
BUG: 279322
FIXED-IN: 4.7.4
CCMAIL: chrigi_1@fastmail.fm
REVIEW: 103088
diff --git a/plasma/generic/dataengines/calendar/calendarengine.cpp b/plasma/generic/dataengines/calendar/calendarengine.cpp
index 53f98c0..f8b3a90 100644
--- a/plasma/generic/dataengines/calendar/calendarengine.cpp
+++ b/plasma/generic/dataengines/calendar/calendarengine.cpp
@@ -31,6 +31,7 @@
#include <KCalCore/Event>
#include <KCalCore/Todo>
#include <KCalCore/Journal>
+#include <kdescendantsproxymodel.h>
#ifdef AKONADI_FOUND
#include <Akonadi/ChangeRecorder>
@@ -38,6 +39,7 @@
#include <Akonadi/Collection>
#include <Akonadi/ItemFetchScope>
#include <Akonadi/EntityDisplayAttribute>
+#include <Akonadi/EntityMimeTypeFilterModel>
#include "akonadi/calendar.h"
#include "akonadi/calendarmodel.h"
@@ -341,8 +343,12 @@ void CalendarEngine::initAkonadiCalendar()
// create the models that contain the data. they will be updated automatically from akonadi.
CalendarSupport::CalendarModel *calendarModel = new CalendarSupport::CalendarModel(monitor, this);
- calendarModel->setCollectionFetchStrategy(Akonadi::EntityTreeModel::InvisibleCollectionFetch);
- m_calendar = new CalendarSupport::Calendar(calendarModel, calendarModel, KSystemTimeZones::local());
+ KDescendantsProxyModel *flatModel = new KDescendantsProxyModel(this);
+ flatModel->setSourceModel(calendarModel);
+ Akonadi::EntityMimeTypeFilterModel *mimeFilteredModel = new Akonadi::EntityMimeTypeFilterModel(this);
+ mimeFilteredModel->addMimeTypeExclusionFilter(Akonadi::Collection::mimeType());
+ mimeFilteredModel->setSourceModel(flatModel);
+ m_calendar = new CalendarSupport::Calendar(mimeFilteredModel, mimeFilteredModel, KSystemTimeZones::local());
}
#endif
|