Bug 252178 - No error message when trying to display emails while 'Enable Disconnected Mode' unchecked
Summary: No error message when trying to display emails while 'Enable Disconnected Mod...
Alias: None
Product: KMail Mobile
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: kdepim bugs
Depends on:
Reported: 2010-09-23 22:45 UTC by Sabine Faure
Modified: 2011-01-08 00:53 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:

Patch to fix error propagation in Akonadi server (2.00 KB, patch)
2010-12-29 13:42 UTC, Tobias Koenig

Note You need to log in before you can comment on or make changes to this bug.
Description Sabine Faure 2010-09-23 22:45:21 UTC
Version:           unspecified (using Devel) 
OS:                Linux

There is no error message when the 'Enable disconnected mode' check box in unchecked and a user tries to load new emails.

The new email content is not displayed even after more than 5 minutes and the user may not realize why.

Reproducible: Always

Steps to Reproduce:
- Launch Kmail-mobile
- Connect the N900 to the wifi
- Click on your Imap account
- Open the 'Actions' tab
- Click on 'Account'
- Click on 'Edit account'
- Uncheck the ' Enable Disconnected Mode' check box
- Click on 'Write new email' (ex: Email 1)
- Enter a subject, a few words (ex: testing disconnected mode disabled) and a recipient
- Click on 'Send'
- Reopen 'Actions' tab
- Click on 'Synchronize emails in account'
- Go to your Imap inbox and check that Email 1 is listed in the Message list
- DO NOT click on the email
- Disconnect the N900 from the wifi
- Go back to the Imap inbox and click on Email 1 to read its content in the Message viewer.

Actual Results:  
The sender's email address, the subject and the date and time are displayed in the Message viewer.

However Email 1 text is not.

Even after 5 minutes there is no error message indicating to the user that there is no wifi connection and that is why he cannot read the email content.

Expected Results:  
After a few minutes an error message should appear when the email content cannot be loaded. Something not too specific like: 'Could not connect to server.' 

That will help the user realize why he cannot see the email content in case he has not realized that he lost his internet connexion.

N900, 4:4.5~20100922.1178352-1maemo1.1177763
Comment 1 Tobias Koenig 2010-12-29 13:40:06 UTC
Hej Sabine,

I have changed the message viewer already to show status information if some error condition happens. Attached is a patch which forwards the item retrieval errors (caused when calling requestItemDelivery on the IMAP resource in offline-mode) to the Akonadi::ItemFetchJob object, which itself will show the error as status information in the message viewer.

@Volker is the patch Ok to commit or do you see any unwanted side effects, since the complete ItemFetchJob fails now whenever requestItemDelivery fails?
Comment 2 Tobias Koenig 2010-12-29 13:42:12 UTC
Created attachment 55347 [details]
Patch to fix error propagation in Akonadi server

Patch that forwards errors of requestItemDelivery() to the FETCH handler
Comment 3 Tobias Koenig 2010-12-30 13:34:30 UTC
commit aa74751de1b4466f6779ce9e865b801893d7de5c
branch master
Author: Tobias Koenig <tokoe@kde.org>
Date:   Thu Dec 30 13:34:04 2010 +0100

    Propagate errors from ItemRetriever to FETCH handler
    Errors from the ItemRetriever (e.g. calling requestItemDelivery
    on a resource in offline mode) will be propagated to the FETCH handler
    now, so that the caller of ItemFetchJob can show an error message
    to the user.

diff --git a/server/src/handler/fetchhelper.cpp b/server/src/handler/fetchhelper.cpp
index 88edf74..d66824f 100644
--- a/server/src/handler/fetchhelper.cpp
+++ b/server/src/handler/fetchhelper.cpp
@@ -224,7 +224,9 @@ bool FetchHelper::parseStream( const QByteArray &responseIdentifier )
     retriever.setScope( mScope );
     retriever.setRetrieveParts( payloadList );
     retriever.setRetrieveFullPayload( mFullPayload );
-    retriever.exec(); // There we go, retrieve the missing parts from the resource.
+    if ( !retriever.exec() ) { // There we go, retrieve the missing parts from the resource.
+      throw HandlerException( "Unable to fetch item from backend" );
+    }
   QSqlQuery itemQuery = buildItemQuery();
diff --git a/server/src/storage/itemretriever.cpp b/server/src/storage/itemretriever.cpp
index 6d5a030..9c84a07 100644
--- a/server/src/storage/itemretriever.cpp
+++ b/server/src/storage/itemretriever.cpp
@@ -169,10 +169,10 @@ QSqlQuery ItemRetriever::buildQuery() const
-void ItemRetriever::exec()
+bool ItemRetriever::exec()
   if ( mParts.isEmpty() && !mFullPayload )
-    return;
+    return true;
   QSqlQuery query = buildQuery();
   ItemRetrievalRequest* lastRequest = 0;
@@ -234,6 +234,7 @@ void ItemRetriever::exec()
       ItemRetrievalManager::instance()->requestItemDelivery( request );
     } catch ( const ItemRetrieverException &e ) {
       akError() << e.type() << ": " << e.what();
+      return false;
@@ -247,6 +248,8 @@ void ItemRetriever::exec()
+  return true;
 QString ItemRetriever::driverName()
diff --git a/server/src/storage/itemretriever.h b/server/src/storage/itemretriever.h
index aeb650b..866d265 100644
--- a/server/src/storage/itemretriever.h
+++ b/server/src/storage/itemretriever.h
@@ -62,7 +62,7 @@ class ItemRetriever
     void setScope( const Scope &scope );
     Scope scope() const;
-    void exec();
+    bool exec();
     /** Convenience method which returns the database driver name */
Comment 4 Sabine Faure 2011-01-08 00:53:52 UTC
Hi Tobias!

Indeed it is corrected now.

First a 'The KDE email client' message appears on a white background as well as 'Loading message...'
After about 20s a 'Message loading failed: Unable to fetch item from backend' message appears indicating to the user that something wrong has happened while loading.
Hopefully, that will give her a clue to check her wifi connexion so I am closing this bug.

N900, 4:4.6~.20110106.1209.gitfde48d5-1maemo1.121147