Commit ea309828 authored by David Faure's avatar David Faure
Browse files

Fix error handling when fetching item for separate reader window.

My previous commit changed the slot that is also called in this case
(double-click or Enter), so use a separate slot, and on error show
the error message in the statusbar, leave the reader window untouched.
parent c210a4da
......@@ -2691,7 +2691,7 @@ void KMMainWidget::slotDisplayCurrentMessage()
slotMessageActivated( mMessagePane->currentItem() );
}
// Called by double-clicked or 'Enter' in the messagelist -> pop up reader window
void KMMainWidget::slotMessageActivated( const Akonadi::Item &msg )
{
if ( !mCurrentFolder || !msg.isValid() )
......@@ -2709,20 +2709,12 @@ void KMMainWidget::slotMessageActivated( const Akonadi::Item &msg )
return;
}
kDebug();
// Try to fetch the mail, even in offline mode, it might be cached
#if 0
bool isImapResourceOnline = false;
bool folderIsAnImap = KMKernel::self()->isImapFolder( mCurrentFolder->collection(), isImapResourceOnline );
if (folderIsAnImap && !isImapResourceOnline) {
return;
}
#endif
ItemFetchJob *itemFetchJob = MessageViewer::Viewer::createFetchJob( msg );
connect( itemFetchJob, SIGNAL(itemsReceived(Akonadi::Item::List)),
SLOT(slotItemsFetchedForActivation(Akonadi::Item::List)) );
connect( itemFetchJob, SIGNAL(result(KJob*)),
SLOT(itemsFetchDone(KJob*)) );
SLOT(itemsFetchForActivationDone(KJob*)) );
}
void KMMainWidget::slotItemsFetchedForActivation( const Akonadi::Item::List &list )
......@@ -2742,6 +2734,14 @@ void KMMainWidget::slotItemsFetchedForActivation( const Akonadi::Item::List &lis
win->show();
}
void KMMainWidget::itemsFetchForActivationDone( KJob * job )
{
if ( job->error() ) {
kDebug() << job->error() << job->errorString();
BroadcastStatus::instance()->setStatusMsg( job->errorString() );
}
}
void KMMainWidget::slotMessageStatusChangeRequest( const Akonadi::Item &item, const Akonadi::MessageStatus & set, const Akonadi::MessageStatus &clear )
{
if ( !item.isValid() )
......
......@@ -526,6 +526,7 @@ class KMAIL_EXPORT KMMainWidget : public QWidget
void itemsReceived(const Akonadi::Item::List &list );
void itemsFetchDone( KJob *job );
void itemsFetchForActivationDone( KJob *job );
void slotCollectionPropertiesContinued( KJob* job );
void slotCollectionPropertiesFinished( KJob *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