From 977b45505c680099937c7a68b0cf5eaf918e9b35 Mon Sep 17 00:00:00 2001 From: David Rosca Date: Tue, 6 Feb 2018 15:48:30 +0100 Subject: [PATCH] PluginProxy: Remove QZ_REGISTER_* macros --- src/lib/plugins/pluginproxy.h | 20 +------------------ .../AccessKeysNavigation/akn_plugin.cpp | 2 +- src/plugins/AutoScroll/autoscrollplugin.cpp | 8 ++++---- .../gnomekeyringplugin.cpp | 2 +- .../KWalletPasswords/kwalletplugin.cpp | 2 +- .../MouseGestures/mousegesturesplugin.cpp | 6 +++--- src/plugins/PIM/PIM_plugin.cpp | 2 +- .../StatusBarIcons/statusbariconsplugin.cpp | 1 + src/plugins/TestPlugin/testplugin.cpp | 2 +- .../VerticalTabs/verticaltabsplugin.cpp | 2 +- 10 files changed, 15 insertions(+), 32 deletions(-) diff --git a/src/lib/plugins/pluginproxy.h b/src/lib/plugins/pluginproxy.h index 3f82756cd..f8055223b 100644 --- a/src/lib/plugins/pluginproxy.h +++ b/src/lib/plugins/pluginproxy.h @@ -1,6 +1,6 @@ /* ============================================================ * Falkon - Qt web browser -* Copyright (C) 2010-2014 David Rosca +* Copyright (C) 2010-2018 David Rosca * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -82,22 +82,4 @@ private: QList m_keyReleaseHandlers; }; -#include "mainapplication.h" -#include "networkmanager.h" -#include "autofill.h" -#include "passwordmanager.h" - -#define QZ_REGISTER_EVENT_HANDLER(Type) \ - mApp->plugins()->registerAppEventHandler(Type, this); - -#define QZ_REGISTER_SCHEME_HANDLER(Scheme, Object) \ - mApp->networkManager()->registerSchemeHandler(Scheme, Object); -#define QZ_UNREGISTER_SCHEME_HANDLER(Scheme, Object) \ - mApp->networkManager()->unregisterSchemeHandler(Scheme, Object); - -#define QZ_REGISTER_PASSWORD_BACKEND(Name, Object) \ - mApp->autoFill()->passwordManager()->registerBackend(Name, Object); -#define QZ_UNREGISTER_PASSWORD_BACKEND(Object) \ - mApp->autoFill()->passwordManager()->unregisterBackend(Object); - #endif // PLUGINPROXY_H diff --git a/src/plugins/AccessKeysNavigation/akn_plugin.cpp b/src/plugins/AccessKeysNavigation/akn_plugin.cpp index 11d9925c5..14d0c7c62 100644 --- a/src/plugins/AccessKeysNavigation/akn_plugin.cpp +++ b/src/plugins/AccessKeysNavigation/akn_plugin.cpp @@ -51,7 +51,7 @@ void AKN_Plugin::init(InitState state, const QString &sPath) m_handler = new AKN_Handler(sPath, this); - QZ_REGISTER_EVENT_HANDLER(PluginProxy::KeyPressHandler); + mApp->plugins->registerAppEventHandler(PluginProxy::KeyPressHandler, this); } void AKN_Plugin::unload() diff --git a/src/plugins/AutoScroll/autoscrollplugin.cpp b/src/plugins/AutoScroll/autoscrollplugin.cpp index ea783c8bf..49067d632 100644 --- a/src/plugins/AutoScroll/autoscrollplugin.cpp +++ b/src/plugins/AutoScroll/autoscrollplugin.cpp @@ -51,10 +51,10 @@ void AutoScrollPlugin::init(InitState state, const QString &settingsPath) m_scroller = new AutoScroller(settingsPath + QL1S("/extensions.ini"), this); - QZ_REGISTER_EVENT_HANDLER(PluginProxy::MouseMoveHandler); - QZ_REGISTER_EVENT_HANDLER(PluginProxy::MousePressHandler); - QZ_REGISTER_EVENT_HANDLER(PluginProxy::MouseReleaseHandler); - QZ_REGISTER_EVENT_HANDLER(PluginProxy::WheelEventHandler); + mApp->plugins()->registerAppEventHandler(PluginProxy::MouseMoveHandler, this); + mApp->plugins()->registerAppEventHandler(PluginProxy::MousePressHandler, this); + mApp->plugins()->registerAppEventHandler(PluginProxy::MouseReleaseHandler, this); + mApp->plugins()->registerAppEventHandler(PluginProxy::WheelEventHandler, this); } void AutoScrollPlugin::unload() diff --git a/src/plugins/GnomeKeyringPasswords/gnomekeyringplugin.cpp b/src/plugins/GnomeKeyringPasswords/gnomekeyringplugin.cpp index a975f090a..ce5be00d4 100644 --- a/src/plugins/GnomeKeyringPasswords/gnomekeyringplugin.cpp +++ b/src/plugins/GnomeKeyringPasswords/gnomekeyringplugin.cpp @@ -49,7 +49,7 @@ void GnomeKeyringPlugin::init(InitState state, const QString &settingsPath) Q_UNUSED(settingsPath); m_backend = new GnomeKeyringPasswordBackend; - QZ_REGISTER_PASSWORD_BACKEND("GnomeKeyring", m_backend); + mApp->autoFill()->passwordManager()->registerBackend(QSL("GnomeKeyring"), m_backend); } void GnomeKeyringPlugin::unload() diff --git a/src/plugins/KWalletPasswords/kwalletplugin.cpp b/src/plugins/KWalletPasswords/kwalletplugin.cpp index 36314a7c3..0bc2b8392 100644 --- a/src/plugins/KWalletPasswords/kwalletplugin.cpp +++ b/src/plugins/KWalletPasswords/kwalletplugin.cpp @@ -49,7 +49,7 @@ void KWalletPlugin::init(InitState state, const QString &settingsPath) Q_UNUSED(settingsPath); m_backend = new KWalletPasswordBackend; - QZ_REGISTER_PASSWORD_BACKEND("KWallet", m_backend); + mApp->autoFill()->passwordManager()->registerBackend(QSL("KWallet"), m_backend); } void KWalletPlugin::unload() diff --git a/src/plugins/MouseGestures/mousegesturesplugin.cpp b/src/plugins/MouseGestures/mousegesturesplugin.cpp index b2f9f0783..1864dc7ce 100644 --- a/src/plugins/MouseGestures/mousegesturesplugin.cpp +++ b/src/plugins/MouseGestures/mousegesturesplugin.cpp @@ -50,9 +50,9 @@ void MouseGesturesPlugin::init(InitState state, const QString &settingsPath) m_gestures = new MouseGestures(settingsPath, this); - QZ_REGISTER_EVENT_HANDLER(PluginProxy::MousePressHandler); - QZ_REGISTER_EVENT_HANDLER(PluginProxy::MouseReleaseHandler); - QZ_REGISTER_EVENT_HANDLER(PluginProxy::MouseMoveHandler); + mApp->plugins()->registerAppEventHandler(PluginProxy::MousePressHandler, this); + mApp->plugins()->registerAppEventHandler(PluginProxy::MouseReleaseHandler, this); + mApp->plugins()->registerAppEventHandler(PluginProxy::MouseMoveHandler, this); } void MouseGesturesPlugin::unload() diff --git a/src/plugins/PIM/PIM_plugin.cpp b/src/plugins/PIM/PIM_plugin.cpp index 051e3b837..2e4875c67 100644 --- a/src/plugins/PIM/PIM_plugin.cpp +++ b/src/plugins/PIM/PIM_plugin.cpp @@ -53,7 +53,7 @@ void PIM_Plugin::init(InitState state, const QString &settingsPath) m_handler = new PIM_Handler(settingsPath, this); - QZ_REGISTER_EVENT_HANDLER(PluginProxy::KeyPressHandler); + mApp->plugins()->registerAppEventHandler(PluginProxy::KeyPressHandler, this); connect(mApp->plugins(), SIGNAL(webPageCreated(WebPage*)), m_handler, SLOT(webPageCreated(WebPage*))); } diff --git a/src/plugins/StatusBarIcons/statusbariconsplugin.cpp b/src/plugins/StatusBarIcons/statusbariconsplugin.cpp index 9cec59778..514de8d30 100644 --- a/src/plugins/StatusBarIcons/statusbariconsplugin.cpp +++ b/src/plugins/StatusBarIcons/statusbariconsplugin.cpp @@ -21,6 +21,7 @@ #include "pluginproxy.h" #include "browserwindow.h" #include "../config.h" +#include "mainapplication.h" #include diff --git a/src/plugins/TestPlugin/testplugin.cpp b/src/plugins/TestPlugin/testplugin.cpp index 8e8224f9d..699873ff7 100644 --- a/src/plugins/TestPlugin/testplugin.cpp +++ b/src/plugins/TestPlugin/testplugin.cpp @@ -73,7 +73,7 @@ void TestPlugin::init(InitState state, const QString &settingsPath) // Registering this plugin as a MousePressHandler. // Otherwise mousePress() function will never be called - QZ_REGISTER_EVENT_HANDLER(PluginProxy::MousePressHandler); + mApp->plugins()->registerAppEventHandler(PluginProxy::MousePressHandler, this); // Adding new sidebar into application SideBarManager::addSidebar("testplugin-sidebar", new TestPlugin_Sidebar(this)); diff --git a/src/plugins/VerticalTabs/verticaltabsplugin.cpp b/src/plugins/VerticalTabs/verticaltabsplugin.cpp index 9adb18d3d..2cd86d1ac 100644 --- a/src/plugins/VerticalTabs/verticaltabsplugin.cpp +++ b/src/plugins/VerticalTabs/verticaltabsplugin.cpp @@ -65,7 +65,7 @@ void VerticalTabsPlugin::init(InitState state, const QString &settingsPath) m_controller = new VerticalTabsController(this); SideBarManager::addSidebar(QSL("VerticalTabs"), m_controller); - QZ_REGISTER_EVENT_HANDLER(PluginProxy::KeyPressHandler); + mApp->plugins()->registerAppEventHandler(PluginProxy::KeyPressHandler, this); mApp->networkManager()->registerExtensionSchemeHandler(QSL("verticaltabs"), new VerticalTabsSchemeHandler); setWebTabBehavior(m_addChildBehavior);