diff --git a/src/creds/httpcredentials.cpp b/src/creds/httpcredentials.cpp index 48b2aff10a..22db507451 100644 --- a/src/creds/httpcredentials.cpp +++ b/src/creds/httpcredentials.cpp @@ -100,7 +100,8 @@ HttpCredentials::HttpCredentials() HttpCredentials::HttpCredentials(const QString& user, const QString& password) : _user(user), _password(password), - _ready(true) + _ready(true), + _fetchJobInProgress(false) { } @@ -183,6 +184,10 @@ void HttpCredentials::fetch(Account *account) return; } + if (_fetchJobInProgress) { + return; + } + fetchUser(account); QSettings *settings = account->settingsWithGroup(Theme::instance()->appName()); @@ -207,6 +212,7 @@ void HttpCredentials::fetch(Account *account) connect(job, SIGNAL(finished(QKeychain::Job*)), SLOT(slotReadJobDone(QKeychain::Job*))); job->setProperty("account", QVariant::fromValue(account)); job->start(); + _fetchJobInProgress = true; } } bool HttpCredentials::stillValid(QNetworkReply *reply) @@ -234,6 +240,7 @@ void HttpCredentials::slotReadJobDone(QKeychain::Job *job) // Still, the password can be empty which indicates a problem and // the password dialog has to be opened. _ready = true; + _fetchJobInProgress = false; emit fetched(); } else { if( error != NoError ) { @@ -241,6 +248,7 @@ void HttpCredentials::slotReadJobDone(QKeychain::Job *job) } bool ok; QString pwd = queryPassword(&ok); + _fetchJobInProgress = false; if (ok) { _password = pwd; _ready = true; diff --git a/src/creds/httpcredentials.h b/src/creds/httpcredentials.h index 1de04d00e6..52312834d9 100644 --- a/src/creds/httpcredentials.h +++ b/src/creds/httpcredentials.h @@ -62,6 +62,7 @@ private: QString _user; QString _password; bool _ready; + bool _fetchJobInProgress; //True if the keychain job is in progress or the input dialog visible }; } // ns Mirall