diff --git a/src/gui/accountstate.cpp b/src/gui/accountstate.cpp index f0698c248..f7743b9ab 100644 --- a/src/gui/accountstate.cpp +++ b/src/gui/accountstate.cpp @@ -77,11 +77,6 @@ QStringList AccountState::connectionErrors() const return _connectionErrors; } -QString AccountState::connectionStatusString(ConnectionStatus status) -{ - return ConnectionValidator::statusString(status); -} - AccountState::State AccountState::state() const { return _state; @@ -258,7 +253,7 @@ void AccountState::checkConnectivity() void AccountState::slotConnectionValidatorResult(ConnectionValidator::Status status, const QStringList &errors) { if (isSignedOut()) { - qCWarning(lcAccountState) << "Signed out, ignoring" << connectionStatusString(status) << _account->url().toString(); + qCWarning(lcAccountState) << "Signed out, ignoring" << status << _account->url().toString(); return; } @@ -281,8 +276,8 @@ void AccountState::slotConnectionValidatorResult(ConnectionValidator::Status sta if (_connectionStatus != status) { qCInfo(lcAccountState) << "AccountState connection status change: " - << connectionStatusString(_connectionStatus) << "->" - << connectionStatusString(status); + << _connectionStatus << "->" + << status; _connectionStatus = status; } _connectionErrors = errors; diff --git a/src/gui/accountstate.h b/src/gui/accountstate.h index 96b840c64..573b084ff 100644 --- a/src/gui/accountstate.h +++ b/src/gui/accountstate.h @@ -94,7 +94,6 @@ public: ConnectionStatus connectionStatus() const; QStringList connectionErrors() const; - static QString connectionStatusString(ConnectionStatus status); State state() const; static QString stateString(State state); diff --git a/src/gui/connectionvalidator.cpp b/src/gui/connectionvalidator.cpp index f88e907ec..103f3116e 100644 --- a/src/gui/connectionvalidator.cpp +++ b/src/gui/connectionvalidator.cpp @@ -41,35 +41,6 @@ ConnectionValidator::ConnectionValidator(AccountPtr account, QObject *parent) { } -QString ConnectionValidator::statusString(Status stat) -{ - switch (stat) { - case Undefined: - return QLatin1String("Undefined"); - case Connected: - return QLatin1String("Connected"); - case NotConfigured: - return QLatin1String("Not configured"); - case ServerVersionMismatch: - return QLatin1String("Server Version Mismatch"); - case CredentialsNotReady: - return QLatin1String("Credentials not ready"); - case CredentialsWrong: - return QLatin1String("Credentials Wrong"); - case SslError: - return QLatin1String("SSL Error"); - case StatusNotFound: - return QLatin1String("Status not found"); - case ServiceUnavailable: - return QLatin1String("Service unavailable"); - case MaintenanceMode: - return QLatin1String("Maintenance mode"); - case Timeout: - return QLatin1String("Timeout"); - } - return QLatin1String("status undeclared."); -} - void ConnectionValidator::checkServerAndAuth() { if (!_account) { diff --git a/src/gui/connectionvalidator.h b/src/gui/connectionvalidator.h index d8bb3d986..e65ceb86b 100644 --- a/src/gui/connectionvalidator.h +++ b/src/gui/connectionvalidator.h @@ -98,8 +98,7 @@ public: MaintenanceMode, // maintenance enabled in status.php Timeout // actually also used for other errors on the authed request }; - - static QString statusString(Status); + Q_ENUM(Status); // How often should the Application ask this object to check for the connection? enum { DefaultCallingIntervalMsec = 32 * 1000 };