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

[Mac] Added some actions to menu of dock icon

This commit is contained in:
S. Razi Alavizadeh 2013-03-16 17:27:08 +03:30
parent 0293a7bcd3
commit d75ab566ef
3 changed files with 25 additions and 0 deletions

View File

@ -62,6 +62,7 @@
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
#include "macmenureceiver.h" #include "macmenureceiver.h"
#include <QFileOpenEvent> #include <QFileOpenEvent>
#include <QMenu>
#endif #endif
#include <QNetworkDiskCache> #include <QNetworkDiskCache>
#include <QDesktopServices> #include <QDesktopServices>
@ -114,6 +115,7 @@ MainApplication::MainApplication(int &argc, char** argv)
#endif #endif
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
, m_macMenuReceiver(0) , m_macMenuReceiver(0)
, m_macDockMenu(0)
#endif #endif
{ {
#if defined(QZ_WS_X11) && !defined(NO_SYSTEM_DATAPATH) #if defined(QZ_WS_X11) && !defined(NO_SYSTEM_DATAPATH)
@ -639,6 +641,17 @@ QupZilla* MainApplication::makeNewWindow(Qz::BrowserWindow type, const QUrl &sta
} }
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
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() MacMenuReceiver* MainApplication::macMenuReceiver()
{ {
if (!m_macMenuReceiver) { if (!m_macMenuReceiver) {
@ -1213,4 +1226,7 @@ QString MainApplication::tempPath() const
MainApplication::~MainApplication() MainApplication::~MainApplication()
{ {
delete m_uaManager; delete m_uaManager;
#ifdef Q_OS_MAC
delete m_macDockMenu;
#endif
} }

View File

@ -54,6 +54,7 @@ class HTML5PermissionsManager;
class Speller; class Speller;
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
class MacMenuReceiver; class MacMenuReceiver;
class QMenu;
#endif #endif
class QT_QUPZILLA_EXPORT MainApplication : public QtSingleApplication class QT_QUPZILLA_EXPORT MainApplication : public QtSingleApplication
@ -130,6 +131,7 @@ public:
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
MacMenuReceiver* macMenuReceiver(); MacMenuReceiver* macMenuReceiver();
QMenu* macDockMenu();
bool event(QEvent* e); bool event(QEvent* e);
#endif #endif
@ -205,6 +207,7 @@ private:
#endif #endif
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
MacMenuReceiver* m_macMenuReceiver; MacMenuReceiver* m_macMenuReceiver;
QMenu* m_macDockMenu;
#endif #endif
}; };

View File

@ -628,6 +628,12 @@ void QupZilla::setupMenu()
m_superMenu->addSeparator(); m_superMenu->addSeparator();
m_superMenu->addAction(new ActionCopy(m_actionQuit, this)); m_superMenu->addAction(new ActionCopy(m_actionQuit, this));
#else
ActionCopy* copyActionPrivateBrowsing = new ActionCopy(m_actionPrivateBrowsing);
copyActionPrivateBrowsing->setText(copyActionPrivateBrowsing->text().remove(QLatin1Char('&')));
mApp->macDockMenu()->addAction(copyActionPrivateBrowsing);
mApp->macDockMenu()->addAction(m_menuFile->actions().at(1));
mApp->macDockMenu()->addAction(m_menuFile->actions().at(0));
#endif #endif
} }