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

List:       kde-commits
Subject:    KDE/kdepim/runtime/resources/shared/filestore
From:       Kevin Krammer <kevin.krammer () gmx ! at>
Date:       2010-05-13 21:17:35
Message-ID: 20100513211735.AA99DAC8B5 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1126377 by krake:

Add job notifier methods for collection results


 M  +48 -0     abstractlocalstore.cpp  
 M  +36 -0     session.cpp  
 M  +8 -0      session_p.h  


--- trunk/KDE/kdepim/runtime/resources/shared/filestore/abstractlocalstore.cpp #1126376:1126377
@@ -127,12 +127,60 @@
   public:
     using JobProcessingAdaptor::visit;
 
+    bool visit( CollectionCreateJob* job )
+    {
+      Q_ASSERT( !mCollections.isEmpty() );
+      if ( mCollections.count() > 1 ) {
+        kError() << "Processing collections for CollectionCreateJob "
+                    "encountered more than one collection. Just processing the first one.";
+      }
+
+      mSession->notifyCollectionCreated( job, mCollections[ 0 ] );
+      return true;
+    }
+
+    bool visit( CollectionDeleteJob* job )
+    {
+      Q_ASSERT( !mCollections.isEmpty() );
+      if ( mCollections.count() > 1 ) {
+        kError() << "Processing collections for CollectionDeleteJob "
+                    "encountered more than one collection. Just processing the first one.";
+      }
+
+      mSession->notifyCollectionDeleted( job, mCollections[ 0 ] );
+      return true;
+    }
+
     bool visit( CollectionFetchJob* job )
     {
       mSession->notifyCollectionsReceived( job, mCollections );
       return true;
     }
 
+    bool visit( CollectionModifyJob* job )
+    {
+      Q_ASSERT( !mCollections.isEmpty() );
+      if ( mCollections.count() > 1 ) {
+        kError() << "Processing collections for CollectionModifyJob "
+                    "encountered more than one collection. Just processing the first one.";
+      }
+
+      mSession->notifyCollectionModified( job, mCollections[ 0 ] );
+      return true;
+    }
+
+    bool visit( CollectionMoveJob* job )
+    {
+      Q_ASSERT( !mCollections.isEmpty() );
+      if ( mCollections.count() > 1 ) {
+        kError() << "Processing collections for CollectionMoveJob "
+                    "encountered more than one collection. Just processing the first one.";
+      }
+
+      mSession->notifyCollectionMoved( job, mCollections[ 0 ] );
+      return true;
+    }
+
   private:
     Collection::List mCollections;
 };
--- trunk/KDE/kdepim/runtime/resources/shared/filestore/session.cpp #1126376:1126377
@@ -19,7 +19,11 @@
 
 #include "session_p.h"
 
+#include "collectioncreatejob.h"
+#include "collectiondeletejob.h"
 #include "collectionfetchjob.h"
+#include "collectionmodifyjob.h"
+#include "collectionmovejob.h"
 #include "itemcreatejob.h"
 #include "itemfetchjob.h"
 #include "itemmodifyjob.h"
@@ -43,6 +47,38 @@
   }
 }
 
+void AbstractJobSession::notifyCollectionCreated( Job *job, const Collection &collection )
+{
+  CollectionCreateJob *createJob = dynamic_cast<CollectionCreateJob*>( job );
+  if ( createJob != 0 ) {
+    createJob->handleCollectionCreated( collection );
+  }
+}
+
+void AbstractJobSession::notifyCollectionDeleted( Job *job, const Collection &collection )
+{
+  CollectionDeleteJob *deleteJob = dynamic_cast<CollectionDeleteJob*>( job );
+  if ( deleteJob != 0 ) {
+    deleteJob->handleCollectionDeleted( collection );
+  }
+}
+
+void AbstractJobSession::notifyCollectionModified( Job *job, const Collection &collection )
+{
+  CollectionModifyJob *modifyJob = dynamic_cast<CollectionModifyJob*>( job );
+  if ( modifyJob != 0 ) {
+    modifyJob->handleCollectionModified( collection );
+  }
+}
+
+void AbstractJobSession::notifyCollectionMoved( Job *job, const Collection &collection )
+{
+  CollectionMoveJob *moveJob = dynamic_cast<CollectionMoveJob*>( job );
+  if ( moveJob != 0 ) {
+    moveJob->handleCollectionMoved( collection );
+  }
+}
+
 void AbstractJobSession::notifyItemsReceived( Job* job, const Item::List &items )
 {
   ItemFetchJob *fetchJob = dynamic_cast<ItemFetchJob*>( job );
--- trunk/KDE/kdepim/runtime/resources/shared/filestore/session_p.h #1126376:1126377
@@ -50,6 +50,14 @@
 
     void notifyCollectionsReceived( Job *job, const Collection::List &collections );
 
+    void notifyCollectionCreated( Job *job, const Collection &collection );
+
+    void notifyCollectionDeleted( Job *job, const Collection &collection );
+
+    void notifyCollectionModified( Job *job, const Collection &collection );
+
+    void notifyCollectionMoved( Job *job, const Collection &collection );
+
     void notifyItemsReceived( Job *job, const Item::List &items );
 
     void notifyItemCreated( Job *job, const Item &item );
[prev in list] [next in list] [prev in thread] [next in thread] 

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