[rkward-cvs] SF.net SVN: rkward:[3807] trunk/rkward

tfry at users.sourceforge.net tfry at users.sourceforge.net
Tue Sep 20 17:38:20 UTC 2011


Revision: 3807
          http://rkward.svn.sourceforge.net/rkward/?rev=3807&view=rev
Author:   tfry
Date:     2011-09-20 17:38:20 +0000 (Tue, 20 Sep 2011)
Log Message:
-----------
Make writing plugins documentation available inline.
This needed some tweaking to handle help:-urls correctly.

Modified Paths:
--------------
    trunk/rkward/ChangeLog
    trunk/rkward/rkward/pages/rkward_for_rkward_devs.rkh
    trunk/rkward/rkward/pages/rkward_welcome.rkh
    trunk/rkward/rkward/rkwardapplication.cpp
    trunk/rkward/rkward/windows/rkhtmlwindow.cpp
    trunk/rkward/rkward/windows/rkworkplace.cpp
    trunk/rkward/rkward/windows/rkworkplace.h

Modified: trunk/rkward/ChangeLog
===================================================================
--- trunk/rkward/ChangeLog	2011-09-20 16:53:27 UTC (rev 3806)
+++ trunk/rkward/ChangeLog	2011-09-20 17:38:20 UTC (rev 3807)
@@ -33,7 +33,6 @@
 - Add "Copy lines to output" action to copy highlighted lines from the R console or script editors to the output window
 - R commands and their output can be "carbon copied" to the output window
 - On Windows, RKWard will detect, and offer to disable "native" file system dialogs
-- 
 - Object browsers that show only the global environment now hide the ".GlobalEnv" item
 - Fixed: Function argument hints would not be shown in some corner cases
 - Added function rk.print.code() to write highlighted R code to the output window

Modified: trunk/rkward/rkward/pages/rkward_for_rkward_devs.rkh
===================================================================
--- trunk/rkward/rkward/pages/rkward_for_rkward_devs.rkh	2011-09-20 16:53:27 UTC (rev 3806)
+++ trunk/rkward/rkward/pages/rkward_for_rkward_devs.rkh	2011-09-20 17:38:20 UTC (rev 3807)
@@ -22,7 +22,7 @@
 <ul>
 	<li>For more functions of interest see: <link href="rkward://page/rkward_public_functions"/></li>
 	<li>Do read the the online <link href="http://sourceforge.net/apps/mediawiki/rkward/index.php?title=Developer_Information">wiki</link> as well.</li>
-	<li>To write and share your own GUI dialogs, see the online <link href="http://rkward.sourceforge.net/documents/devel/plugins/index.html">Introduction to Writing Plugins for RKWard</link>.</li>
+	<li>To write and share your own GUI dialogs, see the online <link href="help:rkwardplugins/">Introduction to Writing Plugins for RKWard</link>.</li>
 </ul>
 	</related>
 

Modified: trunk/rkward/rkward/pages/rkward_welcome.rkh
===================================================================
--- trunk/rkward/rkward/pages/rkward_welcome.rkh	2011-09-20 16:53:27 UTC (rev 3806)
+++ trunk/rkward/rkward/pages/rkward_welcome.rkh	2011-09-20 17:38:20 UTC (rev 3807)
@@ -31,6 +31,6 @@
 	</section>
 
 	<section title="Missing something?" id="missing_something">
-	Are you missing a particular GUI dialog in the current menu? Check out our online <link href="http://rkward.sourceforge.net/documents/devel/plugins/index.html">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.
+	Are you missing a particular GUI dialog in the current menu? Check out our online <link href="help: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.
 	</section>
 </document>

Modified: trunk/rkward/rkward/rkwardapplication.cpp
===================================================================
--- trunk/rkward/rkward/rkwardapplication.cpp	2011-09-20 16:53:27 UTC (rev 3806)
+++ trunk/rkward/rkward/rkwardapplication.cpp	2011-09-20 17:38:20 UTC (rev 3807)
@@ -68,6 +68,8 @@
 
 	// Don't complain when linking rkward://-pages from Rd pages
 	KAuthorized::allowUrlAction ("redirect", KUrl ("http://"), KUrl ("rkward://"));
+	// Don't complain when trying to open help pages
+	KAuthorized::allowUrlAction ("redirect", KUrl ("rkward://"), KUrl ("help:"));
 
 	rkapp = this;
 	detect_x11_creations = false;

Modified: trunk/rkward/rkward/windows/rkhtmlwindow.cpp
===================================================================
--- trunk/rkward/rkward/windows/rkhtmlwindow.cpp	2011-09-20 16:53:27 UTC (rev 3806)
+++ trunk/rkward/rkward/windows/rkhtmlwindow.cpp	2011-09-20 17:38:20 UTC (rev 3807)
@@ -298,11 +298,15 @@
 		if ((host == "127.0.0.1") || (host == "localhost") || host == QHostInfo::localHostName ()) {
 			KIO::TransferJob *job = KIO::get (url, KIO::Reload);
 			connect (job, SIGNAL (mimetype(KIO::Job*, const QString&)), this, SLOT (mimeTypeDetermined(KIO::Job*, const QString&)));
-			return true;
 		}
+		return true;
+	} else if (url.protocol ().toLower ().startsWith ("help")) {
+		khtmlpart->openUrl (url);
+		changeURL (url);
+		return true;
 	}
 
-	RKWorkplace::mainWorkplace ()->openAnyUrl (url);
+	RKWorkplace::mainWorkplace ()->openAnyUrl (url, QString (), KMimeType::findByUrl (url)->is ("text/html"));	// NOTE: text/html type urls, which we have not handled, above, are forced to be opened externally, to avoid recursion. E.g. help:// protocol urls.
 	return true;
 }
 

Modified: trunk/rkward/rkward/windows/rkworkplace.cpp
===================================================================
--- trunk/rkward/rkward/windows/rkworkplace.cpp	2011-09-20 16:53:27 UTC (rev 3806)
+++ trunk/rkward/rkward/windows/rkworkplace.cpp	2011-09-20 17:38:20 UTC (rev 3807)
@@ -207,7 +207,7 @@
 	}
 }
 
-bool RKWorkplace::openAnyUrl (const KUrl &url, const QString &known_mimetype) {
+bool RKWorkplace::openAnyUrl (const KUrl &url, const QString &known_mimetype, bool force_external) {
 	RK_TRACE (APP);
 
 #warning TODO support rkward:\/\/-protocol, here, too
@@ -215,19 +215,21 @@
 	if (!known_mimetype.isEmpty ()) mimetype = KMimeType::mimeType (known_mimetype);
 	else mimetype = KMimeType::findByUrl (url);
 
-// NOTE: Currently a known mimetype implies that the URL is local or served from the local machine.
-// Thus, external web pages are *not* opened, here. Which is the behavior we want, although the implementation is ugly
-	if (mimetype->is ("text/html")) {
-		openHelpWindow (url, true);
-		return true;	// TODO
+	if (!force_external) {
+	// NOTE: Currently a known mimetype implies that the URL is local or served from the local machine.
+	// Thus, external web pages are *not* opened, here. Which is the behavior we want, although the implementation is ugly
+		if (mimetype->is ("text/html")) {
+			openHelpWindow (url, true);
+			return true;	// TODO
+		}
+		if (url.fileName ().toLower ().endsWith (".rdata")) {
+			RKWardMainWindow::getMain ()->fileOpenAskSave (url);
+			return true;	// TODO
+		}
+		if (mimetype->name ().startsWith ("text")) {
+			return (openScriptEditor (url, QString (), RKSettingsModuleCommandEditor::matchesScriptFileFilter (url.fileName())));
+		}
 	}
-	if (url.fileName ().toLower ().endsWith (".rdata")) {
-		RKWardMainWindow::getMain ()->fileOpenAskSave (url);
-		return true;	// TODO
-	}
-	if (mimetype->name ().startsWith ("text")) {
-		return (openScriptEditor (url, QString (), RKSettingsModuleCommandEditor::matchesScriptFileFilter (url.fileName())));
-	}
 
 	if (KMessageBox::questionYesNo (this, i18n ("The url you are trying to open ('%1') is not a local file or the filetype is not supported by RKWard. Do you want to open the url in the default application?", url.prettyUrl ()), i18n ("Open in default application?")) != KMessageBox::Yes) {
 		return false;

Modified: trunk/rkward/rkward/windows/rkworkplace.h
===================================================================
--- trunk/rkward/rkward/windows/rkworkplace.h	2011-09-20 16:53:27 UTC (rev 3806)
+++ trunk/rkward/rkward/windows/rkworkplace.h	2011-09-20 17:38:20 UTC (rev 3807)
@@ -92,7 +92,7 @@
 	RKMDIWindow *activeWindow (RKMDIWindow::State state);
 
 /** Opens the given url in the appropriate way. */
-	bool openAnyUrl (const KUrl &url, const QString &known_mimetype = QString ());
+	bool openAnyUrl (const KUrl &url, const QString &known_mimetype = QString (), bool force_external=false);
 
 /** Opens a new script editor
 @param url URL to load. Default option is to open an empty document

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