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

List:       kde-commits
Subject:    KDE/kdepimlibs
From:       Andras Mantia <amantia () kde ! org>
Date:       2010-12-12 19:02:59
Message-ID: 20101212190259.64D6FAC8A7 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1205840 by amantia:

Implement the recursive sync methods in the resource base and agentmanager. Requires \
the latest akonadi (1.4.81) from git.

 M  +1 -1      CMakeLists.txt  
 M  +6 -1      akonadi/agentmanager.cpp  
 M  +10 -0     akonadi/agentmanager.h  
 M  +13 -1     akonadi/resourcebase.cpp  
 M  +7 -0      akonadi/resourcebase.h  


--- trunk/KDE/kdepimlibs/CMakeLists.txt #1205839:1205840
@@ -80,7 +80,7 @@
 
 if (NOT KDEPIM_ONLY_KLEO)
   #FindAkonadi.cmake is only there for compatibility reasons, but we don't want to \
                use that.
-  set(Akonadi_MIN_VERSION "1.4.52")
+  set(Akonadi_MIN_VERSION "1.4.81")
   find_package(Akonadi ${Akonadi_MIN_VERSION} QUIET NO_MODULE)
   macro_log_feature(Akonadi_FOUND "Akonadi server libraries" "Access to PIM storage \
and services" "http://pim.kde.org/akonadi" TRUE "${Akonadi_MIN_VERSION}" "")  
--- trunk/KDE/kdepimlibs/akonadi/agentmanager.cpp #1205839:1205840
@@ -393,9 +393,14 @@
 
 void AgentManager::synchronizeCollection(const Collection & collection)
 {
+  synchronizeCollection( collection, false );
+}
+
+void AgentManager::synchronizeCollection( const Collection & collection, bool \
recursive ) +{
   const QString resId = collection.resource();
   Q_ASSERT( !resId.isEmpty() );
-  d->mManager->agentInstanceSynchronizeCollection( resId, collection.id() );
+  d->mManager->agentInstanceSynchronizeCollection( resId, collection.id(), recursive \
);  }
 
 #include "agentmanager.moc"
--- trunk/KDE/kdepimlibs/akonadi/agentmanager.h #1205839:1205840
@@ -105,6 +105,16 @@
      */
     void synchronizeCollection( const Collection &collection );
 
+    /**
+     * Trigger a synchronization of the given collection by its owning resource \
agent. +     * 
+     * @param collection The collection to synchronize.
+     * @param recursive If true, the sub-collections are also syncronized
+     *
+     * @since 4.6
+     */
+    void synchronizeCollection( const Collection &collection, bool recursive );
+
   Q_SIGNALS:
     /**
      * This signal is emitted whenever a new agent type was installed on the system.
--- trunk/KDE/kdepimlibs/akonadi/resourcebase.cpp #1205839:1205840
@@ -688,9 +688,15 @@
 
 void ResourceBase::synchronizeCollection( qint64 collectionId )
 {
-  CollectionFetchJob* job = new CollectionFetchJob( Collection( collectionId ), \
CollectionFetchJob::Base ); +  synchronizeCollection( collectionId, false );
+}
+
+void ResourceBase::synchronizeCollection( qint64 collectionId, bool recursive )
+{
+  CollectionFetchJob* job = new CollectionFetchJob( Collection( collectionId ), \
recursive ? CollectionFetchJob::Recursive : CollectionFetchJob::Base );  \
job->setFetchScope( changeRecorder()->collectionFetchScope() );  \
job->fetchScope().setResource( identifier() ); +  job->setProperty( "recursive", \
recursive );  connect( job, SIGNAL( result( KJob* ) ), SLOT( slotCollectionListDone( \
KJob* ) ) );  }
 
@@ -699,10 +705,16 @@
   if ( !job->error() ) {
     Collection::List list = static_cast<CollectionFetchJob*>( job )->collections();
     if ( !list.isEmpty() ) {
+      if ( job->property( "recursive" ).toBool() ) {
+        Q_FOREACH( Collection collection, list ) {
+          scheduler->scheduleSync( collection );
+        }
+      } else {
       Collection col = list.first();
       scheduler->scheduleSync( col );
     }
   }
+  }
   // TODO: error handling
 }
 
--- trunk/KDE/kdepimlibs/akonadi/resourcebase.h #1205839:1205840
@@ -461,6 +461,13 @@
 
     /**
      * This method is called whenever the collection with the given @p id
+     * shall be synchronized.
+     * @param recursive if true, a recursive syncronization is done
+     */
+    void synchronizeCollection( qint64 id, bool recursive );
+
+    /**
+     * This method is called whenever the collection with the given @p id
      * shall have its attributes synchronized.
      *
      * @param id The id of the collection to synchronize


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

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