summaryrefslogtreecommitdiffstats
path: root/src/ui
diff options
context:
space:
mode:
authorDeepBlueV7.X <nicolas.werner@hotmail.de>2023-08-10 07:01:52 +0000
committerGitHub <noreply@github.com>2023-08-10 07:01:52 +0000
commitff079f6b6ae4b7fd020218263b05079ae4d0bfea (patch)
treefb5abe783bcbc6464c696aba1579568ab4b6d24d /src/ui
parentb12892feb3d2adf19d42f366dc888e582cc6a556 (diff)
parent0634d3f09c6e427e0b5091ebd9ba770099057951 (diff)
Merge pull request #1523 from Nheko-Reborn/qmlFallbackAuth
QML the fallback auth dialog
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/UIA.cpp21
-rw-r--r--src/ui/UIA.h2
2 files changed, 9 insertions, 14 deletions
diff --git a/src/ui/UIA.cpp b/src/ui/UIA.cpp
index 9654c9aa..4c1d35b9 100644
--- a/src/ui/UIA.cpp
+++ b/src/ui/UIA.cpp
@@ -13,8 +13,6 @@
#include "Logging.h"
#include "MatrixClient.h"
-#include "ReCaptcha.h"
-#include "dialogs/FallbackAuth.h"
UIA *
UIA::instance()
@@ -132,23 +130,18 @@ UIA::genericHandler(QString context)
}
} else {
// use fallback
- auto dialog = new dialogs::FallbackAuth(QString::fromStdString(current_stage),
- QString::fromStdString(u.session),
- nullptr);
- dialog->setWindowTitle(context);
-
- connect(dialog, &dialogs::FallbackAuth::confirmation, this, [h, u, dialog]() {
- dialog->close();
- dialog->deleteLater();
+ auto fallback = new FallbackAuth(QString::fromStdString(u.session),
+ QString::fromStdString(current_stage),
+ nullptr);
+ QQmlEngine::setObjectOwnership(fallback, QQmlEngine::JavaScriptOwnership);
+ connect(fallback, &FallbackAuth::confirmation, this, [h, u]() {
h.next(mtx::user_interactive::Auth{u.session,
mtx::user_interactive::auth::Fallback{}});
});
-
- connect(dialog, &dialogs::FallbackAuth::cancel, this, [this]() {
+ connect(fallback, &FallbackAuth::cancelled, this, [this]() {
emit error(tr("Registration aborted"));
});
-
- dialog->show();
+ emit fallbackAuth(fallback);
}
});
});
diff --git a/src/ui/UIA.h b/src/ui/UIA.h
index 5b5eb9f4..2bff6948 100644
--- a/src/ui/UIA.h
+++ b/src/ui/UIA.h
@@ -9,6 +9,7 @@
#include <mtxclient/http/client.hpp>
+#include "FallbackAuth.h"
#include "ReCaptcha.h"
class UIA final : public QObject
@@ -62,6 +63,7 @@ signals:
void email();
void phoneNumber();
void reCaptcha(ReCaptcha *recaptcha);
+ void fallbackAuth(FallbackAuth *fallback);
void confirm3pidToken();
void prompt3pidToken();