mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 10:46:35 +01:00
Plugins: Added interface for extension's submenu to Tools menu,
This commit is contained in:
parent
ac48237eca
commit
3fd23a54cb
@ -31,6 +31,7 @@
|
|||||||
#include "mainapplication.h"
|
#include "mainapplication.h"
|
||||||
#include "clearprivatedata.h"
|
#include "clearprivatedata.h"
|
||||||
#include "qzsettings.h"
|
#include "qzsettings.h"
|
||||||
|
#include "pluginproxy.h"
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QMetaObject>
|
#include <QMetaObject>
|
||||||
@ -412,6 +413,11 @@ void MainMenu::aboutToShowToolsMenu()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
m_actions[QSL("Tools/SiteInfo")]->setEnabled(SiteInfo::canShowSiteInfo(m_window->weView()->url()));
|
m_actions[QSL("Tools/SiteInfo")]->setEnabled(SiteInfo::canShowSiteInfo(m_window->weView()->url()));
|
||||||
|
|
||||||
|
m_submenuExtensions->clear();
|
||||||
|
mApp->plugins()->populateExtensionsMenu(m_submenuExtensions);
|
||||||
|
|
||||||
|
m_submenuExtensions->menuAction()->setVisible(!m_submenuExtensions->actions().isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainMenu::aboutToHideToolsMenu()
|
void MainMenu::aboutToHideToolsMenu()
|
||||||
@ -580,6 +586,10 @@ void MainMenu::init()
|
|||||||
ADD_ACTION("Tools/AdBlock", m_menuTools, QIcon(), tr("&AdBlock"), SLOT(showAdBlockDialog()), "");
|
ADD_ACTION("Tools/AdBlock", m_menuTools, QIcon(), tr("&AdBlock"), SLOT(showAdBlockDialog()), "");
|
||||||
ADD_ACTION("Tools/WebInspector", m_menuTools, QIcon(), tr("Web In&spector"), SLOT(toggleWebInspector()), "Ctrl+Shift+I");
|
ADD_ACTION("Tools/WebInspector", m_menuTools, QIcon(), tr("Web In&spector"), SLOT(toggleWebInspector()), "Ctrl+Shift+I");
|
||||||
ADD_ACTION("Tools/ClearRecentHistory", m_menuTools, QIcon::fromTheme(QSL("edit-clear")), tr("Clear Recent &History"), SLOT(showClearRecentHistoryDialog()), "Ctrl+Shift+Del");
|
ADD_ACTION("Tools/ClearRecentHistory", m_menuTools, QIcon::fromTheme(QSL("edit-clear")), tr("Clear Recent &History"), SLOT(showClearRecentHistoryDialog()), "Ctrl+Shift+Del");
|
||||||
|
|
||||||
|
m_submenuExtensions = new QMenu(tr("&Extensions"));
|
||||||
|
m_submenuExtensions->menuAction()->setVisible(false);
|
||||||
|
m_menuTools->addMenu(m_submenuExtensions);
|
||||||
m_menuTools->addSeparator();
|
m_menuTools->addSeparator();
|
||||||
|
|
||||||
// Help menu
|
// Help menu
|
||||||
|
@ -127,6 +127,7 @@ private:
|
|||||||
QMenu* m_menuView;
|
QMenu* m_menuView;
|
||||||
QMenu* m_menuTools;
|
QMenu* m_menuTools;
|
||||||
QMenu* m_menuHelp;
|
QMenu* m_menuHelp;
|
||||||
|
QMenu* m_submenuExtensions;
|
||||||
HistoryMenu* m_menuHistory;
|
HistoryMenu* m_menuHistory;
|
||||||
BookmarksMenu* m_menuBookmarks;
|
BookmarksMenu* m_menuBookmarks;
|
||||||
};
|
};
|
||||||
|
@ -71,6 +71,7 @@ public:
|
|||||||
virtual void showSettings(QWidget* parent = 0) { Q_UNUSED(parent) }
|
virtual void showSettings(QWidget* parent = 0) { Q_UNUSED(parent) }
|
||||||
|
|
||||||
virtual void populateWebViewMenu(QMenu* menu, WebView* view, const WebHitTestResult &r) { Q_UNUSED(menu) Q_UNUSED(view) Q_UNUSED(r) }
|
virtual void populateWebViewMenu(QMenu* menu, WebView* view, const WebHitTestResult &r) { Q_UNUSED(menu) Q_UNUSED(view) Q_UNUSED(r) }
|
||||||
|
virtual void populateExtensionsMenu(QMenu *menu) { Q_UNUSED(menu) }
|
||||||
|
|
||||||
virtual bool mouseDoubleClick(const Qz::ObjectName &type, QObject* obj, QMouseEvent* event) { Q_UNUSED(type) Q_UNUSED(obj) Q_UNUSED(event) return false; }
|
virtual bool mouseDoubleClick(const Qz::ObjectName &type, QObject* obj, QMouseEvent* event) { Q_UNUSED(type) Q_UNUSED(obj) Q_UNUSED(event) return false; }
|
||||||
virtual bool mousePress(const Qz::ObjectName &type, QObject* obj, QMouseEvent* event) { Q_UNUSED(type) Q_UNUSED(obj) Q_UNUSED(event) return false; }
|
virtual bool mousePress(const Qz::ObjectName &type, QObject* obj, QMouseEvent* event) { Q_UNUSED(type) Q_UNUSED(obj) Q_UNUSED(event) return false; }
|
||||||
|
@ -100,6 +100,17 @@ void PluginProxy::populateWebViewMenu(QMenu* menu, WebView* view, const WebHitTe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PluginProxy::populateExtensionsMenu(QMenu *menu)
|
||||||
|
{
|
||||||
|
if (!menu) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (PluginInterface* iPlugin, m_loadedPlugins) {
|
||||||
|
iPlugin->populateExtensionsMenu(menu);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool PluginProxy::processMouseDoubleClick(const Qz::ObjectName &type, QObject* obj, QMouseEvent* event)
|
bool PluginProxy::processMouseDoubleClick(const Qz::ObjectName &type, QObject* obj, QMouseEvent* event)
|
||||||
{
|
{
|
||||||
bool accepted = false;
|
bool accepted = false;
|
||||||
|
@ -40,6 +40,7 @@ public:
|
|||||||
void registerAppEventHandler(const EventHandlerType &type, PluginInterface* obj);
|
void registerAppEventHandler(const EventHandlerType &type, PluginInterface* obj);
|
||||||
|
|
||||||
void populateWebViewMenu(QMenu* menu, WebView* view, const WebHitTestResult &r);
|
void populateWebViewMenu(QMenu* menu, WebView* view, const WebHitTestResult &r);
|
||||||
|
void populateExtensionsMenu(QMenu *menu);
|
||||||
|
|
||||||
bool processMouseDoubleClick(const Qz::ObjectName &type, QObject* obj, QMouseEvent* event);
|
bool processMouseDoubleClick(const Qz::ObjectName &type, QObject* obj, QMouseEvent* event);
|
||||||
bool processMousePress(const Qz::ObjectName &type, QObject* obj, QMouseEvent* event);
|
bool processMousePress(const Qz::ObjectName &type, QObject* obj, QMouseEvent* event);
|
||||||
|
Loading…
Reference in New Issue
Block a user