mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 02:36:34 +01:00
fix code
This commit is contained in:
parent
6d2551cfbe
commit
a2440585d8
@ -19,6 +19,8 @@
|
||||
|
||||
#include <QObject>
|
||||
|
||||
#include "bookmarkitem.h"
|
||||
|
||||
class QmlBookmarksApiTest : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -35,3 +37,5 @@ private Q_SLOTS:
|
||||
void testBookmarksModification();
|
||||
void testBookmarksRemoval();
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(BookmarkItem *)
|
||||
|
@ -246,6 +246,4 @@ private:
|
||||
#endif
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(BrowserWindow*)
|
||||
|
||||
#endif // BROWSERWINDOW_H
|
||||
|
@ -103,6 +103,4 @@ private:
|
||||
bool m_sidebarExpanded;
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(BookmarkItem*)
|
||||
|
||||
#endif // BOOKMARKITEM_H
|
||||
|
@ -213,8 +213,7 @@ bool QmlBookmarks::remove(QmlBookmarkTreeNode *treeNode) const
|
||||
qWarning() << "Unable to remove bookmark:" <<"BookmarkItem not found";
|
||||
return false;
|
||||
}
|
||||
mApp->bookmarks()->removeBookmark(item);
|
||||
return true;
|
||||
return mApp->bookmarks()->removeBookmark(item);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -83,7 +83,7 @@ public:
|
||||
Separator = BookmarkItem::Separator, //!< Represents the bookmark seperator
|
||||
Invalid = BookmarkItem::Invalid //!< Represents invalid bookmark item
|
||||
};
|
||||
Q_ENUMS(Type)
|
||||
Q_ENUM(Type)
|
||||
|
||||
explicit QmlBookmarkTreeNode(BookmarkItem *item = nullptr);
|
||||
|
||||
@ -109,5 +109,5 @@ public:
|
||||
~QmlBookmarkTreeNodeData();
|
||||
QmlBookmarkTreeNode *get(BookmarkItem *item);
|
||||
private:
|
||||
QMap<BookmarkItem*, QmlBookmarkTreeNode*> m_nodes;
|
||||
QHash<BookmarkItem*, QmlBookmarkTreeNode*> m_nodes;
|
||||
};
|
||||
|
@ -174,7 +174,6 @@ void QmlBrowserAction::removeButton(BrowserWindow *window)
|
||||
|
||||
QmlBrowserActionButton::QmlBrowserActionButton(QObject *parent)
|
||||
: AbstractButtonInterface(parent)
|
||||
, m_popup(nullptr)
|
||||
{
|
||||
connect(this, &AbstractButtonInterface::clicked, this, &QmlBrowserActionButton::positionPopup);
|
||||
}
|
||||
|
@ -90,7 +90,7 @@ public:
|
||||
StatusBar = 0x2 //!< to add the button in status bar
|
||||
};
|
||||
Q_DECLARE_FLAGS(Locations, Location)
|
||||
Q_ENUMS(Locations)
|
||||
Q_ENUM(Locations)
|
||||
|
||||
explicit QmlBrowserAction(QObject *parent = nullptr);
|
||||
~QmlBrowserAction();
|
||||
@ -205,7 +205,7 @@ private:
|
||||
QString m_id;
|
||||
QString m_name;
|
||||
QString m_iconUrl;
|
||||
QQmlComponent *m_popup;
|
||||
QQmlComponent *m_popup = nullptr;
|
||||
};
|
||||
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS(QmlBrowserAction::Locations)
|
||||
|
@ -36,7 +36,7 @@ public:
|
||||
ON_TabWidget = Qz::ON_TabWidget, //!< Represents object is tabwidget
|
||||
ON_BrowserWindow = Qz::ON_BrowserWindow //!< Represents object is browser window
|
||||
};
|
||||
Q_ENUMS(ObjectName)
|
||||
Q_ENUM(ObjectName)
|
||||
|
||||
explicit QmlQzObjects(QObject *parent = nullptr);
|
||||
};
|
||||
|
@ -49,7 +49,7 @@ public:
|
||||
RequestDenied = QWebEngineUrlRequestJob::RequestDenied, //! Request denied
|
||||
RequestFailed = QWebEngineUrlRequestJob::RequestFailed //! Request failed
|
||||
};
|
||||
Q_ENUMS(Error)
|
||||
Q_ENUM(Error)
|
||||
explicit QmlWebEngineUrlRequestJob(QWebEngineUrlRequestJob *job = nullptr, QObject *parent = nullptr);
|
||||
Q_INVOKABLE void fail(Error error);
|
||||
Q_INVOKABLE void redirect(const QString &urlString);
|
||||
|
@ -41,22 +41,22 @@ QmlFileUtils::QmlFileUtils(QString filePath, QObject *parent)
|
||||
|
||||
QString QmlFileUtils::resolve(const QString &filePath)
|
||||
{
|
||||
QUrl resolvedUrl = QUrl::fromLocalFile(m_path).resolved(QUrl::fromEncoded(filePath.toUtf8()));
|
||||
QString resolvedPath = resolvedUrl.toLocalFile();
|
||||
const QUrl resolvedUrl = QUrl::fromLocalFile(m_path).resolved(QUrl::fromEncoded(filePath.toUtf8()));
|
||||
const QString resolvedPath = resolvedUrl.toLocalFile();
|
||||
if (resolvedPath.contains(m_path)) {
|
||||
return resolvedPath;
|
||||
}
|
||||
return QString();
|
||||
}
|
||||
|
||||
QString QmlFileUtils::readAllFileContents(const QString &fileName)
|
||||
QByteArray QmlFileUtils::readAllFileContents(const QString &fileName)
|
||||
{
|
||||
QString path = resolve(fileName);
|
||||
return QzTools::readAllFileContents(path);
|
||||
const QString path = resolve(fileName);
|
||||
return QzTools::readAllFileByteContents(path);
|
||||
}
|
||||
|
||||
bool QmlFileUtils::exists(const QString &filePath)
|
||||
{
|
||||
QString path = resolve(filePath);
|
||||
const QString path = resolve(filePath);
|
||||
return QFile(path).exists();
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ public:
|
||||
* @param file path within the plugin directory
|
||||
* @return contents of the file
|
||||
*/
|
||||
Q_INVOKABLE QString readAllFileContents(const QString &fileName);
|
||||
Q_INVOKABLE QByteArray readAllFileContents(const QString &fileName);
|
||||
/**
|
||||
* @brief Checks if the file exists within the plugin directory
|
||||
* @param file path within the plugin directory
|
||||
|
@ -18,8 +18,6 @@
|
||||
#include "qmlwebhittestresult.h"
|
||||
#include <QQmlEngine>
|
||||
|
||||
#define NOT !
|
||||
|
||||
QmlWebHitTestResult::QmlWebHitTestResult(const WebHitTestResult &webHitTestResult, QObject *parent)
|
||||
: QObject(parent)
|
||||
, m_webHitTestResult(webHitTestResult)
|
||||
@ -33,7 +31,7 @@ QmlWebHitTestResult::QmlWebHitTestResult(const WebHitTestResult &webHitTestResul
|
||||
*/
|
||||
bool QmlWebHitTestResult::isImage() const
|
||||
{
|
||||
return NOT m_webHitTestResult.imageUrl().isEmpty();
|
||||
return !m_webHitTestResult.imageUrl().isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -69,7 +67,7 @@ bool QmlWebHitTestResult::isNull() const
|
||||
*/
|
||||
bool QmlWebHitTestResult::isLink() const
|
||||
{
|
||||
return NOT m_webHitTestResult.linkUrl().isEmpty();
|
||||
return !m_webHitTestResult.linkUrl().isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -78,7 +76,7 @@ bool QmlWebHitTestResult::isLink() const
|
||||
*/
|
||||
bool QmlWebHitTestResult::isMedia() const
|
||||
{
|
||||
return NOT m_webHitTestResult.mediaUrl().isEmpty();
|
||||
return !m_webHitTestResult.mediaUrl().isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -114,7 +112,7 @@ QString QmlWebHitTestResult::tagName() const
|
||||
*/
|
||||
QString QmlWebHitTestResult::baseUrl() const
|
||||
{
|
||||
QUrl base = m_webHitTestResult.baseUrl();
|
||||
const QUrl base = m_webHitTestResult.baseUrl();
|
||||
return QString::fromUtf8(base.toEncoded());
|
||||
}
|
||||
|
||||
@ -133,7 +131,7 @@ QString QmlWebHitTestResult::linkTitle() const
|
||||
*/
|
||||
QString QmlWebHitTestResult::linkUrl() const
|
||||
{
|
||||
QUrl link = m_webHitTestResult.linkUrl();
|
||||
const QUrl link = m_webHitTestResult.linkUrl();
|
||||
return QString::fromUtf8(link.toEncoded());
|
||||
}
|
||||
|
||||
@ -143,7 +141,7 @@ QString QmlWebHitTestResult::linkUrl() const
|
||||
*/
|
||||
QString QmlWebHitTestResult::imageUrl() const
|
||||
{
|
||||
QUrl image = m_webHitTestResult.imageUrl();
|
||||
const QUrl image = m_webHitTestResult.imageUrl();
|
||||
return QString::fromUtf8(image.toEncoded());
|
||||
}
|
||||
|
||||
@ -153,7 +151,7 @@ QString QmlWebHitTestResult::imageUrl() const
|
||||
*/
|
||||
QString QmlWebHitTestResult::mediaUrl() const
|
||||
{
|
||||
QUrl media = m_webHitTestResult.mediaUrl();
|
||||
const QUrl media = m_webHitTestResult.mediaUrl();
|
||||
return QString::fromUtf8(media.toEncoded());
|
||||
}
|
||||
|
||||
|
@ -26,6 +26,14 @@
|
||||
class QmlWebHitTestResult : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QString tagName READ tagName CONSTANT)
|
||||
Q_PROPERTY(QString baseUrl READ baseUrl CONSTANT)
|
||||
Q_PROPERTY(QString linkTitle READ linkTitle CONSTANT)
|
||||
Q_PROPERTY(QString linkUrl READ linkUrl CONSTANT)
|
||||
Q_PROPERTY(QString imageUrl READ imageUrl CONSTANT)
|
||||
Q_PROPERTY(QString mediaUrl READ mediaUrl CONSTANT)
|
||||
Q_PROPERTY(QPoint pos READ pos CONSTANT)
|
||||
Q_PROPERTY(QPointF viewportPos READ viewportPos CONSTANT)
|
||||
public:
|
||||
explicit QmlWebHitTestResult(const WebHitTestResult &webHitTestResult, QObject *parent = nullptr);
|
||||
Q_INVOKABLE bool isImage() const;
|
||||
@ -36,14 +44,14 @@ public:
|
||||
Q_INVOKABLE bool isMedia() const;
|
||||
Q_INVOKABLE bool mediaPaused() const;
|
||||
Q_INVOKABLE bool mediaMuted() const;
|
||||
Q_INVOKABLE QString tagName() const;
|
||||
Q_INVOKABLE QString baseUrl() const;
|
||||
Q_INVOKABLE QString linkTitle() const;
|
||||
Q_INVOKABLE QString linkUrl() const;
|
||||
Q_INVOKABLE QString imageUrl() const;
|
||||
Q_INVOKABLE QString mediaUrl() const;
|
||||
Q_INVOKABLE QPoint pos() const;
|
||||
Q_INVOKABLE QPointF viewportPos() const;
|
||||
QString tagName() const;
|
||||
QString baseUrl() const;
|
||||
QString linkTitle() const;
|
||||
QString linkUrl() const;
|
||||
QString imageUrl() const;
|
||||
QString mediaUrl() const;
|
||||
QPoint pos() const;
|
||||
QPointF viewportPos() const;
|
||||
|
||||
private:
|
||||
WebHitTestResult m_webHitTestResult;
|
||||
|
@ -44,30 +44,7 @@ class QmlTab : public QObject
|
||||
/**
|
||||
* @brief zoom level of the tab
|
||||
*
|
||||
* Zoom level will have the following values
|
||||
* <table>
|
||||
* <caption>Zoom Levels</caption>
|
||||
* <tr><th>Zoom Level</th><th>Zoom Percentage</th></tr>
|
||||
* <tr><td>0</td><td>30</td></tr>
|
||||
* <tr><td>1</td><td>40</td></tr>
|
||||
* <tr><td>2</td><td>50</td></tr>
|
||||
* <tr><td>3</td><td>67</td></tr>
|
||||
* <tr><td>4</td><td>80</td></tr>
|
||||
* <tr><td>5</td><td>90</td></tr>
|
||||
* <tr><td>6</td><td>100</td></tr>
|
||||
* <tr><td>7</td><td>110</td></tr>
|
||||
* <tr><td>8</td><td>120</td></tr>
|
||||
* <tr><td>9</td><td>133</td></tr>
|
||||
* <tr><td>10</td><td>150</td></tr>
|
||||
* <tr><td>11</td><td>170</td></tr>
|
||||
* <tr><td>12</td><td>200</td></tr>
|
||||
* <tr><td>13</td><td>220</td></tr>
|
||||
* <tr><td>14</td><td>233</td></tr>
|
||||
* <tr><td>15</td><td>250</td></tr>
|
||||
* <tr><td>16</td><td>270</td></tr>
|
||||
* <tr><td>17</td><td>285</td></tr>
|
||||
* <tr><td>18</td><td>300</td></tr>
|
||||
* </table>
|
||||
* Zoom levels are from 0 to 18
|
||||
*/
|
||||
Q_PROPERTY(int zoomLevel READ zoomLevel CONSTANT)
|
||||
|
||||
|
@ -443,8 +443,7 @@ bool QmlTabs::addTab(const QVariantMap &map)
|
||||
qDebug() << "Unable to add tab:" << "window not found";
|
||||
return false;
|
||||
}
|
||||
LoadRequest req;
|
||||
req.setUrl(QUrl::fromEncoded(urlString.toUtf8()));
|
||||
LoadRequest req(QUrl::fromEncoded(urlString.toUtf8()));
|
||||
const int ret = window->tabWidget()->addView(req);
|
||||
return ret != -1 ? true : false;
|
||||
}
|
||||
|
@ -93,12 +93,12 @@ void QmlUserScript::setSourceCode(const QString &sourceCode)
|
||||
emit sourceCodeChanged(sourceCode);
|
||||
}
|
||||
|
||||
int QmlUserScript::injectionPoint() const
|
||||
QmlUserScript::InjectionPoint QmlUserScript::injectionPoint() const
|
||||
{
|
||||
return (int)m_webEngineScript.injectionPoint();
|
||||
return (InjectionPoint)m_webEngineScript.injectionPoint();
|
||||
}
|
||||
|
||||
void QmlUserScript::setInjectionPoint(int injectionPoint)
|
||||
void QmlUserScript::setInjectionPoint(InjectionPoint injectionPoint)
|
||||
{
|
||||
switch (injectionPoint) {
|
||||
case QWebEngineScript::DocumentCreation:
|
||||
|
@ -51,7 +51,7 @@ class FALKON_EXPORT QmlUserScript : public QObject
|
||||
/**
|
||||
* @brief Injection point of the UserScript
|
||||
*/
|
||||
Q_PROPERTY(int injectionPoint READ injectionPoint WRITE setInjectionPoint NOTIFY injectionPointChanged)
|
||||
Q_PROPERTY(InjectionPoint injectionPoint READ injectionPoint WRITE setInjectionPoint NOTIFY injectionPointChanged)
|
||||
public:
|
||||
/**
|
||||
* @brief The enum exposing QWebEngineScript::InjectionPoint
|
||||
@ -69,8 +69,8 @@ public:
|
||||
ApplicationWorld = QWebEngineScript::ApplicationWorld, //!< Represents QWebEngineScript::ApplicationWorld
|
||||
UserWorld = QWebEngineScript::UserWorld //! < Represents QWebEngineScript::UserWorld
|
||||
};
|
||||
Q_ENUMS(InjectionPoint)
|
||||
Q_ENUMS(ScriptWorldId)
|
||||
Q_ENUM(InjectionPoint)
|
||||
Q_ENUM(ScriptWorldId)
|
||||
|
||||
explicit QmlUserScript(QObject *parent = nullptr);
|
||||
QWebEngineScript webEngineScript() const;
|
||||
@ -108,6 +108,6 @@ private:
|
||||
void setWorldId(int worldId);
|
||||
QString sourceCode() const;
|
||||
void setSourceCode(const QString &sourceCode);
|
||||
int injectionPoint() const;
|
||||
void setInjectionPoint(int injectionPoint);
|
||||
InjectionPoint injectionPoint() const;
|
||||
void setInjectionPoint(InjectionPoint injectionPoint);
|
||||
};
|
||||
|
@ -36,7 +36,7 @@ public:
|
||||
Normal, //! Represents normal window
|
||||
Invalid //! Represents a invalid window
|
||||
};
|
||||
Q_ENUMS(WindowState)
|
||||
Q_ENUM(WindowState)
|
||||
|
||||
QmlWindowState(QObject *parent = nullptr);
|
||||
};
|
||||
|
@ -36,7 +36,7 @@ public:
|
||||
NewWindow = Qz::BW_NewWindow, //! Represents new window
|
||||
OtherRestoredWindow = Qz::BW_OtherRestoredWindow //! Represents other restored window
|
||||
};
|
||||
Q_ENUMS(WindowType)
|
||||
Q_ENUM(WindowType)
|
||||
|
||||
QmlWindowType(QObject *parent = nullptr);
|
||||
};
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "api/events/qmlkeyevent.h"
|
||||
#include "api/tabs/qmltab.h"
|
||||
#include "webpage.h"
|
||||
#include "qztools.h"
|
||||
#include <QDebug>
|
||||
#include <QQuickWindow>
|
||||
#include <QDialog>
|
||||
@ -118,21 +119,16 @@ void QmlPluginInterface::showSettings(QWidget *parent)
|
||||
}
|
||||
|
||||
QWidget *widget = QWidget::createWindowContainer(window);
|
||||
QDialog *dialog = new QDialog(parent);
|
||||
QVBoxLayout *boxLayout = new QVBoxLayout;
|
||||
boxLayout->addWidget(widget);
|
||||
boxLayout->setContentsMargins(0 ,0 ,0 ,0);
|
||||
dialog->setLayout(boxLayout);
|
||||
dialog->setFixedSize(window->size());
|
||||
dialog->exec();
|
||||
window->destroy();
|
||||
widget->setFixedSize(window->size());
|
||||
widget->show();
|
||||
QzTools::centerWidgetToParent(widget, parent);
|
||||
connect(widget, &QWidget::destroyed, window, &QQuickWindow::destroy);
|
||||
}
|
||||
|
||||
bool QmlPluginInterface::mouseDoubleClick(Qz::ObjectName type, QObject *obj, QMouseEvent *event)
|
||||
{
|
||||
Q_UNUSED(obj)
|
||||
if (!m_mouseDoubleClick.isCallable()) {
|
||||
qWarning() << "Unable to call" << __FUNCTION__;
|
||||
return false;
|
||||
}
|
||||
QJSValueList args;
|
||||
@ -146,7 +142,6 @@ bool QmlPluginInterface::mousePress(Qz::ObjectName type, QObject *obj, QMouseEve
|
||||
{
|
||||
Q_UNUSED(obj)
|
||||
if (!m_mousePress.isCallable()) {
|
||||
qWarning() << "Unable to call" << __FUNCTION__;
|
||||
return false;
|
||||
}
|
||||
QJSValueList args;
|
||||
@ -160,7 +155,6 @@ bool QmlPluginInterface::mouseRelease(Qz::ObjectName type, QObject *obj, QMouseE
|
||||
{
|
||||
Q_UNUSED(obj)
|
||||
if (!m_mouseRelease.isCallable()) {
|
||||
qWarning() << "Unable to call" << __FUNCTION__;
|
||||
return false;
|
||||
}
|
||||
QJSValueList args;
|
||||
@ -174,7 +168,6 @@ bool QmlPluginInterface::mouseMove(Qz::ObjectName type, QObject *obj, QMouseEven
|
||||
{
|
||||
Q_UNUSED(obj)
|
||||
if (!m_mouseMove.isCallable()) {
|
||||
qWarning() << "Unable to call" << __FUNCTION__;
|
||||
return false;
|
||||
}
|
||||
QJSValueList args;
|
||||
@ -188,7 +181,6 @@ bool QmlPluginInterface::wheelEvent(Qz::ObjectName type, QObject *obj, QWheelEve
|
||||
{
|
||||
Q_UNUSED(obj)
|
||||
if (!m_wheelEvent.isCallable()) {
|
||||
qWarning() << "Unable to call" << __FUNCTION__;
|
||||
return false;
|
||||
}
|
||||
QJSValueList args;
|
||||
@ -202,7 +194,6 @@ bool QmlPluginInterface::keyPress(Qz::ObjectName type, QObject *obj, QKeyEvent *
|
||||
{
|
||||
Q_UNUSED(obj)
|
||||
if (!m_keyPress.isCallable()) {
|
||||
qWarning() << "Unable to call" << __FUNCTION__;
|
||||
return false;
|
||||
}
|
||||
QJSValueList args;
|
||||
@ -216,7 +207,6 @@ bool QmlPluginInterface::keyRelease(Qz::ObjectName type, QObject *obj, QKeyEvent
|
||||
{
|
||||
Q_UNUSED(obj)
|
||||
if (!m_keyRelease.isCallable()) {
|
||||
qWarning() << "Unable to call" << __FUNCTION__;
|
||||
return false;
|
||||
}
|
||||
QJSValueList args;
|
||||
|
@ -28,7 +28,7 @@ class QmlPluginInterface : public QObject, public PluginInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(PluginInterface)
|
||||
Q_ENUMS(InitState)
|
||||
Q_ENUM(InitState)
|
||||
Q_PROPERTY(QJSValue init READ readInit WRITE setInit)
|
||||
Q_PROPERTY(QJSValue unload READ readUnload WRITE setUnload)
|
||||
Q_PROPERTY(QJSValue testPlugin READ readTestPlugin WRITE setTestPlugin)
|
||||
|
@ -69,8 +69,7 @@ void QmlPlugins::registerQmlTypes()
|
||||
Q_UNUSED(engine)
|
||||
Q_UNUSED(scriptEngine)
|
||||
|
||||
auto *object = new QmlBookmarks();
|
||||
return object;
|
||||
return new QmlBookmarks();
|
||||
});
|
||||
|
||||
// TopSites
|
||||
@ -80,8 +79,7 @@ void QmlPlugins::registerQmlTypes()
|
||||
Q_UNUSED(engine)
|
||||
Q_UNUSED(scriptEngine)
|
||||
|
||||
auto *object = new QmlTopSites();
|
||||
return object;
|
||||
return new QmlTopSites();
|
||||
});
|
||||
|
||||
// History
|
||||
@ -91,8 +89,7 @@ void QmlPlugins::registerQmlTypes()
|
||||
Q_UNUSED(engine)
|
||||
Q_UNUSED(scriptEngine)
|
||||
|
||||
auto *object = new QmlHistory();
|
||||
return object;
|
||||
return new QmlHistory();
|
||||
});
|
||||
|
||||
// Cookies
|
||||
@ -102,8 +99,7 @@ void QmlPlugins::registerQmlTypes()
|
||||
Q_UNUSED(engine)
|
||||
Q_UNUSED(scriptEngine)
|
||||
|
||||
auto *object = new QmlCookies();
|
||||
return object;
|
||||
return new QmlCookies();
|
||||
});
|
||||
|
||||
// Tabs
|
||||
@ -113,8 +109,7 @@ void QmlPlugins::registerQmlTypes()
|
||||
Q_UNUSED(engine)
|
||||
Q_UNUSED(scriptEngine)
|
||||
|
||||
auto *object = new QmlTabs();
|
||||
return object;
|
||||
return new QmlTabs();
|
||||
});
|
||||
|
||||
// Notifications
|
||||
@ -134,8 +129,7 @@ void QmlPlugins::registerQmlTypes()
|
||||
Q_UNUSED(engine)
|
||||
Q_UNUSED(scriptEngine)
|
||||
|
||||
auto *object = new QmlClipboard();
|
||||
return object;
|
||||
return new QmlClipboard();
|
||||
});
|
||||
|
||||
// Windows
|
||||
@ -149,8 +143,7 @@ void QmlPlugins::registerQmlTypes()
|
||||
Q_UNUSED(engine)
|
||||
Q_UNUSED(scriptEngine)
|
||||
|
||||
auto *object = new QmlWindows();
|
||||
return object;
|
||||
return new QmlWindows();
|
||||
});
|
||||
|
||||
// BrowserAction
|
||||
@ -185,8 +178,7 @@ void QmlPlugins::registerQmlTypes()
|
||||
qmlRegisterSingletonType<QmlI18n>("org.kde.falkon", 1, 0, "I18n", [](QQmlEngine *engine, QJSEngine *scriptEngine) -> QObject * {
|
||||
Q_UNUSED(scriptEngine)
|
||||
QString pluginName = engine->rootContext()->contextProperty("__name__").toString();
|
||||
auto *object = new QmlI18n(pluginName);
|
||||
return object;
|
||||
return new QmlI18n(pluginName);
|
||||
});
|
||||
#endif
|
||||
|
||||
@ -197,16 +189,14 @@ void QmlPlugins::registerQmlTypes()
|
||||
Q_UNUSED(engine)
|
||||
Q_UNUSED(scriptEngine)
|
||||
|
||||
auto *object = new QmlUserScripts();
|
||||
return object;
|
||||
return new QmlUserScripts();
|
||||
});
|
||||
|
||||
qmlRegisterSingletonType<QmlExternalJsObject>("org.kde.falkon", 1, 0, "ExternalJsObject", [](QQmlEngine *engine, QJSEngine *scriptEngine) -> QObject * {
|
||||
Q_UNUSED(engine)
|
||||
Q_UNUSED(scriptEngine)
|
||||
|
||||
auto *object = new QmlExternalJsObject();
|
||||
return object;
|
||||
return new QmlExternalJsObject();
|
||||
});
|
||||
|
||||
// ExtensionScheme
|
||||
@ -221,7 +211,6 @@ void QmlPlugins::registerQmlTypes()
|
||||
|
||||
QString filePath = engine->rootContext()->contextProperty("__path__").toString();
|
||||
|
||||
auto *object = new QmlFileUtils(filePath);
|
||||
return object;
|
||||
return new QmlFileUtils(filePath);
|
||||
});
|
||||
}
|
||||
|
@ -16,9 +16,12 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* ============================================================ */
|
||||
#pragma once
|
||||
#include "browserwindow.h"
|
||||
|
||||
class QmlPlugins
|
||||
class FALKON_EXPORT QmlPlugins
|
||||
{
|
||||
public:
|
||||
static void registerQmlTypes();
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(BrowserWindow *)
|
||||
|
Loading…
Reference in New Issue
Block a user