1
mirror of https://invent.kde.org/network/falkon.git synced 2024-09-21 17:52:10 +02:00

window.external: Only export speedDial on qupzilla:speeddial

This commit is contained in:
David Rosca 2015-08-31 13:17:14 +02:00
parent 19f1ed6bfb
commit a04efdc0be
2 changed files with 14 additions and 5 deletions

View File

@ -19,10 +19,12 @@
#include "mainapplication.h" #include "mainapplication.h"
#include "pluginproxy.h" #include "pluginproxy.h"
#include "speeddial.h" #include "speeddial.h"
#include "webpage.h"
#include "searchenginesmanager.h" #include "searchenginesmanager.h"
ExternalJsObject::ExternalJsObject(QObject* parent) ExternalJsObject::ExternalJsObject(WebPage *page)
: QObject(parent) : QObject(page)
, m_page(page)
{ {
} }
@ -39,5 +41,8 @@ int ExternalJsObject::IsSearchProviderInstalled(const QString &engineURL)
QObject *ExternalJsObject::speedDial() const QObject *ExternalJsObject::speedDial() const
{ {
if (m_page->url().toString() != QL1S("qupzilla:speeddial"))
return Q_NULLPTR;
return mApp->plugins()->speedDial(); return mApp->plugins()->speedDial();
} }

View File

@ -20,13 +20,15 @@
#include <QObject> #include <QObject>
class WebPage;
class ExternalJsObject : public QObject class ExternalJsObject : public QObject
{ {
Q_OBJECT Q_OBJECT
Q_PROPERTY(QObject* speedDial READ speedDial CONSTANT) Q_PROPERTY(QObject* speedDial READ speedDial CONSTANT)
public: public:
explicit ExternalJsObject(QObject* parent = 0); explicit ExternalJsObject(WebPage *page);
public slots: public slots:
void AddSearchProvider(const QString &engineUrl); void AddSearchProvider(const QString &engineUrl);
@ -35,6 +37,8 @@ public slots:
private: private:
QObject *speedDial() const; QObject *speedDial() const;
WebPage *m_page;
}; };
#endif // EXTERNALJSOBJECT_H #endif // EXTERNALJSOBJECT_H