[rkward] /: Handle help:/-urls inside the help window, again.

Thomas Friedrichsmeier null at kde.org
Mon May 14 08:10:59 UTC 2018


Git commit c1a92d084fc4165999d4b12549b9fd3d76170fa7 by Thomas Friedrichsmeier.
Committed on 14/05/2018 at 08:10.
Pushed by tfry into branch 'master'.

Handle help:/-urls inside the help window, again.

M  +1    -0    ChangeLog
M  +1    -1    rkward/pages/rkward_welcome.rkh
M  +11   -6    rkward/windows/rkhtmlwindow.cpp

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

diff --git a/ChangeLog b/ChangeLog
index b84317af..d6c1f185 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,5 @@
 --- Version 0.7.1 - UNRELEASED
+- Support handling of help:/ pages (e.g. RKWard plugins documentation) inside the RKWard help window, again.
 - Do not attempt object name hinting behind empty quoted strings or spaces.
 - rk.show.message() gains a parameter to allow setting a default button other than "yes"
 - Compile in ui definitions, instead of providing them as separate files
diff --git a/rkward/pages/rkward_welcome.rkh b/rkward/pages/rkward_welcome.rkh
index 64e5d403..aba6bdeb 100644
--- a/rkward/pages/rkward_welcome.rkh
+++ b/rkward/pages/rkward_welcome.rkh
@@ -27,7 +27,7 @@
 	</section>
 
 	<section title="Still missing something?" id="writing_plugins">
-	Check out the <link href="http://api.kde.org/doc/rkwardplugins/">Introduction to Writing Plugins for RKWard</link> to learn how easy it is to enhance RKWard with your custom dialogs. And if you like, how to share your work with the community of RKWard users. See the <link href="rkward://rhelp/rkward-package">rkward package overview</link> for RKWard specific function for development and scripting. As another way of contributing, consider supporting the development of RKWard with money. One easy way to give a small amount is <a href="http://flattr.com/thing/1092073/RKWard">donating via <i>Flattr</i></a>.
+	Check out the <link href="help:/rkwardplugins/index.html">Introduction to Writing Plugins for RKWard</link> (<link href="http://api.kde.org/doc/rkwardplugins/">most recent version online</link>) to learn how easy it is to enhance RKWard with your custom dialogs. And if you like, how to share your work with the community of RKWard users. See the <link href="rkward://rhelp/rkward-package">rkward package overview</link> for RKWard specific function for development and scripting. As another way of contributing, consider supporting the development of RKWard with money. One easy way to give a small amount is <a href="http://flattr.com/thing/1092073/RKWard">donating via <i>Flattr</i></a>.
 	</section>
 
 	<section title="General Information" id="further_info">
diff --git a/rkward/windows/rkhtmlwindow.cpp b/rkward/windows/rkhtmlwindow.cpp
index d2dfdb51..8680b548 100644
--- a/rkward/windows/rkhtmlwindow.cpp
+++ b/rkward/windows/rkhtmlwindow.cpp
@@ -2,7 +2,7 @@
                           rkhtmlwindow  -  description
                              -------------------
     begin                : Wed Oct 12 2005
-    copyright            : (C) 2005-2017 by Thomas Friedrichsmeier
+    copyright            : (C) 2005-2018 by Thomas Friedrichsmeier
     email                : thomas.friedrichsmeier at kdemail.net
  ***************************************************************************/
 
@@ -65,9 +65,10 @@
 #include "../windows/rkworkplaceview.h"
 #include "../debug.h"
 
-// TODO: We used to have KioIntegration in addition to KPartsIntegration. But this is just buggy, buggy, buggy in KF5 5.9.0. (e.g. navigation to previous
-// // page in history just doesn't work).
-RKWebPage::RKWebPage (RKHTMLWindow* window): KWebPage (window, KPartsIntegration) {
+// NOTE: According to an earlier note at this place, KIOIntegration used to be very buggy around KF5 5.9.0. It seem to just work,
+//       at 5.44.0, and the symptoms are probably not terible for earlier versions, so we use it here (allows us to render help:/-pages
+//       inside the help window.
+RKWebPage::RKWebPage (RKHTMLWindow* window): KWebPage (window, KPartsIntegration | KIOIntegration) {
 	RK_TRACE (APP);
 	RKWebPage::window = window;
 	new_window = false;
@@ -377,7 +378,7 @@ bool RKHTMLWindow::openURL (const QUrl &url) {
 		return ok;
 	}
 
-	if (url_change_is_from_history || url.scheme ().toLower ().startsWith (QLatin1String ("help"))) {	// handle help pages, and any page that we have previously handled (from history)
+	if (url_change_is_from_history || url.scheme ().toLower ().startsWith (QLatin1String ("help"))) {	// handle any page that we have previously handled (from history)
 		changeURL (url);
 		page->load (url);
 		return true;
@@ -461,12 +462,16 @@ void RKHTMLWindow::changeURL (const QUrl &url) {
 
 	if (!url_change_is_from_history) {
 		if (window_mode == HTMLHelpWindow) {
-			if (current_history_position >= 0) {	// skip initial blank page
+			if (current_history_position >= 0) {	// just skip initial blank page
 				url_history = url_history.mid (0, current_history_position);
 
 				VisitedLocation loc;
 				loc.url = prev_url;
 				saveBrowserState (&loc);
+				if (url_history.value (current_history_position).url == url) { // e.g. a redirect. We still save the most recent browser state, but do not keep two entries for the same page
+					url_history.pop_back ();
+					--current_history_position;
+				}
 				url_history.append (loc);
 			}
 



More information about the rkward-tracker mailing list