Commit b2061665 authored by Nicolas Fella's avatar Nicolas Fella
Browse files

[nextcloud] Add state property to controller

parent ee7b88de
...@@ -88,6 +88,8 @@ void NextcloudController::fileChecked(KJob* job) ...@@ -88,6 +88,8 @@ void NextcloudController::fileChecked(KJob* job)
QUrl url = KIO::upUrl(kJob->url()); QUrl url = KIO::upUrl(kJob->url());
m_server = url.toString(); m_server = url.toString();
m_state = WebLogin;
Q_EMIT stateChanged();
// Call webview for login // Call webview for login
openWebView(); openWebView();
} }
...@@ -200,6 +202,8 @@ void NextcloudController::authCheckResult(KJob *job) ...@@ -200,6 +202,8 @@ void NextcloudController::authCheckResult(KJob *job)
} else { } else {
m_errorMessage.clear(); m_errorMessage.clear();
m_isLoginComplete = true; m_isLoginComplete = true;
m_state = Services;
Q_EMIT stateChanged();
Q_EMIT isLoginCompleteChanged(); Q_EMIT isLoginCompleteChanged();
} }
......
...@@ -28,8 +28,17 @@ class NextcloudController : public QObject ...@@ -28,8 +28,17 @@ class NextcloudController : public QObject
Q_PROPERTY(bool isWorking READ isWorking NOTIFY isWorkingChanged) Q_PROPERTY(bool isWorking READ isWorking NOTIFY isWorkingChanged)
Q_PROPERTY(bool isLoginComplete READ isLoginComplete NOTIFY isLoginCompleteChanged) Q_PROPERTY(bool isLoginComplete READ isLoginComplete NOTIFY isLoginCompleteChanged)
Q_PROPERTY(QString errorMessage READ errorMessage NOTIFY errorMessageChanged) Q_PROPERTY(QString errorMessage READ errorMessage NOTIFY errorMessageChanged)
Q_PROPERTY(State state MEMBER m_state NOTIFY stateChanged)
public: public:
enum State {
ServerUrl = 0,
WebLogin,
Services,
};
Q_ENUM(State)
NextcloudController(QObject *parent = 0); NextcloudController(QObject *parent = 0);
~NextcloudController(); ~NextcloudController();
...@@ -44,6 +53,7 @@ Q_SIGNALS: ...@@ -44,6 +53,7 @@ Q_SIGNALS:
void errorMessageChanged(); void errorMessageChanged();
void isLoginCompleteChanged(); void isLoginCompleteChanged();
void wizardFinished(const QString &username, const QString &password, const QVariantMap &data); void wizardFinished(const QString &username, const QString &password, const QVariantMap &data);
void stateChanged();
private Q_SLOTS: private Q_SLOTS:
void fileChecked(KJob *job); void fileChecked(KJob *job);
...@@ -69,6 +79,7 @@ private: ...@@ -69,6 +79,7 @@ private:
QStringList m_disabledServices; QStringList m_disabledServices;
bool m_isWorking = false; bool m_isWorking = false;
bool m_isLoginComplete = false; bool m_isLoginComplete = false;
State m_state = ServerUrl;
}; };
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment