1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 10:46:35 +01:00

Mac: Re-enable dock menu with New Tab, New Window and New Private Window actions

This commit is contained in:
David Rosca 2014-09-25 14:09:26 +02:00
parent c607a2f717
commit 767e01fd22
5 changed files with 12 additions and 44 deletions

View File

@ -546,15 +546,6 @@ void BrowserWindow::goBack()
weView()->back();
}
QMenuBar* BrowserWindow::menuBar() const
{
#ifdef Q_OS_MAC
return mApp->macMenuReceiver()->menuBar();
#endif
return QMainWindow::menuBar();
}
TabbedWebView* BrowserWindow::weView() const
{
return weView(m_tabWidget->currentIndex());

View File

@ -25,7 +25,6 @@
#include "restoremanager.h"
#include "qzcommon.h"
class QMenuBar;
class QLabel;
class QVBoxLayout;
class QSplitter;
@ -84,7 +83,6 @@ public:
void createEncodingMenu(QMenu* menu);
SideBar* addSideBar();
virtual QMenuBar* menuBar() const;
QByteArray saveState(int version = 0) const;
bool restoreState(const QByteArray &state, int version = 0);

View File

@ -102,7 +102,6 @@ MainApplication::MainApplication(int &argc, char** argv)
, m_registerQAppAssociation(0)
#endif
#ifdef Q_OS_MAC
, m_macMenuReceiver(0)
, m_macDockMenu(0)
#endif
{
@ -1115,29 +1114,7 @@ RegisterQAppAssociation* MainApplication::associationManager()
#endif
#ifdef Q_OS_MAC
#include "macmenureceiver.h"
#include <QFileOpenEvent>
#include <QMenu>
extern void qt_mac_set_dock_menu(QMenu* menu);
QMenu* MainApplication::macDockMenu()
{
if (!m_macDockMenu) {
m_macDockMenu = new QMenu(0);
qt_mac_set_dock_menu(m_macDockMenu);
}
return m_macDockMenu;
}
MacMenuReceiver* MainApplication::macMenuReceiver()
{
if (!m_macMenuReceiver) {
m_macMenuReceiver = new MacMenuReceiver(this);
}
return m_macMenuReceiver;
}
bool MainApplication::event(QEvent* e)
{

View File

@ -31,6 +31,7 @@ class QNetworkDiskCache;
class History;
class AutoFill;
class MainMenu;
class Bookmarks;
class CookieJar;
class AutoSaver;
@ -48,10 +49,6 @@ class HTML5PermissionsManager;
class RegisterQAppAssociation;
class DesktopNotificationsFactory;
#ifdef Q_OS_MAC
class MacMenuReceiver;
#endif
class QUPZILLA_EXPORT MainApplication : public QtSingleApplication
{
Q_OBJECT
@ -188,13 +185,7 @@ private:
#ifdef Q_OS_MAC
public:
MacMenuReceiver* macMenuReceiver();
QMenu* macDockMenu();
bool event(QEvent* e);
private:
MacMenuReceiver* m_macMenuReceiver;
QMenu* m_macDockMenu;
#endif
};

View File

@ -39,6 +39,10 @@
#include <QWebPage>
#include <QMenuBar>
#ifdef Q_OS_MAC
extern void qt_mac_set_dock_menu(QMenu* menu);
#endif
MainMenu::MainMenu(BrowserWindow* window, QWidget* parent)
: QMenu(parent)
, m_window(window)
@ -631,6 +635,13 @@ void MainMenu::init()
// Add standard actions to File Menu (as it won't be ever cleared) and Mac menubar should move them to "Application" menu
m_menuFile->addAction(m_actions[QSL("Standard/About")]);
m_menuFile->addAction(m_actions[QSL("Standard/Preferences")]);
// Create Dock menu
QMenu* dockMenu = new QMenu(0);
dockMenu->addAction(m_actions[QSL("File/NewTab")]);
dockMenu->addAction(m_actions[QSL("File/NewWindow")]);
dockMenu->addAction(m_actions[QSL("File/NewPrivateWindow")]);
qt_mac_set_dock_menu(dockMenu);
#endif
#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC)