From kde-commits Fri Nov 15 20:06:59 2013 From: Andras Mantia Date: Fri, 15 Nov 2013 20:06:59 +0000 To: kde-commits Subject: [kdepim-runtime] resources: Improve error handling. Message-Id: X-MARC-Message: https://marc.info/?l=kde-commits&m=138454602925692 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/12fd0533d1b9d31aeec26e8cd28b7ef7161e7= c51 diff --git a/resources/maildir/configdialog.cpp b/resources/maildir/configd= ialog.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 M= aildir folders." ) ); mToplevelIsContainer =3D true; ok =3D 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/l= ibmaildir/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 =3D=3D rhs.path; } - bool accessIsPossible( QString& error, bool createMissingFolders =3D t= rue ) const; + bool accessIsPossible( bool createMissingFolders =3D 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 createMissin= gFolders ) const +bool Maildir::Private::accessIsPossible( bool createMissingFolders ) { QStringList paths =3D subPaths(); - = + paths.prepend( path ); = Q_FOREACH ( const QString &p, paths ) { if ( !QFile::exists( p ) ) { if ( !createMissingFolders ) { - error =3D i18n( "Error opening %1; this folder is missing.",= p ); + lastError =3D i18n( "Error opening %1; this folder is missin= g.", p ); return false; } QDir().mkpath( p ); if ( !QFile::exists( p ) ) { - error =3D i18n( "Error opening %1; this folder is missing.",= p ); + lastError =3D i18n( "Error opening %1; this folder is missin= g.", p ); return false; } } if ( !canAccess( p ) ) { - error =3D i18n( "Error opening %1; either this is not a valid " + lastError =3D i18n( "Error opening %1; either this is not a va= lid " "maildir folder, or you do not have sufficient access = permissions." ,p ); return false; } @@ -269,21 +270,17 @@ bool Maildir::Private::accessIsPossible( QString& err= or, 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 =3D Maildir( path() + QLatin1Char( '/' ) + sf = ); - if ( !subMd.isValid( error ) ) + if ( !subMd.isValid() ) { + d->lastError =3D subMd.lastError(); return false; + } } return true; } @@ -458,11 +455,15 @@ QByteArray Maildir::readEntry( const QString& key ) c= onst if ( realKey.isEmpty() ) { // FIXME error handling? qWarning() << "Maildir::readEntry unable to find: " << key; + d->lastError =3D i18n( "Cannot locate mail file %1." ).arg( key ); return result; } = QFile f( realKey ); - f.open( QIODevice::ReadOnly ); + if ( !f.open( QIODevice::ReadOnly ) ) { + d->lastError =3D i18n( "Cannot open mail file %1." ).arg( realKey ); + return result; + } = // FIXME be safer than this result =3D 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 =3D i18n( "Cannot locate mail file %1." ).arg( key ); return -1; } = QFileInfo info( realKey ); - if ( !info.exists() ) + if ( !info.exists() ) { + d->lastError =3D i18n( "Cannot open mail file %1." ).arg( realKey = ); return -1; + } = return info.size(); } @@ -490,6 +494,7 @@ QDateTime Maildir::lastModified(const QString& key) con= st const QString realKey( d->findRealKey( key ) ); if ( realKey.isEmpty() ) { qWarning() << "Maildir::lastModified unable to find: " << key; + d->lastError =3D i18n( "Cannot locate mail file %1." ).arg( key ); return QDateTime(); } = @@ -508,6 +513,7 @@ QByteArray Maildir::readEntryHeadersFromFile( const QSt= ring& file ) const if ( !f.open( QIODevice::ReadOnly ) ) { // FIXME error handling? qWarning() << "Maildir::readEntryHeaders unable to find: " << file; + d->lastError =3D 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& ke= y ) const const QString realKey( d->findRealKey( key ) ); if ( realKey.isEmpty() ) { qWarning() << "Maildir::readEntryHeaders unable to find: " << key; + d->lastError =3D 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 =3D i18n( "Cannot locate mail file %1." ).arg( key ); + return false; } + bool result; QFile f( realKey ); - f.open( QIODevice::WriteOnly ); - f.write( data ); + result =3D f.open( QIODevice::WriteOnly ); + result &=3D ( f.write( data ) !=3D -1 ); f.close(); + if ( !result) { + d->lastError =3D i18n( "Cannot write to mail file %1." ).arg( realK= ey ); + return false; + } + return true; } = QString Maildir::addEntry( const QByteArray& data ) @@ -573,10 +587,15 @@ QString Maildir::addEntry( const QByteArray& data ) curKey =3D 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 =3D f.open( QIODevice::WriteOnly ); + result &=3D ( f.write( data ) !=3D -1 ); f.close(); + if ( !result) { + d->lastError =3D 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 =3D i18n( "Failed to create mail file %1. The error w= as: %2" ).arg( finalKey, f.errorString() ); + return QString(); } KeyCache *keyCache =3D 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, c= onst 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 =3D i18n( "Cannot locate mail file %1." ).arg( key ); + return QString(); } = const QRegExp rx =3D *( statusSeparatorRx() ); @@ -679,6 +699,7 @@ QString Maildir::changeEntryFlags(const QString& key, c= onst Akonadi::Item::Flags = if ( !f.rename( finalKey ) ) { qWarning() << "Maildir: Failed to rename entry: " << f.fileName() = << " to " << finalKey << "! Error: " << f.errorString(); + d->lastError =3D i18n("Failed to update the file name %1 to %2 on = the disk. The error was: %3.").arg(f.fileName()).arg(finalKey).arg(f.errorS= tring()); 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 =3D 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 =3D destination.path() + QDir::separator() + QLa= tin1String( "new" ) + QDir::separator() + key; if ( !f.rename( targetKey ) ) { kDebug() << "Failed to rename" << realKey << "to" << targetKey << "! E= rror: " << f.errorString();; + d->lastError =3D 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/lib= maildir/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 =3D true ) const; = /** - * Returns whether the maildir is valid, and sets the error out-parame= ter - * 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 =3D true ) con= st; - - /** * 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 destinatio= n. * @returns The new file name inside @p destination. */ - QString moveEntryTo( const QString &key, const Maildir &destination ); + QString moveEntryTo( const QString& key, const KPIM::Maildir& destinat= ion ); = /** * 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 fro= m the last performed operation, + if that was sucessful. The caller should always check the return valu= e 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 =3D d.readEntry( entries[0] ); QByteArray data2 =3D "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/mail= dirresource.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 =3D 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 =3D 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 QSetparse(); data =3D 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, co= nst Collection &source, con } = Maildir sourceDir =3D 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.lastErr= or() ) ); return; } = Maildir destDir =3D 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.last= Error() ) ); return; } = @@ -400,7 +407,7 @@ void MaildirResource::itemMoved( const Item &item, cons= t Collection &source, con restartMaildirScan( destDir ); = if ( newRid.isEmpty() ) { - cancelTask( i18n( "Could not move message '%1' from '%2' to '%3'.", it= em.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(), sourceDi= r.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/mixedmaild= ir/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 M= aildir folders." ) ); mToplevelIsContainer =3D true; ok =3D 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/mixed= maildir/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 =3D 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 =3D mMaildir.moveEntryTo( key, destination.mMai= ldir ); 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 =3D mMaildir.isValid(); + if ( !result ) error =3D mMaildir.lastError(); + return result; } = bool isValidEntry( const QString &entry ) const { @@ -829,7 +835,7 @@ bool MixedMaildirStore::Private::fillItem( MBoxPtr &mbo= x, 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 Maildi= rPtr &md, bool includeHea const qint64 entrySize =3D 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::It= emModifyJob *job ) const bool payloadChangedButIgnored =3D payloadChanged && job->ignorePay= load(); const bool ignoreModifyIfValid =3D nothingChanged || ( payloadChangedButIgnored && !flagsCha= nged ); - = + Item item =3D job->item(); const Collection collection =3D item.parentCollection(); QString path; @@ -1791,7 +1797,7 @@ bool MixedMaildirStore::Private::visit( FileStore::It= emModifyJob *job ) q->notifyItemsProcessed( Item::List() << item ); return true; } - = + // make sure to read the index (if available) before modifying the dat= a, which would // make the index invalid mbox->readIndexData(); @@ -1865,8 +1871,8 @@ bool MixedMaildirStore::Private::visit( FileStore::It= emModifyJob *job ) Maildir md( mdPtr->maildir() ); newKey =3D md.changeEntryFlags( item.remoteId(), item.flags() ); if ( newKey.isEmpty() ) { - errorText =3D i18nc( "@info:status", "Cannot modify emails in fold= er %1", - collection.name() ); + errorText =3D i18nc( "@info:status", "Cannot modify emails in fold= er %1. %2", + collection.name(), md.lastError() ); kError() << errorText << "FolderType=3D" << folderType; q->notifyError( FileStore::Job::InvalidJobContext, errorText ); return false; diff --git a/resources/mixedmaildir/tests/itemfetchtest.cpp b/resources/mix= edmaildir/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() ); QVERIFY( !items[ 1 ].hasPayload() ); QVERIFY( !items[ 2 ].hasPayload() ); @@ -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() ); QVERIFY( !items[ 2 ].hasPayload() ); QVERIFY( !items[ 3 ].hasPayload() ); - = + // 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() ); QVERIFY( !items[ 2 ].hasPayload() ); QVERIFY( !items[ 3 ].hasPayload() ); - = + // 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() ); QVERIFY( !items[ 2 ].hasPayload() ); QVERIFY( !items[ 3 ].hasPayload() ); - = + // 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() ); QVERIFY( !items[ 3 ].hasPayload() ); QVERIFY( !items[ 4 ].hasPayload() ); - = + // not flags from index, no flags from file names QCOMPARE( items[ 0 ].flags(), QSet() ); QCOMPARE( items[ 1 ].flags(), QSet() ); @@ -580,7 +580,7 @@ void ItemFetchTest::testListingMBox() QVERIFY( !items[ 1 ].hasPayload() ); QVERIFY( !items[ 2 ].hasPayload() ); QVERIFY( !items[ 3 ].hasPayload() ); - = + QCOMPARE( items[ 0 ].flags(), QSet() ); QCOMPARE( items[ 1 ].flags(), QSet() ); QCOMPARE( items[ 2 ].flags(), QSet() ); @@ -640,7 +640,7 @@ void ItemFetchTest::testListingMBox() QVERIFY( !items[ 1 ].hasPayload() ); QVERIFY( !items[ 2 ].hasPayload() ); QVERIFY( !items[ 3 ].hasPayload() ); - = + // see data/README QCOMPARE( items[ 0 ].flags(), QSet() ); QCOMPARE( items[ 1 ].flags(), QSet() << "\\SEEN" << "$TODO" = ); @@ -701,7 +701,7 @@ void ItemFetchTest::testListingMBox() QVERIFY( !items[ 1 ].hasPayload() ); QVERIFY( !items[ 2 ].hasPayload() ); QVERIFY( !items[ 3 ].hasPayload() ); - = + // see data/README QCOMPARE( items[ 0 ].flags(), QSet() ); QCOMPARE( items[ 1 ].flags(), QSet() << "\\SEEN" << "$TODO" = ); @@ -749,7 +749,7 @@ void ItemFetchTest::testListingMBox() QVERIFY( !items[ 1 ].hasPayload() ); QVERIFY( !items[ 2 ].hasPayload() ); QVERIFY( !items[ 3 ].hasPayload() ); - = + // see data/README QCOMPARE( items[ 0 ].flags(), QSet() << "\\SEEN" ); QCOMPARE( items[ 1 ].flags(), QSet() << "\\DELETED" ); @@ -806,7 +806,7 @@ void ItemFetchTest::testListingMBox() QVERIFY( !items[ 1 ].hasPayload() ); QVERIFY( !items[ 2 ].hasPayload() ); QVERIFY( !items[ 3 ].hasPayload() ); - = + QCOMPARE( items[ 0 ].flags(), QSet() ); QCOMPARE( items[ 1 ].flags(), QSet() ); QCOMPARE( items[ 2 ].flags(), QSet() ); @@ -857,9 +857,9 @@ void ItemFetchTest::testListingMBox() QVERIFY( !items[ 0 ].hasPayload() ); QVERIFY( !items[ 1 ].hasPayload() ); QVERIFY( !items[ 2 ].hasPayload() ); - QVERIFY( !items[ 3 ].hasPayload() ); = + QVERIFY( !items[ 3 ].hasPayload() ); QVERIFY( !items[ 4 ].hasPayload() ); - = + // see data/README QCOMPARE( items[ 0 ].flags(), QSet() ); QCOMPARE( items[ 1 ].flags(), QSet() << "\\SEEN" << "$TODO" = );