aboutsummaryrefslogtreecommitdiffstats
path: root/src/ui/main_window/MainWindowUI.cpp
diff options
context:
space:
mode:
authorsaturneric <[email protected]>2023-10-25 14:28:25 +0000
committersaturneric <[email protected]>2023-10-25 14:28:25 +0000
commitb7ceed0b87752077fe19fefe9b0df8ec27ce0531 (patch)
tree51cb5f2a9210dabaa585b65d085f336cc5f0f844 /src/ui/main_window/MainWindowUI.cpp
parentfix: solve some code tidy issues (diff)
downloadGpgFrontend-b7ceed0b87752077fe19fefe9b0df8ec27ce0531.tar.gz
GpgFrontend-b7ceed0b87752077fe19fefe9b0df8ec27ce0531.zip
feat: moving gnupg info gathering logic to a new module
Diffstat (limited to 'src/ui/main_window/MainWindowUI.cpp')
-rw-r--r--src/ui/main_window/MainWindowUI.cpp28
1 files changed, 18 insertions, 10 deletions
diff --git a/src/ui/main_window/MainWindowUI.cpp b/src/ui/main_window/MainWindowUI.cpp
index f18a7c7b..93bbd088 100644
--- a/src/ui/main_window/MainWindowUI.cpp
+++ b/src/ui/main_window/MainWindowUI.cpp
@@ -26,9 +26,12 @@
*
*/
+#include <any>
+
#include "MainWindow.h"
#include "core/function/GlobalSettingStation.h"
#include "core/function/gpg/GpgAdvancedOperator.h"
+#include "core/module/ModuleManager.h"
#include "ui/UserInterfaceUtils.h"
#include "ui/dialog/gnupg/GnuPGControllerDialog.h"
#include "ui/dialog/help/AboutDialog.h"
@@ -313,16 +316,21 @@ void MainWindow::create_actions() {
restart_components_act_->setIcon(QIcon(":configure.png"));
restart_components_act_->setToolTip(_("Restart All GnuPG's Components"));
connect(restart_components_act_, &QAction::triggered, this, [=]() {
- if (GpgFrontend::GpgAdvancedOperator::GetInstance()
- .RestartGpgComponents()) {
- QMessageBox::information(
- this, _("Successful Operation"),
- _("Restart all the GnuPG's components successfully"));
- } else {
- QMessageBox::critical(
- this, _("Failed Operation"),
- _("Failed to restart all or one of the GnuPG's component(s)"));
- }
+ GpgFrontend::GpgAdvancedOperator::GetInstance().RestartGpgComponents();
+ Module::ListenRTPublishEvent(
+ this, "core", "gpg_advanced_operator.restart_gpg_components",
+ [=](Module::Namespace, Module::Key, int, std::any value) {
+ bool success_state = std::any_cast<bool>(value);
+ if (success_state) {
+ QMessageBox::information(
+ this, _("Successful Operation"),
+ _("Restart all the GnuPG's components successfully"));
+ } else {
+ QMessageBox::critical(
+ this, _("Failed Operation"),
+ _("Failed to restart all or one of the GnuPG's component(s)"));
+ }
+ });
});
gnupg_controller_open_act_ = new QAction(_("Open GnuPG Controller"), this);