From 128d46e19a4246364af4d361e3c570982a43fb7d Mon Sep 17 00:00:00 2001 From: Jocelyn Turcotte Date: Sat, 5 Sep 2015 15:51:11 +0200 Subject: [PATCH] Remove *Credentials::_fetchJobInProgress Now that fetchFromKeychain is solely called from AccountState::slotInvalidCredentials and that this one already protects the fetch call using _waitingForNewCredentials, we can remove that extra check. --- src/gui/creds/shibbolethcredentials.cpp | 13 ------------- src/gui/creds/shibbolethcredentials.h | 1 - src/libsync/creds/httpcredentials.cpp | 13 ++----------- src/libsync/creds/httpcredentials.h | 1 - 4 files changed, 2 insertions(+), 26 deletions(-) diff --git a/src/gui/creds/shibbolethcredentials.cpp b/src/gui/creds/shibbolethcredentials.cpp index 12b9b7d82..0a1cac4b3 100644 --- a/src/gui/creds/shibbolethcredentials.cpp +++ b/src/gui/creds/shibbolethcredentials.cpp @@ -51,14 +51,12 @@ ShibbolethCredentials::ShibbolethCredentials() _url(), _ready(false), _stillValid(false), - _fetchJobInProgress(false), _browser(0) {} ShibbolethCredentials::ShibbolethCredentials(const QNetworkCookie& cookie) : _ready(true), _stillValid(true), - _fetchJobInProgress(false), _browser(0), _shibCookie(cookie) { @@ -153,15 +151,10 @@ bool ShibbolethCredentials::ready() const void ShibbolethCredentials::fetchFromKeychain() { - if(_fetchJobInProgress) { - return; - } - if (_user.isEmpty()) { _user = _account->credentialSetting(QLatin1String(userC)).toString(); } if (_ready) { - _fetchJobInProgress = false; Q_EMIT fetched(); } else { _url = _account->url(); @@ -171,7 +164,6 @@ void ShibbolethCredentials::fetchFromKeychain() job->setKey(keychainKey(_account->url().toString(), "shibAssertion")); connect(job, SIGNAL(finished(QKeychain::Job*)), SLOT(slotReadJobDone(QKeychain::Job*))); job->start(); - _fetchJobInProgress = true; } } @@ -197,7 +189,6 @@ void ShibbolethCredentials::persist() void ShibbolethCredentials::invalidateToken() { _ready = false; - _fetchJobInProgress = true; CookieJar *jar = static_cast(_account->networkAccessManager()->cookieJar()); @@ -263,7 +254,6 @@ void ShibbolethCredentials::slotUserFetched(const QString &user) _stillValid = true; _ready = true; - _fetchJobInProgress = false; Q_EMIT asked(); } @@ -271,7 +261,6 @@ void ShibbolethCredentials::slotUserFetched(const QString &user) void ShibbolethCredentials::slotBrowserRejected() { _ready = false; - _fetchJobInProgress = false; Q_EMIT asked(); } @@ -290,11 +279,9 @@ void ShibbolethCredentials::slotReadJobDone(QKeychain::Job *job) _ready = true; _stillValid = true; - _fetchJobInProgress = false; Q_EMIT fetched(); } else { _ready = false; - _fetchJobInProgress = false; Q_EMIT fetched(); } } diff --git a/src/gui/creds/shibbolethcredentials.h b/src/gui/creds/shibbolethcredentials.h index 19bbbb25a..99ecdac47 100644 --- a/src/gui/creds/shibbolethcredentials.h +++ b/src/gui/creds/shibbolethcredentials.h @@ -88,7 +88,6 @@ private: bool _ready; bool _stillValid; - bool _fetchJobInProgress; QPointer _browser; QNetworkCookie _shibCookie; QString _user; diff --git a/src/libsync/creds/httpcredentials.cpp b/src/libsync/creds/httpcredentials.cpp index cfeba26a4..f31265a8c 100644 --- a/src/libsync/creds/httpcredentials.cpp +++ b/src/libsync/creds/httpcredentials.cpp @@ -82,8 +82,7 @@ const char authenticationFailedC[] = "owncloud-authentication-failed"; } // ns HttpCredentials::HttpCredentials() - : _ready(false), - _fetchJobInProgress(false) + : _ready(false) { } @@ -92,8 +91,7 @@ HttpCredentials::HttpCredentials(const QString& user, const QString& password, c _password(password), _ready(true), _certificatePath(certificatePath), - _certificatePasswd(certificatePasswd), - _fetchJobInProgress(false) + _certificatePasswd(certificatePasswd) { } @@ -197,11 +195,6 @@ QString HttpCredentials::fetchUser() void HttpCredentials::fetchFromKeychain() { - // FIXME: Should this check go if we check in AccountState instead? - if (_fetchJobInProgress) { - return; - } - // User must be fetched from config file fetchUser(); _certificatePath = _account->credentialSetting(QLatin1String(certifPathC)).toString(); @@ -231,7 +224,6 @@ void HttpCredentials::fetchFromKeychain() job->setKey(kck); connect(job, SIGNAL(finished(QKeychain::Job*)), SLOT(slotReadJobDone(QKeychain::Job*))); job->start(); - _fetchJobInProgress = true; } } bool HttpCredentials::stillValid(QNetworkReply *reply) @@ -250,7 +242,6 @@ void HttpCredentials::slotReadJobDone(QKeychain::Job *job) QKeychain::Error error = job->error(); - _fetchJobInProgress = false; if( !_password.isEmpty() && error == NoError ) { // All cool, the keychain did not come back with error. diff --git a/src/libsync/creds/httpcredentials.h b/src/libsync/creds/httpcredentials.h index bbd0a3d2c..ce3d9c42b 100644 --- a/src/libsync/creds/httpcredentials.h +++ b/src/libsync/creds/httpcredentials.h @@ -73,7 +73,6 @@ protected: private: QString _certificatePath; QString _certificatePasswd; - bool _fetchJobInProgress; //True if the keychain job is in progress or the input dialog visible }; } // namespace OCC -- 2.30.2