1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 01:22:10 +01: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)
{ {
} }
@ -37,7 +39,10 @@ int ExternalJsObject::IsSearchProviderInstalled(const QString &engineURL)
return 0; 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(); return mApp->plugins()->speedDial();
} }

View File

@ -20,20 +20,24 @@
#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);
int IsSearchProviderInstalled(const QString &engineURL); int IsSearchProviderInstalled(const QString &engineURL);
private: private:
QObject* speedDial() const; QObject *speedDial() const;
WebPage *m_page;
}; };