void ConnectionValidator::slotStatusFound(const QUrl&url, const QVariantMap &info) { // status.php was found. qDebug() << "** Application: ownCloud found: " << url << " with version " << CheckServerJob::versionString(info) << "(" << CheckServerJob::version(info) << ")"; QString version = CheckServerJob::version(info); _account->setServerVersion(version); if (version.contains('.') && version.split('.')[0].toInt() < 5) { _errors.append( tr("The configured server for this client is too old") ); _errors.append( tr("Please update to the latest server and restart the client.") ); reportResult( ServerVersionMismatch ); return; } // now check the authentication AbstractCredentials *creds = _account->credentials(); if (creds->ready()) { QTimer::singleShot( 0, this, SLOT( checkAuthentication() )); } else { // We can't proceed with the auth check because we don't have credentials. // Fetch them now! Once fetched, a new connectivity check will be // initiated anyway. creds->fetch(); // no result is reported deleteLater(); } }
void AbstractNetworkJob::slotFinished() { _timer.stop(); if( _reply->error() != QNetworkReply::NoError ) { qDebug() << Q_FUNC_INFO << _reply->error() << _reply->errorString(); if (_reply->error() == QNetworkReply::ProxyAuthenticationRequiredError) { qDebug() << Q_FUNC_INFO << _reply->rawHeader("Proxy-Authenticate"); } emit networkError(_reply); } // get the Date timestamp from reply _responseTimestamp = QString::fromAscii(_reply->rawHeader("Date")); _duration = _durationTimer.elapsed(); bool discard = finished(); AbstractCredentials *creds = _account->credentials(); if (!creds->stillValid(_reply) &&! _ignoreCredentialFailure && _account->state() != Account::InvalidCredidential) { _account->setState(Account::InvalidCredidential); // invalidate & forget token/password // but try to re-sign in. connect( creds, SIGNAL(fetched()), qApp, SLOT(slotCredentialsFetched()), Qt::UniqueConnection); if (creds->ready()) { creds->invalidateAndFetch(_account); } else { creds->fetch(_account); } } if (discard) { deleteLater(); } }