diff --git a/src/lib/webengine/javascript/externaljsobject.cpp b/src/lib/webengine/javascript/externaljsobject.cpp index ad7dedd94..c8e160acb 100644 --- a/src/lib/webengine/javascript/externaljsobject.cpp +++ b/src/lib/webengine/javascript/externaljsobject.cpp @@ -19,10 +19,12 @@ #include "mainapplication.h" #include "pluginproxy.h" #include "speeddial.h" +#include "webpage.h" #include "searchenginesmanager.h" -ExternalJsObject::ExternalJsObject(QObject* parent) - : QObject(parent) +ExternalJsObject::ExternalJsObject(WebPage *page) + : QObject(page) + , m_page(page) { } @@ -37,7 +39,10 @@ int ExternalJsObject::IsSearchProviderInstalled(const QString &engineURL) return 0; } -QObject* ExternalJsObject::speedDial() const +QObject *ExternalJsObject::speedDial() const { + if (m_page->url().toString() != QL1S("qupzilla:speeddial")) + return Q_NULLPTR; + return mApp->plugins()->speedDial(); } diff --git a/src/lib/webengine/javascript/externaljsobject.h b/src/lib/webengine/javascript/externaljsobject.h index 3c2db0a46..1d1bad29b 100644 --- a/src/lib/webengine/javascript/externaljsobject.h +++ b/src/lib/webengine/javascript/externaljsobject.h @@ -20,20 +20,24 @@ #include +class WebPage; + class ExternalJsObject : public QObject { Q_OBJECT Q_PROPERTY(QObject* speedDial READ speedDial CONSTANT) public: - explicit ExternalJsObject(QObject* parent = 0); + explicit ExternalJsObject(WebPage *page); public slots: void AddSearchProvider(const QString &engineUrl); int IsSearchProviderInstalled(const QString &engineURL); private: - QObject* speedDial() const; + QObject *speedDial() const; + + WebPage *m_page; };