[education/rkward] /: Fix opening R help pages in new window/tab

Thomas Friedrichsmeier null at kde.org
Thu Apr 28 21:46:19 BST 2022


Git commit 623f449c6d57c2b89e4a4c0e1e0db6105c7262ae by Thomas Friedrichsmeier.
Committed on 28/04/2022 at 20:46.
Pushed by tfry into branch 'master'.

Fix opening R help pages in new window/tab

M  +1    -0    ChangeLog
M  +6    -3    rkward/windows/rkhtmlwindow.cpp

https://invent.kde.org/education/rkward/commit/623f449c6d57c2b89e4a4c0e1e0db6105c7262ae

diff --git a/ChangeLog b/ChangeLog
index 1baddbb4..084d37d4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,7 @@
 TODOs:
 	- More tolerant handshake on Windows? Simply a matter of allowing more time?
 
+- Fixed: R help pages would refuse to open in new tab
 - (Re-)added improved "Import Assistant" to help getting started with importing data
 - "Paste special" can now also paste data.frames with labels, and is available in the Workspace Browser context menu
 - Fixed: Windows: Issues with some shiny apps due to a too small stack size
diff --git a/rkward/windows/rkhtmlwindow.cpp b/rkward/windows/rkhtmlwindow.cpp
index b4119c4f..33885b73 100644
--- a/rkward/windows/rkhtmlwindow.cpp
+++ b/rkward/windows/rkhtmlwindow.cpp
@@ -58,6 +58,10 @@ SPDX-License-Identifier: GPL-2.0-or-later
 #include "../windows/rkworkplaceview.h"
 #include "../debug.h"
 
+QUrl restorableUrl(const QUrl &url) {
+	return QUrl(url.url().replace(RKSettingsModuleR::helpBaseUrl(), "rkward://RHELPBASE"));
+}
+
 #ifdef NO_QT_WEBENGINE
 #	include <QWebFrame>
 #	include <QNetworkRequest>
@@ -181,7 +185,7 @@ protected:
 		if (RKHTMLWindow::new_window) {
 			RK_ASSERT (RKHTMLWindow::new_window == this);
 			RK_ASSERT (!window);
-			RKWorkplace::mainWorkplace ()->openAnyUrl (navurl);
+			RKWorkplace::mainWorkplace()->openAnyUrl(restorableUrl(navurl));
 			RKHTMLWindow::new_window = nullptr;
 			if (!window) deleteLater ();  // this page was _not_ reused
 			return false;
@@ -385,8 +389,7 @@ RKHTMLWindow::~RKHTMLWindow () {
 
 QUrl RKHTMLWindow::restorableUrl () {
 	RK_TRACE (APP);
-
-	return QUrl ((current_url.url ().replace (RKSettingsModuleR::helpBaseUrl(), "rkward://RHELPBASE")));
+	return ::restorableUrl(current_url);
 }
 
 bool RKHTMLWindow::isModified () {


More information about the rkward-tracker mailing list