Branch 'kolab/integration/4.13.0' - 2 commits - akonadi/entitytreemodel_p.cpp akonadi/monitor.cpp akonadi/monitor.h akonadi/monitor_p.cpp akonadi/monitor_p.h akonadi/notificationsource.cpp akonadi/notificationsource_p.h

Christian Mollekopf mollekopf at kolabsys.com
Fri Oct 10 17:41:54 CEST 2014


 akonadi/entitytreemodel_p.cpp  |    6 ++----
 akonadi/monitor.cpp            |   15 +++++++++++++++
 akonadi/monitor.h              |    3 +++
 akonadi/monitor_p.cpp          |    2 ++
 akonadi/monitor_p.h            |    1 +
 akonadi/notificationsource.cpp |    8 ++++++++
 akonadi/notificationsource_p.h |    1 +
 7 files changed, 32 insertions(+), 4 deletions(-)

New commits:
commit a689bec0d471cfa89dac33d6a007cac01ab2785a
Author: Christian Mollekopf <chrigi_1 at fastmail.fm>
Date:   Fri Oct 10 17:28:25 2014 +0200

    Monitor: setExclusive

diff --git a/akonadi/monitor.cpp b/akonadi/monitor.cpp
index 2759b34..0ca93d5 100644
--- a/akonadi/monitor.cpp
+++ b/akonadi/monitor.cpp
@@ -203,6 +203,21 @@ void Akonadi::Monitor::setAllMonitored(bool monitored)
     emit allMonitored(monitored);
 }
 
+void Monitor::setExclusive(bool exclusive)
+{
+    Q_D(Monitor);
+    d->exclusive = exclusive;
+    if (d->notificationSource) {
+        d->notificationSource->setExclusive(exclusive);
+    }
+}
+
+bool Monitor::exclusive() const
+{
+    Q_D(const Monitor);
+    return d->exclusive;
+}
+
 void Monitor::ignoreSession(Session *session)
 {
     Q_D(Monitor);
diff --git a/akonadi/monitor.h b/akonadi/monitor.h
index e737a42..3f5526a 100644
--- a/akonadi/monitor.h
+++ b/akonadi/monitor.h
@@ -186,6 +186,9 @@ public:
      */
     void setAllMonitored(bool monitored = true);
 
+    void setExclusive(bool exclusive = true);
+    bool exclusive() const;
+
     /**
      * Ignores all change notifications caused by the given session. This
      * overrides all other settings on this session.
diff --git a/akonadi/monitor_p.cpp b/akonadi/monitor_p.cpp
index 58500db..9eb1686 100644
--- a/akonadi/monitor_p.cpp
+++ b/akonadi/monitor_p.cpp
@@ -42,6 +42,7 @@ MonitorPrivate::MonitorPrivate(ChangeNotificationDependenciesFactory *dependenci
     , dependenciesFactory(dependenciesFactory_ ? dependenciesFactory_ : new ChangeNotificationDependenciesFactory)
     , notificationSource(0)
     , monitorAll(false)
+    , exclusive(false)
     , mFetchChangedOnly(false)
     , session(Session::defaultSession())
     , collectionCache(0)
@@ -121,6 +122,7 @@ void MonitorPrivate::serverStateChanged(ServerManager::State state)
         Q_FOREACH (Monitor::Type type, types) {
             notificationSource->setMonitoredType(static_cast<NotificationMessageV2::Type>(type), true);
         }
+        notificationSource->setExclusive(exclusive);
     }
 }
 
diff --git a/akonadi/monitor_p.h b/akonadi/monitor_p.h
index 03e1aee..f3789ac 100644
--- a/akonadi/monitor_p.h
+++ b/akonadi/monitor_p.h
@@ -70,6 +70,7 @@ public:
     QSet<Monitor::Type> types;
     QSet<QString> mimetypes;
     bool monitorAll;
+    bool exclusive;
     QList<QByteArray> sessions;
     ItemFetchScope mItemFetchScope;
     TagFetchScope mTagFetchScope;
diff --git a/akonadi/notificationsource.cpp b/akonadi/notificationsource.cpp
index c635581..9946cdf 100644
--- a/akonadi/notificationsource.cpp
+++ b/akonadi/notificationsource.cpp
@@ -42,6 +42,14 @@ void NotificationSource::setAllMonitored(bool allMonitored)
     Q_UNUSED(ok);
 }
 
+void NotificationSource::setExclusive(bool exclusive)
+{
+    const bool ok = QMetaObject::invokeMethod(parent(), "setExclusive",
+                                              Q_ARG(bool, exclusive));
+    Q_ASSERT(ok);
+    Q_UNUSED(ok);
+}
+
 void NotificationSource::setMonitoredCollection(Entity::Id id, bool monitored)
 {
     const bool ok = QMetaObject::invokeMethod(parent(), "setMonitoredCollection",
diff --git a/akonadi/notificationsource_p.h b/akonadi/notificationsource_p.h
index 6bda4f2..97b0935 100644
--- a/akonadi/notificationsource_p.h
+++ b/akonadi/notificationsource_p.h
@@ -39,6 +39,7 @@ public:
     ~NotificationSource();
 
     void setAllMonitored(bool allMonitored);
+    void setExclusive(bool exclusive);
     void setMonitoredCollection(Entity::Id id, bool monitored);
     void setMonitoredItem(Entity::Id id, bool monitored);
     void setMonitoredResource(const QByteArray &resource, bool monitored);


commit 3caabf76badf1a62d3de56a586552c84095a2e24
Author: Christian Mollekopf <chrigi_1 at fastmail.fm>
Date:   Fri Oct 10 12:08:46 2014 +0200

    EntityTreeModel: Make it clear what this is about.
    
    The previous fix was working as well but was hiding the actual purpose.

diff --git a/akonadi/entitytreemodel_p.cpp b/akonadi/entitytreemodel_p.cpp
index d7771d2..5c4c254 100644
--- a/akonadi/entitytreemodel_p.cpp
+++ b/akonadi/entitytreemodel_p.cpp
@@ -1409,11 +1409,9 @@ void EntityTreeModelPrivate::itemFetchJobDone(KJob *job)
 
     // If collections are not in the model, there will be no valid index for them.
     if ((m_collectionFetchStrategy != EntityTreeModel::InvisibleCollectionFetch) &&
-        (m_collectionFetchStrategy != EntityTreeModel::FetchNoCollections)) {
+        (m_collectionFetchStrategy != EntityTreeModel::FetchNoCollections) &&
+        !(m_showRootCollection && collectionId == m_rootCollection.id())) {
         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