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

List:       kde-commits
Subject:    [kdepim-runtime/KDE/4.7] resources/mixedmaildir: Fix missing parent collection information in fetche
From:       Kevin Krammer <kevin.krammer () gmx ! at>
Date:       2012-02-11 9:56:42
Message-ID: 20120211095642.E2DBDA60A6 () git ! kde ! org
[Download RAW message or body]

Git commit 0b928627827ef1c48e024ff3f8f68c684c915012 by Kevin Krammer, on behalf of \
David Faure. Committed on 10/02/2012 at 21:51.
Pushed by krake into branch 'KDE/4.7'.

Fix missing parent collection information in fetched items.

This gave "Given folder name is empty" warnings, and made items technically
inaccessible.

Arriving 9 hours late in Osnabrueck at least gave me an opportunity to debug
mixedmaildir with Kevin Krammer's help, in the train :-)

BUG: 285973

M  +11   -0    resources/mixedmaildir/mixedmaildirstore.cpp
M  +2    -0    resources/mixedmaildir/mixedmaildirstore.h
M  +5    -1    resources/mixedmaildir/retrieveitemsjob.cpp

http://commits.kde.org/kdepim-runtime/0b928627827ef1c48e024ff3f8f68c684c915012

diff --git a/resources/mixedmaildir/mixedmaildirstore.cpp \
b/resources/mixedmaildir/mixedmaildirstore.cpp index a06f81c..7991cbf 100644
--- a/resources/mixedmaildir/mixedmaildirstore.cpp
+++ b/resources/mixedmaildir/mixedmaildirstore.cpp
@@ -520,6 +520,8 @@ MixedMaildirStore::Private::FolderType \
MixedMaildirStore::Private::folderForColl  
   if ( col.remoteId().isEmpty() ) {
     errorText = i18nc( "@info:status", "Given folder name is empty" );
+    kWarning() << "Incomplete ancestor chain for collection.";
+    Q_ASSERT(!col.remoteId().isEmpty()); // abort! Look at backtrace to see where we \
came from.  return InvalidFolder;
   }
 
@@ -1616,6 +1618,7 @@ bool MixedMaildirStore::Private::visit( FileStore::ItemFetchJob \
*job )  
   QString path;
   QString errorText;
+  Q_ASSERT( !collection.remoteId().isEmpty() );
   const FolderType folderType = folderForCollection( collection, path, errorText );
 
   if ( folderType == InvalidFolder ) {
@@ -2320,6 +2323,14 @@ void MixedMaildirStore::checkItemModify( \
FileStore::ItemModifyJob *job, int &err  }
 }
 
+void MixedMaildirStore::checkItemFetch( FileStore::ItemFetchJob *job, int \
&errorCode, QString &errorText ) const +{
+  Q_UNUSED( errorCode );
+  Q_UNUSED( errorText );
+  Collection coll = job->item().parentCollection();
+  Q_ASSERT( !coll.remoteId().isEmpty() );
+}
+
 #include "mixedmaildirstore.moc"
 
 // kate: space-indent on; indent-width 2; replace-tabs on;
diff --git a/resources/mixedmaildir/mixedmaildirstore.h \
b/resources/mixedmaildir/mixedmaildirstore.h index ac71458..d5549f0 100644
--- a/resources/mixedmaildir/mixedmaildirstore.h
+++ b/resources/mixedmaildir/mixedmaildirstore.h
@@ -42,6 +42,8 @@ class MixedMaildirStore : public \
Akonadi::FileStore::AbstractLocalStore  
     void checkItemModify( Akonadi::FileStore::ItemModifyJob *job, int &errorCode, \
QString &errorText ) const;  
+    void checkItemFetch( Akonadi::FileStore::ItemFetchJob *job, int &errorCode, \
QString &errorText ) const; +
   private:
     class Private;
     Private *const d;
diff --git a/resources/mixedmaildir/retrieveitemsjob.cpp \
b/resources/mixedmaildir/retrieveitemsjob.cpp index f6d3836..65d15f5 100644
--- a/resources/mixedmaildir/retrieveitemsjob.cpp
+++ b/resources/mixedmaildir/retrieveitemsjob.cpp
@@ -102,7 +102,10 @@ void RetrieveItemsJob::Private::akonadiFetchResult( KJob *job )
   Q_FOREACH ( const Item &item, items ) {
     // items without remoteId have not been written to the resource yet
     if ( !item.remoteId().isEmpty() ) {
-      mServerItemsByRemoteId.insert( item.remoteId(), item );
+      // set the parent collection (with all ancestors) in every item
+      Item copy( item );
+      copy.setParentCollection( mCollection );
+      mServerItemsByRemoteId.insert( copy.remoteId(), copy );
     }
   }
 
@@ -285,6 +288,7 @@ RetrieveItemsJob::RetrieveItemsJob( const Akonadi::Collection \
&collection, Mixed  : Job( parent ), d( new Private( this, collection, store ) )
 {
   Q_ASSERT( d->mCollection.isValid() );
+  Q_ASSERT( !d->mCollection.remoteId().isEmpty() );
   Q_ASSERT( d->mStore != 0 );
 }
 


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

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