[rkward/frameworks] rkward: Work in progress: Port away form KUrl.

Thomas Friedrichsmeier thomas.friedrichsmeier at ruhr-uni-bochum.de
Tue Nov 24 10:06:18 UTC 2015


Git commit c06fcd1d8aabb367033ef2baf4cbba8bc1dfdc83 by Thomas Friedrichsmeier.
Committed on 24/11/2015 at 10:05.
Pushed by tfry into branch 'frameworks'.

Work in progress: Port away form KUrl.

M  +3    -3    rkward/agents/rkloadagent.cpp
M  +2    -2    rkward/agents/rkloadagent.h
M  +3    -2    rkward/agents/rkprintagent.cpp
M  +1    -1    rkward/agents/rksaveagent.cpp
M  +5    -5    rkward/agents/rksaveagent.h
M  +1    -1    rkward/agents/showedittextfileagent.cpp
M  +1    -1    rkward/core/robjectlist.h
M  +7    -7    rkward/dialogs/startupdialog.cpp
M  +3    -3    rkward/dialogs/startupdialog.h
M  +3    -3    rkward/main.cpp
M  +2    -2    rkward/plugin/rkstandardcomponentgui.cpp
M  +2    -2    rkward/rbackend/rinterface.cpp
M  +6    -6    rkward/rkconsole.cpp
M  +2    -2    rkward/rkconsole.h
M  +19   -19   rkward/rkward.cpp
M  +6    -6    rkward/rkward.h
M  +2    -3    rkward/scriptbackends/qtscriptbackend.cpp
M  +1    -2    rkward/scriptbackends/rkcomponentscripting.cpp
M  +2    -4    rkward/settings/rksettingsmodulegeneral.cpp
M  +1    -1    rkward/settings/rksettingsmoduler.cpp
M  +11   -9    rkward/windows/rkcommandeditorwindow.cpp
M  +4    -4    rkward/windows/rkcommandeditorwindow.h
M  +1    -1    rkward/windows/rkfilebrowser.cpp
M  +1    -1    rkward/windows/rkhelpsearchwindow.cpp
M  +30   -30   rkward/windows/rkhtmlwindow.cpp
M  +11   -11   rkward/windows/rkhtmlwindow.h
M  +2    -2    rkward/windows/rktoplevelwindowgui.cpp
M  +17   -17   rkward/windows/rkworkplace.cpp
M  +10   -10   rkward/windows/rkworkplace.h

http://commits.kde.org/rkward/c06fcd1d8aabb367033ef2baf4cbba8bc1dfdc83

diff --git a/rkward/agents/rkloadagent.cpp b/rkward/agents/rkloadagent.cpp
index c83019a..1b6bb49 100644
--- a/rkward/agents/rkloadagent.cpp
+++ b/rkward/agents/rkloadagent.cpp
@@ -35,7 +35,7 @@
 #define WORKSPACE_LOAD_COMMAND 1
 #define WORKSPACE_LOAD_COMPLETE_COMMAND 2
 
-RKLoadAgent::RKLoadAgent (const KUrl &url, bool merge) {
+RKLoadAgent::RKLoadAgent (const QUrl &url, bool merge) {
 	RK_TRACE (APP);
 	RKWardMainWindow::getMain ()->slotSetStatusBarText (i18n ("Loading Workspace..."));
 
@@ -74,12 +74,12 @@ void RKLoadAgent::rCommandDone (RCommand *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", RKWorkplace::mainWorkplace ()->workspaceURL ().path (), command->error ()), i18n ("Error loading workspace"));
-			RKWorkplace::mainWorkplace ()->setWorkspaceURL (KUrl());
+			RKWorkplace::mainWorkplace ()->setWorkspaceURL (QUrl());
 		} else {
 			RKWorkplace::mainWorkplace ()->restoreWorkplace (0, _merge);
 			if (RKSettingsModuleGeneral::cdToWorkspaceOnLoad ()) {
 				if (RKWorkplace::mainWorkplace ()->workspaceURL ().isLocalFile ()) {
-					RKGlobals::rInterface ()->issueCommand ("setwd (" + RObject::rQuote (RKWorkplace::mainWorkplace ()->workspaceURL ().directory ()) + ')', RCommand::App);
+					RKGlobals::rInterface ()->issueCommand ("setwd (" + RObject::rQuote (RKWorkplace::mainWorkplace ()->workspaceURL ().adjusted (QUrl::RemoveFilename).path ()) + ')', RCommand::App);
 				}
 			}
 			RKGlobals::rInterface ()->issueCommand (QString (), RCommand::EmptyCommand | RCommand::App, QString (), this, WORKSPACE_LOAD_COMPLETE_COMMAND);
diff --git a/rkward/agents/rkloadagent.h b/rkward/agents/rkloadagent.h
index a69aca0..f3badd0 100644
--- a/rkward/agents/rkloadagent.h
+++ b/rkward/agents/rkloadagent.h
@@ -21,7 +21,7 @@
 #include "../rbackend/rcommandreceiver.h"
 
 #include <qstring.h>
-#include <kurl.h>
+#include <QUrl>
 
 /** The RKLoadAgent is really a rather simple agent. All it needs to do is display an error message, if loading fails. No further action is required. Like all
 agents, the RKLoadAgent self-destructs when done.
@@ -30,7 +30,7 @@ agents, the RKLoadAgent self-destructs when done.
 class RKLoadAgent : public QObject, public RCommandReceiver {
 	Q_OBJECT
 public:
-	explicit RKLoadAgent (const KUrl &url, bool merge=false);
+	explicit RKLoadAgent (const QUrl &url, bool merge=false);
 
 	~RKLoadAgent ();
 protected:
diff --git a/rkward/agents/rkprintagent.cpp b/rkward/agents/rkprintagent.cpp
index 5f376fe..810f0ee 100644
--- a/rkward/agents/rkprintagent.cpp
+++ b/rkward/agents/rkprintagent.cpp
@@ -25,6 +25,7 @@
 #include <kservice.h>
 #include <kmessagebox.h>
 #include <klocale.h>
+#include <QUrl>
 
 #include "../rkward.h"
 
@@ -60,7 +61,7 @@ void RKPrintAgent::printPostscript (const QString &file, bool delete_file) {
 			bool ok = connect (a, SIGNAL (triggered()), provider, SLOT (slotPrint()));
 			if (ok) printaction = a;
 		}
-		if (!(printaction && provider->openUrl (KUrl::fromLocalFile (file)))) {
+		if (!(printaction && provider->openUrl (QUrl::fromLocalFile (file)))) {
 			RK_DEBUG (APP, DL_WARNING, "No print action in postscript provider");
 			delete provider;
 			provider = 0;
@@ -71,7 +72,7 @@ void RKPrintAgent::printPostscript (const QString &file, bool delete_file) {
 		RK_DEBUG (APP, DL_WARNING, "No valid postscript postscript provider was found");
 		KMessageBox::sorry (RKWardMainWindow::getMain (), i18n ("No service was found to provide a KDE print dialog for PostScript files. We will try to open a generic PostScript viewer (if any), instead.<br><br>Consider installing 'okular', or configure RKWard not to attempt to print using a KDE print dialog."), i18n ("Unable to open KDE print dialog"));
 		// fallback: If we can't find a proper part, try to invoke a standalone PS reader, instead
-		KRun::runUrl (KUrl::fromLocalFile (file), "appication/postscript", RKWardMainWindow::getMain ());
+		KRun::runUrl (QUrl::fromLocalFile (file), "appication/postscript", RKWardMainWindow::getMain ());
 		return;
 	}
 
diff --git a/rkward/agents/rksaveagent.cpp b/rkward/agents/rksaveagent.cpp
index 3530db1..5a65292 100644
--- a/rkward/agents/rksaveagent.cpp
+++ b/rkward/agents/rksaveagent.cpp
@@ -31,7 +31,7 @@
 
 #include "../debug.h"
 
-RKSaveAgent::RKSaveAgent (KUrl url, bool save_file_as, DoneAction when_done, KUrl load_url) : QObject () {
+RKSaveAgent::RKSaveAgent (QUrl url, bool save_file_as, DoneAction when_done, QUrl load_url) : QObject () {
 	RK_TRACE (APP);
 	save_url = url;
 	RKSaveAgent::when_done = when_done;
diff --git a/rkward/agents/rksaveagent.h b/rkward/agents/rksaveagent.h
index dc62f12..7853336 100644
--- a/rkward/agents/rksaveagent.h
+++ b/rkward/agents/rksaveagent.h
@@ -19,7 +19,7 @@
 
 #include "../rbackend/rcommandreceiver.h"
 
-#include <kurl.h>
+#include <QUrl>
 #include <QObject>
 
 class RCommandChain;
@@ -34,7 +34,7 @@ public:
 	enum DoneAction { DoNothing=0, Load=1 };
 
 /** creates a new RKSaveAgent. If when_done == Quit, the RKSaveAgent will quit the application as soon as saving was successful (or it asked to by the user). Similarly, if when_done==Load, it will load a new workspace after saving (specify the url in load_url). If url is given (not empty), and not save_file_as, the agent will try to save to the given url, else it will ask the user to specify a url. RKSaveAgent will self destruct when done. */
-	explicit RKSaveAgent (KUrl url, bool save_file_as=false, DoneAction when_done=DoNothing, KUrl load_url=KUrl());
+	explicit RKSaveAgent (QUrl url, bool save_file_as=false, DoneAction when_done=DoNothing, QUrl load_url=QUrl());
 	
 	~RKSaveAgent ();
 protected:
@@ -43,9 +43,9 @@ private:
 	bool askURL ();
 	void done ();
 	RCommandChain *save_chain;
-	KUrl save_url;
-	KUrl load_url;
-	KUrl previous_url;
+	QUrl save_url;
+	QUrl load_url;
+	QUrl previous_url;
 	DoneAction when_done;
 };
 
diff --git a/rkward/agents/showedittextfileagent.cpp b/rkward/agents/showedittextfileagent.cpp
index 7199f30..a90bb3e 100644
--- a/rkward/agents/showedittextfileagent.cpp
+++ b/rkward/agents/showedittextfileagent.cpp
@@ -120,7 +120,7 @@ void ShowEditTextFileAgent::showEditFiles (RBackendRequest *request) {
 
 	// do this last, as it may produce error messages, if some of the files could not be opened.
 	for (int n = 0; n < count; ++n) {
-		RKWorkplace::mainWorkplace ()->openScriptEditor (KUrl::fromLocalFile (files[n]), QString (), r_highlighting, read_only, display_titles[n], delete_files);
+		RKWorkplace::mainWorkplace ()->openScriptEditor (QUrl::fromLocalFile (files[n]), QString (), r_highlighting, read_only, display_titles[n], delete_files);
 	}
 }
 
diff --git a/rkward/core/robjectlist.h b/rkward/core/robjectlist.h
index ea6f41b..8440bf0 100644
--- a/rkward/core/robjectlist.h
+++ b/rkward/core/robjectlist.h
@@ -22,7 +22,7 @@
 #include <qstring.h>
 #include <qmap.h>
 
-#include <kurl.h>
+#include <QUrl>
 
 #include "rcontainerobject.h"
 
diff --git a/rkward/dialogs/startupdialog.cpp b/rkward/dialogs/startupdialog.cpp
index f0c27f5..4a7f900 100644
--- a/rkward/dialogs/startupdialog.cpp
+++ b/rkward/dialogs/startupdialog.cpp
@@ -60,7 +60,7 @@ StartupDialog::StartupDialog (QWidget *parent, StartupDialogResult *result, KRec
 	choser->addButton (empty_workspace_button);
 	choser_layout->addWidget (empty_table_button = new QRadioButton (i18n ("Start with an empty table"), choser_box));
 	choser->addButton (empty_table_button);
-	KUrl rdata_file = getRestoreFile ();
+	QUrl rdata_file = getRestoreFile ();
 	choser_layout->addWidget (restore_workspace_button = new QRadioButton (choser_box));
 	choser->addButton (restore_workspace_button);
 	if (rdata_file.isEmpty ()) {
@@ -77,9 +77,9 @@ StartupDialog::StartupDialog (QWidget *parent, StartupDialogResult *result, KRec
 	file_list->setSortingEnabled (false);
 	chose_file_item = new QListWidgetItem (i18n ("<<Open another file>>"), file_list);
 	if (recent_files) {
-		KUrl::List urls = recent_files->urls ();
+		QList<QUrl> urls = recent_files->urls ();
 		for (int i = 0; i < urls.length (); ++i) {
-			file_list->addItem (urls[i].pathOrUrl ());
+			file_list->addItem (urls[i].url (QUrl::PreferLocalFile));
 		}
 	}
 	connect (file_list, SIGNAL (itemClicked(QListWidgetItem*)), this, SLOT (listClicked(QListWidgetItem*)));
@@ -108,7 +108,7 @@ void StartupDialog::accept () {
 			result->result = ChoseFile;
 		} else {
 			result->result = OpenFile;
-			result->open_url = KUrl (item->text ());
+			result->open_url = QUrl (item->text ());
 		}
 	} else {
 		RK_ASSERT (false);
@@ -172,13 +172,13 @@ void StartupDialog::showEvent (QShowEvent *event) {
 }
 
 // static
-KUrl StartupDialog::getRestoreFile () {
+QUrl StartupDialog::getRestoreFile () {
 	RK_TRACE (DIALOGS);
 
 	QFileInfo rdata_file (".RData");
-	if (rdata_file.exists ()) return KUrl::fromLocalFile (rdata_file.absoluteFilePath ());
+	if (rdata_file.exists ()) return QUrl::fromLocalFile (rdata_file.absoluteFilePath ());
 
-	return KUrl ();
+	return QUrl ();
 }
 
 //static
diff --git a/rkward/dialogs/startupdialog.h b/rkward/dialogs/startupdialog.h
index 43702b6..9722e70 100644
--- a/rkward/dialogs/startupdialog.h
+++ b/rkward/dialogs/startupdialog.h
@@ -18,7 +18,7 @@
 #define STARTUPDIALOG_H
 
 #include <kdialog.h>
-#include <kurl.h>
+#include <QUrl>
 
 class QCheckBox;
 class QButtonGroup;
@@ -47,7 +47,7 @@ public:
 	};
 	struct StartupDialogResult {
 		Result result;
-		KUrl open_url;
+		QUrl open_url;
 	};
 
 	StartupDialog (QWidget *parent, StartupDialogResult *result, KRecentFilesAction *recent_files);
@@ -55,7 +55,7 @@ public:
 	~StartupDialog();
 	
 	static StartupDialogResult getStartupAction (QWidget *parent, KRecentFilesAction *recent_files);
-	static KUrl getRestoreFile ();
+	static QUrl getRestoreFile ();
 public slots:
 	void accept () override;
 	void reject () override;
diff --git a/rkward/main.cpp b/rkward/main.cpp
index 6d8f68a..f82e2ec 100644
--- a/rkward/main.cpp
+++ b/rkward/main.cpp
@@ -56,7 +56,7 @@
 #include <kstandarddirs.h>
 #include <kglobal.h>
 #include <KUrlAuthorized>
-#include <kurl.h>
+#include <QUrl>
 
 #include <qstring.h>
 #include <QMutex>
@@ -132,9 +132,9 @@ int main (int argc, char *argv[]) {
 
 	QApplication app (argc, argv_copy);
 	// Don't complain when linking rkward://-pages from Rd pages
-	KUrlAuthorized::allowUrlAction ("redirect", KUrl ("http://"), KUrl ("rkward://"));
+	KUrlAuthorized::allowUrlAction ("redirect", QUrl("http://"), QUrl ("rkward://"));
 	// Don't complain when trying to open help pages
-	KUrlAuthorized::allowUrlAction ("redirect", KUrl ("rkward://"), KUrl ("help:"));
+	KUrlAuthorized::allowUrlAction ("redirect", QUrl("rkward://"), QUrl ("help:"));
 
 	KAboutData aboutData ("rkward", i18n ("RKWard"), RKWARD_VERSION, i18n ("Frontend to the R statistics language"), KAboutLicense::GPL, i18n ("(c) 2002, 2004 - 2015"), QString (), "http://rkward.kde.org");
 	aboutData.addAuthor (i18n ("Thomas Friedrichsmeier"), i18n ("Project leader / main developer"));
diff --git a/rkward/plugin/rkstandardcomponentgui.cpp b/rkward/plugin/rkstandardcomponentgui.cpp
index 6bd53f3..c14ad9c 100644
--- a/rkward/plugin/rkstandardcomponentgui.cpp
+++ b/rkward/plugin/rkstandardcomponentgui.cpp
@@ -20,7 +20,7 @@
 #include <klocale.h>
 #include <QAction>
 #include <kactioncollection.h>
-#include <kurl.h>
+#include <QUrl>
 #include <kvbox.h>
 #include <khbox.h>
 
@@ -226,7 +226,7 @@ void RKStandardComponentGUI::help () {
 	RK_TRACE (PLUGIN);
 
 	QString path = component->getId ().split ("::").join ("/");
-	RKWorkplace::mainWorkplace ()->openHelpWindow (KUrl ("rkward://component/" + path));
+	RKWorkplace::mainWorkplace ()->openHelpWindow (QUrl ("rkward://component/" + path));
 }
 
 void RKStandardComponentGUI::closeEvent (QCloseEvent *e) {
diff --git a/rkward/rbackend/rinterface.cpp b/rkward/rbackend/rinterface.cpp
index 06b7d7c..49be4b2 100644
--- a/rkward/rbackend/rinterface.cpp
+++ b/rkward/rbackend/rinterface.cpp
@@ -563,7 +563,7 @@ QStringList RInterface::processPlainGenericRequest (const QStringList &calllist)
 		RK_ASSERT (calllist.count () == 2);
 		RKOutputWindowManager::self ()->setCurrentOutputPath (calllist.value (1));
 	} else if (call == "getCSSlink") {
-		return (QStringList (QString ("<link rel=\"StyleSheet\" type=\"text/css\" href=\"" + KUrl::fromLocalFile (RKCommonFunctions::getRKWardDataDir () + "pages/rkward_output.css").toString () + "\"/>\n")));
+		return (QStringList (QString ("<link rel=\"StyleSheet\" type=\"text/css\" href=\"" + QUrl::fromLocalFile (RKCommonFunctions::getRKWardDataDir () + "pages/rkward_output.css").toString () + "\"/>\n")));
 	} else if (call == "wdChange") {
 		// in case of separate processes, apply new working directory in frontend, too.
 		QDir::setCurrent (calllist.value (1));
@@ -614,7 +614,7 @@ QStringList RInterface::processPlainGenericRequest (const QStringList &calllist)
 			RKConsole::mainConsole ()->setCommandHistory (calllist.mid (2), calllist.value (1) == "append");
 		}
 	} else if (call == "getWorkspaceUrl") {
-		KUrl url = RKWorkplace::mainWorkplace ()->workspaceURL ();
+		QUrl url = RKWorkplace::mainWorkplace ()->workspaceURL ();
 		if (!url.isEmpty ()) return (QStringList (url.url ()));
 	} else if (call == "workplace.layout") {
 		if (calllist.value (1) == "set") {
diff --git a/rkward/rkconsole.cpp b/rkward/rkconsole.cpp
index eebd52d..c76f10a 100644
--- a/rkward/rkconsole.cpp
+++ b/rkward/rkconsole.cpp
@@ -758,12 +758,12 @@ void RKConsole::setCommandHistory (const QStringList &new_history, bool append)
 	commands_history.setHistory (new_history, append);
 }
 
-void RKConsole::userLoadHistory (const KUrl &_url) {
+void RKConsole::userLoadHistory (const QUrl &_url) {
 	RK_TRACE (APP);
 
-	KUrl url = _url;
+	QUrl url = _url;
 	if (url.isEmpty ()) {
-		url = KFileDialog::getOpenUrl (KUrl (), i18n ("*.Rhistory|R history files (*.Rhistory)\n*|All files (*)"), this, i18n ("Select command history file to load"));
+		url = KFileDialog::getOpenUrl (QUrl (), i18n ("*.Rhistory|R history files (*.Rhistory)\n*|All files (*)"), this, i18n ("Select command history file to load"));
 		if (url.isEmpty ()) return;
 	}
 
@@ -778,12 +778,12 @@ void RKConsole::userLoadHistory (const KUrl &_url) {
 	KIO::NetAccess::removeTempFile (tempfile);
 }
 
-void RKConsole::userSaveHistory (const KUrl &_url) {
+void RKConsole::userSaveHistory (const QUrl &_url) {
 	RK_TRACE (APP);
 
-	KUrl url = _url;
+	QUrl url = _url;
 	if (url.isEmpty ()) {
-		url = KFileDialog::getSaveUrl (KUrl (), i18n ("*.Rhistory|R history files (*.Rhistory)\n*|All files (*)"), this, i18n ("Select filename to save command history")
+		url = KFileDialog::getSaveUrl (QUrl (), i18n ("*.Rhistory|R history files (*.Rhistory)\n*|All files (*)"), this, i18n ("Select filename to save command history")
 #if KDE_IS_VERSION(4,4,0)
 		                                    , KFileDialog::ConfirmOverwrite
 #endif
diff --git a/rkward/rkconsole.h b/rkward/rkconsole.h
index 79c0a93..bf1e107 100644
--- a/rkward/rkconsole.h
+++ b/rkward/rkconsole.h
@@ -169,8 +169,8 @@ public slots:
 \param batch a QString containing the batch of commands to be executed */
 	void submitBatch (const QString &batch);
 
-	void userLoadHistory (const KUrl &url=KUrl ());
-	void userSaveHistory (const KUrl &url=KUrl ());
+	void userLoadHistory (const QUrl &url=QUrl ());
+	void userSaveHistory (const QUrl &url=QUrl ());
 private:
 /** Commands can be queued in the console in four different places:
 1) The not-yet-executed remainder of a previous incomplete command.
diff --git a/rkward/rkward.cpp b/rkward/rkward.cpp
index f79ba56..16ed23a 100644
--- a/rkward/rkward.cpp
+++ b/rkward/rkward.cpp
@@ -133,7 +133,7 @@ RKWardMainWindow::RKWardMainWindow () : KParts::MainWindow ((QWidget *)0, (Qt::W
 	RKWorkplace::mainWorkplace ()->initActions (actionCollection (), "left_window", "right_window");
 	setCentralWidget (RKWorkplace::mainWorkplace ());
 	connect (RKWorkplace::mainWorkplace ()->view (), SIGNAL (captionChanged(QString)), this, SLOT (setCaption(QString)));
-	connect (RKWorkplace::mainWorkplace (), SIGNAL (workspaceUrlChanged(KUrl)), this, SLOT (addWorkspaceUrl(KUrl)));
+	connect (RKWorkplace::mainWorkplace (), SIGNAL (workspaceUrlChanged(QUrl)), this, SLOT (addWorkspaceUrl(QUrl)));
 
 	part_manager = new KParts::PartManager (this);
 	// When the manager says the active part changes,
@@ -220,7 +220,7 @@ void RKWardMainWindow::doPostInit () {
 	}
 #endif
 
-	KUrl recover_url = RKRecoverDialog::checkRecoverCrashedWorkspace ();
+	QUrl recover_url = RKRecoverDialog::checkRecoverCrashedWorkspace ();
 	if (!recover_url.isEmpty ()) {
 		open_urls.clear ();
 		open_urls.append (recover_url);		// Well, not a perfect solution. But we certainly don't want to overwrite the just recovered workspace.
@@ -229,9 +229,9 @@ void RKWardMainWindow::doPostInit () {
 	setMergeLoads (true);
 	for (int i = 0; i < open_urls.size (); ++i) {
 		// make sure local urls are absolute, as we may be changing wd before loading
-		KUrl url = open_urls[i].toUrl ();
+		QUrl url = open_urls[i].toUrl ();
 		if (url.isRelative ()) {
-			open_urls[i] = KUrl::fromLocalFile (QDir::current ().absoluteFilePath (url.toLocalFile ()));
+			open_urls[i] = QUrl::fromLocalFile (QDir::current ().absoluteFilePath (url.toLocalFile ()));
 		}
 	}
 	setMergeLoads (false);
@@ -255,7 +255,7 @@ void RKWardMainWindow::doPostInit () {
 			openWorkspace (result.open_url);
 		} else {
 			if (result.result == StartupDialog::ChoseFile) {
-				askOpenWorkspace (KUrl());
+				askOpenWorkspace (QUrl());
 			} else if (result.result == StartupDialog::EmptyTable) {
 				RKWorkplace::mainWorkplace ()->editNewDataFrame (i18n ("my.data"));
 			}
@@ -435,7 +435,7 @@ void RKWardMainWindow::initActions() {
 	fileOpen = actionCollection ()->addAction (KStandardAction::Open, "file_openy", this, SLOT(slotOpenCommandEditor()));
 	fileOpen->setText (i18n ("Open R Script File..."));
 
-	fileOpenRecent = static_cast<KRecentFilesAction*> (actionCollection ()->addAction (KStandardAction::OpenRecent, "file_open_recenty", this, SLOT(slotOpenCommandEditor(KUrl))));
+	fileOpenRecent = static_cast<KRecentFilesAction*> (actionCollection ()->addAction (KStandardAction::OpenRecent, "file_open_recenty", this, SLOT(slotOpenCommandEditor(QUrl))));
 	fileOpenRecent->setText (i18n ("Open Recent R Script File"));
 
 #if 0
@@ -457,7 +457,7 @@ void RKWardMainWindow::initActions() {
 	fileOpenWorkspace->setShortcut (Qt::ControlModifier + Qt::ShiftModifier + Qt::Key_O);
 	fileOpenWorkspace->setStatusTip (i18n ("Opens an existing document"));
 
-	fileOpenRecentWorkspace = static_cast<KRecentFilesAction*> (actionCollection ()->addAction (KStandardAction::OpenRecent, "file_open_recentx", this, SLOT(askOpenWorkspace(KUrl))));
+	fileOpenRecentWorkspace = static_cast<KRecentFilesAction*> (actionCollection ()->addAction (KStandardAction::OpenRecent, "file_open_recentx", this, SLOT(askOpenWorkspace(QUrl))));
 	fileOpenRecentWorkspace->setText (i18n ("Open Recent Workspace"));
 	fileOpenRecentWorkspace->setStatusTip (i18n ("Opens a recently used file"));
 
@@ -656,7 +656,7 @@ void RKWardMainWindow::initStatusBar () {
 	setRStatus (Starting);
 }
 
-void RKWardMainWindow::openWorkspace (const KUrl &url) {
+void RKWardMainWindow::openWorkspace (const QUrl &url) {
 	RK_TRACE (APP);
 	if (url.isEmpty ()) return;
 
@@ -755,7 +755,7 @@ void RKWardMainWindow::slotNewDataFrame () {
 	if (ok) RKWorkplace::mainWorkplace ()->editNewDataFrame (name);
 }
 
-void RKWardMainWindow::askOpenWorkspace (const KUrl &url) {
+void RKWardMainWindow::askOpenWorkspace (const QUrl &url) {
 	RK_TRACE (APP);
 
 	if (!no_ask_save && ((!RObjectList::getGlobalEnv ()->isEmpty () && workspace_modified) || !RKGlobals::rInterface ()->backendIsIdle ())) {
@@ -771,16 +771,16 @@ void RKWardMainWindow::askOpenWorkspace (const KUrl &url) {
 	slotCloseAllEditors ();
 
 	slotSetStatusBarText(i18n("Opening workspace..."));
-	KUrl lurl = url;
+	QUrl lurl = url;
 	if (lurl.isEmpty ()) {
 #ifdef Q_WS_WIN
-	// getOpenUrl(KUrl("kfiledialog:///<rfiles>"), ...) causes a hang on windows (KDElibs 4.2.3).
+	// getOpenUrl(QUrl("kfiledialog:///<rfiles>"), ...) causes a hang on windows (KDElibs 4.2.3).
 #	ifdef __GNUC__
 #		warning Track this bug down and/or report it
 #	endif
-		lurl = KFileDialog::getOpenUrl (KUrl (), i18n("%1|R Workspace Files (%1)\n*|All files", RKSettingsModuleGeneral::workspaceFilenameFilter ()), this, i18n("Select workspace to open..."));
+		lurl = KFileDialog::getOpenUrl (QUrl (), i18n("%1|R Workspace Files (%1)\n*|All files", RKSettingsModuleGeneral::workspaceFilenameFilter ()), this, i18n("Select workspace to open..."));
 #else
-		lurl = KFileDialog::getOpenUrl (KUrl ("kfiledialog:///<rfiles>"), i18n("%1|R Workspace Files (%1)\n*|All files", RKSettingsModuleGeneral::workspaceFilenameFilter ()), this, i18n("Select workspace to open..."));
+		lurl = KFileDialog::getOpenUrl (QUrl("kfiledialog:///<rfiles>"), i18n("%1|R Workspace Files (%1)\n*|All files", RKSettingsModuleGeneral::workspaceFilenameFilter ()), this, i18n("Select workspace to open..."));
 #endif
 	}
 	if (!lurl.isEmpty ()) {
@@ -791,7 +791,7 @@ void RKWardMainWindow::askOpenWorkspace (const KUrl &url) {
 
 void RKWardMainWindow::slotFileOpenWorkspace () {
 	RK_TRACE (APP);
-	askOpenWorkspace (KUrl ());
+	askOpenWorkspace (QUrl ());
 }
 
 void RKWardMainWindow::slotFileLoadLibs () {
@@ -810,7 +810,7 @@ void RKWardMainWindow::slotFileSaveWorkspaceAs () {
 	new RKSaveAgent (RKWorkplace::mainWorkplace ()->workspaceURL (), true);
 }
 
-void RKWardMainWindow::addWorkspaceUrl (const KUrl &url) {
+void RKWardMainWindow::addWorkspaceUrl (const QUrl &url) {
 	RK_TRACE (APP);
 
 	if (!url.isEmpty ()) fileOpenRecentWorkspace->addUrl (url);
@@ -891,16 +891,16 @@ void RKWardMainWindow::importData () {
 void RKWardMainWindow::slotNewCommandEditor () {
 	RK_TRACE (APP);
 
-	slotOpenCommandEditor (KUrl ());
+	slotOpenCommandEditor (QUrl ());
 }
 
-void RKWardMainWindow::addScriptUrl (const KUrl& url) {
+void RKWardMainWindow::addScriptUrl (const QUrl &url) {
 	RK_TRACE (APP);
 
 	if (!url.isEmpty ()) fileOpenRecent->addUrl (url);
 }
 
-void RKWardMainWindow::slotOpenCommandEditor (const KUrl &url, const QString &encoding) {
+void RKWardMainWindow::slotOpenCommandEditor (const QUrl &url, const QString &encoding) {
 	RK_TRACE (APP);
 
 	RKWorkplace::mainWorkplace ()->openScriptEditor (url, encoding);
@@ -911,7 +911,7 @@ void RKWardMainWindow::slotOpenCommandEditor () {
 	KEncodingFileDialog::Result res;
 
 #ifdef Q_WS_WIN
-	// getOpenUrls(KUrl("kfiledialog:///<rfiles>"), ...) causes a hang on windows (KDElibs 4.2.3).
+	// getOpenUrls(QUrl("kfiledialog:///<rfiles>"), ...) causes a hang on windows (KDElibs 4.2.3).
 #	ifdef __GNUC__
 #		warning Track this bug down and/or report it
 #	endif
diff --git a/rkward/rkward.h b/rkward/rkward.h
index 54a52dd..c116cab 100644
--- a/rkward/rkward.h
+++ b/rkward/rkward.h
@@ -20,7 +20,7 @@
 
 #include <kapplication.h>
 #include <QAction>
-#include <kurl.h>
+#include <QUrl>
 #include <kparts/mainwindow.h>
 
 class QLabel;
@@ -80,7 +80,7 @@ public slots:
 	/** open a workspace. If the current workspace is not empty, ask whether to save first.
     @see setNoAskSave ()
     @see setWorkspaceMightBeModified () */
-	void askOpenWorkspace (const KUrl &url);
+	void askOpenWorkspace (const QUrl &url);
 	/** creates a new (empty) data.frame */
 	void slotNewDataFrame ();
 	/** open a file and load it into the document*/
@@ -108,9 +108,9 @@ public slots:
 	void slotConfigure ();
 
 /** Add the given url to the list of recent scripts */
-	void addScriptUrl (const KUrl& url);
+	void addScriptUrl (const QUrl &url);
 /** Add the given url to the list of recent workspaces */
-	void addWorkspaceUrl (const KUrl& url);
+	void addWorkspaceUrl (const QUrl &url);
 
 	/** Init-procedures to be done after the exec-loop was started */
 	void doPostInit ();
@@ -120,7 +120,7 @@ public slots:
 /** open a new command editor (ask for file to open) */
 	void slotOpenCommandEditor ();
 /** open a new command editor (load given url) */
-	void slotOpenCommandEditor (const KUrl &url, const QString& encoding = QString ());
+	void slotOpenCommandEditor (const QUrl &url, const QString& encoding = QString ());
 
 /** close current window (Windows->Close). */
 	void slotCloseWindow ();
@@ -137,7 +137,7 @@ private slots:
 	void partChanged (KParts::Part *new_part);
 private:
 /** Opens a new workspace, without asking or closing anything. */
-	void openWorkspace (const KUrl &url);
+	void openWorkspace (const QUrl &url);
 
 	QLabel* statusbar_r_status;
 	KSqueezedTextLabel* statusbar_cwd;
diff --git a/rkward/scriptbackends/qtscriptbackend.cpp b/rkward/scriptbackends/qtscriptbackend.cpp
index 2fca0fd..b6aa965 100644
--- a/rkward/scriptbackends/qtscriptbackend.cpp
+++ b/rkward/scriptbackends/qtscriptbackend.cpp
@@ -141,7 +141,7 @@ void QtScriptBackend::needData (const QString &identifier, const int hint) {
 
 /////////////////////////////////////////////////////////////////////////////////////////
 
-#include <kurl.h>
+#include <QUrl>
 
 QtScriptBackendThread::QtScriptBackendThread (const QString &commonfile, const QString &scriptfile, QtScriptBackend *parent, const RKMessageCatalog *catalog) : QThread (parent), engine (0) {
 	RK_TRACE (PHP);
@@ -252,8 +252,7 @@ bool QtScriptBackendThread::includeFile (const QString &filename) {
 
 	QString _filename = filename;
 	if (QFileInfo (filename).isRelative ()) {
-		KUrl script_path = KUrl (QUrl::fromLocalFile (_scriptfile)).upUrl ();
-		script_path.addPath (filename);
+		QUrl script_path = QUrl (QUrl::fromLocalFile (_scriptfile)).adjusted (QUrl::RemoveFilename).resolved (filename);
 		_filename = script_path.toLocalFile ();
 	}
 
diff --git a/rkward/scriptbackends/rkcomponentscripting.cpp b/rkward/scriptbackends/rkcomponentscripting.cpp
index 2848be9..c5a3283 100644
--- a/rkward/scriptbackends/rkcomponentscripting.cpp
+++ b/rkward/scriptbackends/rkcomponentscripting.cpp
@@ -92,8 +92,7 @@ void RKComponentScriptingProxy::include (const QString& filename) {
 
 	QString _filename = filename;
 	if (QFileInfo (filename).isRelative ()) {
-		KUrl script_path = KUrl (QUrl::fromLocalFile (_scriptfile)).upUrl ();
-		script_path.addPath (filename);
+		QUrl script_path = QUrl (QUrl::fromLocalFile (_scriptfile)).adjusted (QUrl::RemoveFilename).resolved (filename);
 		_filename = script_path.toLocalFile ();
 	}
 
diff --git a/rkward/settings/rksettingsmodulegeneral.cpp b/rkward/settings/rksettingsmodulegeneral.cpp
index c1c7488..31237a6 100644
--- a/rkward/settings/rksettingsmodulegeneral.cpp
+++ b/rkward/settings/rksettingsmodulegeneral.cpp
@@ -289,12 +289,10 @@ QString RKSettingsModuleGeneral::checkAdjustLoadedPath (const QString& localpath
 	RK_TRACE (SETTINGS);
 
 	if (!installation_moved) return localpath;
-	bool is_parent;	// old data path is parent of given path
-	QString adjusted = KUrl::relativePath (previous_rkward_data_dir, localpath, &is_parent);
-	if (is_parent) {
+	if (QUrl::fromLocalFile (previous_rkward_data_dir).isParentOf (QUrl::fromLocalFile (localpath))) { // old data path is parent of given path
+		QString adjusted = QDir (previous_rkward_data_dir).relativeFilePath (localpath);
 		QDir new_data_dir (RKCommonFunctions::getRKWardDataDir ());
 		return QDir::cleanPath (new_data_dir.absoluteFilePath (adjusted));
 	}
 	return localpath;
 }
-
diff --git a/rkward/settings/rksettingsmoduler.cpp b/rkward/settings/rksettingsmoduler.cpp
index 2a603a1..344330e 100644
--- a/rkward/settings/rksettingsmoduler.cpp
+++ b/rkward/settings/rksettingsmoduler.cpp
@@ -429,7 +429,7 @@ void RKSettingsModuleRPackages::addLibLoc (QStringList *string_list) {
 		new_string = dummy.selectedFiles ().value (0);
 	}
 #else
-	QString new_string = KFileDialog::getExistingDirectory (KUrl (), this, i18n ("Add R Library Directory"));
+	QString new_string = KFileDialog::getExistingDirectory (QUrl (), this, i18n ("Add R Library Directory"));
 #endif
 	if (!new_string.isEmpty ()) {
 		(*string_list).append (new_string);
diff --git a/rkward/windows/rkcommandeditorwindow.cpp b/rkward/windows/rkcommandeditorwindow.cpp
index 3b7c7a2..1dbfad5 100644
--- a/rkward/windows/rkcommandeditorwindow.cpp
+++ b/rkward/windows/rkcommandeditorwindow.cpp
@@ -447,10 +447,11 @@ void RKCommandEditorWindow::doAutoSave () {
 	// Thus, for the simple case of local files, we use QFile, instead.
 	connect (alljobs, SIGNAL (finished(RKJobSequence*)), this, SLOT (autoSaveHandlerJobFinished(RKJobSequence*)));
 	// backup the old autosave file in case something goes wrong during pushing the new one
-	KUrl backup_autosave_url;
+	QUrl backup_autosave_url;
 	if (previous_autosave_url.isValid ()) {
 		backup_autosave_url = previous_autosave_url;
-		backup_autosave_url.setFileName (backup_autosave_url.fileName () + '~');
+		backup_autosave_url = backup_autosave_url.adjusted(QUrl::RemoveFilename);
+		backup_autosave_url.setPath(backup_autosave_url.path() + backup_autosave_url.fileName () + '~');
 		if (previous_autosave_url.isLocalFile ()) {
 			QFile::remove (backup_autosave_url.toLocalFile ());
 			QFile::copy (previous_autosave_url.toLocalFile (), backup_autosave_url.toLocalFile ());
@@ -461,18 +462,19 @@ void RKCommandEditorWindow::doAutoSave () {
 	
 	// push the newly written file
 	if (url ().isValid ()) {
-		KUrl autosave_url = url ();
-		autosave_url.setFileName (autosave_url.fileName () + RKSettingsModuleCommandEditor::autosaveSuffix ());
+		QUrl autosave_url = url ();
+		autosave_url = autosave_url.adjusted(QUrl::RemoveFilename);
+		autosave_url.setPath(autosave_url.path() + autosave_url.fileName () + RKSettingsModuleCommandEditor::autosaveSuffix ());
 		if (autosave_url.isLocalFile ()) {
 			QFile::remove (autosave_url.toLocalFile ());
 			save.copy (autosave_url.toLocalFile ());
 			save.remove ();
 		} else {
-			alljobs->addJob (KIO::file_move (KUrl::fromLocalFile (save.fileName ()), autosave_url, -1, KIO::HideProgressInfo | KIO::Overwrite));
+			alljobs->addJob (KIO::file_move (QUrl::fromLocalFile (save.fileName ()), autosave_url, -1, KIO::HideProgressInfo | KIO::Overwrite));
 		}
 		previous_autosave_url = autosave_url;
 	} else {		// i.e., the document is still "Untitled"
-		previous_autosave_url = KUrl::fromLocalFile (save.fileName ());
+		previous_autosave_url = QUrl::fromLocalFile (save.fileName ());
 	}
 
 	// remove the backup
@@ -497,7 +499,7 @@ void RKCommandEditorWindow::autoSaveHandlerJobFinished (RKJobSequence* seq) {
 	}
 }
 
-KUrl RKCommandEditorWindow::url () {
+QUrl RKCommandEditorWindow::url () {
 //	RK_TRACE (COMMANDEDITOR);
 	return (m_doc->url ());
 }
@@ -559,7 +561,7 @@ void RKCommandEditorWindow::highlightLine (int linenum) {
 void RKCommandEditorWindow::updateCaption (KTextEditor::Document*) {
 	RK_TRACE (COMMANDEDITOR);
 	QString name = url ().fileName ();
-	if (name.isEmpty ()) name = url ().prettyUrl ();
+	if (name.isEmpty ()) name = url ().toDisplayString ();
 	if (name.isEmpty ()) name = i18n ("Unnamed");
 	if (isModified ()) name.append (i18n (" [modified]"));
 
@@ -672,7 +674,7 @@ void RKCommandEditorWindow::setWDToScript () {
 	RK_TRACE (COMMANDEDITOR);
 
 	RK_ASSERT (!url ().isEmpty ());
-	QString dir = url ().directory ();
+	QString dir = url ().adjusted (QUrl::RemoveFilename).path ();
 #ifdef Q_OS_WIN
 	// KURL::directory () returns a leading slash on windows as of KDElibs 4.3
 	while (dir.startsWith ('/')) dir.remove (0, 1);
diff --git a/rkward/windows/rkcommandeditorwindow.h b/rkward/windows/rkcommandeditorwindow.h
index 0d57e46..463a072 100644
--- a/rkward/windows/rkcommandeditorwindow.h
+++ b/rkward/windows/rkcommandeditorwindow.h
@@ -31,7 +31,7 @@
 #include <ktexteditor/movingrange.h>
 #include <ktexteditor/movinginterface.h>
 
-#include <kurl.h>
+#include <QUrl>
 
 #include "../windows/rkmdiwindow.h"
 
@@ -165,7 +165,7 @@ public:
 	void setReadOnly (bool ro);
 
 /** Return current url */
-	KUrl url ();
+	QUrl url ();
 
 	QString provideContext (int line_rev) override;
 	QString currentCompletionWord () const;
@@ -264,10 +264,10 @@ private:
 
 	QAction* action_help_function;
 
-	KUrl previous_autosave_url;
+	QUrl previous_autosave_url;
 	QTimer* autosave_timer;
 
-	KUrl delete_on_close;
+	QUrl delete_on_close;
 };
 
 /** Simple class to provide HTML highlighting for arbitrary R code. */
diff --git a/rkward/windows/rkfilebrowser.cpp b/rkward/windows/rkfilebrowser.cpp
index bbb1cf8..f3e652f 100644
--- a/rkward/windows/rkfilebrowser.cpp
+++ b/rkward/windows/rkfilebrowser.cpp
@@ -103,7 +103,7 @@ RKFileBrowserWidget::RKFileBrowserWidget (QWidget *parent) : KVBox (parent) {
 	urlbox->completionBox (true)->installEventFilter (this);
 	setFocusProxy (urlbox);
 
-	dir = new KDirOperator (KUrl (), this);
+	dir = new KDirOperator (QUrl (), this);
 	dir->setPreviewWidget (0);
 	KConfigGroup config = KSharedConfig::openConfig ()->group ("file browser window");
 	dir->readConfig (config);
diff --git a/rkward/windows/rkhelpsearchwindow.cpp b/rkward/windows/rkhelpsearchwindow.cpp
index e816cff..9f1ab28 100644
--- a/rkward/windows/rkhelpsearchwindow.cpp
+++ b/rkward/windows/rkhelpsearchwindow.cpp
@@ -18,7 +18,7 @@
 #include "rkhelpsearchwindow.h"
 
 #include <klocale.h>
-#include <kurl.h>
+#include <QUrl>
 #include <kmessagebox.h>
 
 #include <qcheckbox.h>
diff --git a/rkward/windows/rkhtmlwindow.cpp b/rkward/windows/rkhtmlwindow.cpp
index 8bd0a37..d9d368d 100644
--- a/rkward/windows/rkhtmlwindow.cpp
+++ b/rkward/windows/rkhtmlwindow.cpp
@@ -95,7 +95,7 @@ bool RKWebPage::acceptNavigationRequest (QWebFrame* frame, const QNetworkRequest
 		return false;
 	}
 
-	if (KUrl (mainFrame ()->url ()).equals (request.url (), KUrl::CompareWithoutFragment | KUrl::CompareWithoutTrailingSlash)) {
+	if (QUrl (mainFrame ()->url ()).matches (request.url (), QUrl::NormalizePathSegments | QUrl::StripTrailingSlash)) {
 		RK_DEBUG (APP, DL_DEBUG, "Page internal navigation request from %s to %s", qPrintable (mainFrame ()->url ().toString ()), qPrintable (request.url ().toString ()));
 		emit (pageInternalNavigation (request.url ()));
 		return true;
@@ -166,7 +166,7 @@ RKHTMLWindow::~RKHTMLWindow () {
 	delete current_cache_file;
 }
 
-KUrl RKHTMLWindow::restorableUrl () {
+QUrl RKHTMLWindow::restorableUrl () {
 	RK_TRACE (APP);
 
 	return (current_url.url ().replace (RKSettingsModuleR::helpBaseUrl(), "rkward://RHELPBASE"));
@@ -286,10 +286,10 @@ void RKHTMLWindow::slotBack () {
 	openLocationFromHistory (url_history[current_history_position]);
 }
 
-void RKHTMLWindow::openRKHPage (const KUrl& url) {
+void RKHTMLWindow::openRKHPage (const QUrl &url) {
 	RK_TRACE (APP);
 
-	RK_ASSERT (url.protocol () == "rkward");
+	RK_ASSERT (url.scheme () == "rkward");
 	changeURL (url);
 	bool ok = false;
 	if ((url.host () == "component") || (url.host () == "page")) {
@@ -300,11 +300,11 @@ void RKHTMLWindow::openRKHPage (const KUrl& url) {
 		ok = render.renderRKHelp (url);
 		current_cache_file->close ();
 
-		KUrl cache_url = KUrl::fromLocalFile (current_cache_file->fileName ());
+		QUrl cache_url = QUrl::fromLocalFile (current_cache_file->fileName ());
 		cache_url.setFragment (url.fragment ());
 		page->load (cache_url);
 	} else if (url.host ().toUpper () == "RHELPBASE") {	// NOTE: QUrl () may lowercase the host part, internally
-		KUrl fixed_url = KUrl (RKSettingsModuleR::helpBaseUrl ());
+		QUrl fixed_url = QUrl (RKSettingsModuleR::helpBaseUrl ());
 		fixed_url.setPath (url.path ());
 		if (url.hasQuery ()) fixed_url.setQuery (url.query ());
 		if (url.hasFragment ()) fixed_url.setFragment (url.fragment ());
@@ -316,10 +316,10 @@ void RKHTMLWindow::openRKHPage (const KUrl& url) {
 }
 
 // static
-bool RKHTMLWindow::handleRKWardURL (const KUrl &url, RKHTMLWindow *window) {
+bool RKHTMLWindow::handleRKWardURL (const QUrl &url, RKHTMLWindow *window) {
 	RK_TRACE (APP);
 
-	if (url.protocol () == "rkward") {
+	if (url.scheme () == "rkward") {
 		if (url.host () == "runplugin") {
 			QString path = url.path ();
 			if (path.startsWith ('/')) path = path.mid (1);
@@ -346,7 +346,7 @@ bool RKHTMLWindow::handleRKWardURL (const KUrl &url, RKHTMLWindow *window) {
 	return false;
 }
 
-bool RKHTMLWindow::openURL (const KUrl &url) {
+bool RKHTMLWindow::openURL (const QUrl &url) {
 	RK_TRACE (APP);
 
 	if (handleRKWardURL (url, this)) return true;
@@ -376,14 +376,14 @@ bool RKHTMLWindow::openURL (const KUrl &url) {
 		return ok;
 	}
 
-	if (url_change_is_from_history || url.protocol ().toLower ().startsWith ("help")) {	// handle help pages, and any page that we have previously handled (from history)
+	if (url_change_is_from_history || url.scheme ().toLower ().startsWith ("help")) {	// handle help pages, and any page that we have previously handled (from history)
 		changeURL (url);
 		page->load (url);
 		return true;
 	}
 
 	// special casing for R's dynamic help pages. These should be considered local, even though they are served through http
-	if (url.protocol ().toLower ().startsWith ("http")) {
+	if (url.scheme ().toLower ().startsWith ("http")) {
 		QString host = url.host ();
 		if ((host == "127.0.0.1") || (host == "localhost") || host == QHostInfo::localHostName ()) {
 			KIO::TransferJob *job = KIO::get (url, KIO::Reload);
@@ -398,7 +398,7 @@ bool RKHTMLWindow::openURL (const KUrl &url) {
 	return true;
 }
 
-KUrl RKHTMLWindow::url () {
+QUrl RKHTMLWindow::url () {
 	return current_url;
 }
 
@@ -434,7 +434,7 @@ void RKHTMLWindow::mimeTypeDetermined (KIO::Job* job, const QString& type) {
 	RK_TRACE (APP);
 
 	KIO::TransferJob* tj = static_cast<KIO::TransferJob*> (job);
-	KUrl url = tj->url ();
+	QUrl url = tj->url ();
 	tj->putOnHold ();
 	if (type == "text/html") {
 		changeURL (url);
@@ -447,14 +447,14 @@ void RKHTMLWindow::mimeTypeDetermined (KIO::Job* job, const QString& type) {
 void RKHTMLWindow::internalNavigation (const QUrl& new_url) {
 	RK_TRACE (APP);
 
-	KUrl real_url = current_url;    // Note: This could be something quite different from new_url: a temp file for rkward://-urls. We know the base part of the URL has not actually changed, when this gets called, though.
+	QUrl real_url = current_url;    // Note: This could be something quite different from new_url: a temp file for rkward://-urls. We know the base part of the URL has not actually changed, when this gets called, though.
 	real_url.setFragment (new_url.fragment ());
 
 	changeURL (real_url);
 }
 
-void RKHTMLWindow::changeURL (const KUrl &url) {
-	KUrl prev_url = current_url;
+void RKHTMLWindow::changeURL (const QUrl &url) {
+	QUrl prev_url = current_url;
 	current_url = url;
 	updateCaption (url);
 
@@ -476,7 +476,7 @@ void RKHTMLWindow::changeURL (const KUrl &url) {
 	}
 }
 
-void RKHTMLWindow::updateCaption (const KUrl &url) {
+void RKHTMLWindow::updateCaption (const QUrl &url) {
 	RK_TRACE (APP);
 
 	if (window_mode == HTMLOutputWindow) setCaption (i18n ("Output %1").arg (url.fileName ()));
@@ -557,7 +557,7 @@ void RKHTMLWindow::fileDoesNotExistMessage () {
 	}
 	current_cache_file->close ();
 
-	KUrl cache_url = KUrl::fromLocalFile (current_cache_file->fileName ());
+	QUrl cache_url = QUrl::fromLocalFile (current_cache_file->fileName ());
 	page->load (cache_url);
 }
 
@@ -673,10 +673,10 @@ void RKHTMLWindowPart::setHelpWindowSkin () {
 //////////////////////////////////////////
 //////////////////////////////////////////
 
-bool RKHelpRenderer::renderRKHelp (const KUrl &url) {
+bool RKHelpRenderer::renderRKHelp (const QUrl &url) {
 	RK_TRACE (APP);
 
-	if (url.protocol () != "rkward") {
+	if (url.scheme () != "rkward") {
 		RK_ASSERT (false);
 		return (false);
 	}
@@ -745,7 +745,7 @@ bool RKHelpRenderer::renderRKHelp (const KUrl &url) {
 	XMLChildList src_elements = help_xml->findElementsWithAttribute (help_doc_element, "src", QString (), true, DL_DEBUG);
 	for (XMLChildList::iterator it = src_elements.begin (); it != src_elements.end (); ++it) {
 		QString src = (*it).attribute ("src");
-		if (KUrl::isRelativeUrl (src)) {
+		if (QUrl (src).isRelative ()) {
 			src = "file://" + QDir::cleanPath (base_path.filePath (src));
 			(*it).setAttribute ("src", src);
 		}
@@ -834,14 +834,14 @@ bool RKHelpRenderer::renderRKHelp (const KUrl &url) {
 	}
 
 	// create a navigation bar
-	KUrl url_copy = url;
+	QUrl url_copy = url;
 	QString navigation = i18n ("<h1>On this page:</h1>");
 	RK_ASSERT (anchornames.size () == anchors.size ());
 	for (int i = 0; i < anchors.size (); ++i) {
 		QString anchor = anchors[i];
 		QString anchorname = anchornames[i];
 		if (!(anchor.isEmpty () || anchorname.isEmpty ())) {
-			url_copy.setRef (anchor);
+			url_copy.setFragment (anchor);
 			navigation.append ("<p><a href=\"" + url_copy.url () + "\">" + anchorname + "</a></p>\n");
 		}
 	}
@@ -926,8 +926,8 @@ QString RKHelpRenderer::prepareHelpLink (const QString &href, const QString &tex
 		ret += text;
 	} else {
 		QString ltext;
-		KUrl url (href);
-		if (url.protocol () == "rkward") {
+		QUrl url (href);
+		if (url.scheme () == "rkward") {
 			if (url.host () == "component") {
 				RKComponentHandle *chandle = componentPathToHandle (url.path ());
 				if (chandle) ltext = chandle->getLabel ();
@@ -1020,14 +1020,14 @@ void RKOutputWindowManager::registerWindow (RKHTMLWindow *window) {
 	RK_TRACE (APP);
 
 	RK_ASSERT (window->mode () == RKHTMLWindow::HTMLOutputWindow);
-	KUrl url = window->url ();
+	QUrl url = window->url ();
 
 	if (!url.isLocalFile ()) {
 		RK_ASSERT (false);		// should not happen right now, but might be an ok condition in the future. We can't monitor non-local files, though.
 		return;
 	}
 
-	url.cleanPath ();
+	url = url.adjusted (QUrl::NormalizePathSegments);
 	QString file = url.toLocalFile ();
 	if (!windows.contains (file, window)) {
 		if (!windows.contains (file)) {
@@ -1044,8 +1044,8 @@ void RKOutputWindowManager::registerWindow (RKHTMLWindow *window) {
 void RKOutputWindowManager::setCurrentOutputPath (const QString &_path) {
 	RK_TRACE (APP);
 
-	KUrl url = KUrl::fromLocalFile (_path);
-	url.cleanPath ();
+	QUrl url = QUrl::fromLocalFile (_path);
+	url = url.adjusted (QUrl::NormalizePathSegments);
 	QString path = url.toLocalFile ();
 
 	if (path == current_default_path) return;
@@ -1068,7 +1068,7 @@ RKHTMLWindow* RKOutputWindowManager::getCurrentOutputWindow () {
 	if (!current_output) {
 		current_output = new RKHTMLWindow (RKWorkplace::mainWorkplace ()->view (), RKHTMLWindow::HTMLOutputWindow);
 
-		current_output->openURL (KUrl::fromLocalFile (current_default_path));
+		current_output->openURL (QUrl::fromLocalFile (current_default_path));
 
 		RK_ASSERT (current_output->url ().toLocalFile () == current_default_path);
 	}
diff --git a/rkward/windows/rkhtmlwindow.h b/rkward/windows/rkhtmlwindow.h
index 3f802e6..4487d0b 100644
--- a/rkward/windows/rkhtmlwindow.h
+++ b/rkward/windows/rkhtmlwindow.h
@@ -18,7 +18,7 @@
 #ifndef RKHTMLWINDOW_H
 #define RKHTMLWINDOW_H
 
-#include <kurl.h>
+#include <QUrl>
 #include <kparts/part.h>
 #include <kio/jobclasses.h>
 #include <kwebpage.h>
@@ -80,19 +80,19 @@ public:
 /** destructor */
 	~RKHTMLWindow ();
 /** open given URL. Returns false, if the URL is not an existing local file. Loading a non-local URL may succeed, even if this returns false! */
-	bool openURL (const KUrl &url);
+	bool openURL (const QUrl &url);
 /** takes care of special handling, if the url is an rkward://-url. Does nothing and returns false, otherwise.
  *  If window is not 0, and the url is a help window, open it, there (otherwise in a new window).
  *  TODO: move to RKWorkplace? As this can really open a bunch of different things, although generally _from_ an html window.
  */
-	static bool handleRKWardURL (const KUrl &url, RKHTMLWindow *window=0);
-	void openRKHPage (const KUrl &url);
+	static bool handleRKWardURL (const QUrl &url, RKHTMLWindow *window=0);
+	void openRKHPage (const QUrl &url);
 
 	bool isModified () override;
 /** Return current url */
-	KUrl url ();
+	QUrl url ();
 /** Return current url in a restorable way, i.e. for help pages, abstract the session specific part of the path */
-	KUrl restorableUrl ();
+	QUrl restorableUrl ();
 
 	WindowMode mode () { return window_mode; };
 public slots:
@@ -127,12 +127,12 @@ friend class RKHTMLWindowPart;
 /** In case the part is a khtmlpart: A ready-cast pointer to that. 0 otherwise (if a webkit part is in use) */
 	RKHTMLWindowPart *part;
 /** update caption according to given URL */
-	virtual void updateCaption (const KUrl &url);
+	virtual void updateCaption (const QUrl &url);
 /** called from openURL. Takes care of updating caption, and updating back/forward actions, if available */
-	void changeURL (const KUrl &url);
+	void changeURL (const QUrl &url);
 
 	struct VisitedLocation {
-		KUrl url;
+		QUrl url;
 		QPoint scroll_position;
 	};
 	QList<VisitedLocation> url_history;
@@ -140,7 +140,7 @@ friend class RKHTMLWindowPart;
 	int current_history_position;
 	bool url_change_is_from_history;	// dirty!!!
 
-	KUrl current_url;
+	QUrl current_url;
 	void startNewCacheFile ();
 	KTemporaryFile *current_cache_file;
 
@@ -196,7 +196,7 @@ public:
 	QDomElement component_doc_element;
 
 	// for dealing with rkward://[page|component]-pages
-	bool renderRKHelp (const KUrl &url);
+	bool renderRKHelp (const QUrl &url);
 	QString renderHelpFragment (QDomElement &fragment);
 	QString resolveLabel (const QString &id) const;
 	QString prepareHelpLink (const QString &href, const QString &text);
diff --git a/rkward/windows/rktoplevelwindowgui.cpp b/rkward/windows/rktoplevelwindowgui.cpp
index 04c29fe..f93af4f 100644
--- a/rkward/windows/rktoplevelwindowgui.cpp
+++ b/rkward/windows/rktoplevelwindowgui.cpp
@@ -183,7 +183,7 @@ void RKTopLevelWindowGUI::showHelpSearch () {
 void RKTopLevelWindowGUI::showRKWardHelp () {
 	RK_TRACE (APP);
 
-	RKWorkplace::mainWorkplace ()->openHelpWindow (KUrl ("rkward://page/rkward_welcome"), true);
+	RKWorkplace::mainWorkplace ()->openHelpWindow (QUrl("rkward://page/rkward_welcome"), true);
 }
 
 void RKTopLevelWindowGUI::activateDocumentView () {
@@ -196,7 +196,7 @@ void RKTopLevelWindowGUI::activateDocumentView () {
 void RKTopLevelWindowGUI::slotOutputShow () {
 	RK_TRACE (APP);
 
-	RKWorkplace::mainWorkplace ()->openOutputWindow (KUrl ());
+	RKWorkplace::mainWorkplace ()->openOutputWindow (QUrl ());
 }
 
 void RKTopLevelWindowGUI::nextWindow () {
diff --git a/rkward/windows/rkworkplace.cpp b/rkward/windows/rkworkplace.cpp
index 5be30cb..8a3796e 100644
--- a/rkward/windows/rkworkplace.cpp
+++ b/rkward/windows/rkworkplace.cpp
@@ -114,8 +114,8 @@ RKWorkplace::~RKWorkplace () {
 //	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());
+QString workspaceConfigFileName (const QUrl &url) {
+	QString base_name = QString (QCryptographicHash::hash (url.toDisplayString ().toUtf8 (), QCryptographicHash::Md5).toHex());
 	return (KStandardDirs::locateLocal ("data", "rkward/workspace_config_" + base_name));
 }
 
@@ -127,13 +127,13 @@ KConfigBase *RKWorkplace::workspaceConfig () {
 	return _workspace_config;
 }
 
-QString RKWorkplace::portableUrl (const KUrl &url) {
-	KUrl relative = KUrl::relativeUrl (workspaceURL (), url);
+QString RKWorkplace::portableUrl (const QUrl &url) {
+	QUrl relative = QUrl::relativeUrl (workspaceURL (), url);
 	relative.cleanPath ();
 	return relative.prettyUrl ();
 }
 
-void RKWorkplace::setWorkspaceURL (const KUrl &url, bool keep_config) {
+void RKWorkplace::setWorkspaceURL (const QUrl &url, bool keep_config) {
 	RK_TRACE (APP);
 
 	if (url != current_url) {
@@ -248,7 +248,7 @@ void RKWorkplace::placeInToolWindowBar (RKMDIWindow *window, int position) {
 	else if (needs_registration) attachWindow (window);
 }
 
-bool RKWorkplace::openAnyUrl (const KUrl &url, const QString &known_mimetype, bool force_external) {
+bool RKWorkplace::openAnyUrl (const QUrl &url, const QString &known_mimetype, bool force_external) {
 	RK_TRACE (APP);
 
 	if (url.protocol () == "rkward") {
@@ -283,14 +283,14 @@ bool RKWorkplace::openAnyUrl (const KUrl &url, const QString &known_mimetype, bo
 	return false;
 }
 
-RKMDIWindow* RKWorkplace::openScriptEditor (const KUrl &url, const QString& encoding, bool use_r_highlighting, bool read_only, const QString &force_caption, bool delete_on_close) {
+RKMDIWindow* RKWorkplace::openScriptEditor (const QUrl &url, const QString& encoding, bool use_r_highlighting, bool read_only, const QString &force_caption, bool delete_on_close) {
 	RK_TRACE (APP);
 
 // is this url already opened?
 	if (!url.isEmpty ()) {
 	  	RKWorkplaceObjectList script_windows = getObjectList (RKMDIWindow::CommandEditorWindow, RKMDIWindow::AnyWindowState);
 		for (RKWorkplaceObjectList::const_iterator it = script_windows.constBegin (); it != script_windows.constEnd (); ++it) {
-			  KUrl ourl = static_cast<RKCommandEditorWindow *> (*it)->url ();
+			  QUrl ourl = static_cast<RKCommandEditorWindow *> (*it)->url ();
 			  if (url == ourl) {
 				  (*it)->activate ();
 				  return (*it);
@@ -313,7 +313,7 @@ RKMDIWindow* RKWorkplace::openScriptEditor (const KUrl &url, const QString& enco
 	return (editor);
 }
 
-RKMDIWindow* RKWorkplace::openHelpWindow (const KUrl &url, bool only_once) {
+RKMDIWindow* RKWorkplace::openHelpWindow (const QUrl &url, bool only_once) {
 	RK_TRACE (APP);
 
 	if (url.isEmpty ()) {
@@ -324,7 +324,7 @@ RKMDIWindow* RKWorkplace::openHelpWindow (const KUrl &url, bool only_once) {
 	if (only_once) {
 		RKWorkplaceObjectList help_windows = getObjectList (RKMDIWindow::HelpWindow, RKMDIWindow::AnyWindowState);
 		for (RKWorkplaceObjectList::const_iterator it = help_windows.constBegin (); it != help_windows.constEnd (); ++it) {
-			if (static_cast<RKHTMLWindow *> (*it)->url ().equals (url, KUrl::CompareWithoutTrailingSlash | KUrl::CompareWithoutFragment)) {
+			if (static_cast<RKHTMLWindow *> (*it)->url ().equals (url, QUrl::CompareWithoutTrailingSlash | QUrl::CompareWithoutFragment)) {
 				(*it)->activate ();
 				return (*it);
 			}
@@ -337,7 +337,7 @@ RKMDIWindow* RKWorkplace::openHelpWindow (const KUrl &url, bool only_once) {
 	return (hw);
 }
 
-RKMDIWindow* RKWorkplace::openOutputWindow (const KUrl &url) {
+RKMDIWindow* RKWorkplace::openOutputWindow (const QUrl &url) {
 	RK_TRACE (APP);
 
 	RKHTMLWindow *w = RKOutputWindowManager::self ()->getCurrentOutputWindow ();
@@ -566,7 +566,7 @@ QStringList RKWorkplace::makeWorkplaceDescription () {
 	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 = workspaceURL ();
+	QUrl base_url = workspaceURL ();
 	base_url.setPath (base_url.directory ());
 	if (base_url.isLocalFile () && base_url.hasPath ()) workplace_description.append ("base::::" + base_url.url ());
 
@@ -632,14 +632,14 @@ void RKWorkplace::restoreWorkplace (RCommandChain *chain, bool merge) {
 	RKGlobals::rInterface ()->issueCommand ("rk.restore.workplace(" + no_close_windows + ')', RCommand::App, i18n ("Restore Workplace layout"), 0, 0, chain);
 }
 
-KUrl checkAdjustRestoredUrl (const QString &_url, const QString old_base) {
-	KUrl url (_url);
+QUrl checkAdjustRestoredUrl (const QString &_url, const QString old_base) {
+	QUrl url (_url);
 
 	if (old_base.isEmpty ()) return (url);
-	KUrl new_base_url = RKWorkplace::mainWorkplace ()->workspaceURL ();
+	QUrl 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);
+	QUrl old_base_url (old_base);
 	if (old_base_url == new_base_url) return (url);
 
 	// TODO: Should we also care about non-local files? In theory: yes, but stat'ing remote files for existence can take a long time.
@@ -649,7 +649,7 @@ KUrl checkAdjustRestoredUrl (const QString &_url, const QString old_base) {
 	if (QFileInfo (url.toLocalFile ()).exists ()) return (url);
 
 	// 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 ()));
+	QUrl relative = QUrl::fromLocalFile (new_base_url.path () + '/' + QUrl::relativePath (old_base_url.path (), url.path ()));
 	relative.cleanPath ();
 // 	if (QFileInfo (relative.toLocalFile ()).exists ()) return (relative);
 	return (url);
diff --git a/rkward/windows/rkworkplace.h b/rkward/windows/rkworkplace.h
index 9939448..b91e496 100644
--- a/rkward/windows/rkworkplace.h
+++ b/rkward/windows/rkworkplace.h
@@ -23,7 +23,7 @@
 #include <qtabwidget.h>
 #include <QSplitter>
 
-#include <kurl.h>
+#include <QUrl>
 #include <kconfigbase.h>
 
 #include "rkmdiwindow.h"
@@ -94,7 +94,7 @@ public:
 	RKMDIWindow *activeWindow (RKMDIWindow::State state);
 
 /** Opens the given url in the appropriate way. */
-	bool openAnyUrl (const KUrl &url, const QString &known_mimetype = QString (), bool force_external=false);
+	bool openAnyUrl (const QUrl &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
@@ -103,14 +103,14 @@ public:
 @param read_only Open the document read only? Default is false, i.e. Read-write
 @param force_caption Usually the caption is determined from the url of the file. If you specify a non-empty string here, that is used instead.
 @returns false if a local url could not be opened, true for all remote urls, and on success */
-	RKMDIWindow* openScriptEditor (const KUrl &url=KUrl (), const QString& encoding=QString (), bool use_r_highlighting=true, bool read_only=false, const QString &force_caption = QString (), bool delete_on_close=false);
+	RKMDIWindow* openScriptEditor (const QUrl &url=QUrl (), const QString& encoding=QString (), bool use_r_highlighting=true, bool read_only=false, const QString &force_caption = QString (), bool delete_on_close=false);
 /** Opens a new help window, starting at the given url
 @param url URL to open
 @param only_once if true, checks whether any help window already shows this URL. If so, raise it, but do not open a new window. Else show the new window */
-	RKMDIWindow* openHelpWindow (const KUrl &url=KUrl (), bool only_once=false);
+	RKMDIWindow* openHelpWindow (const QUrl &url=QUrl (), bool only_once=false);
 /** Opens a new output window. Currently only a single output window will ever be created. Subsequent calls to the function will not create additional windows right now (but will raise / refresh the output window
 @param url currently ignored! */
-	RKMDIWindow* openOutputWindow (const KUrl &url=KUrl ());
+	RKMDIWindow* openOutputWindow (const QUrl &url=QUrl ());
 
 	void newX11Window (WId window_to_embed, int device_number);
 	void newRKWardGraphisWindow (RKGraphicsDevice *dev, int device_number);
@@ -159,19 +159,19 @@ Has no effect, if RKSettingsModuleGeneral::workplaceSaveMode () != RKSettingsMod
 	static RKMDIWindowHistory *getHistory () { return main_workplace->history; };
 	void placeToolWindows ();
 
-	void setWorkspaceURL (const KUrl &url, bool keep_config=false);
-	KUrl workspaceURL () const { return current_url; };
+	void setWorkspaceURL (const QUrl &url, bool keep_config=false);
+	QUrl workspaceURL () const { return current_url; };
 	KConfigBase *workspaceConfig ();
-	QString portableUrl (const KUrl &url);
+	QString portableUrl (const QUrl &url);
 signals:
 /** emitted when the workspace Url has changed */
-	void workspaceUrlChanged (const KUrl& url);
+	void workspaceUrlChanged (const QUrl &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;
+	QUrl current_url;
 	KConfig *_workspace_config;
 
 /** current list of windows. @See getObjectList () */ 



More information about the rkward-tracker mailing list