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

tfry at users.sourceforge.net tfry at users.sourceforge.net
Sat May 16 20:09:57 UTC 2009


Revision: 2483
          http://rkward.svn.sourceforge.net/rkward/?rev=2483&view=rev
Author:   tfry
Date:     2009-05-16 20:09:56 +0000 (Sat, 16 May 2009)

Log Message:
-----------
Make a - slightly - better effort at supporting non-local files

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

Modified: trunk/rkward/ChangeLog
===================================================================
--- trunk/rkward/ChangeLog	2009-05-15 14:17:29 UTC (rev 2482)
+++ trunk/rkward/ChangeLog	2009-05-16 20:09:56 UTC (rev 2483)
@@ -1,4 +1,4 @@
-- Fixed: Opening most file type (e.g. PDF) from the help browser was broken	TODO: backport in basic form
+- Fixed: Opening most file types (e.g. PDF) from the help browser was broken	TODO: backport in basic form
 - Fixed: Make built-in editor work again for file.edit ()
 - (Almost) all plugins now write a header to the output window		TODO: work in progress; which ones should not?
 - Add convenience function "makeHeaderCode()" for use inside plugins	TODO: document, adjust for tests (->rk.describe.alternative())

Modified: trunk/rkward/rkward/windows/rkhtmlwindow.cpp
===================================================================
--- trunk/rkward/rkward/windows/rkhtmlwindow.cpp	2009-05-15 14:17:29 UTC (rev 2482)
+++ trunk/rkward/rkward/windows/rkhtmlwindow.cpp	2009-05-16 20:09:56 UTC (rev 2483)
@@ -253,9 +253,16 @@
 	RK_TRACE (APP);
 
 	if (handleRKWardURL (url)) return true;
+	if (window_mode == HTMLOutputWindow) {
+		// output window should not change url after initialization
+		if ((url != current_url) && (!current_url.isEmpty ())) {
+			RK_ASSERT (false);
+			return false;
+		}
+	}
 
-	// asyncrhonously dealing with non-local files would be quite a task. We chose the simple answer instead...
-	if (!(url.isLocalFile () && KMimeType::findByUrl (url)->is ("text/html"))) {
+	// this also means, that we bail out on almost all non-local files.
+	if (!KMimeType::findByUrl (url)->is ("text/html")) {
 		RKWorkplace::mainWorkplace ()->openAnyUrl (url);
 		return true;
 	}

Modified: trunk/rkward/rkward/windows/rkworkplace.cpp
===================================================================
--- trunk/rkward/rkward/windows/rkworkplace.cpp	2009-05-15 14:17:29 UTC (rev 2482)
+++ trunk/rkward/rkward/windows/rkworkplace.cpp	2009-05-16 20:09:56 UTC (rev 2483)
@@ -196,20 +196,18 @@
 	RK_TRACE (APP);
 
 #warning TODO support rkward:\/\/-protocol, here, too
-	if (url.isLocalFile ()) {
-		KMimeType::Ptr mimetype = KMimeType::findByUrl (url);
-		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, false));
-		}
+	KMimeType::Ptr mimetype = KMimeType::findByUrl (url);
+	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, false));
+	}
 
 	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;


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