aboutsummaryrefslogtreecommitdiffstats
path: root/src/ui/function/RaisePinentry.cpp
diff options
context:
space:
mode:
authorsaturneric <[email protected]>2023-12-03 13:01:27 +0000
committersaturneric <[email protected]>2023-12-03 13:01:27 +0000
commitd0602f09564d3d200b20e83a977315134ced842e (patch)
treeb9cd6f429983a0c9bce51e7fb711b894d634601b /src/ui/function/RaisePinentry.cpp
parentfeat: general improvements of aync execution and memory security (diff)
downloadGpgFrontend-d0602f09564d3d200b20e83a977315134ced842e.tar.gz
GpgFrontend-d0602f09564d3d200b20e83a977315134ced842e.zip
fix: slove issues in key/subkey generation
Diffstat (limited to '')
-rw-r--r--src/ui/function/RaisePinentry.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/ui/function/RaisePinentry.cpp b/src/ui/function/RaisePinentry.cpp
index 65bae527..f47962f4 100644
--- a/src/ui/function/RaisePinentry.cpp
+++ b/src/ui/function/RaisePinentry.cpp
@@ -32,14 +32,27 @@
#include "core/function/CoreSignalStation.h"
#include "pinentry/pinentrydialog.h"
+#include "spdlog/spdlog.h"
namespace GpgFrontend::UI {
+auto FindTopMostWindow(QWidget* fallback) -> QWidget* {
+ QList<QWidget*> top_widgets = QApplication::topLevelWidgets();
+ foreach (QWidget* widget, top_widgets) {
+ if (widget->isActiveWindow()) {
+ SPDLOG_TRACE("find a topmost widget, address: {}",
+ static_cast<void*>(widget));
+ return widget;
+ }
+ }
+ return fallback;
+}
+
RaisePinentry::RaisePinentry(QWidget* parent) : QWidget(parent) {}
auto RaisePinentry::Exec() -> int {
auto* pinentry =
- new PinEntryDialog(this, 0, 0, true, false, QString(),
+ new PinEntryDialog(FindTopMostWindow(this), 0, 0, true, false, QString(),
QString::fromStdString(_("Show passphrase")),
QString::fromStdString(_("Hide passphrase")));