1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-19 18:26:34 +01:00

[Plugins] Added possibility to unregister scheme handlers.

It is important to unregister scheme handler when unloading
a plugin, otherwise it will crash on next createRequest call.
This commit is contained in:
nowrep 2013-04-12 18:05:45 +02:00
parent c073ce0094
commit 901bdac85d
3 changed files with 11 additions and 0 deletions

View File

@ -608,6 +608,15 @@ bool NetworkManager::registerSchemeHandler(const QString &scheme, SchemeHandler*
return true;
}
bool NetworkManager::unregisterSchemeHandler(const QString &scheme, SchemeHandler* handler)
{
if (!m_schemeHandlers.contains(scheme) || m_schemeHandlers[scheme] != handler) {
return false;
}
return m_schemeHandlers.remove(scheme) == 1;
}
void NetworkManager::saveCertificates()
{
Settings settings;

View File

@ -55,6 +55,7 @@ public:
NetworkProxyFactory* proxyFactory() const;
bool registerSchemeHandler(const QString &scheme, SchemeHandler* handler);
bool unregisterSchemeHandler(const QString &scheme, SchemeHandler* handler);
void disconnectObjects();

View File

@ -81,5 +81,6 @@ private:
#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);
#endif // PLUGINPROXY_H