Commit 224365ef authored by Milian Wolff's avatar Milian Wolff
Browse files

proper error handling of fetch jobs in ETM

cleanup m_pendingCollectionRetrieveJobs on error as otherwise
the collection can never be retrieved after an error

furthermore display the error to the user in a dialog

CCBUG: 286045
parent 0b008ffb
......@@ -48,6 +48,7 @@
#include <akonadi/servermanager.h>
#include <kdebug.h>
#include <QApplication>
/// comment this out to track time spent on jobs created by the ETM
// #define DBG_TRACK_JOB_TIMES
......@@ -1196,13 +1197,15 @@ void EntityTreeModelPrivate::monitoredItemUnlinked( const Akonadi::Item& item, c
void EntityTreeModelPrivate::fetchJobDone( KJob *job )
{
const Collection::Id collectionId = job->property( FetchCollectionId() ).value<Collection::Id>();
if ( job->error() ) {
kWarning() << "Job error: " << job->errorString() << endl;
KMessageBox::error(qApp->activeWindow(), i18n("Fetch Job Error"), job->errorString());
m_pendingCollectionRetrieveJobs.remove( collectionId );
return; // let's be safe, otherwise emitting dataChanged will get us into loops
}
const Collection::Id collectionId = job->property( FetchCollectionId() ).value<Collection::Id>();
#ifdef DBG_TRACK_JOB_TIMES
kDebug() << "Fetch job took " << jobTimeTracker.take(job).elapsed() << "msec";
if ( CollectionFetchJob* cJob = dynamic_cast<CollectionFetchJob*>( job ) ) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment