Commit 44a9c26b authored by David Narváez's avatar David Narváez
Browse files

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
parent 093f56f4
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment