summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/webengine/CMakeLists.txt2
-rw-r--r--plugins/webengine/WebEngine.json2
-rw-r--r--plugins/webengine/webengineplugin.cpp4
-rw-r--r--plugins/webengine/webengineplugin.hpp3
-rw-r--r--plugins/webengine/webview.cpp24
-rw-r--r--plugins/webengine/webview.h10
6 files changed, 37 insertions, 8 deletions
diff --git a/plugins/webengine/CMakeLists.txt b/plugins/webengine/CMakeLists.txt
index f49d9c7c..c1f8145d 100644
--- a/plugins/webengine/CMakeLists.txt
+++ b/plugins/webengine/CMakeLists.txt
@@ -2,7 +2,7 @@ add_library(WebEnginePlugin MODULE
webengineplugin.cpp webengineplugin.hpp
webview.cpp webview.h
${PROJECT_SOURCE_DIR}/src/plugins/rplugininterface.hpp
- ${PROJECT_SOURCE_DIR}/src/plugins/rview.hpp
+ ${PROJECT_SOURCE_DIR}/include/rview.hpp
)
target_include_directories(WebEnginePlugin PRIVATE ${PROJECT_SOURCE_DIR}/src/plugins)
target_link_libraries(WebEnginePlugin PUBLIC Qt6::Core Qt6::WebEngineWidgets)
diff --git a/plugins/webengine/WebEngine.json b/plugins/webengine/WebEngine.json
index 03e2112c..8f197186 100644
--- a/plugins/webengine/WebEngine.json
+++ b/plugins/webengine/WebEngine.json
@@ -1,4 +1,4 @@
{
"name": "WebEngine",
- "schemes": [ "file", "http", "https" ]
+ "schemes": [ "about", "file", "http", "https" ]
}
diff --git a/plugins/webengine/webengineplugin.cpp b/plugins/webengine/webengineplugin.cpp
index cf6811dc..0c3f2dcd 100644
--- a/plugins/webengine/webengineplugin.cpp
+++ b/plugins/webengine/webengineplugin.cpp
@@ -10,4 +10,6 @@
#include "webengineplugin.hpp"
#include "webview.h"
-rView *WebEnginePlugin::view(const QUrl &url) { return new WebView(url, nullptr); }
+void WebEnginePlugin::init(RekonqSettings *) {}
+
+RekonqView *WebEnginePlugin::view(const QUrl &url) { return new WebView(url, nullptr); }
diff --git a/plugins/webengine/webengineplugin.hpp b/plugins/webengine/webengineplugin.hpp
index 3ee63ff8..dcbc2db8 100644
--- a/plugins/webengine/webengineplugin.hpp
+++ b/plugins/webengine/webengineplugin.hpp
@@ -19,5 +19,6 @@ class WebEnginePlugin final : public RekonqPluginInterface {
public:
WebEnginePlugin() = default;
- rView *view(const QUrl &url) override;
+ void init(RekonqSettings *settings) override;
+ RekonqView *view(const QUrl &url) override;
};
diff --git a/plugins/webengine/webview.cpp b/plugins/webengine/webview.cpp
index fab941a9..fc2e4642 100644
--- a/plugins/webengine/webview.cpp
+++ b/plugins/webengine/webview.cpp
@@ -11,7 +11,7 @@
#include <QVBoxLayout>
#include <QWebEngineView>
-WebView::WebView(const QUrl &url, QWidget *parent) : rView(url, parent), view(new QWebEngineView(this))
+WebView::WebView(const QUrl &url, QWidget *parent) : RekonqView(url, parent), view(new QWebEngineView(this))
{
auto *layout = new QVBoxLayout;
layout->setContentsMargins(0, 0, 0, 0);
@@ -19,8 +19,28 @@ WebView::WebView(const QUrl &url, QWidget *parent) : rView(url, parent), view(ne
setLayout(layout);
connect(view, &QWebEngineView::iconChanged, this, [this](const QIcon &icon) { emit iconChanged(icon); });
- connect(view, &QWebEngineView::urlChanged, this, [this](const QUrl &url) { emit urlChanged(url); });
+ connect(view, &QWebEngineView::urlChanged, this, [this](const QUrl &u) { emit urlChanged(u); });
connect(view, &QWebEngineView::titleChanged, this, [this](const QString &title) { emit titleChanged(title); });
+
+ // load progress
+ connect(view, &QWebEngineView::loadStarted, this, [this]() {
+ m_loadProgress = 0;
+ emit loadStarted();
+ });
+ connect(view, &QWebEngineView::loadProgress, this, [this](int progress) {
+ m_loadProgress = progress;
+ emit loadProgress(progress);
+ });
+ connect(view, &QWebEngineView::loadFinished, this, [this]() {
+ m_loadProgress = 100;
+ emit loadFinished();
+ });
+
view->load(url);
}
+
+void WebView::load(const QUrl &url) { view->load(url); }
+
+QUrl WebView::url() const { return view->url(); }
QString WebView::title() const { return view->title(); }
+QIcon WebView::icon() const { return view->icon(); }
diff --git a/plugins/webengine/webview.h b/plugins/webengine/webview.h
index 5bb90696..103b98b3 100644
--- a/plugins/webengine/webview.h
+++ b/plugins/webengine/webview.h
@@ -13,15 +13,21 @@
class QWebEngineView;
-class WebView final : public rView {
+class WebView final : public RekonqView {
Q_OBJECT
public:
explicit WebView(const QUrl &url = QUrl(), QWidget *parent = nullptr);
~WebView() final = default;
- QString title() const override;
+ void load(const QUrl &url) override;
+ [[nodiscard]] int progress() const override { return m_loadProgress; }
+
+ [[nodiscard]] QUrl url() const override;
+ [[nodiscard]] QString title() const override;
+ [[nodiscard]] QIcon icon() const override;
private:
QWebEngineView *view;
+ int m_loadProgress = 0;
};