[rkward/work/qtwebengine] /: ... and fix compilation for QtWebKit, again, too.

Thomas Friedrichsmeier null at kde.org
Mon Mar 30 20:17:26 BST 2020


Git commit a75be4e23a9b2bebea34d96b3f4ddcf3ac7f7f47 by Thomas Friedrichsmeier.
Committed on 30/03/2020 at 19:16.
Pushed by tfry into branch 'work/qtwebengine'.

... and fix compilation for QtWebKit, again, too.

M  +6    -0    ChangeLog
M  +1    -1    rkward/windows/CMakeLists.txt
M  +10   -6    rkward/windows/rkhtmlwindow.cpp

https://commits.kde.org/rkward/a75be4e23a9b2bebea34d96b3f4ddcf3ac7f7f47

diff --git a/ChangeLog b/ChangeLog
index 7895895a..e3601679 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,10 @@
 --- Version 0.7.2 - UNRELEASED
+- Support using QWebEngine instead of QtWebKit (still supported)
+  - TODO:
+    - Restore scroll position (needs to happen *after* page load)
+    - Support help:// protocol
+    - Support pdf
+    - Support Ctrl+scrollwheel
 - <text> elements in plugins may now also contain clickable links, including rkward://-scheme links
 * TODO: Bring new code hinting features to the console window!
 - On unix-systems, RKWard can now be run without installation
diff --git a/rkward/windows/CMakeLists.txt b/rkward/windows/CMakeLists.txt
index 7c5af7f5..f67f8807 100644
--- a/rkward/windows/CMakeLists.txt
+++ b/rkward/windows/CMakeLists.txt
@@ -27,7 +27,7 @@ SET(windows_STAT_SRCS
 
 ADD_LIBRARY(windows STATIC ${windows_STAT_SRCS})
 IF(NO_QT_WEBENGINE)
-TARGET_LINK_LIBRARIES(windows Qt5::Widgets Qt5::Xml Qt5::PrintSupport Qt5::WebEngineWidgets Qt5::WebKitWidgets KF5::WebKit KF5::TextEditor KF5::Notifications KF5::WindowSystem KF5::KIOFileWidgets)
+TARGET_LINK_LIBRARIES(windows Qt5::Widgets Qt5::Xml Qt5::PrintSupport Qt5::WebKitWidgets KF5::WebKit KF5::TextEditor KF5::Notifications KF5::WindowSystem KF5::KIOFileWidgets)
 ELSE(NO_QT_WEBENGINE)
 TARGET_LINK_LIBRARIES(windows Qt5::Widgets Qt5::Xml Qt5::PrintSupport Qt5::WebEngineWidgets KF5::TextEditor KF5::Notifications KF5::WindowSystem KF5::KIOFileWidgets)
 ENDIF(NO_QT_WEBENGINE)
diff --git a/rkward/windows/rkhtmlwindow.cpp b/rkward/windows/rkhtmlwindow.cpp
index d44c3bda..44e90e0a 100644
--- a/rkward/windows/rkhtmlwindow.cpp
+++ b/rkward/windows/rkhtmlwindow.cpp
@@ -114,11 +114,14 @@ public:
 	QUrl url () {
 		return mainFrame ()->url ();
 	}
-	void setHTML (const QString &html) {
-		mainFrame ()->setHTML (html);
+	void setHtml (const QString &html) {
+		mainFrame ()->setHtml (html);
 	}
-	QPointF scroll_position () const {
-		return mainFrame ()->scrollPosition();
+	QPointF scrollPosition () const {
+		return mainFrame ()->scrollPosition ();
+	}
+	void setScrollPosition (const QPoint &pos)  {
+		mainFrame ()->setScrollPosition (pos);
 	}
 #else
 	bool supportsContentType (const QString &name) {
@@ -130,6 +133,7 @@ public:
 		download (url);
 	}
 	void setScrollPosition (const QPoint &point) {
+		RK_DEBUG(APP, DL_DEBUG, "scrolling to %d, %d", point.x (), point.y ());
 		runJavaScript (QString ("window.scrollTo(%1, %2);").arg (point.x ()).arg(point.y ()));
 	}
 #endif
@@ -243,7 +247,7 @@ RKHTMLWindow::RKHTMLWindow (QWidget *parent, WindowMode mode) : RKMDIWindow (par
 	// We have to connect this in order to allow browsing.
 	connect (page, &RKWebPage::pageInternalNavigation, this, &RKHTMLWindow::internalNavigation);
 #ifdef NO_QT_WEBENGINE
-	connect (page, &QWebPage::downloadRequested, [page](const QNetworkRequest &request) { page->downloadUrl (request.url ()); });
+	connect (page, &QWebPage::downloadRequested, [this](const QNetworkRequest &request) { page->downloadUrl (request.url ()); });
 #else
 	connect (page->profile (), &QWebEngineProfile::downloadRequested, [this](QWebEngineDownloadItem* item) { page->downloadUrl (item->url ()); });
 #endif
@@ -307,7 +311,7 @@ void RKHTMLWindow::runSelection () {
 void RKHTMLWindow::findRequest (const QString& text, bool backwards, const RKFindBar* findbar, bool* found) {
 	RK_TRACE (APP);
 
-#ifdef QT_NO_WEBENGINE
+#ifdef NO_QT_WEBENGINE
 	QWebPage::FindFlags flags = QWebPage::FindWrapsAroundDocument;
 	if (backwards) flags |= QWebPage::FindBackward;
 	bool highlight = findbar->isOptionSet (RKFindBar::HighlightAll);



More information about the rkward-tracker mailing list