From 1c8944a28c625e199347c3bf0595bdb488ac2b2a Mon Sep 17 00:00:00 2001 From: sunwen Date: Tue, 7 May 2024 10:18:44 +0800 Subject: [PATCH] Add confirm logout. --- src/dialogs/AccountFormDialog.cpp | 4 ++++ src/dialogs/AlertDialog.cpp | 2 ++ 2 files changed, 6 insertions(+) diff --git a/src/dialogs/AccountFormDialog.cpp b/src/dialogs/AccountFormDialog.cpp index 5e72792..73d60eb 100644 --- a/src/dialogs/AccountFormDialog.cpp +++ b/src/dialogs/AccountFormDialog.cpp @@ -152,6 +152,10 @@ void AccountFormDialog::addSelfModeUI(QHBoxLayout* hlayout) hlayout->addWidget(btnLogout); connect(btnLogout, &QAbstractButton::clicked, [=]() { + if(DialogManager::Default()->requestAlertMessage(tr("Do you want to logout the current user?"), OkAndCancel, tr("Logout")) == QDialog::Rejected) + { + return; + } accept(); LOG_USER_OPERATION("Logout") EventCenter::Default()->triggerEvent(RequestLogin, nullptr, nullptr); diff --git a/src/dialogs/AlertDialog.cpp b/src/dialogs/AlertDialog.cpp index 3e80d71..2f27d9a 100644 --- a/src/dialogs/AlertDialog.cpp +++ b/src/dialogs/AlertDialog.cpp @@ -16,6 +16,8 @@ AlertDialog::AlertDialog(QWidget *parent, Qt::WindowFlags f) mLblTitle->setAlignment(Qt::AlignCenter); mLblTitle->setText(tr("Warning")); mLblTitle->setObjectName("AlertDialogTitle"); + mLblMsg->setWordWrap(true); + mLblMsg->setMinimumHeight(70); layout->addWidget(mLblTitle); layout->addWidget(mLblMsg); }