From 3b8d49104c35a0a85ef8511e1d563037ef505673 Mon Sep 17 00:00:00 2001 From: Weslly Date: Mon, 20 Nov 2017 04:26:53 -0200 Subject: [PATCH] Focus database unlock dialog on macOS, fix #1023 --- src/autotype/AutoType.cpp | 7 +++++++ src/autotype/AutoType.h | 1 + src/gui/DatabaseWidget.cpp | 6 ++++++ 3 files changed, 14 insertions(+) diff --git a/src/autotype/AutoType.cpp b/src/autotype/AutoType.cpp index 2519b9dcb..0d01a8311 100644 --- a/src/autotype/AutoType.cpp +++ b/src/autotype/AutoType.cpp @@ -256,6 +256,13 @@ void AutoType::resetInAutoType() m_inAutoType = false; } +void AutoType::raiseWindow() +{ +#if defined(Q_OS_MAC) + m_plugin->raiseOwnWindow(); +#endif +} + void AutoType::unloadPlugin() { if (m_executor) { diff --git a/src/autotype/AutoType.h b/src/autotype/AutoType.h index 6f4a815f8..e881975ac 100644 --- a/src/autotype/AutoType.h +++ b/src/autotype/AutoType.h @@ -51,6 +51,7 @@ public: public slots: void performGlobalAutoType(const QList& dbList); + void raiseWindow(); signals: void globalShortcutTriggered(); diff --git a/src/gui/DatabaseWidget.cpp b/src/gui/DatabaseWidget.cpp index a610cf506..e5110e30a 100644 --- a/src/gui/DatabaseWidget.cpp +++ b/src/gui/DatabaseWidget.cpp @@ -1400,6 +1400,12 @@ void DatabaseWidget::showUnlockDialog() { m_unlockDatabaseDialog->clearForms(); m_unlockDatabaseDialog->setDBFilename(m_filename); + +#if defined(Q_OS_MAC) + autoType()->raiseWindow(); + Tools::wait(500); +#endif + m_unlockDatabaseDialog->show(); m_unlockDatabaseDialog->activateWindow(); }