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

List:       kde-commits
Subject:    [kdepim-runtime] resources: Improve error handling.
From:       Andras Mantia <amantia () kde ! org>
Date:       2013-11-15 20:06:59
Message-ID: E1VhPfP-0002MQ-LS () scm ! kde ! org
[Download RAW message or body]

Git commit 12fd0533d1b9d31aeec26e8cd28b7ef7161e7c51 by Andras Mantia.
Committed on 15/11/2013 at 19:27.
Pushed by amantia into branch 'master'.

Improve error handling.

M  +2    -3    resources/maildir/configdialog.cpp
M  +53   -26   resources/maildir/libmaildir/maildir.cpp
M  +8    -12   resources/maildir/libmaildir/maildir.h
M  +3    -4    resources/maildir/libmaildir/tests/testmaildir.cpp
M  +23   -17   resources/maildir/maildirresource.cpp
M  +2    -3    resources/mixedmaildir/configdialog.cpp
M  +14   -8    resources/mixedmaildir/mixedmaildirstore.cpp
M  +14   -14   resources/mixedmaildir/tests/itemfetchtest.cpp

http://commits.kde.org/kdepim-runtime/12fd0533d1b9d31aeec26e8cd28b7ef7161e7c51

diff --git a/resources/maildir/configdialog.cpp b/resources/maildir/configdialog.cpp
index ebea669..e898e8c 100644
--- a/resources/maildir/configdialog.cpp
+++ b/resources/maildir/configdialog.cpp
@@ -60,15 +60,14 @@ void ConfigDialog::checkPath()
 
   if ( d.exists() ) {
     Maildir md( d.path() );
-    QString error;
-    if ( !md.isValid( error, false ) ) {
+    if ( !md.isValid( false ) ) {
       Maildir md2( d.path(), true );
       if ( md2.isValid( false ) ) {
         ui.statusLabel->setText( i18n( "The selected path contains valid Maildir \
folders." ) );  mToplevelIsContainer = true;
         ok = true;
       } else {
-        ui.statusLabel->setText( error );
+        ui.statusLabel->setText( md.lastError() );
       }
     } else {
       ui.statusLabel->setText( i18n( "The selected path is a valid Maildir." ) );
diff --git a/resources/maildir/libmaildir/maildir.cpp \
b/resources/maildir/libmaildir/maildir.cpp index 4a932db..712994d 100644
--- a/resources/maildir/libmaildir/maildir.cpp
+++ b/resources/maildir/libmaildir/maildir.cpp
@@ -91,7 +91,7 @@ public:
     {
         return path == rhs.path;
     }
-    bool accessIsPossible( QString& error, bool createMissingFolders = true ) const;
+    bool accessIsPossible( bool createMissingFolders = true );
     bool canAccess( const QString& path ) const;
 
     QStringList subPaths() const
@@ -191,6 +191,7 @@ public:
     QString path;
     bool isRoot;
     QString hostName;
+    QString lastError;
 };
 
 Maildir::Maildir( const QString& path, bool isRoot )
@@ -240,26 +241,26 @@ bool Maildir::Private::canAccess( const QString& path ) const
     return d.isReadable() && d.isWritable();
 }
 
-bool Maildir::Private::accessIsPossible( QString& error, bool createMissingFolders ) \
const +bool Maildir::Private::accessIsPossible( bool createMissingFolders )
 {
     QStringList paths = subPaths();
-    
+
     paths.prepend( path );
 
     Q_FOREACH ( const QString &p, paths ) {
         if ( !QFile::exists( p ) ) {
             if ( !createMissingFolders ) {
-              error = i18n( "Error opening %1; this folder is missing.", p );
+              lastError = i18n( "Error opening %1; this folder is missing.", p );
               return false;
             }
             QDir().mkpath( p );
             if ( !QFile::exists( p ) ) {
-              error = i18n( "Error opening %1; this folder is missing.", p );
+              lastError = i18n( "Error opening %1; this folder is missing.", p );
               return false;
             }
         }
         if ( !canAccess( p ) ) {
-            error = i18n( "Error opening %1; either this is not a valid "
+            lastError = i18n( "Error opening %1; either this is not a valid "
                     "maildir folder, or you do not have sufficient access \
permissions." ,p );  return false;
         }
@@ -269,21 +270,17 @@ bool Maildir::Private::accessIsPossible( QString& error, bool \
createMissingFolde  
 bool Maildir::isValid( bool createMissingFolders ) const
 {
-    QString error;
-    return isValid( error, createMissingFolders );
-}
-
-bool Maildir::isValid( QString &error, bool createMissingFolders ) const
-{
     if ( !d->isRoot ) {
-      if ( d->accessIsPossible( error, createMissingFolders ) ) {
+      if ( d->accessIsPossible( createMissingFolders ) ) {
           return true;
       }
     } else {
       Q_FOREACH ( const QString &sf, subFolderList() ) {
         const Maildir subMd = Maildir( path() + QLatin1Char( '/' ) + sf );
-        if ( !subMd.isValid( error ) )
+        if ( !subMd.isValid() ) {
+          d->lastError = subMd.lastError();
           return false;
+        }
       }
       return true;
     }
@@ -458,11 +455,15 @@ QByteArray Maildir::readEntry( const QString& key ) const
     if ( realKey.isEmpty() ) {
         // FIXME error handling?
         qWarning() << "Maildir::readEntry unable to find: " << key;
+        d->lastError = i18n( "Cannot locate mail file %1." ).arg( key );
         return result;
     }
 
     QFile f( realKey );
-    f.open( QIODevice::ReadOnly );
+    if ( !f.open( QIODevice::ReadOnly ) ) {
+      d->lastError = i18n( "Cannot open mail file %1." ).arg( realKey );
+      return result;
+    }
 
     // FIXME be safer than this
     result = f.readAll();
@@ -475,12 +476,15 @@ qint64 Maildir::size( const QString& key ) const
     if ( realKey.isEmpty() ) {
         // FIXME error handling?
         qWarning() << "Maildir::size unable to find: " << key;
+        d->lastError = i18n( "Cannot locate mail file %1." ).arg( key );
         return -1;
     }
 
     QFileInfo info( realKey );
-    if ( !info.exists() )
+    if ( !info.exists() ) {
+        d->lastError = i18n( "Cannot open mail file %1." ).arg( realKey );
         return -1;
+    }
 
     return info.size();
 }
@@ -490,6 +494,7 @@ QDateTime Maildir::lastModified(const QString& key) const
     const QString realKey( d->findRealKey( key ) );
     if ( realKey.isEmpty() ) {
         qWarning() << "Maildir::lastModified unable to find: " << key;
+        d->lastError = i18n( "Cannot locate mail file %1." ).arg( key );
         return QDateTime();
     }
 
@@ -508,6 +513,7 @@ QByteArray Maildir::readEntryHeadersFromFile( const QString& file \
) const  if ( !f.open( QIODevice::ReadOnly ) ) {
         // FIXME error handling?
         qWarning() << "Maildir::readEntryHeaders unable to find: " << file;
+        d->lastError = i18n( "Cannot locate mail file %1." ).arg( file );
         return result;
     }
     f.map( 0, qMin( (qint64)8000, f.size() ) );
@@ -525,6 +531,7 @@ QByteArray Maildir::readEntryHeaders( const QString& key ) const
     const QString realKey( d->findRealKey( key ) );
     if ( realKey.isEmpty() ) {
         qWarning() << "Maildir::readEntryHeaders unable to find: " << key;
+        d->lastError = i18n( "Cannot locate mail file %1." ).arg( key );
         return QByteArray();
     }
 
@@ -543,18 +550,25 @@ static QString createUniqueFileName()
     return fileName;
 }
 
-void Maildir::writeEntry( const QString& key, const QByteArray& data )
+bool Maildir::writeEntry( const QString& key, const QByteArray& data )
 {
     QString realKey( d->findRealKey( key ) );
     if ( realKey.isEmpty() ) {
         // FIXME error handling?
         qWarning() << "Maildir::writeEntry unable to find: " << key;
-        return;
+        d->lastError = i18n( "Cannot locate mail file %1." ).arg( key );
+        return false;
     }
+    bool result;
     QFile f( realKey );
-    f.open( QIODevice::WriteOnly );
-    f.write( data );
+    result = f.open( QIODevice::WriteOnly );
+    result &= ( f.write( data ) != -1 );
     f.close();
+    if ( !result) {
+       d->lastError = i18n( "Cannot write to mail file %1." ).arg( realKey );
+       return false;
+    }
+    return true;
 }
 
 QString Maildir::addEntry( const QByteArray& data )
@@ -573,10 +587,15 @@ QString Maildir::addEntry( const QByteArray& data )
       curKey = d->path + QLatin1String( "/cur/" ) + uniqueKey;
     } while ( QFile::exists( key ) || QFile::exists( finalKey ) || QFile::exists( \
curKey ) );  
+    bool result;
     QFile f( key );
-    f.open( QIODevice::WriteOnly );
-    f.write( data );
+    result = f.open( QIODevice::WriteOnly );
+    result &= ( f.write( data ) != -1 );
     f.close();
+    if ( !result) {
+       d->lastError = i18n( "Cannot write to mail file %1." ).arg( key );
+       return QString();
+    }
     /*
      * FIXME:
      *
@@ -588,6 +607,8 @@ QString Maildir::addEntry( const QByteArray& data )
      */
     if ( !f.rename( finalKey ) ) {
         qWarning() << "Maildir: Failed to add entry: " << finalKey  << "! Error: " \
<< f.errorString(); +        d->lastError = i18n( "Failed to create mail file %1. The \
error was: %2" ).arg( finalKey, f.errorString() ); +        return QString();
     }
     KeyCache *keyCache = KeyCache::self();
     keyCache->removeKey( d->path, key ); //remove all keys, be it "cur" or "new" \
first @@ -599,7 +620,6 @@ bool Maildir::removeEntry( const QString& key )
 {
     QString realKey( d->findRealKey( key ) );
     if ( realKey.isEmpty() ) {
-        // FIXME error handling?
         qWarning() << "Maildir::removeEntry unable to find: " << key;
         return false;
     }
@@ -612,9 +632,9 @@ QString Maildir::changeEntryFlags(const QString& key, const \
Akonadi::Item::Flags  {
     QString realKey( d->findRealKey( key ) );
     if ( realKey.isEmpty() ) {
-        // FIXME error handling?
         qWarning() << "Maildir::changeEntryFlags unable to find: " << key;
-        return key;
+        d->lastError = i18n( "Cannot locate mail file %1." ).arg( key );
+        return QString();
     }
 
     const QRegExp rx = *( statusSeparatorRx() );
@@ -679,6 +699,7 @@ QString Maildir::changeEntryFlags(const QString& key, const \
Akonadi::Item::Flags  
     if ( !f.rename( finalKey ) ) {
         qWarning() << "Maildir: Failed to rename entry: " << f.fileName() << " to "  \
<< finalKey  << "! Error: " << f.errorString(); +        d->lastError = i18n("Failed \
to update the file name %1 to %2 on the disk. The error was: \
%3.").arg(f.fileName()).arg(finalKey).arg(f.errorString());  return QString();
      }
 
@@ -753,7 +774,7 @@ QString Maildir::moveEntryTo( const QString &key, const Maildir \
&destination )  {
   const QString realKey( d->findRealKey( key ) );
   if ( realKey.isEmpty() ) {
-    kDebug() << "Unable to find" << key;
+    d->lastError = i18n( "Cannot locate mail file %1." ).arg( key );
     return QString();
   }
   QFile f( realKey );
@@ -761,6 +782,7 @@ QString Maildir::moveEntryTo( const QString &key, const Maildir \
&destination )  const QString targetKey = destination.path() + QDir::separator() + \
QLatin1String( "new" ) + QDir::separator() + key;  if ( !f.rename( targetKey ) ) {
     kDebug() << "Failed to rename" << realKey << "to" << targetKey << "! Error: " << \
f.errorString();; +    d->lastError = f.errorString();
     return QString();
   }
 
@@ -797,3 +819,8 @@ void Maildir::refreshKeyCache()
 {
   KeyCache::self()->refreshKeys( d->path );
 }
+
+QString Maildir::lastError() const
+{
+  return d->lastError;
+}
diff --git a/resources/maildir/libmaildir/maildir.h \
b/resources/maildir/libmaildir/maildir.h index 506e4c7..b23fb7a 100644
--- a/resources/maildir/libmaildir/maildir.h
+++ b/resources/maildir/libmaildir/maildir.h
@@ -59,16 +59,6 @@ public:
     bool isValid( bool createMissingFolders = true ) const;
 
     /**
-     * Returns whether the maildir is valid, and sets the error out-parameter
-     * so it can be used to signal the kind of error to the user.
-     * @see isValid
-     *
-     * @param error will contain the error message
-     * @param createMissingFolders if true (the default), the cur/new/tmp folders \
                are created if they are missing
-     */
-    bool isValid( QString &error, bool createMissingFolders = true ) const;
-
-    /**
      * Returns whether this is a normal maildir or a container containing maildirs.
      */
     bool isRoot() const;
@@ -185,8 +175,9 @@ public:
 
     /**
      * Write the given @p data to a file in the maildir with the given  @p key.
+     * Returns true in case of success, false in case of any error.
      */
-    void writeEntry( const QString& key, const QByteArray& data );
+    bool writeEntry( const QString& key, const QByteArray& data );
 
     /**
      * Adds the given @p data to the maildir. Returns the key of the entry.
@@ -218,7 +209,7 @@ public:
      * Moves the file with the given @p key into the Maildir @p destination.
      * @returns The new file name inside @p destination.
      */
-    QString moveEntryTo( const QString &key, const Maildir &destination );
+    QString moveEntryTo( const QString& key, const KPIM::Maildir& destination );
 
     /**
      * Creates the maildir tree structure specific directory path that the
@@ -247,6 +238,11 @@ public:
     /** Reloads the keys associated with the maildir in the key cache*/
     void refreshKeyCache();
 
+    /** Return the last error message string. The error might not come from the last \
performed operation, +     if that was sucessful. The caller should always check the \
return value of the methods before +     querying the last error string. */
+    QString lastError() const;
+
 private:
     void swap( const Maildir& );
     class Private;
diff --git a/resources/maildir/libmaildir/tests/testmaildir.cpp \
b/resources/maildir/libmaildir/tests/testmaildir.cpp index ed312ea..47bc5c9 100644
--- a/resources/maildir/libmaildir/tests/testmaildir.cpp
+++ b/resources/maildir/libmaildir/tests/testmaildir.cpp
@@ -121,9 +121,8 @@ void MaildirTest::testMaildirInstantiation()
 
   QDir temp( m_temp->name() );
   temp.rmdir( QLatin1String( "new" ) );
-  QString error;
-  QVERIFY( !good.isValid( error, false ) );
-  QVERIFY( !error.isEmpty() );
+  QVERIFY( !good.isValid( false ) );
+  QVERIFY( !good.lastError().isEmpty() );
 
   Maildir root1( QLatin1String( "/foo/bar/Mail" ), true );
   QVERIFY( root1.isRoot() );
@@ -182,7 +181,7 @@ void MaildirTest::testMaildirWrite()
 
   QByteArray data = d.readEntry( entries[0] );
   QByteArray data2 = "changed\n";
-  d.writeEntry( entries[0], data2 );
+  QVERIFY( d.writeEntry( entries[0], data2 ) );
   QCOMPARE( data2, d.readEntry( entries[0] ) );
 }
 
diff --git a/resources/maildir/maildirresource.cpp \
b/resources/maildir/maildirresource.cpp index 932f7d4..9265352 100644
--- a/resources/maildir/maildirresource.cpp
+++ b/resources/maildir/maildirresource.cpp
@@ -266,9 +266,8 @@ void MaildirResource::itemAdded( const Akonadi::Item & item, \
const Akonadi::Coll  return;
     }
     Maildir dir = maildirForCollection( collection );
-    QString errMsg;
-    if ( mSettings->readOnly() || !dir.isValid( errMsg ) ) {
-      cancelTask( errMsg );
+    if ( mSettings->readOnly() || !dir.isValid() ) {
+      cancelTask( dir.lastError() );
       return;
     }
 
@@ -283,6 +282,12 @@ void MaildirResource::itemAdded( const Akonadi::Item & item, \
const Akonadi::Coll  
     const QString rid = dir.addEntry( mail->encodedContent() );
 
+    if ( rid.isEmpty() ) {
+      restartMaildirScan( dir );
+      cancelTask( dir.lastError() );
+      return;
+    }
+
     restartMaildirScan( dir );
 
     Item i( item );
@@ -318,9 +323,8 @@ void MaildirResource::itemChanged( const Akonadi::Item& item, \
const QSet<QByteAr  }
 
     Maildir dir = maildirForCollection( item.parentCollection() );
-    QString errMsg;
-    if ( !dir.isValid( errMsg ) ) {
-        cancelTask( errMsg );
+    if ( !dir.isValid() ) {
+        cancelTask( dir.lastError() );
         return;
     }
 
@@ -333,7 +337,7 @@ void MaildirResource::itemChanged( const Akonadi::Item& item, \
                const QSet<QByteAr
         const QString newKey = dir.changeEntryFlags( item.remoteId(), item.flags() \
);  if ( newKey.isEmpty() ) {
           restartMaildirScan( dir );
-          cancelTask( i18n( "Failed to change the flags for the mail." ) );
+          cancelTask( i18n( "Failed to change the flags for the mail. %1" ).arg( \
dir.lastError() ) );  return;
         }
         newItem.setRemoteId( newKey );
@@ -354,7 +358,11 @@ void MaildirResource::itemChanged( const Akonadi::Item& item, \
const QSet<QByteAr  mail->parse();
             data = mail->encodedContent();
           }
-          dir.writeEntry( newItem.remoteId(), data );
+          if ( !dir.writeEntry( newItem.remoteId(), data ) ) {
+            restartMaildirScan( dir );
+            cancelTask( dir.lastError() );
+            return;
+          }
         }
       }
 
@@ -379,15 +387,14 @@ void MaildirResource::itemMoved( const Item &item, const \
Collection &source, con  }
 
   Maildir sourceDir = maildirForCollection( source );
-  QString errMsg;
-  if ( !sourceDir.isValid( errMsg ) ) {
-    cancelTask( i18n( "Source folder is invalid: '%1'.", errMsg ) );
+  if ( !sourceDir.isValid() ) {
+    cancelTask( i18n( "Source folder is invalid: '%1'.", sourceDir.lastError() ) );
     return;
   }
 
   Maildir destDir = maildirForCollection( destination );
-  if ( !destDir.isValid( errMsg ) ) {
-    cancelTask( i18n( "Destination folder is invalid: '%1'.", errMsg ) );
+  if ( !destDir.isValid() ) {
+    cancelTask( i18n( "Destination folder is invalid: '%1'.", destDir.lastError() ) \
);  return;
   }
 
@@ -400,7 +407,7 @@ void MaildirResource::itemMoved( const Item &item, const \
Collection &source, con  restartMaildirScan( destDir );
 
   if ( newRid.isEmpty() ) {
-    cancelTask( i18n( "Could not move message '%1' from '%2' to '%3'.", \
item.remoteId(), sourceDir.path(), destDir.path() ) ); +    cancelTask( i18n( "Could \
not move message '%1' from '%2' to '%3'. The error was %4.", item.remoteId(), \
sourceDir.path(), destDir.path(), sourceDir.lastError() ) );  return;
   }
 
@@ -463,9 +470,8 @@ Collection::List MaildirResource::listRecursive( const Collection \
&root, const M  void MaildirResource::retrieveCollections()
 {
   Maildir dir( mSettings->path(), mSettings->topLevelIsContainer() );
-  QString errMsg;
-  if ( !dir.isValid( errMsg ) ) {
-    emit error( errMsg );
+  if ( !dir.isValid() ) {
+    emit error( dir.lastError() );
     collectionsRetrieved( Collection::List() );
     return;
   }
diff --git a/resources/mixedmaildir/configdialog.cpp \
b/resources/mixedmaildir/configdialog.cpp index 9c5a85b..90374ae 100644
--- a/resources/mixedmaildir/configdialog.cpp
+++ b/resources/mixedmaildir/configdialog.cpp
@@ -58,15 +58,14 @@ void ConfigDialog::checkPath()
 
   if ( d.exists() ) {
     Maildir md( d.path() );
-    QString error;
-    if ( !md.isValid( error ) ) {
+    if ( !md.isValid() ) {
       Maildir md2( d.path(), true );
       if ( md2.isValid() ) {
         ui.statusLabel->setText( i18n( "The selected path contains valid Maildir \
folders." ) );  mToplevelIsContainer = true;
         ok = true;
       } else {
-        ui.statusLabel->setText( error );
+        ui.statusLabel->setText( md.lastError() );
       }
     } else {
       ui.statusLabel->setText( i18n( "The selected path is a valid Maildir." ) );
diff --git a/resources/mixedmaildir/mixedmaildirstore.cpp \
b/resources/mixedmaildir/mixedmaildirstore.cpp index 922071c..80f5735 100644
--- a/resources/mixedmaildir/mixedmaildirstore.cpp
+++ b/resources/mixedmaildir/mixedmaildirstore.cpp
@@ -318,6 +318,8 @@ class MaildirContext
     QString addEntry( const QByteArray &data ) {
       const QString result = mMaildir.addEntry( data );
       if ( !result.isEmpty() && mHasIndexData ) {
+        //TODO: use the error string?
+        kWarning() << mMaildir.lastError();
         mIndexData.insert( result, KMIndexDataPtr( new KMIndexData ) );
         Q_ASSERT( mIndexData.value( result )->isEmpty() );
       }
@@ -326,7 +328,7 @@ class MaildirContext
     }
 
     void writeEntry( const QString &key, const QByteArray &data ) {
-      mMaildir.writeEntry( key, data );
+      mMaildir.writeEntry( key, data ); //TODO: error handling
       if ( mHasIndexData ) {
         mIndexData.insert( key, KMIndexDataPtr( new KMIndexData ) );
       }
@@ -344,6 +346,8 @@ class MaildirContext
     QString moveEntryTo( const QString &key, MaildirContext &destination ) {
       const QString result = mMaildir.moveEntryTo( key, destination.mMaildir );
       if ( !result.isEmpty() ) {
+        //TODO error handling?
+        kWarning() << mMaildir.lastError();
         if ( mHasIndexData ) {
           mIndexData.remove( key );
         }
@@ -365,7 +369,9 @@ class MaildirContext
     }
 
     bool isValid( QString &error ) const {
-      return mMaildir.isValid( error );
+      bool result = mMaildir.isValid();
+      if ( !result ) error = mMaildir.lastError();
+      return result;
     }
 
     bool isValidEntry( const QString &entry ) const {
@@ -829,7 +835,7 @@ bool MixedMaildirStore::Private::fillItem( MBoxPtr &mbox, bool \
includeHeaders, b  if ( !ok || !mbox->isValidOffset( offset ) ) {
     return false;
   }
-  
+
   // TODO: size and modification timestamp?
 
   if ( includeHeaders || includeBody ) {
@@ -855,7 +861,7 @@ bool MixedMaildirStore::Private::fillItem( const MaildirPtr &md, \
bool includeHea  const qint64 entrySize = md->maildir().size( item.remoteId() );
   if ( entrySize < 0 )
     return false;
-  
+
   item.setSize( entrySize );
   item.setModificationTime( md->maildir().lastModified( item.remoteId() ) );
 
@@ -1731,7 +1737,7 @@ bool MixedMaildirStore::Private::visit( \
FileStore::ItemModifyJob *job )  const bool payloadChangedButIgnored = payloadChanged \
&& job->ignorePayload();  const bool ignoreModifyIfValid = nothingChanged ||
                                    ( payloadChangedButIgnored && !flagsChanged );
-  
+
   Item item = job->item();
   const Collection collection = item.parentCollection();
   QString path;
@@ -1791,7 +1797,7 @@ bool MixedMaildirStore::Private::visit( \
FileStore::ItemModifyJob *job )  q->notifyItemsProcessed( Item::List() << item );
       return true;
     }
- 
+
     // make sure to read the index (if available) before modifying the data, which \
would  // make the index invalid
     mbox->readIndexData();
@@ -1865,8 +1871,8 @@ bool MixedMaildirStore::Private::visit( \
FileStore::ItemModifyJob *job )  Maildir md( mdPtr->maildir() );
       newKey = md.changeEntryFlags( item.remoteId(), item.flags() );
       if ( newKey.isEmpty() ) {
-        errorText = i18nc( "@info:status", "Cannot modify emails in folder %1",
-                            collection.name() );
+        errorText = i18nc( "@info:status", "Cannot modify emails in folder %1. %2",
+                            collection.name(), md.lastError() );
         kError() << errorText << "FolderType=" << folderType;
         q->notifyError( FileStore::Job::InvalidJobContext, errorText );
         return false;
diff --git a/resources/mixedmaildir/tests/itemfetchtest.cpp \
b/resources/mixedmaildir/tests/itemfetchtest.cpp index 13ac8fa..28a0f6e 100644
--- a/resources/mixedmaildir/tests/itemfetchtest.cpp
+++ b/resources/mixedmaildir/tests/itemfetchtest.cpp
@@ -208,7 +208,7 @@ void ItemFetchTest::testListingMaildir()
   QCOMPARE( items[ 1 ].parentCollection(), collection1 );
   QCOMPARE( items[ 2 ].parentCollection(), collection1 );
   QCOMPARE( items[ 3 ].parentCollection(), collection1 );
-  
+
   QVERIFY( !items[ 0 ].hasPayload<KMime::Message::Ptr>() );
   QVERIFY( !items[ 1 ].hasPayload<KMime::Message::Ptr>() );
   QVERIFY( !items[ 2 ].hasPayload<KMime::Message::Ptr>() );
@@ -219,7 +219,7 @@ void ItemFetchTest::testListingMaildir()
       ++flagCounts[ flag ];
     }
   }
-  
+
   // no flags from maildir file name, no advanced flags without index
   QCOMPARE( flagCounts.count(), 0 );
   QCOMPARE( flagCounts[ "\\SEEN" ], 0 );
@@ -282,7 +282,7 @@ void ItemFetchTest::testListingMaildir()
   QVERIFY( !items[ 1 ].hasPayload<KMime::Message::Ptr>() );
   QVERIFY( !items[ 2 ].hasPayload<KMime::Message::Ptr>() );
   QVERIFY( !items[ 3 ].hasPayload<KMime::Message::Ptr>() );
-  
+
   // see data/README
   Q_FOREACH( const Item &item, items ) {
     Q_FOREACH( const QByteArray &flag, item.flags() ) {
@@ -349,14 +349,14 @@ void ItemFetchTest::testListingMaildir()
   QVERIFY( !items[ 1 ].hasPayload<KMime::Message::Ptr>() );
   QVERIFY( !items[ 2 ].hasPayload<KMime::Message::Ptr>() );
   QVERIFY( !items[ 3 ].hasPayload<KMime::Message::Ptr>() );
-  
+
   // see data/README
   Q_FOREACH( const Item &item, items ) {
     Q_FOREACH( const QByteArray &flag, item.flags() ) {
       ++flagCounts[ flag ];
     }
   }
-  
+
   // 2x \SEEN flags: 2x from index, none from file name
   QCOMPARE( flagCounts[ "\\SEEN" ], 2 );
   QCOMPARE( flagCounts[ "\\FLAGGED" ], 1 );
@@ -405,7 +405,7 @@ void ItemFetchTest::testListingMaildir()
   QVERIFY( !items[ 1 ].hasPayload<KMime::Message::Ptr>() );
   QVERIFY( !items[ 2 ].hasPayload<KMime::Message::Ptr>() );
   QVERIFY( !items[ 3 ].hasPayload<KMime::Message::Ptr>() );
-  
+
   // see data/README
   Q_FOREACH( const Item &item, items ) {
     Q_FOREACH( const QByteArray &flag, item.flags() ) {
@@ -482,7 +482,7 @@ void ItemFetchTest::testListingMaildir()
   QVERIFY( !items[ 2 ].hasPayload<KMime::Message::Ptr>() );
   QVERIFY( !items[ 3 ].hasPayload<KMime::Message::Ptr>() );
   QVERIFY( !items[ 4 ].hasPayload<KMime::Message::Ptr>() );
-  
+
   // not flags from index, no flags from file names
   QCOMPARE( items[ 0 ].flags(), QSet<QByteArray>() );
   QCOMPARE( items[ 1 ].flags(), QSet<QByteArray>() );
@@ -580,7 +580,7 @@ void ItemFetchTest::testListingMBox()
   QVERIFY( !items[ 1 ].hasPayload<KMime::Message::Ptr>() );
   QVERIFY( !items[ 2 ].hasPayload<KMime::Message::Ptr>() );
   QVERIFY( !items[ 3 ].hasPayload<KMime::Message::Ptr>() );
-  
+
   QCOMPARE( items[ 0 ].flags(), QSet<QByteArray>() );
   QCOMPARE( items[ 1 ].flags(), QSet<QByteArray>() );
   QCOMPARE( items[ 2 ].flags(), QSet<QByteArray>() );
@@ -640,7 +640,7 @@ void ItemFetchTest::testListingMBox()
   QVERIFY( !items[ 1 ].hasPayload<KMime::Message::Ptr>() );
   QVERIFY( !items[ 2 ].hasPayload<KMime::Message::Ptr>() );
   QVERIFY( !items[ 3 ].hasPayload<KMime::Message::Ptr>() );
-  
+
   // see data/README
   QCOMPARE( items[ 0 ].flags(), QSet<QByteArray>()  );
   QCOMPARE( items[ 1 ].flags(), QSet<QByteArray>() << "\\SEEN" << "$TODO" );
@@ -701,7 +701,7 @@ void ItemFetchTest::testListingMBox()
   QVERIFY( !items[ 1 ].hasPayload<KMime::Message::Ptr>() );
   QVERIFY( !items[ 2 ].hasPayload<KMime::Message::Ptr>() );
   QVERIFY( !items[ 3 ].hasPayload<KMime::Message::Ptr>() );
-  
+
   // see data/README
   QCOMPARE( items[ 0 ].flags(), QSet<QByteArray>()  );
   QCOMPARE( items[ 1 ].flags(), QSet<QByteArray>() << "\\SEEN" << "$TODO" );
@@ -749,7 +749,7 @@ void ItemFetchTest::testListingMBox()
   QVERIFY( !items[ 1 ].hasPayload<KMime::Message::Ptr>() );
   QVERIFY( !items[ 2 ].hasPayload<KMime::Message::Ptr>() );
   QVERIFY( !items[ 3 ].hasPayload<KMime::Message::Ptr>() );
-  
+
   // see data/README
   QCOMPARE( items[ 0 ].flags(), QSet<QByteArray>() << "\\SEEN" );
   QCOMPARE( items[ 1 ].flags(), QSet<QByteArray>() << "\\DELETED" );
@@ -806,7 +806,7 @@ void ItemFetchTest::testListingMBox()
   QVERIFY( !items[ 1 ].hasPayload<KMime::Message::Ptr>() );
   QVERIFY( !items[ 2 ].hasPayload<KMime::Message::Ptr>() );
   QVERIFY( !items[ 3 ].hasPayload<KMime::Message::Ptr>() );
-  
+
   QCOMPARE( items[ 0 ].flags(), QSet<QByteArray>() );
   QCOMPARE( items[ 1 ].flags(), QSet<QByteArray>() );
   QCOMPARE( items[ 2 ].flags(), QSet<QByteArray>() );
@@ -857,9 +857,9 @@ void ItemFetchTest::testListingMBox()
   QVERIFY( !items[ 0 ].hasPayload<KMime::Message::Ptr>() );
   QVERIFY( !items[ 1 ].hasPayload<KMime::Message::Ptr>() );
   QVERIFY( !items[ 2 ].hasPayload<KMime::Message::Ptr>() );
-  QVERIFY( !items[ 3 ].hasPayload<KMime::Message::Ptr>() );  
+  QVERIFY( !items[ 3 ].hasPayload<KMime::Message::Ptr>() );
   QVERIFY( !items[ 4 ].hasPayload<KMime::Message::Ptr>() );
-  
+
   // see data/README
   QCOMPARE( items[ 0 ].flags(), QSet<QByteArray>()  );
   QCOMPARE( items[ 1 ].flags(), QSet<QByteArray>() << "\\SEEN" << "$TODO" );


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

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