示例#1
0
void Application::slotCheckConnection()
{
    Account *account = AccountManager::instance()->account();

    if( account ) {
        if (account->state() == Account::InvalidCredidential
                || account->state() == Account::SignedOut) {
            //Do not try to connect if we are logged out
            if (!_userTriggeredConnect) {
                return;
            }
        }

        if (_conValidator)
            _conValidator->deleteLater();
        _conValidator = new ConnectionValidator(account);
        connect( _conValidator, SIGNAL(connectionResult(ConnectionValidator::Status)),
                 this, SLOT(slotConnectionValidatorResult(ConnectionValidator::Status)) );
        _conValidator->checkConnection();

    } else {
        // let gui open the setup wizard
        _gui->slotOpenSettingsDialog( true );

        _checkConnectionTimer.stop(); // don't popup the wizard on interval;
    }
}
示例#2
0
void AccountState::checkConnectivity()
{
    if (isSignedOut() || _waitingForNewCredentials) {
        return;
    }

    ConnectionValidator * conValidator = new ConnectionValidator(account());
    connect(conValidator, SIGNAL(connectionResult(ConnectionValidator::Status,QStringList)),
            SLOT(slotConnectionValidatorResult(ConnectionValidator::Status,QStringList)));
    if (isConnected()) {
        // Use a small authed propfind as a minimal ping when we're
        // already connected.
        conValidator->checkAuthentication();
    } else {
        // Check the server and then the auth.

#ifdef Q_OS_WIN
        // There seems to be a bug in Qt on Windows where QNAM sometimes stops
        // working correctly after the computer woke up from sleep. See #2895 #2899
        // and #2973.
        // As an attempted workaround, reset the QNAM regularly if the account is
        // disconnected.
        account()->resetNetworkAccessManager();
#endif
        conValidator->checkServerAndAuth();
    }
}
示例#3
0
void Application::slotCredentialsFetched()
{
    Account *account = AccountManager::instance()->account();
    Q_ASSERT(account);
    disconnect(account->credentials(), SIGNAL(fetched()), this, SLOT(slotCredentialsFetched()));
    if (!account->credentials()->ready()) {
        // User canceled the connection or did not give a password
        account->setState(Account::SignedOut);
        return;
    }
    if (account->state() == Account::InvalidCredidential) {
        // Then we ask again for the credidentials if they are wrong again
        account->setState(Account::Disconnected);
    }

    if (_conValidator)
        _conValidator->deleteLater();
    _conValidator = new ConnectionValidator(account);
    connect( _conValidator, SIGNAL(connectionResult(ConnectionValidator::Status)),
             this, SLOT(slotConnectionValidatorResult(ConnectionValidator::Status)) );
    _conValidator->checkConnection();
}