Commit b2061665 authored by Nicolas Fella's avatar Nicolas Fella

[nextcloud] Add state property to controller

parent ee7b88de
......@@ -88,6 +88,8 @@ void NextcloudController::fileChecked(KJob* job)
QUrl url = KIO::upUrl(kJob->url());
m_server = url.toString();
m_state = WebLogin;
Q_EMIT stateChanged();
// Call webview for login
openWebView();
}
......@@ -200,6 +202,8 @@ void NextcloudController::authCheckResult(KJob *job)
} else {
m_errorMessage.clear();
m_isLoginComplete = true;
m_state = Services;
Q_EMIT stateChanged();
Q_EMIT isLoginCompleteChanged();
}
......
......@@ -28,8 +28,17 @@ class NextcloudController : public QObject
Q_PROPERTY(bool isWorking READ isWorking NOTIFY isWorkingChanged)
Q_PROPERTY(bool isLoginComplete READ isLoginComplete NOTIFY isLoginCompleteChanged)
Q_PROPERTY(QString errorMessage READ errorMessage NOTIFY errorMessageChanged)
Q_PROPERTY(State state MEMBER m_state NOTIFY stateChanged)
public:
enum State {
ServerUrl = 0,
WebLogin,
Services,
};
Q_ENUM(State)
NextcloudController(QObject *parent = 0);
~NextcloudController();
......@@ -44,6 +53,7 @@ Q_SIGNALS:
void errorMessageChanged();
void isLoginCompleteChanged();
void wizardFinished(const QString &username, const QString &password, const QVariantMap &data);
void stateChanged();
private Q_SLOTS:
void fileChecked(KJob *job);
......@@ -69,6 +79,7 @@ private:
QStringList m_disabledServices;
bool m_isWorking = 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