Bug 243605 - Connection error dialog pops up too often
Summary: Connection error dialog pops up too often
Status: RESOLVED FIXED
Alias: None
Product: Akonadi
Classification: Frameworks and Libraries
Component: POP3 Resource (show other bugs)
Version: 4.5
Platform: Unlisted Binaries Linux
: NOR normal
Target Milestone: ---
Assignee: Thomas McGuire
URL:
Keywords: akonadi-ports-regression
: 282612 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-07-04 21:22 UTC by Thomas McGuire
Modified: 2011-09-23 12:43 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas McGuire 2010-07-04 21:22:00 UTC
The password stuff was recently refactored.
Now a dialog box pops up every time a connection attempt failed.
With a mail check interval of 1 minute, I get a lot of annoying messageboxes all the time.
This should not happen.
Comment 1 Thomas McGuire 2010-12-25 00:02:11 UTC
commit 4fcd35e51a0857ef0f4886e9b98e4ceeb7608cb6
branch master
Author: Thomas McGuire <mcguire@kde.org>
Date:   Fri Dec 24 23:43:46 2010 +0100

    Don't check mail while the error dialog is shown.
    
    With interval check enabled, the user would see 12 error boxes stacked
    over each other after one hour otherwise.
    
    I never liked this dialog and am tempted to remove it altogether,
    actually.
    
    BUG: 243605

diff --git a/resources/pop3/pop3resource.cpp b/resources/pop3/pop3resource.cpp
index 066c1db..68dad58 100644
--- a/resources/pop3/pop3resource.cpp
+++ b/resources/pop3/pop3resource.cpp
@@ -47,7 +47,8 @@ POP3Resource::POP3Resource( const QString &id )
       mAskAgain( false ),
       mIntervalTimer( new QTimer( this ) ),
       mTestLocalInbox( false ),
-      mWallet( 0 )
+      mWallet( 0 ),
+      mErrorDialogShown( false )
 {
   setNeedsNetwork( true );
   Settings::self()->setResourceId( identifier() );
@@ -84,7 +85,7 @@ void POP3Resource::updateIntervalTimer()
 void POP3Resource::intervalCheckTriggered()
 {
   Q_ASSERT( mState == Idle );
-  if (isOnline()) {
+  if ( isOnline() && !mErrorDialogShown ) {
     kDebug() << "Starting interval mail check.";
     startMailCheck();
     mIntervalCheckInProgress = true;
@@ -522,6 +523,7 @@ void POP3Resource::loginJobResult( KJob *job )
 
     // FIXME: "The server refused the supplied username and password." is not correct! The server might
     //        not even be online, there might be a connection problem etc
+    mErrorDialogShown = true;
     int i = KMessageBox::questionYesNoCancelWId( winIdForDialogs(),
                                   i18n( "The server refused the supplied username and password. "
                                         "Do you want to go to the settings, have another attempt "
@@ -530,6 +532,7 @@ void POP3Resource::loginJobResult( KJob *job )
                                   i18n( "Could Not Authenticate" ),
                                   KGuiItem( i18n( "Settings" ) ),
                                   KGuiItem( i18nc( "Input username/password manually and not store them", "Single Input" ) ) );
+    mErrorDialogShown = false;
     if ( i == KMessageBox::Yes ) {
       configure( winIdForDialogs() );
       return;
@@ -995,7 +998,7 @@ void POP3Resource::startMailCheck()
 
 void POP3Resource::retrieveCollections()
 {
-  if ( mState == Idle ) {
+  if ( mState == Idle && !mErrorDialogShown ) {
     startMailCheck();
   }
   else {
diff --git a/resources/pop3/pop3resource.h b/resources/pop3/pop3resource.h
index 14aba20..b594a28 100644
--- a/resources/pop3/pop3resource.h
+++ b/resources/pop3/pop3resource.h
@@ -143,6 +143,7 @@ class POP3Resource : public Akonadi::ResourceBase,
     bool mSavePassword;
     bool mTestLocalInbox;
     KWallet::Wallet *mWallet;
+    bool mErrorDialogShown;
 
     // Maps IDs on the server to message sizes on the server
     QMap<int,int> mIdsToSizeMap;
Comment 2 Christophe Marin 2011-09-23 12:43:08 UTC
*** Bug 282612 has been marked as a duplicate of this bug. ***