1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 02:36:34 +01:00

macOS: Fix global menu with multiple windows.

- Closes #2261
This commit is contained in:
srazi 2017-03-20 11:37:33 +03:30
parent 9af542aa03
commit 345d03105f
4 changed files with 8 additions and 3 deletions

View File

@ -346,20 +346,20 @@ void BrowserWindow::setupMenu()
if (!macMainMenu) { if (!macMainMenu) {
macMainMenu = new MainMenu(this, 0); macMainMenu = new MainMenu(this, 0);
macMainMenu->initMenuBar(new QMenuBar(0)); macMainMenu->initMenuBar(new QMenuBar(0));
connect(mApp, SIGNAL(activeWindowChanged(BrowserWindow*)), macMainMenu, SLOT(setWindow(BrowserWindow*)));
} }
else { else {
macMainMenu->setWindow(this); macMainMenu->setWindow(this);
} }
m_mainMenu = macMainMenu; m_mainMenu = macMainMenu;
m_mainMenu->initSuperMenu(m_superMenu);
#else #else
setMenuBar(new MenuBar(this)); setMenuBar(new MenuBar(this));
m_mainMenu = new MainMenu(this, this); m_mainMenu = new MainMenu(this, this);
m_mainMenu->initMenuBar(menuBar()); m_mainMenu->initMenuBar(menuBar());
m_mainMenu->initSuperMenu(m_superMenu);
#endif #endif
m_mainMenu->initSuperMenu(m_superMenu);
// Setup other shortcuts // Setup other shortcuts
QShortcut* reloadBypassCacheAction = new QShortcut(QKeySequence(QSL("Ctrl+F5")), this); QShortcut* reloadBypassCacheAction = new QShortcut(QKeySequence(QSL("Ctrl+F5")), this);

View File

@ -845,6 +845,8 @@ void MainApplication::onFocusChanged()
if (activeBrowserWindow) { if (activeBrowserWindow) {
m_lastActiveWindow = activeBrowserWindow; m_lastActiveWindow = activeBrowserWindow;
emit activeWindowChanged(m_lastActiveWindow);
} }
} }

View File

@ -121,6 +121,7 @@ public slots:
signals: signals:
void settingsReloaded(); void settingsReloaded();
void activeWindowChanged(BrowserWindow* window);
private slots: private slots:
void postLaunch(); void postLaunch();

View File

@ -38,13 +38,15 @@ class QUPZILLA_EXPORT MainMenu : public QMenu
public: public:
explicit MainMenu(BrowserWindow* window, QWidget* parent = 0); explicit MainMenu(BrowserWindow* window, QWidget* parent = 0);
void setWindow(BrowserWindow* window);
void initMenuBar(QMenuBar* menuBar) const; void initMenuBar(QMenuBar* menuBar) const;
void initSuperMenu(QMenu* superMenu) const; void initSuperMenu(QMenu* superMenu) const;
QAction* action(const QString &name) const; QAction* action(const QString &name) const;
public slots:
void setWindow(BrowserWindow* window);
private slots: private slots:
// Standard actions // Standard actions
void showAboutDialog(); void showAboutDialog();