diff options
Diffstat (limited to 'src/ui/main_window/MainWindowUI.cpp')
-rw-r--r-- | src/ui/main_window/MainWindowUI.cpp | 51 |
1 files changed, 50 insertions, 1 deletions
diff --git a/src/ui/main_window/MainWindowUI.cpp b/src/ui/main_window/MainWindowUI.cpp index 1470b731..77bf2e14 100644 --- a/src/ui/main_window/MainWindowUI.cpp +++ b/src/ui/main_window/MainWindowUI.cpp @@ -27,6 +27,7 @@ */ #include "MainWindow.h" +#include "core/function/gpg/GpgAdvancedOperator.h" #include "ui/UserInterfaceUtils.h" namespace GpgFrontend::UI { @@ -241,6 +242,48 @@ void MainWindow::create_actions() { connect(open_key_management_act_, &QAction::triggered, this, &MainWindow::slot_open_key_management); + clean_gpg_password_cache_act_ = new QAction(_("Clear Password Cache"), this); + clean_gpg_password_cache_act_->setIcon(QIcon(":configure.png")); + clean_gpg_password_cache_act_->setToolTip(_("Clear Password Cache of GnuPG")); + connect(clean_gpg_password_cache_act_, &QAction::triggered, this, [=]() { + if (GpgFrontend::GpgAdvancedOperator::GetInstance() + .ClearGpgPasswordCache()) { + QMessageBox::information(this, _("Successful Operation"), + _("Clear password cache successfully")); + } else { + QMessageBox::critical(this, _("Failed Operation"), + _("Failed to clear password cache of GnuPG")); + } + }); + + reload_components_act_ = new QAction(_("Reload All Components"), this); + reload_components_act_->setIcon(QIcon(":configure.png")); + reload_components_act_->setToolTip(_("Reload All GnuPG's Components")); + connect(reload_components_act_, &QAction::triggered, this, [=]() { + if (GpgFrontend::GpgAdvancedOperator::GetInstance() + .ReloadGpgComponents()) { + QMessageBox::information(this, _("Successful Operation"), + _("Reload all the GnuPG's components successfully")); + } else { + QMessageBox::critical(this, _("Failed Operation"), + _("Failed to reload all or one of the GnuPG's component(s)")); + } + }); + + restart_components_act_ = new QAction(_("Restart All Components"), this); + 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)")); + } + }); + /* * About Menu */ @@ -270,7 +313,7 @@ void MainWindow::create_actions() { check_update_act_->setIcon(QIcon(":help.png")); check_update_act_->setToolTip(_("Check for updates")); connect(check_update_act_, &QAction::triggered, this, - [=]() { new AboutDialog(2, this); }); + [=]() { new AboutDialog(3, this); }); start_wizard_act_ = new QAction(_("Open Wizard"), this); start_wizard_act_->setToolTip(_("Open the wizard")); @@ -372,6 +415,12 @@ void MainWindow::create_menus() { import_key_menu_->addAction(import_key_from_key_server_act_); key_menu_->addAction(open_key_management_act_); + gpg_menu_ = menuBar()->addMenu(_("GnuPG")); + gpg_menu_->addAction(clean_gpg_password_cache_act_); + gpg_menu_->addSeparator(); + gpg_menu_->addAction(reload_components_act_); + gpg_menu_->addAction(restart_components_act_); + steganography_menu_ = menuBar()->addMenu(_("Steganography")); steganography_menu_->addAction(cut_pgp_header_act_); steganography_menu_->addAction(add_pgp_header_act_); |