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