From 05c1fec5c633aafd224ad1df27629bda79023a85 Mon Sep 17 00:00:00 2001 From: David Rosca Date: Fri, 7 Nov 2014 17:16:22 +0100 Subject: [PATCH] Preferences: Prevent opening more than one window --- src/lib/app/mainmenu.cpp | 8 ++++++-- src/lib/app/mainmenu.h | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/lib/app/mainmenu.cpp b/src/lib/app/mainmenu.cpp index 8a49b6039..5db2fad1b 100644 --- a/src/lib/app/mainmenu.cpp +++ b/src/lib/app/mainmenu.cpp @@ -118,8 +118,12 @@ void MainMenu::showAboutDialog() void MainMenu::showPreferences() { - Preferences* prefs = new Preferences(m_window, this); - prefs->show(); + if (!m_preferences) + m_preferences = new Preferences(m_window, this); + + m_preferences->show(); + m_preferences->raise(); + m_preferences->activateWindow(); } void MainMenu::quitApplication() diff --git a/src/lib/app/mainmenu.h b/src/lib/app/mainmenu.h index 09c8816ac..8a00565c2 100644 --- a/src/lib/app/mainmenu.h +++ b/src/lib/app/mainmenu.h @@ -26,6 +26,7 @@ class QMenuBar; +class Preferences; class HistoryMenu; class BookmarksMenu; class BrowserWindow; @@ -122,6 +123,7 @@ private: QHash m_actions; QPointer m_window; + QPointer m_preferences; QMenu* m_menuFile; QMenu* m_menuEdit;