From 95189ed86457301609fec6ea63e2d974b88992ad Mon Sep 17 00:00:00 2001 From: Thomas McGuire Date: Sun, 8 Jun 2008 13:48:06 +0000 Subject: [PATCH] Don't assert when the password entered is empty. The password dialog is still shown too many times, but at least it doesn't crash anymore. BUG: 156990 svn path=/trunk/KDE/kdepim/; revision=818395 --- imapaccountbase.cpp | 13 ++++++++++++- imapaccountbase.h | 1 + 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/imapaccountbase.cpp b/imapaccountbase.cpp index 716728989..6d329cf31 100644 --- a/imapaccountbase.cpp +++ b/imapaccountbase.cpp @@ -90,6 +90,7 @@ ImapAccountBase::ImapAccountBase( AccountManager *parent, const QString &name, u mProgressEnabled( false ), mErrorDialogIsActive( false ), mPasswordDialogIsActive( false ), + mPasswordEnteredAndEmpty( false ), mACLSupport( true ), mAnnotationSupport( true ), mQuotaSupport( true ), @@ -293,8 +294,12 @@ ImapAccountBase::ConnectionState ImapAccountBase::makeConnection() return Connecting; } + // Show the password dialog if the password wasn't entered + // before (passwd().isEmpty() && !mPasswordEnteredAndEmpty) or the + // entered password was wrong (mAskAgain). if ( mAskAgain || - ( ( passwd().isEmpty() || login().isEmpty() ) && auth() != "GSSAPI" ) ) { + ( ( ( passwd().isEmpty() && !mPasswordEnteredAndEmpty ) || + login().isEmpty() ) && auth() != "GSSAPI" ) ) { Q_ASSERT( !mSlave ); // disconnected on 'wrong login' error already, or first try QString log = login(); @@ -316,10 +321,16 @@ ImapAccountBase::ConnectionState ImapAccountBase::makeConnection() if (ret != QDialog::Accepted ) { mPasswordDialogIsActive = false; mAskAgain = false; + mPasswordEnteredAndEmpty = false; emit connectionResult( KIO::ERR_USER_CANCELED, QString() ); return Error; } mPasswordDialogIsActive = false; + + // If the user entered an empty password, we need to be able to keep apart + // the case from the case that the user simply didn't enter a password at all. + mPasswordEnteredAndEmpty = dlg.password().isEmpty(); + // The user has been given the chance to change login and // password, so copy both from the dialog: setPasswd( dlg.password(), dlg.keepPassword() ); diff --git a/imapaccountbase.h b/imapaccountbase.h index 59ed78eb7..2ad82c924 100644 --- a/imapaccountbase.h +++ b/imapaccountbase.h @@ -542,6 +542,7 @@ namespace KMail { bool mErrorDialogIsActive : 1; bool mPasswordDialogIsActive : 1; + bool mPasswordEnteredAndEmpty : 1; bool mACLSupport : 1; bool mAnnotationSupport : 1; bool mQuotaSupport : 1;