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
wilder-work
Thomas McGuire 18 years ago
parent ec629790b0
commit 95189ed864
  1. 13
      imapaccountbase.cpp
  2. 1
      imapaccountbase.h

@ -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() );

@ -542,6 +542,7 @@ namespace KMail {
bool mErrorDialogIsActive : 1;
bool mPasswordDialogIsActive : 1;
bool mPasswordEnteredAndEmpty : 1;
bool mACLSupport : 1;
bool mAnnotationSupport : 1;
bool mQuotaSupport : 1;

Loading…
Cancel
Save