aboutsummaryrefslogtreecommitdiffstats
path: root/src/ui/main_window
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/main_window')
-rw-r--r--src/ui/main_window/KeyMgmt.cpp19
-rw-r--r--src/ui/main_window/MainWindow.cpp21
2 files changed, 32 insertions, 8 deletions
diff --git a/src/ui/main_window/KeyMgmt.cpp b/src/ui/main_window/KeyMgmt.cpp
index e3128231..f9364ecf 100644
--- a/src/ui/main_window/KeyMgmt.cpp
+++ b/src/ui/main_window/KeyMgmt.cpp
@@ -428,12 +428,20 @@ void KeyMgmt::SlotExportKeyToClipboard() {
}
void KeyMgmt::SlotGenerateKeyDialog() {
- (new KeyGenerateDialog(key_list_->GetCurrentGpgContextChannel(), this))
- ->exec();
- this->raise();
+ if (!CheckGpgVersion(key_list_->GetCurrentGpgContextChannel(), "2.2.0")) {
+ CommonUtils::RaiseMessageBoxNotSupported(this);
+ return;
+ }
+
+ new KeyGenerateDialog(key_list_->GetCurrentGpgContextChannel(), this);
}
void KeyMgmt::SlotGenerateSubKey() {
+ if (!CheckGpgVersion(key_list_->GetCurrentGpgContextChannel(), "2.2.0")) {
+ CommonUtils::RaiseMessageBoxNotSupported(this);
+ return;
+ }
+
auto key = key_list_->GetSelectedGpgKey();
if (key == nullptr) return;
@@ -444,10 +452,7 @@ void KeyMgmt::SlotGenerateSubKey() {
return;
}
- (new SubkeyGenerateDialog(key_list_->GetCurrentGpgContextChannel(), key,
- this))
- ->exec();
- this->raise();
+ new SubkeyGenerateDialog(key_list_->GetCurrentGpgContextChannel(), key, this);
}
void KeyMgmt::SlotExportAsOpenSSHFormat() {
diff --git a/src/ui/main_window/MainWindow.cpp b/src/ui/main_window/MainWindow.cpp
index 104f54d8..4b5c71f5 100644
--- a/src/ui/main_window/MainWindow.cpp
+++ b/src/ui/main_window/MainWindow.cpp
@@ -31,6 +31,8 @@
#include "core/function/GlobalSettingStation.h"
#include "core/model/SettingsObject.h"
#include "core/module/ModuleManager.h"
+#include "core/utils/CommonUtils.h"
+#include "core/utils/GpgUtils.h"
#include "ui/UISignalStation.h"
#include "ui/main_window/GeneralMainWindow.h"
#include "ui/struct/settings_object/AppearanceSO.h"
@@ -115,6 +117,24 @@ void MainWindow::Init() noexcept {
&UISignalStation::SignalMainWindowOpenFile, this,
&MainWindow::SlotOpenFile);
+#if defined(__linux__)
+ connect(this, &MainWindow::SignalLoaded, this, [=]() {
+ QTimer::singleShot(3000, [self = QPointer<MainWindow>(this)]() {
+ if (self != nullptr && DecidePinentry().isEmpty() && !IsFlatpakENV()) {
+ QMessageBox::warning(
+ self, QObject::tr("Pinentry Not Found"),
+ QObject::tr(
+ "No suitable pinentry program was found on your system.\n\n"
+ "Please install 'pinentry-qt' or another compatible pinentry "
+ "(e.g., pinentry-gnome3, pinentry-gtk2).\n\n"
+ "Without it, GnuPG cannot prompt for passwords.\n\n"
+ "Once you have installed it, please restart GpgFrontend. "
+ "The configuration file will be updated automatically."));
+ }
+ });
+ });
+#endif
+
popup_menu_ = new QMenu(this);
popup_menu_->addAction(append_selected_keys_act_);
@@ -152,7 +172,6 @@ void MainWindow::Init() noexcept {
// loading process is done
emit SignalLoaded();
Module::TriggerEvent("APPLICATION_LOADED");
-
} catch (...) {
LOG_W() << tr("Critical error occur while loading GpgFrontend.");
QMessageBox::critical(