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

List:       kde-commits
Subject:    branches/work/~ervin/imap-resource-refactor
From:       Kevin Ottens <ervin () kde ! org>
Date:       2010-08-03 10:01:47
Message-ID: 20100803100147.D966EAC7A9 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1158639 by ervin:

No need to make it uselessly complicated, we'll get only one collection
back anyway.


 M  +5 -14     imapresource.cpp  


--- branches/work/~ervin/imap-resource-refactor/imapresource.cpp #1158638:1158639
@@ -75,8 +75,6 @@
 
 using namespace Akonadi;
 
-static const char AKONADI_COLLECTION[] = "akonadiCollection";
-
 ImapResource::ImapResource( const QString &id )
   : ResourceBase( id ), m_pool( new SessionPool( 2, this ) ), m_idle( 0 )
 {
@@ -443,7 +441,6 @@
                                          Akonadi::CollectionFetchJob::Base,
                                          this );
     fetch->setFetchScope( scope );
-    fetch->setProperty( AKONADI_COLLECTION, collectionId );
 
     connect( fetch, SIGNAL(result(KJob*)),
              this, SLOT(onExpungeCollectionFetchDone(KJob*)) );
@@ -452,22 +449,17 @@
 
 void ImapResource::onExpungeCollectionFetchDone( KJob *job )
 {
-  const Collection::Id collectionId = job->property( AKONADI_COLLECTION ).toLongLong();
-
   if ( job->error() == 0 ) {
     Akonadi::CollectionFetchJob *fetch = static_cast<Akonadi::CollectionFetchJob*>( job );
+    Akonadi::Collection collection = fetch->collections().first();
 
-    foreach ( const Akonadi::Collection &collection, fetch->collections() ) {
-      if ( collection.id() == collectionId ) {
         scheduleCustomTask( this, "triggerCollectionExpunge",
                             QVariant::fromValue( collection ) );
-        break;
-      }
-    }
+
   } else {
-    kWarning() << "CollectionFetch for collection "
-               << collectionId << "failed. error="
-               << job->error() << ", errorString=" << job->errorString();
+    kWarning() << "CollectionFetch for expunge failed."
+               << "error=" << job->error()
+               << ", errorString=" << job->errorString();
   }
 }
 
@@ -487,4 +479,3 @@
 AKONADI_RESOURCE_MAIN( ImapResource )
 
 #include "imapresource.moc"
-
[prev in list] [next in list] [prev in thread] [next in thread] 

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