[rkward-cvs] SF.net SVN: rkward:[2672] trunk/rkward/rkward/windows/rkhtmlwindow.cpp

tfry at users.sourceforge.net tfry at users.sourceforge.net
Tue Sep 29 12:55:52 UTC 2009


Revision: 2672
          http://rkward.svn.sourceforge.net/rkward/?rev=2672&view=rev
Author:   tfry
Date:     2009-09-29 12:55:52 +0000 (Tue, 29 Sep 2009)

Log Message:
-----------
Support the dynamic help pages of R 2.10.0. Oddly, only the first page is being loaded, ATM, after that the khtmlpart can no longer connect.

Modified Paths:
--------------
    trunk/rkward/rkward/windows/rkhtmlwindow.cpp

Modified: trunk/rkward/rkward/windows/rkhtmlwindow.cpp
===================================================================
--- trunk/rkward/rkward/windows/rkhtmlwindow.cpp	2009-09-29 12:54:20 UTC (rev 2671)
+++ trunk/rkward/rkward/windows/rkhtmlwindow.cpp	2009-09-29 12:55:52 UTC (rev 2672)
@@ -25,6 +25,7 @@
 #include <kparts/partmanager.h>
 #include <kactioncollection.h>
 #include <kdirwatch.h>
+#include <kmimetype.h>
 
 #include <qfileinfo.h>
 #include <qwidget.h>
@@ -32,6 +33,7 @@
 #include <qtimer.h>
 #include <qdir.h>
 #include <QHBoxLayout>
+#include <QHostInfo>
 
 #include "../rkglobals.h"
 #include "rkhelpsearchwindow.h"
@@ -247,7 +249,6 @@
 	return false;
 }
 
-#include <kmimetype.h>
 bool RKHTMLWindow::openURL (const KUrl &url) {
 	RK_TRACE (APP);
 
@@ -259,6 +260,19 @@
 			return false;
 		}
 	} else {
+		if (!(url.isLocalFile ())) {
+			if (window_mode == HTMLHelpWindow) {
+				// since R 2.10.0, help urls may be on local ports
+				if (url.protocol ().toLower ().startsWith ("http")) {
+					QString host = url.host ();
+					if ((host == "127.0.0.1") || (host == "localhost") || host == QHostInfo::localHostName ()) {
+						khtmlpart->openUrl (url);
+						changeURL (url);
+						return true;
+					}
+				}
+			}
+		}
 		if (!(url.isLocalFile () && KMimeType::findByUrl (url)->is ("text/html"))) {
 			RKWorkplace::mainWorkplace ()->openAnyUrl (url);
 			return true;


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the rkward-tracker mailing list