QML the logout dialog
This commit is contained in:
parent
acc257ea06
commit
81406171a0
@ -111,6 +111,13 @@ Page {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Component {
|
||||||
|
id: logoutDialog
|
||||||
|
|
||||||
|
LogoutDialog {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Shortcut {
|
Shortcut {
|
||||||
sequence: "Ctrl+K"
|
sequence: "Ctrl+K"
|
||||||
onActivated: {
|
onActivated: {
|
||||||
@ -135,6 +142,15 @@ Page {
|
|||||||
onActivated: Rooms.previousRoom()
|
onActivated: Rooms.previousRoom()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
function onOpenLogoutDialog() {
|
||||||
|
var dialog = logoutDialog.createObject(timelineRoot);
|
||||||
|
dialog.open();
|
||||||
|
}
|
||||||
|
|
||||||
|
target: Nheko
|
||||||
|
}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
function onNewDeviceVerificationRequest(flow) {
|
function onNewDeviceVerificationRequest(flow) {
|
||||||
var dialog = deviceVerificationDialog.createObject(timelineRoot, {
|
var dialog = deviceVerificationDialog.createObject(timelineRoot, {
|
||||||
|
19
resources/qml/dialogs/LogoutDialog.qml
Normal file
19
resources/qml/dialogs/LogoutDialog.qml
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
// SPDX-FileCopyrightText: 2021 Nheko Contributors
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
import QtQuick 2.15
|
||||||
|
import QtQuick.Controls 2.15
|
||||||
|
import Qt.labs.platform 1.1
|
||||||
|
import im.nheko 1.0
|
||||||
|
|
||||||
|
MessageDialog {
|
||||||
|
id: logoutRoot
|
||||||
|
|
||||||
|
title: qsTr("Log out")
|
||||||
|
text: CallManager.isOnCall ? qsTr("A call is in progress. Log out?") : qsTr("Are you sure you want to log out?")
|
||||||
|
modality: Qt.WindowModal
|
||||||
|
flags: Qt.Tool | Qt.WindowStaysOnTopHint | Qt.WindowCloseButtonHint | Qt.WindowTitleHint
|
||||||
|
buttons: Dialog.Ok | Dialog.Cancel
|
||||||
|
onAccepted: Nheko.logout()
|
||||||
|
}
|
@ -183,6 +183,7 @@
|
|||||||
<file>qml/dialogs/RoomMembers.qml</file>
|
<file>qml/dialogs/RoomMembers.qml</file>
|
||||||
<file>qml/dialogs/RoomSettings.qml</file>
|
<file>qml/dialogs/RoomSettings.qml</file>
|
||||||
<file>qml/dialogs/UserProfile.qml</file>
|
<file>qml/dialogs/UserProfile.qml</file>
|
||||||
|
<file>qml/dialogs/LogoutDialog.qml</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
<qresource prefix="/media">
|
<qresource prefix="/media">
|
||||||
<file>media/ring.ogg</file>
|
<file>media/ring.ogg</file>
|
||||||
|
@ -35,7 +35,6 @@
|
|||||||
#include "dialogs/CreateRoom.h"
|
#include "dialogs/CreateRoom.h"
|
||||||
#include "dialogs/JoinRoom.h"
|
#include "dialogs/JoinRoom.h"
|
||||||
#include "dialogs/LeaveRoom.h"
|
#include "dialogs/LeaveRoom.h"
|
||||||
#include "dialogs/Logout.h"
|
|
||||||
|
|
||||||
MainWindow *MainWindow::instance_ = nullptr;
|
MainWindow *MainWindow::instance_ = nullptr;
|
||||||
|
|
||||||
@ -372,24 +371,6 @@ MainWindow::showSolidOverlayModal(QWidget *content, QFlags<Qt::AlignmentFlag> fl
|
|||||||
modal_->show();
|
modal_->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
MainWindow::openLogoutDialog()
|
|
||||||
{
|
|
||||||
auto dialog = new dialogs::Logout(this);
|
|
||||||
connect(dialog, &dialogs::Logout::loggingOut, this, [this]() {
|
|
||||||
if (WebRTCSession::instance().state() != webrtc::State::DISCONNECTED) {
|
|
||||||
if (QMessageBox::question(this, "nheko", "A call is in progress. Log out?") !=
|
|
||||||
QMessageBox::Yes) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
WebRTCSession::instance().end();
|
|
||||||
}
|
|
||||||
chat_page_->initiateLogout();
|
|
||||||
});
|
|
||||||
|
|
||||||
showDialog(dialog);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
MainWindow::hasActiveDialogs() const
|
MainWindow::hasActiveDialogs() const
|
||||||
{
|
{
|
||||||
|
@ -64,7 +64,6 @@ public:
|
|||||||
void openCreateRoomDialog(
|
void openCreateRoomDialog(
|
||||||
std::function<void(const mtx::requests::CreateRoom &request)> callback);
|
std::function<void(const mtx::requests::CreateRoom &request)> callback);
|
||||||
void openJoinRoomDialog(std::function<void(const QString &room_id)> callback);
|
void openJoinRoomDialog(std::function<void(const QString &room_id)> callback);
|
||||||
void openLogoutDialog();
|
|
||||||
|
|
||||||
void hideOverlay();
|
void hideOverlay();
|
||||||
void showSolidOverlayModal(QWidget *content, QFlags<Qt::AlignmentFlag> flags = Qt::AlignCenter);
|
void showSolidOverlayModal(QWidget *content, QFlags<Qt::AlignmentFlag> flags = Qt::AlignCenter);
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
#include "Logging.h"
|
#include "Logging.h"
|
||||||
#include "MainWindow.h"
|
#include "MainWindow.h"
|
||||||
#include "UserSettingsPage.h"
|
#include "UserSettingsPage.h"
|
||||||
|
#include "WebRTCSession.h"
|
||||||
#include "Utils.h"
|
#include "Utils.h"
|
||||||
|
|
||||||
Nheko::Nheko()
|
Nheko::Nheko()
|
||||||
@ -83,9 +84,9 @@ Nheko::showUserSettingsPage() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Nheko::openLogoutDialog() const
|
Nheko::logout() const
|
||||||
{
|
{
|
||||||
MainWindow::instance()->openLogoutDialog();
|
ChatPage::instance()->initiateLogout();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -48,7 +48,7 @@ public:
|
|||||||
Q_INVOKABLE void openLink(QString link) const;
|
Q_INVOKABLE void openLink(QString link) const;
|
||||||
Q_INVOKABLE void setStatusMessage(QString msg) const;
|
Q_INVOKABLE void setStatusMessage(QString msg) const;
|
||||||
Q_INVOKABLE void showUserSettingsPage() const;
|
Q_INVOKABLE void showUserSettingsPage() const;
|
||||||
Q_INVOKABLE void openLogoutDialog() const;
|
Q_INVOKABLE void logout() const;
|
||||||
Q_INVOKABLE void openCreateRoomDialog() const;
|
Q_INVOKABLE void openCreateRoomDialog() const;
|
||||||
Q_INVOKABLE void openJoinRoomDialog() const;
|
Q_INVOKABLE void openJoinRoomDialog() const;
|
||||||
Q_INVOKABLE void reparent(QWindow *win) const;
|
Q_INVOKABLE void reparent(QWindow *win) const;
|
||||||
@ -60,6 +60,8 @@ signals:
|
|||||||
void colorsChanged();
|
void colorsChanged();
|
||||||
void profileChanged();
|
void profileChanged();
|
||||||
|
|
||||||
|
void openLogoutDialog();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QScopedPointer<UserProfile> currentUser_;
|
QScopedPointer<UserProfile> currentUser_;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user