Branch 'kolab/integration/4.13.0' - akonadi/calendar akonadi/entitytreemodel_p.cpp
Sandro Knauß
knauss at kolabsys.com
Wed Oct 8 16:26:04 CEST 2014
akonadi/calendar/etmcalendar.cpp | 16 ++++++++++++++++
akonadi/calendar/etmcalendar.h | 2 ++
akonadi/entitytreemodel_p.cpp | 3 +++
3 files changed, 21 insertions(+)
New commits:
commit 43525a232912bfee3e88d5a8a6527afd786d8c40
Author: Sandro Knauà <knauss at kolabsys.com>
Date: Wed Oct 8 14:02:40 2014 +0200
Make it possible to show only a subtree as calendar
Kolab: #3054
diff --git a/akonadi/calendar/etmcalendar.cpp b/akonadi/calendar/etmcalendar.cpp
index ff051c3..49a2e45 100644
--- a/akonadi/calendar/etmcalendar.cpp
+++ b/akonadi/calendar/etmcalendar.cpp
@@ -501,6 +501,22 @@ ETMCalendar::ETMCalendar(ETMCalendar *other, QObject *parent)
d->init();
}
+ETMCalendar::ETMCalendar(ChangeRecorder *monitor, QObject *parent)
+ : CalendarBase(new ETMCalendarPrivate(this), parent)
+{
+ Q_D(ETMCalendar);
+
+ if (monitor) {
+ connect(monitor, SIGNAL(collectionChanged(Akonadi::Collection,QSet<QByteArray>)),
+ d, SLOT(onCollectionChanged(Akonadi::Collection,QSet<QByteArray>)));
+ d->mETM = CalendarModel::create(monitor);
+ d->mETM->setObjectName("ETM");
+ d->mETM->setListFilter(Akonadi::CollectionFetchScope::Display);
+ }
+
+ d->init();
+}
+
ETMCalendar::~ETMCalendar()
{
}
diff --git a/akonadi/calendar/etmcalendar.h b/akonadi/calendar/etmcalendar.h
index e4d3126..013af52 100644
--- a/akonadi/calendar/etmcalendar.h
+++ b/akonadi/calendar/etmcalendar.h
@@ -32,6 +32,7 @@ class KCheckableProxyModel;
namespace Akonadi {
class EntityTreeModel;
+class ChangeRecorder;
class ETMCalendarPrivate;
class CollectionSelection;
@@ -90,6 +91,7 @@ public:
*/
explicit ETMCalendar(ETMCalendar *calendar, QObject *parent = 0);
+ explicit ETMCalendar(ChangeRecorder *monitor, QObject *parent = 0);
/**
* Destroys this ETMCalendar.
*/
diff --git a/akonadi/entitytreemodel_p.cpp b/akonadi/entitytreemodel_p.cpp
index e45403c..d7771d2 100644
--- a/akonadi/entitytreemodel_p.cpp
+++ b/akonadi/entitytreemodel_p.cpp
@@ -1411,6 +1411,9 @@ void EntityTreeModelPrivate::itemFetchJobDone(KJob *job)
if ((m_collectionFetchStrategy != EntityTreeModel::InvisibleCollectionFetch) &&
(m_collectionFetchStrategy != EntityTreeModel::FetchNoCollections)) {
const QModelIndex index = indexForCollection(Collection(collectionId));
+ if (collectionId == m_rootCollection.id() && !index.isValid()) {
+ return;
+ }
Q_ASSERT(index.isValid());
//To notify about the changed fetch and population state
emit dataChanged(index, index);
More information about the commits
mailing list