From 53fcf7f428d8d7ef2390f5877fe8f682ba9971d3 Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Sun, 30 May 2021 12:41:44 +0200 Subject: Port remaining sidebar actions to qml --- src/ui/NhekoGlobalObject.cpp | 27 +++++++++++++++++++++++++++ src/ui/NhekoGlobalObject.h | 4 ++++ 2 files changed, 31 insertions(+) (limited to 'src/ui') diff --git a/src/ui/NhekoGlobalObject.cpp b/src/ui/NhekoGlobalObject.cpp index fd572b4b..fea10839 100644 --- a/src/ui/NhekoGlobalObject.cpp +++ b/src/ui/NhekoGlobalObject.cpp @@ -10,6 +10,7 @@ #include "Cache_p.h" #include "ChatPage.h" #include "Logging.h" +#include "MainWindow.h" #include "UserSettingsPage.h" #include "Utils.h" @@ -113,3 +114,29 @@ Nheko::currentUser() const return currentUser_.get(); } + +void +Nheko::showUserSettingsPage() const +{ + ChatPage::instance()->showUserSettingsPage(); +} + +void +Nheko::openLogoutDialog() const +{ + MainWindow::instance()->openLogoutDialog(); +} + +void +Nheko::openCreateRoomDialog() const +{ + MainWindow::instance()->openCreateRoomDialog( + [](const mtx::requests::CreateRoom &req) { ChatPage::instance()->createRoom(req); }); +} + +void +Nheko::openJoinRoomDialog() const +{ + MainWindow::instance()->openJoinRoomDialog( + [](const QString &room_id) { ChatPage::instance()->joinRoom(room_id); }); +} diff --git a/src/ui/NhekoGlobalObject.h b/src/ui/NhekoGlobalObject.h index 593514fa..14135fd1 100644 --- a/src/ui/NhekoGlobalObject.h +++ b/src/ui/NhekoGlobalObject.h @@ -40,6 +40,10 @@ public: Q_INVOKABLE void openLink(QString link) const; Q_INVOKABLE void setStatusMessage(QString msg) const; + Q_INVOKABLE void showUserSettingsPage() const; + Q_INVOKABLE void openLogoutDialog() const; + Q_INVOKABLE void openCreateRoomDialog() const; + Q_INVOKABLE void openJoinRoomDialog() const; public slots: void updateUserProfile(); -- cgit 1.5.1