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

tfry at users.sourceforge.net tfry at users.sourceforge.net
Thu Aug 23 09:56:26 UTC 2012


Revision: 4289
          http://rkward.svn.sourceforge.net/rkward/?rev=4289&view=rev
Author:   tfry
Date:     2012-08-23 09:56:26 +0000 (Thu, 23 Aug 2012)
Log Message:
-----------
Also save KTextEditor's "session" config, including bookmarks, folding, and cursor position.
Settings are stored separately per workspace.

Note: This should really be merged with the other workplace settings in a consistent way.

Modified Paths:
--------------
    trunk/rkward/ChangeLog
    trunk/rkward/rkward/agents/rkloadagent.cpp
    trunk/rkward/rkward/agents/rksaveagent.cpp
    trunk/rkward/rkward/core/robjectlist.cpp
    trunk/rkward/rkward/core/robjectlist.h
    trunk/rkward/rkward/rbackend/rinterface.cpp
    trunk/rkward/rkward/rkward.cpp
    trunk/rkward/rkward/windows/rkcommandeditorwindow.cpp
    trunk/rkward/rkward/windows/rkcommandeditorwindow.h
    trunk/rkward/rkward/windows/rkworkplace.cpp
    trunk/rkward/rkward/windows/rkworkplace.h

Modified: trunk/rkward/ChangeLog
===================================================================
--- trunk/rkward/ChangeLog	2012-08-22 22:35:00 UTC (rev 4288)
+++ trunk/rkward/ChangeLog	2012-08-23 09:56:26 UTC (rev 4289)
@@ -1,3 +1,4 @@
+- Also save cursor position, folding, etc. for scripts. Note: Implementation details may be subject to change.
 - New function rk.list.labels() to retrieve column labels in a data.frame
 - rk.get.label() will now return an empty string ("") instead of NULL, in case no label is assigned
 - Fixed: Changed configuration settings would not be saved for script editor
@@ -5,7 +6,7 @@
 - Fixed: "Next"-button in wizards would remain enabled while settings are missing on a page
 - Fixed: Dynamic pages in a wizard would cause a layout bug on the first page
 - Do not offer to restore individual removed columns of a data.frame opened for editing
-- Fixed: Plot history and graphical menus broken in some cases with R 2.15.0		TODO: backport? (r4182)
+- Fixed: Plot history and graphical menus broken in some cases with R 2.15.0
 - Fixed: If the rkward package was loaded in a plain R session, q() and quit() still work
 - combined all Wilcoxon/Mann-Whitney-tests in one plugin (from previously two separate plugins)			TODO: adjust test(s)
 - Added polyserial/polychoric correlations to correlation matrix plugin			TODO: adjust test(s)

Modified: trunk/rkward/rkward/agents/rkloadagent.cpp
===================================================================
--- trunk/rkward/rkward/agents/rkloadagent.cpp	2012-08-22 22:35:00 UTC (rev 4288)
+++ trunk/rkward/rkward/agents/rkloadagent.cpp	2012-08-23 09:56:26 UTC (rev 4289)
@@ -2,7 +2,7 @@
                           rkloadagent  -  description
                              -------------------
     begin                : Sun Sep 5 2004
-    copyright            : (C) 2004, 2007, 2009, 2011 by Thomas Friedrichsmeier
+    copyright            : (C) 2004, 2007, 2009, 2011, 2012 by Thomas Friedrichsmeier
     email                : tfry at users.sourceforge.net
  ***************************************************************************/
 
@@ -58,7 +58,7 @@
 	command = new RCommand ("load (\"" + filename + "\")", RCommand::App | RCommand::ObjectListUpdate, QString::null, this, WORKSPACE_LOAD_COMMAND);
 	RKGlobals::rInterface ()->issueCommand (command);
 
-	RObjectList::getObjectList ()->setWorkspaceURL (url);
+	RKWorkplace::mainWorkplace ()->setWorkspaceURL (url);
 }
 
 RKLoadAgent::~RKLoadAgent () {
@@ -71,13 +71,13 @@
 	if (command->getFlags () == WORKSPACE_LOAD_COMMAND) {
 		if (!tmpfile.isEmpty ()) KIO::NetAccess::removeTempFile (tmpfile);
 		if (command->failed ()) {
-			KMessageBox::error (0, i18n ("There has been an error opening file '%1':\n%2", RObjectList::getObjectList ()->getWorkspaceURL ().path (), command->error ()), i18n ("Error loading workspace"));
-			RObjectList::getObjectList ()->setWorkspaceURL (KUrl());
+			KMessageBox::error (0, i18n ("There has been an error opening file '%1':\n%2", RKWorkplace::mainWorkplace ()->workspaceURL ().path (), command->error ()), i18n ("Error loading workspace"));
+			RKWorkplace::mainWorkplace ()->setWorkspaceURL (KUrl());
 		} else {
 			RKWorkplace::mainWorkplace ()->restoreWorkplace ();
 			if (RKSettingsModuleGeneral::cdToWorkspaceOnLoad ()) {
-				if (RObjectList::getObjectList ()->getWorkspaceURL ().isLocalFile ()) {
-					RKGlobals::rInterface ()->issueCommand ("setwd (" + RObject::rQuote (RObjectList::getObjectList ()->getWorkspaceURL ().directory ()) + ")", RCommand::App);
+				if (RKWorkplace::mainWorkplace ()->workspaceURL ().isLocalFile ()) {
+					RKGlobals::rInterface ()->issueCommand ("setwd (" + RObject::rQuote (RKWorkplace::mainWorkplace ()->workspaceURL ().directory ()) + ")", RCommand::App);
 				}
 			}
 		}

Modified: trunk/rkward/rkward/agents/rksaveagent.cpp
===================================================================
--- trunk/rkward/rkward/agents/rksaveagent.cpp	2012-08-22 22:35:00 UTC (rev 4288)
+++ trunk/rkward/rkward/agents/rksaveagent.cpp	2012-08-23 09:56:26 UTC (rev 4289)
@@ -2,7 +2,7 @@
                           rksaveagent  -  description
                              -------------------
     begin                : Sun Aug 29 2004
-    copyright            : (C) 2004, 2009, 2010, 2011 by Thomas Friedrichsmeier
+    copyright            : (C) 2004, 2009, 2010, 2011, 2012 by Thomas Friedrichsmeier
     email                : tfry at users.sourceforge.net
  ***************************************************************************/
 
@@ -36,7 +36,7 @@
 	save_url = url;
 	RKSaveAgent::when_done = when_done;
 	RKSaveAgent::load_url = load_url;
-	previous_url = RObjectList::getObjectList ()->getWorkspaceURL ();
+	previous_url = RKWorkplace::mainWorkplace ()->workspaceURL ();
 	save_chain = 0;
 	if (save_url.isEmpty () || save_file_as) {
 		if (!askURL ()) {
@@ -48,7 +48,7 @@
 	RKWorkplace::mainWorkplace ()->flushAllData ();
 	save_chain = RKGlobals::rInterface ()->startChain (0);
 	
-	RObjectList::getObjectList ()->setWorkspaceURL (save_url);
+	RKWorkplace::mainWorkplace ()->setWorkspaceURL (save_url, true);
 	RKWorkplace::mainWorkplace ()->saveWorkplace (save_chain);
 	RKGlobals::rInterface ()->issueCommand (new RCommand ("save.image (\"" + save_url.toLocalFile () + "\")", RCommand::App, QString::null, this), save_chain);
 }
@@ -72,7 +72,7 @@
 void RKSaveAgent::rCommandDone (RCommand *command) {
 	RK_TRACE (APP);
 	if (command->hasError ()) {
-		RObjectList::getObjectList ()->setWorkspaceURL (previous_url);
+		RKWorkplace::mainWorkplace ()->setWorkspaceURL (previous_url);
 
 		int res;
 		if (when_done != DoNothing) {

Modified: trunk/rkward/rkward/core/robjectlist.cpp
===================================================================
--- trunk/rkward/rkward/core/robjectlist.cpp	2012-08-22 22:35:00 UTC (rev 4288)
+++ trunk/rkward/rkward/core/robjectlist.cpp	2012-08-23 09:56:26 UTC (rev 4289)
@@ -63,15 +63,6 @@
 	RK_TRACE (OBJECTS);
 }
 
-void RObjectList::setWorkspaceURL (const KUrl &url) {
-	RK_TRACE (OBJECTS);
-
-	if (url != current_url) {
-		current_url = url;
-		emit (workspaceUrlChanged (url));
-	}
-}
-
 QStringList RObjectList::detachPackages (const QStringList &packages, RCommandChain *chain, RKProgressControl* control) {
 	RK_TRACE (OBJECTS);
 

Modified: trunk/rkward/rkward/core/robjectlist.h
===================================================================
--- trunk/rkward/rkward/core/robjectlist.h	2012-08-22 22:35:00 UTC (rev 4288)
+++ trunk/rkward/rkward/core/robjectlist.h	2012-08-23 09:56:26 UTC (rev 4289)
@@ -56,8 +56,6 @@
 	/** reimplemented from RContainerObject: do nothing. The object-list has no meta data. */
 	void writeMetaData (RCommandChain *) {};
 
-	KUrl getWorkspaceURL () const { return current_url; };
-
 	REnvironmentObject* findChildByNamespace (const QString &namespacename) const;
 
 	static RObjectList *getObjectList () { return object_list; };
@@ -73,8 +71,6 @@
 	void updateStarted ();
 /// emitted when the list of objects has been updated	// TODO: remove me
 	void updateComplete ();
-/** emitted when the workspace Url has changed */
-	void workspaceUrlChanged (const KUrl& url);
 protected:
 /** reimplemented from RContainerObject to search the environments in search order */
 	RObject *findObjects (const QStringList &path, RObjectSearchMap *matches, const QString &op);
@@ -91,15 +87,12 @@
 private:
 	friend class RKLoadAgent;
 	friend class RKSaveAgent;
-	void setWorkspaceURL (const KUrl &url);
 	QTimer *update_timer;
 	
 	RCommandChain *update_chain;
 
 	REnvironmentObject *createTopLevelEnvironment (const QString &name);
 
-	KUrl current_url;
-
 	static RObjectList *object_list;
 };
 

Modified: trunk/rkward/rkward/rbackend/rinterface.cpp
===================================================================
--- trunk/rkward/rkward/rbackend/rinterface.cpp	2012-08-22 22:35:00 UTC (rev 4288)
+++ trunk/rkward/rkward/rbackend/rinterface.cpp	2012-08-23 09:56:26 UTC (rev 4289)
@@ -546,7 +546,7 @@
 			RKConsole::mainConsole ()->setCommandHistory (calllist.mid (2), calllist.value (1) == "append");
 		}
 	} else if (call == "getWorkspaceUrl") {
-		KUrl url = RObjectList::getObjectList ()->getWorkspaceURL ();
+		KUrl url = RKWorkplace::mainWorkplace ()->workspaceURL ();
 		if (!url.isEmpty ()) return (QStringList (url.url ()));
 	} else if (call == "workplace.layout") {
 		if (calllist.value (1) == "set") {

Modified: trunk/rkward/rkward/rkward.cpp
===================================================================
--- trunk/rkward/rkward/rkward.cpp	2012-08-22 22:35:00 UTC (rev 4288)
+++ trunk/rkward/rkward/rkward.cpp	2012-08-23 09:56:26 UTC (rev 4289)
@@ -133,6 +133,7 @@
 	RKWorkplace::mainWorkplace ()->initActions (actionCollection (), "left_window", "right_window");
 	setCentralWidget (RKWorkplace::mainWorkplace ());
 	connect (RKWorkplace::mainWorkplace ()->view (), SIGNAL (captionChanged (const QString &)), this, SLOT (setCaption (const QString &)));
+	connect (RKWorkplace::mainWorkplace (), SIGNAL (workspaceUrlChanged(const KUrl&)), this, SLOT (addWorkspaceUrl(const KUrl&)));
 
 	part_manager = new KParts::PartManager (this);
 	// When the manager says the active part changes,
@@ -287,7 +288,6 @@
 
 	RKGlobals::rinter = new RInterface ();
 	new RObjectList ();
-	connect (RObjectList::getObjectList (), SIGNAL (workspaceUrlChanged(const KUrl&)), this, SLOT (addWorkspaceUrl(const KUrl&)));
 
 	RObjectBrowser::mainBrowser ()->unlock ();
 }
@@ -660,7 +660,7 @@
 	int res;
 	res = KMessageBox::questionYesNoCancel (this, i18n ("Quitting RKWard: Do you want to save the workspace?"), i18n ("Save Workspace?"), KStandardGuiItem::save (), KStandardGuiItem::discard (), KGuiItem (i18n ("Don't quit")));
 	if (res == KMessageBox::Yes) {
-		new RKSaveAgent (RObjectList::getObjectList ()->getWorkspaceURL (), false, RKSaveAgent::DoNothing);
+		new RKSaveAgent (RKWorkplace::mainWorkplace ()->workspaceURL (), false, RKSaveAgent::DoNothing);
 	} else if (res == KMessageBox::Cancel) {
 		slotSetStatusReady ();
 		return false;
@@ -727,7 +727,7 @@
 	if (res == KMessageBox::No) {
 		fileOpenNoSave (url);
 	} else if (res == KMessageBox::Yes) {
-		new RKSaveAgent (RObjectList::getObjectList ()->getWorkspaceURL (), false, RKSaveAgent::Load, url);
+		new RKSaveAgent (RKWorkplace::mainWorkplace ()->workspaceURL (), false, RKSaveAgent::Load, url);
 	}
 	// else: cancel. Don't do anything
 }
@@ -751,12 +751,12 @@
 
 void RKWardMainWindow::slotFileSaveWorkspace () {
 	RK_TRACE (APP);
-	new RKSaveAgent (RObjectList::getObjectList ()->getWorkspaceURL ());
+	new RKSaveAgent (RKWorkplace::mainWorkplace ()->workspaceURL ());
 }
 
 void RKWardMainWindow::slotFileSaveWorkspaceAs () {
 	RK_TRACE (APP);
-	new RKSaveAgent (RObjectList::getObjectList ()->getWorkspaceURL (), true);
+	new RKSaveAgent (RKWorkplace::mainWorkplace ()->workspaceURL (), true);
 }
 
 void RKWardMainWindow::addWorkspaceUrl (const KUrl &url) {
@@ -881,8 +881,8 @@
 void RKWardMainWindow::setCaption (const QString &) {
 	RK_TRACE (APP);
 
-	QString wcaption = RObjectList::getObjectList ()->getWorkspaceURL ().fileName ();
-	if (wcaption.isEmpty ()) wcaption = RObjectList::getObjectList ()->getWorkspaceURL ().prettyUrl ();
+	QString wcaption = RKWorkplace::mainWorkplace ()->workspaceURL ().fileName ();
+	if (wcaption.isEmpty ()) wcaption = RKWorkplace::mainWorkplace ()->workspaceURL ().prettyUrl ();
 	if (wcaption.isEmpty ()) wcaption = i18n ("[Unnamed Workspace]");
 	RKMDIWindow *window = RKWorkplace::mainWorkplace ()->view ()->activePage ();
 	if (window) wcaption.append (" - " + window->fullCaption ());

Modified: trunk/rkward/rkward/windows/rkcommandeditorwindow.cpp
===================================================================
--- trunk/rkward/rkward/windows/rkcommandeditorwindow.cpp	2012-08-22 22:35:00 UTC (rev 4288)
+++ trunk/rkward/rkward/windows/rkcommandeditorwindow.cpp	2012-08-23 09:56:26 UTC (rev 4289)
@@ -21,6 +21,7 @@
 #include <ktexteditor/editorchooser.h>
 #include <ktexteditor/modificationinterface.h>
 #include <ktexteditor/markinterface.h>
+#include <ktexteditor/sessionconfiginterface.h>
 
 #include <qlayout.h>
 #include <qapplication.h>
@@ -62,6 +63,7 @@
 #include "../rkglobals.h"
 #include "../rkward.h"
 #include "rkhelpsearchwindow.h"
+#include "rkworkplace.h"
 
 #include "../debug.h"
 
@@ -161,6 +163,19 @@
 	// NOTE: TODO: Ideally we'd only write out a changed config, but how to detect config changes?
 	// 	Alternatively, only for the last closed script window
 	m_doc->editor ()->writeConfig ();
+	if (!url ().isEmpty ()) {
+		KTextEditor::SessionConfigInterface *iface = qobject_cast<KTextEditor::SessionConfigInterface*> (m_doc);
+		QString p_url = RKWorkplace::mainWorkplace ()->portableUrl (m_doc->url ());
+		if (iface) {
+			KConfigGroup conf (RKWorkplace::mainWorkplace ()->workspaceConfig (), QString ("SkriptDocumentSettings %1").arg (p_url));
+			iface->writeSessionConfig (conf);
+		}
+		iface = qobject_cast<KTextEditor::SessionConfigInterface*> (m_view);
+		if (iface) {
+			KConfigGroup conf (RKWorkplace::mainWorkplace ()->workspaceConfig (), QString ("SkriptViewSettings %1").arg (p_url));
+			iface->writeSessionConfig (conf);
+		}
+	}
 
 	delete hinter;
 	delete m_doc;
@@ -347,12 +362,30 @@
 	m_doc->setReadWrite (!ro);
 }
 
-bool RKCommandEditorWindow::openURL (const KUrl &url, const QString& encoding, bool use_r_highlighting, bool read_only, bool delete_on_close){
+bool RKCommandEditorWindow::openURL (const KUrl url, const QString& encoding, bool use_r_highlighting, bool read_only, bool delete_on_close){
 	RK_TRACE (COMMANDEDITOR);
 
 	// encoding must be set *before* loading the file
 	if (!encoding.isEmpty ()) m_doc->setEncoding (encoding);
-	if (m_doc->openUrl (url)){
+	if (m_doc->openUrl (url)) {
+		if (!delete_on_close) {	// don't litter config with temporary files
+			KTextEditor::SessionConfigInterface *iface = qobject_cast<KTextEditor::SessionConfigInterface*> (m_doc);
+			QString p_url = RKWorkplace::mainWorkplace ()->portableUrl (m_doc->url ());
+			if (iface) {
+				KConfigGroup conf (RKWorkplace::mainWorkplace ()->workspaceConfig (), QString ("SkriptDocumentSettings %1").arg (p_url));
+				// Hmm. KTextEditor::Document's readSessionConfig() simply restores too much. Yes, I want to load bookmarks and stuff.
+				// I do not want to mess with encoding, or risk loading a different url, after the doc is already loaded!
+				if (conf.readEntry ("Encoding", encoding) != encoding) conf.writeEntry ("Encoding", encoding);
+				if (conf.readEntry ("URL", url) != url) conf.writeEntry ("URL", url);
+				iface->readSessionConfig (conf);
+			}
+			iface = qobject_cast<KTextEditor::SessionConfigInterface*> (m_view);
+			if (iface) {
+				KConfigGroup conf (RKWorkplace::mainWorkplace ()->workspaceConfig (), QString ("SkriptViewSettings %1").arg (p_url));
+				iface->readSessionConfig (conf);
+			}
+		}
+
 		if (use_r_highlighting) RKCommandHighlighter::setHighlighting (m_doc, RKCommandHighlighter::RScript);
 		setReadOnly (read_only);
 
@@ -363,7 +396,7 @@
 				RK_ASSERT (false);
 				return true;
 			}
-			RKCommandEditorWindow::delete_on_close=url;
+			RKCommandEditorWindow::delete_on_close = url;
 		}
 
 		return true;

Modified: trunk/rkward/rkward/windows/rkcommandeditorwindow.h
===================================================================
--- trunk/rkward/rkward/windows/rkcommandeditorwindow.h	2012-08-22 22:35:00 UTC (rev 4288)
+++ trunk/rkward/rkward/windows/rkcommandeditorwindow.h	2012-08-23 09:56:26 UTC (rev 4289)
@@ -168,7 +168,7 @@
 @param encoding encoding to use. If QString (), the default encoding is used.
 @param read_only Open the file in read-only mode
 @param delete_on_close File should be deleted when closing the window. Only respected with read_only=true. */
-	bool openURL (const KUrl &url, const QString& encoding=QString (), bool use_r_highlighting=true, bool read_only=false, bool delete_on_close=false);
+	bool openURL (const KUrl url, const QString& encoding=QString (), bool use_r_highlighting=true, bool read_only=false, bool delete_on_close=false);
 /** returns, whether the document was modified since the last save */
 	bool isModified ();
 /** insert the given text into the document at the current cursor position. Additionally, focuses the view */

Modified: trunk/rkward/rkward/windows/rkworkplace.cpp
===================================================================
--- trunk/rkward/rkward/windows/rkworkplace.cpp	2012-08-22 22:35:00 UTC (rev 4288)
+++ trunk/rkward/rkward/windows/rkworkplace.cpp	2012-08-23 09:56:26 UTC (rev 4289)
@@ -2,7 +2,7 @@
                           rkworkplace  -  description
                              -------------------
     begin                : Thu Sep 21 2006
-    copyright            : (C) 2006, 2007, 2009, 2010, 2011 by Thomas Friedrichsmeier
+    copyright            : (C) 2006, 2007, 2009, 2010, 2011, 2012 by Thomas Friedrichsmeier
     email                : tfry at users.sourceforge.net
  ***************************************************************************/
 
@@ -27,8 +27,10 @@
 #include <kactioncollection.h>
 #include <krun.h>
 #include <kmimetype.h>
+#include <kstandarddirs.h>
 
 #include <QFileInfo>
+#include <QCryptographicHash>
 
 #include "detachedwindowcontainer.h"
 #include "rkcommandeditorwindow.h"
@@ -61,6 +63,7 @@
 	RK_ASSERT (main_workplace == 0);
 
 	main_workplace = this;
+	_workspace_config = 0;
 
 	/* Splitter setup contains heavy copying from Kate's katemdi! */
 	KVBox *vbox = new KVBox (this);
@@ -105,9 +108,46 @@
 RKWorkplace::~RKWorkplace () {
 	RK_TRACE (APP);
 
+	delete _workspace_config;
 //	closeAll ();	// not needed, as the windows will autodelete themselves using QObject mechanism. Of course, closeAll () should be called *before* quitting.
 }
 
+QString workspaceConfigFileName (const KUrl &url) {
+	QString base_name = QString (QCryptographicHash::hash (url.prettyUrl ().toUtf8 (), QCryptographicHash::Md5).toHex());
+	return (KStandardDirs::locateLocal ("data", "rkward/workspace_config_" + base_name));
+}
+
+KConfigBase *RKWorkplace::workspaceConfig () {
+	if (!_workspace_config) {
+		RK_TRACE (APP);
+		_workspace_config = new KConfig (workspaceConfigFileName (workspaceURL ()));
+	}
+	return _workspace_config;
+}
+
+QString RKWorkplace::portableUrl (const KUrl &url) {
+	KUrl relative = KUrl::relativeUrl (workspaceURL (), url);
+	relative.cleanPath ();
+	return relative.prettyUrl ();
+}
+
+void RKWorkplace::setWorkspaceURL (const KUrl &url, bool keep_config) {
+	RK_TRACE (APP);
+
+	if (url != current_url) {
+		current_url = url;
+		if (keep_config && _workspace_config) {
+			KConfig * _new_config = _workspace_config->copyTo (workspaceConfigFileName (workspaceURL ()));
+			delete _workspace_config;
+			_workspace_config = _new_config;
+		} else {
+			delete _workspace_config;
+			_workspace_config = 0;
+		}
+		emit (workspaceUrlChanged (url));
+	}
+}
+
 void RKWorkplace::saveSettings () {
 	RK_TRACE (APP);
 
@@ -514,7 +554,7 @@
 	QStringList workplace_description;
 
 	// first, save the base directory of the workplace. This allows us to cope better with moved workspaces while restoring.
-	KUrl base_url = RObjectList::getObjectList ()->getWorkspaceURL ();
+	KUrl base_url = workspaceURL ();
 	base_url.setPath (base_url.directory ());
 	if (base_url.isLocalFile () && base_url.hasPath ()) workplace_description.append ("base::::" + base_url.url ());
 
@@ -564,6 +604,8 @@
 
 void RKWorkplace::saveWorkplace (RCommandChain *chain) {
 	RK_TRACE (APP);
+// TODO: This is still a mess. All workplace-related settings, including the workspaceConfig(), should be saved to a single place, and in 
+// standard KConfig format.
 	if (RKSettingsModuleGeneral::workplaceSaveMode () != RKSettingsModuleGeneral::SaveWorkplaceWithWorkspace) return;
 
 	RKGlobals::rInterface ()->issueCommand ("rk.save.workplace(description=" + RObject::rQuote (makeWorkplaceDescription().join ("\n")) + ")", RCommand::App, i18n ("Save Workplace layout"), 0, 0, chain);
@@ -580,7 +622,7 @@
 	KUrl url (_url);
 
 	if (old_base.isEmpty ()) return (url);
-	KUrl new_base_url = RObjectList::getObjectList ()->getWorkspaceURL ();
+	KUrl new_base_url = RKWorkplace::mainWorkplace ()->workspaceURL ();
 	new_base_url.setPath (new_base_url.directory ());
 	if (new_base_url.isEmpty ()) return (url);
 	KUrl old_base_url (old_base);
@@ -595,7 +637,7 @@
 	// check whether a file exists for the adjusted url
 	KUrl relative = KUrl::fromLocalFile (new_base_url.path () + '/' + KUrl::relativePath (old_base_url.path (), url.path ()));
 	relative.cleanPath ();
-	if (QFileInfo (relative.toLocalFile ()).exists ()) return (relative);
+// 	if (QFileInfo (relative.toLocalFile ()).exists ()) return (relative);
 	return (url);
 }
 

Modified: trunk/rkward/rkward/windows/rkworkplace.h
===================================================================
--- trunk/rkward/rkward/windows/rkworkplace.h	2012-08-22 22:35:00 UTC (rev 4288)
+++ trunk/rkward/rkward/windows/rkworkplace.h	2012-08-23 09:56:26 UTC (rev 4289)
@@ -2,7 +2,7 @@
                           rkworkplace  -  description
                              -------------------
     begin                : Thu Sep 21 2006
-    copyright            : (C) 2006, 2007, 2009, 2010, 2011 by Thomas Friedrichsmeier
+    copyright            : (C) 2006, 2007, 2009, 2010, 2011, 2012 by Thomas Friedrichsmeier
     email                : tfry at users.sourceforge.net
  ***************************************************************************/
 
@@ -155,14 +155,22 @@
 	static RKWorkplace *mainWorkplace () { return main_workplace; };
 	static RKMDIWindowHistory *getHistory () { return main_workplace->history; };
 	void placeToolWindows ();
+
+	void setWorkspaceURL (const KUrl &url, bool keep_config=false);
+	KUrl workspaceURL () const { return current_url; };
+	KConfigBase *workspaceConfig ();
+	QString portableUrl (const KUrl &url);
 signals:
-/** TODO: For future expansion. This signal is neither emitted nor used so far. It could be used to deactivate some options in the "Window" menu. Or maybe it can be removed? */
-	void lastWindowClosed ();
+/** emitted when the workspace Url has changed */
+	void workspaceUrlChanged (const KUrl& url);
 public slots:
 /** When windows are attached to the workplace, their QObject::destroyed () signal is connected to this slot. Thereby deleted objects are removed from the workplace automatically */
 	void removeWindow (QObject *window);
 	void saveSettings ();
 private:
+	KUrl current_url;
+	KConfig *_workspace_config;
+
 /** current list of windows. @See getObjectList () */ 
 	RKWorkplaceObjectList windows;
 /** the view. @See view () */ 

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