[rkward/work/render_rmd] rkward/windows: Add possibility to 'link' to settings pages

Thomas Friedrichsmeier null at kde.org
Thu Sep 27 11:16:27 BST 2018


Git commit 426385d49f29c0f1bb37d2c94372bdc649edcbd2 by Thomas Friedrichsmeier.
Committed on 27/09/2018 at 10:13.
Pushed by tfry into branch 'work/render_rmd'.

Add possibility to 'link' to settings pages

M  +18   -13   rkward/windows/rkhtmlwindow.cpp

https://commits.kde.org/rkward/426385d49f29c0f1bb37d2c94372bdc649edcbd2

diff --git a/rkward/windows/rkhtmlwindow.cpp b/rkward/windows/rkhtmlwindow.cpp
index d2dfdb51..75568838 100644
--- a/rkward/windows/rkhtmlwindow.cpp
+++ b/rkward/windows/rkhtmlwindow.cpp
@@ -51,6 +51,7 @@
 #include "../rkconsole.h"
 #include "../settings/rksettingsmodulegeneral.h"
 #include "../settings/rksettingsmoduler.h"
+#include "../settings/rksettings.h"
 #include "../settings/rksettingsmoduleoutput.h"
 #include "../misc/rkcommonfunctions.h"
 #include "../misc/rkstandardactions.h"
@@ -326,23 +327,27 @@ bool RKHTMLWindow::handleRKWardURL (const QUrl &url, RKHTMLWindow *window) {
 			int sep = path.indexOf ('/');
 			// NOTE: These links may originate externally, even from untrusted sources. The submit mode *must* remain "ManualSubmit" for this reason!
 			RKComponentMap::invokeComponent (path.left (sep), path.mid (sep+1).split ('\n', QString::SkipEmptyParts), RKComponentMap::ManualSubmit);
-			return true;
-		} else {
-			if (url.host () == "rhelp") {
-				// TODO: find a nice solution to render this in the current window
-				QStringList spec = url.path ().mid (1).split ('/');
-				QString function, package, type;
-				if (!spec.isEmpty ()) function = spec.takeLast ();
-				if (!spec.isEmpty ()) package = spec.takeLast ();
-				if (!spec.isEmpty ()) type = spec.takeLast ();
-				RKHelpSearchWindow::mainHelpSearch ()->getFunctionHelp (function, package, type);
-				return true;
+		} else if (url.host () == "rhelp") {
+			// TODO: find a nice solution to render this in the current window
+			QStringList spec = url.path ().mid (1).split ('/');
+			QString function, package, type;
+			if (!spec.isEmpty ()) function = spec.takeLast ();
+			if (!spec.isEmpty ()) package = spec.takeLast ();
+			if (!spec.isEmpty ()) type = spec.takeLast ();
+			RKHelpSearchWindow::mainHelpSearch ()->getFunctionHelp (function, package, type);
+		} else if (url.host () == "settings") {
+			QString path = url.path ();
+			if (path.startsWith ('/')) path = path.mid (1);
+			if (path == QStringLiteral ("rbackend")) {
+				RKSettings::configureSettings (RKSettings::PageR);
+			} else {
+				RKSettings::configureSettings (RKSettings::NoPage);
 			}
-
+		} else {
 			if (window) window->openRKHPage (url);
 			else RKWorkplace::mainWorkplace ()->openHelpWindow (url);	// will recurse with window set, via openURL()
-			return true;
 		}
+		return true;
 	}
 	return false;
 }



More information about the rkward-tracker mailing list