[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdepimlibs/akonadi
From:       Volker Krause <vkrause () kde ! org>
Date:       2010-12-22 12:43:40
Message-ID: 20101222124340.61735AC8AA () svn ! kde ! org
[Download RAW message or body]

SVN commit 1208589 by vkrause:

Add a whole bunch of resource-specific sanity checking for change
notifications to ResourceBase. Some resources (mainly noticed and tested
with maildir) don't handle eg. change notifications without RIDs very
well. These should not happen of course, but sometimes do, if the
initial add to the resource failed for whatever reason.

Now we at least prevent random misbehavior or asserts there, but it would
also be possible to add recovery code for those cases and retry adding
the RID-less objects for example.


 M  +9 -9      agentbase_p.h  
 M  +89 -0     resourcebase.cpp  


--- trunk/KDE/kdepimlibs/akonadi/agentbase_p.h #1208588:1208589
@@ -96,18 +96,18 @@
     AgentBase::Observer *mObserver;
 
   protected Q_SLOTS:
-    void itemAdded( const Akonadi::Item &item, const Akonadi::Collection &collection \
                );
-    void itemChanged( const Akonadi::Item &item, const QSet<QByteArray> \
                &partIdentifiers );
-    void itemMoved( const Akonadi::Item &, const Akonadi::Collection &source, const \
                Akonadi::Collection &destination );
-    void itemRemoved( const Akonadi::Item &item );
+    virtual void itemAdded( const Akonadi::Item &item, const Akonadi::Collection \
&collection ); +    virtual void itemChanged( const Akonadi::Item &item, const \
QSet<QByteArray> &partIdentifiers ); +    virtual void itemMoved( const Akonadi::Item \
&, const Akonadi::Collection &source, const Akonadi::Collection &destination ); +    \
                virtual void itemRemoved( const Akonadi::Item &item );
     void itemLinked( const Akonadi::Item &item, const Akonadi::Collection \
                &collection );
     void itemUnlinked( const Akonadi::Item &item, const Akonadi::Collection \
&collection );  
-    void collectionAdded( const Akonadi::Collection &collection, const \
                Akonadi::Collection &parent );
-    void collectionChanged( const Akonadi::Collection &collection );
-    void collectionChanged( const Akonadi::Collection &collection, const \
                QSet<QByteArray> &partIdentifiers );
-    void collectionMoved( const Akonadi::Collection &collection, const \
                Akonadi::Collection &source, const Akonadi::Collection &destination \
                );
-    void collectionRemoved( const Akonadi::Collection &collection );
+    virtual void collectionAdded( const Akonadi::Collection &collection, const \
Akonadi::Collection &parent ); +    virtual void collectionChanged( const \
Akonadi::Collection &collection ); +    virtual void collectionChanged( const \
Akonadi::Collection &collection, const QSet<QByteArray> &partIdentifiers ); +    \
virtual void collectionMoved( const Akonadi::Collection &collection, const \
Akonadi::Collection &source, const Akonadi::Collection &destination ); +    virtual \
                void collectionRemoved( const Akonadi::Collection &collection );
     void collectionSubscribed( const Akonadi::Collection &collection, const \
Akonadi::Collection &parent );  void collectionUnsubscribed( const \
Akonadi::Collection &collection );  };
--- trunk/KDE/kdepimlibs/akonadi/resourcebase.cpp #1208588:1208589
@@ -171,6 +171,95 @@
       scheduler->clear();
     }
 
+  protected Q_SLOTS:
+    // reimplementations from AgentbBasePrivate, containing sanity checks that only \
apply to resources +    // such as making sure that RIDs are present as well as \
translations of cross-resource moves +    // TODO: we could possibly add recovery \
code for no-RID notifications by re-enquing those to the change recorder +    // as \
the corresponding Add notifications, although that contains a risk of endless \
fail/retry loops +
+    void itemAdded(const Akonadi::Item& item, const Akonadi::Collection& collection)
+    {
+      if ( collection.remoteId().isEmpty() ) {
+        changeProcessed();
+        return;
+      }
+      AgentBasePrivate::itemAdded( item, collection );
+    }
+
+    void itemChanged(const Akonadi::Item& item, const QSet< QByteArray >& \
partIdentifiers) +    {
+      if ( item.remoteId().isEmpty() ) {
+        changeProcessed();
+        return;
+      }
+      AgentBasePrivate::itemChanged( item, partIdentifiers );
+    }
+
+    // TODO move the move translation code from AgebtBasePrivate here, it's wrong \
for agents +    void itemMoved(const Akonadi::Item &item, const Akonadi::Collection \
&source, const Akonadi::Collection &destination) +    {
+      if ( item.remoteId().isEmpty() || destination.remoteId().isEmpty() || \
destination == source ) { +        changeProcessed();
+        return;
+      }
+      AgentBasePrivate::itemMoved( item, source, destination );
+    }
+
+    void itemRemoved(const Akonadi::Item& item)
+    {
+      if ( item.remoteId().isEmpty() ) {
+        changeProcessed();
+        return;
+      }
+      AgentBasePrivate::itemRemoved( item );
+    }
+
+    void collectionAdded(const Akonadi::Collection& collection, const \
Akonadi::Collection& parent) +    {
+      if ( parent.remoteId().isEmpty() ) {
+        changeProcessed();
+        return;
+      }
+      AgentBasePrivate::collectionAdded( collection, parent );
+    }
+
+    void collectionChanged(const Akonadi::Collection& collection)
+    {
+      if ( collection.remoteId().isEmpty() ) {
+        changeProcessed();
+        return;
+      }
+      AgentBasePrivate::collectionChanged( collection );
+    }
+
+    void collectionChanged(const Akonadi::Collection& collection, const QSet< \
QByteArray >& partIdentifiers) +    {
+      if ( collection.remoteId().isEmpty() ) {
+        changeProcessed();
+        return;
+      }
+      AgentBasePrivate::collectionChanged( collection, partIdentifiers );
+    }
+
+    // TODO move the move translation code from AgebtBasePrivate here, it's wrong \
for agents +    void collectionMoved(const Akonadi::Collection& collection, const \
Akonadi::Collection& source, const Akonadi::Collection& destination) +    {
+      if ( collection.remoteId().isEmpty() || destination.remoteId().isEmpty() || \
source == destination ) { +        changeProcessed();
+        return;
+      }
+      AgentBasePrivate::collectionMoved( collection, source, destination );
+    }
+
+    void collectionRemoved(const Akonadi::Collection& collection)
+    {
+      if ( collection.remoteId().isEmpty() ) {
+        changeProcessed();
+        return;
+      }
+      AgentBasePrivate::collectionRemoved( collection );
+    }
+
   public:
     // synchronize states
     Collection currentCollection;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic