Changeset View
Changeset View
Standalone View
Standalone View
qt/main.cpp
| Context not available. | |||||
| #include <windows.h> | #include <windows.h> | ||||
| #endif | #endif | ||||
| #ifdef PINENTRY_KWINDOWSYSTEM | |||||
| #include <KWindowSystem> | |||||
| #endif | |||||
| #include "pinentry_debug.h" | #include "pinentry_debug.h" | ||||
| static QString escape_accel(const QString &s) | static QString escape_accel(const QString &s) | ||||
| Context not available. | |||||
| Qt::WindowMinimizeButtonHint); | Qt::WindowMinimizeButtonHint); | ||||
| } | } | ||||
| static void | |||||
| setup_foreground_window(QWidget *widget, const QString &parentWid) | |||||
| { | |||||
| #ifdef PINENTRY_KWINDOWSYSTEM | |||||
| widget->winId(); // Important; ensures that a window handle is returned. | |||||
| KWindowSystem::setMainWindow(widget->windowHandle(), parentWid); | |||||
| #endif | |||||
| } | |||||
| static int | static int | ||||
| qt_cmd_handler(pinentry_t pe) | qt_cmd_handler(pinentry_t pe) | ||||
| { | { | ||||
| Context not available. | |||||
| if (want_pass) { | if (want_pass) { | ||||
| PinEntryDialog pinentry(pe, nullptr, 0, true, | PinEntryDialog pinentry(pe, nullptr, 0, true, | ||||
| repeatString, visibilityTT, hideTT); | repeatString, visibilityTT, hideTT); | ||||
| setup_foreground_window(&pinentry, pe->parent_wid); | if (qApp->platformName() == QStringLiteral("wayland")) { | ||||
| setup_foreground_window(&pinentry, QString::fromLatin1(qgetenv("PINENTRY_GEOM_HINT"))); | |||||
| } else { | |||||
| setup_foreground_window(&pinentry, pe->parent_wid); | |||||
| } | |||||
| pinentry.setPrompt(escape_accel(from_utf8(pe->prompt))); | pinentry.setPrompt(escape_accel(from_utf8(pe->prompt))); | ||||
| pinentry.setDescription(from_utf8(pe->description)); | pinentry.setDescription(from_utf8(pe->description)); | ||||
| pinentry.setRepeatErrorText(repeatError); | pinentry.setRepeatErrorText(repeatError); | ||||
| pinentry.setGenpinLabel(generateLbl); | pinentry.setGenpinLabel(generateLbl); | ||||
| Context not available. | |||||
| box.setTextFormat(Qt::PlainText); | box.setTextFormat(Qt::PlainText); | ||||
| box.setTextInteractionFlags(Qt::TextSelectableByMouse); | box.setTextInteractionFlags(Qt::TextSelectableByMouse); | ||||
| box.setTimeout(std::chrono::seconds{pe->timeout}); | box.setTimeout(std::chrono::seconds{pe->timeout}); | ||||
| setup_foreground_window(&box, pe->parent_wid); | if (qApp->platformName() == QStringLiteral("wayland")) { | ||||
| setup_foreground_window(&box, QString::fromLatin1(qgetenv("PINENTRY_GEOM_HINT"))); | |||||
| } else { | |||||
| setup_foreground_window(&box, pe->parent_wid); | |||||
| } | |||||
| const struct { | const struct { | ||||
| QMessageBox::StandardButton button; | QMessageBox::StandardButton button; | ||||
| Context not available. | |||||