[rkward/frameworks] /: Activate QT_NO_URL_CAST_FROM_STRING and associated adjustments.

Thomas Friedrichsmeier thomas.friedrichsmeier at ruhr-uni-bochum.de
Wed Nov 25 08:46:12 UTC 2015


Git commit e1336fc37e8ddd8bb4d1ae1591145c31fceb55a4 by Thomas Friedrichsmeier.
Committed on 25/11/2015 at 08:45.
Pushed by tfry into branch 'frameworks'.

Activate QT_NO_URL_CAST_FROM_STRING and associated adjustments.

M  +2    -1    CMakeLists.txt
M  +2    -2    rkward/misc/getfilenamewidget.cpp
M  +1    -1    rkward/misc/rkdbusapi.cpp
M  +1    -1    rkward/rbackend/rinterface.cpp
M  +2    -2    rkward/rkconsole.cpp
M  +1    -1    rkward/scriptbackends/qtscriptbackend.cpp
M  +1    -1    rkward/scriptbackends/rkcomponentscripting.cpp
M  +2    -1    rkward/settings/rksettingsmodule.h
M  +1    -1    rkward/settings/rksettingsmoduleconsole.h
M  +1    -1    rkward/settings/rksettingsmodulegraphics.h
M  +1    -1    rkward/settings/rksettingsmoduleobjectbrowser.h
M  +2    -2    rkward/settings/rksettingsmoduleplugins.cpp
M  +1    -1    rkward/windows/rkcommandeditorwindow.cpp
M  +3    -3    rkward/windows/rkfilebrowser.cpp
M  +1    -1    rkward/windows/rkfilebrowser.h
M  +3    -3    rkward/windows/rkhtmlwindow.cpp
M  +1    -1    rkward/windows/rkmdiwindow.cpp
M  +3    -2    rkward/windows/rkmdiwindow.h
M  +1    -1    rkward/windows/rkwindowcatcher.cpp
M  +2    -2    rkward/windows/rkworkplace.cpp
M  +1    -1    rkward/windows/robjectbrowser.cpp

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

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7c7f495..b0605db 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -24,7 +24,8 @@ IF(FORCE_PRETTY_MAKEFILE)
 ENDIF(FORCE_PRETTY_MAKEFILE)
 
 ADD_DEFINITIONS(${QT_DEFINITIONS} ${KDE4_DEFINITIONS} -DQT_NO_CAST_TO_ASCII)
-add_definitions(-DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS)
+ADD_DEFINITIONS(-DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS)
+ADD_DEFINITIONS(-DQT_NO_URL_CAST_FROM_STRING)
 
 #uncomment the line below to save ~250-350kB in object size
 #ADD_DEFINITIONS(-DRKWARD_NO_TRACE)
diff --git a/rkward/misc/getfilenamewidget.cpp b/rkward/misc/getfilenamewidget.cpp
index 461b39d..8c7d9ed 100644
--- a/rkward/misc/getfilenamewidget.cpp
+++ b/rkward/misc/getfilenamewidget.cpp
@@ -38,7 +38,7 @@ GetFileNameWidget::GetFileNameWidget (QWidget *parent, FileType mode, bool only_
 	connect (edit, SIGNAL (textChanged(QString)), this, SLOT (locationEditChanged(QString)));
 	vbox->addWidget (edit);
 
-	edit->setUrl (initial);
+	edit->setUrl (QUrl::fromUserInput (initial, QString (), QUrl::AssumeLocalFile));
 
 	KFile::Modes mode_flags;
 	if (mode == ExistingDirectory) {
@@ -77,7 +77,7 @@ void GetFileNameWidget::setFilter (const QString &filter) {
 void GetFileNameWidget::setLocation (const QString &new_location) {
 	RK_TRACE (MISC);
 
-	if (edit->text () != new_location) edit->setUrl (new_location);
+	if (edit->text () != new_location) edit->setUrl (QUrl::fromUserInput (new_location, QString (), QUrl::AssumeLocalFile));
 }
 
 #ifdef Q_WS_WIN
diff --git a/rkward/misc/rkdbusapi.cpp b/rkward/misc/rkdbusapi.cpp
index e5d3afb..acfd6e5 100644
--- a/rkward/misc/rkdbusapi.cpp
+++ b/rkward/misc/rkdbusapi.cpp
@@ -57,7 +57,7 @@ void RKDBusAPI::openAnyUrl(const QStringList& urls) {
 
 	RKWardMainWindow::getMain ()->setMergeLoads (true);
 	for (int i = 0; i < urls.size (); ++i) {
-		RKWorkplace::mainWorkplace ()->openAnyUrl (urls[i]);
+		RKWorkplace::mainWorkplace ()->openAnyUrl (QUrl::fromUserInput (urls[i], QString (), QUrl::AssumeLocalFile));
 	}
 	RKWardMainWindow::getMain ()->setMergeLoads (false);
 }
diff --git a/rkward/rbackend/rinterface.cpp b/rkward/rbackend/rinterface.cpp
index 49be4b2..2878eda 100644
--- a/rkward/rbackend/rinterface.cpp
+++ b/rkward/rbackend/rinterface.cpp
@@ -596,7 +596,7 @@ QStringList RInterface::processPlainGenericRequest (const QStringList &calllist)
 		RKSessionVars::instance ()->setInstalledPackages (calllist.mid (1));
 	} else if (call == "showHTML") {
 		RK_ASSERT (calllist.count () == 2);
-		RKWorkplace::mainWorkplace ()->openHelpWindow (calllist.value (1));
+		RKWorkplace::mainWorkplace ()->openHelpWindow (QUrl::fromUserInput (calllist.value (1), QDir::currentPath (), QUrl::AssumeLocalFile));
 	} else if (call == "select.list") {
 		QString title = calllist.value (1);
 		bool multiple = (calllist.value (2) == "multi");
diff --git a/rkward/rkconsole.cpp b/rkward/rkconsole.cpp
index 8c34c11..4cb311e 100644
--- a/rkward/rkconsole.cpp
+++ b/rkward/rkconsole.cpp
@@ -123,7 +123,7 @@ RKConsole::RKConsole (QWidget *parent, bool tool_window, const char *name) : RKM
 	setCaption (i18n ("R Console"));
 	console_part = new RKConsolePart (this);
 	setPart (console_part);
-	setMetaInfo (shortCaption (), "rkward://page/rkward_console", RKSettings::PageConsole);
+	setMetaInfo (shortCaption (), QUrl ("rkward://page/rkward_console"), RKSettings::PageConsole);
 	initializeActivationSignals ();
 	initializeActions (getPart ()->actionCollection ());
 
@@ -461,7 +461,7 @@ void RKConsole::doTabCompletion () {
 	// as a very simple heuristic: If the current symbol starts with a quote, we should probably attempt file name completion, instead of symbol name completion
 	if (current_symbol.startsWith ('\"') || current_symbol.startsWith ('\'') || current_symbol.startsWith ('`')) {
 		KUrlCompletion comp (KUrlCompletion::FileCompletion);
-		comp.setDir (QDir::currentPath ());
+		comp.setDir (QUrl::fromLocalFile (QDir::currentPath ()));
 		comp.makeCompletion (current_symbol.mid (1));
 
 		if (doTabCompletionHelper (current_line_num, current_line, word_start + 1, word_end, comp.allMatches ())) return;
diff --git a/rkward/scriptbackends/qtscriptbackend.cpp b/rkward/scriptbackends/qtscriptbackend.cpp
index b6aa965..130a18d 100644
--- a/rkward/scriptbackends/qtscriptbackend.cpp
+++ b/rkward/scriptbackends/qtscriptbackend.cpp
@@ -252,7 +252,7 @@ bool QtScriptBackendThread::includeFile (const QString &filename) {
 
 	QString _filename = filename;
 	if (QFileInfo (filename).isRelative ()) {
-		QUrl script_path = QUrl (QUrl::fromLocalFile (_scriptfile)).adjusted (QUrl::RemoveFilename).resolved (filename);
+		QUrl script_path = QUrl (QUrl::fromLocalFile (_scriptfile)).adjusted (QUrl::RemoveFilename).resolved (QUrl (filename));
 		_filename = script_path.toLocalFile ();
 	}
 
diff --git a/rkward/scriptbackends/rkcomponentscripting.cpp b/rkward/scriptbackends/rkcomponentscripting.cpp
index c5a3283..07d0904 100644
--- a/rkward/scriptbackends/rkcomponentscripting.cpp
+++ b/rkward/scriptbackends/rkcomponentscripting.cpp
@@ -92,7 +92,7 @@ void RKComponentScriptingProxy::include (const QString& filename) {
 
 	QString _filename = filename;
 	if (QFileInfo (filename).isRelative ()) {
-		QUrl script_path = QUrl (QUrl::fromLocalFile (_scriptfile)).adjusted (QUrl::RemoveFilename).resolved (filename);
+		QUrl script_path = QUrl (QUrl::fromLocalFile (_scriptfile)).adjusted (QUrl::RemoveFilename).resolved (QUrl (filename));
 		_filename = script_path.toLocalFile ();
 	}
 
diff --git a/rkward/settings/rksettingsmodule.h b/rkward/settings/rksettingsmodule.h
index dbf991b..1cd28d6 100644
--- a/rkward/settings/rksettingsmodule.h
+++ b/rkward/settings/rksettingsmodule.h
@@ -19,6 +19,7 @@
 
 #include <qstring.h>
 #include <qwidget.h>
+#include <QUrl>
 
 class KConfig;
 class RKSettings;
@@ -44,7 +45,7 @@ public:
 be inserted into this chain. It's safe to use this unconditionally, as if there is no chain, this will return 0, which corresponds to using the top-level chain */
 	RCommandChain *commandChain () { return chain; };
 
-	virtual QString helpURL () { return QString (); };
+	virtual QUrl helpURL () { return QUrl (); };
 protected:
 	void change ();
 
diff --git a/rkward/settings/rksettingsmoduleconsole.h b/rkward/settings/rksettingsmoduleconsole.h
index 2813d52..f5c5482 100644
--- a/rkward/settings/rksettingsmoduleconsole.h
+++ b/rkward/settings/rksettingsmoduleconsole.h
@@ -63,7 +63,7 @@ public:
 
 	QString caption () override;
 
-	QString helpURL () override { return ("rkward://page/rkward_console#settings"); };
+	QUrl helpURL () override { return QUrl ("rkward://page/rkward_console#settings"); };
 public slots:
 	void changedSetting (int);
 private:
diff --git a/rkward/settings/rksettingsmodulegraphics.h b/rkward/settings/rksettingsmodulegraphics.h
index bef1583..caeba2c 100644
--- a/rkward/settings/rksettingsmodulegraphics.h
+++ b/rkward/settings/rksettingsmodulegraphics.h
@@ -51,7 +51,7 @@ public:
 	static void loadSettings (KConfig *config);
 	
 	QString caption () override;
-	QString helpURL () override { return ("rkward://page/rkward_plot_history#scd_settings"); };
+	QUrl helpURL () override { return QUrl ("rkward://page/rkward_plot_history#scd_settings"); };
 
 	enum DefaultDevice {
 		RKDevice,
diff --git a/rkward/settings/rksettingsmoduleobjectbrowser.h b/rkward/settings/rksettingsmoduleobjectbrowser.h
index 575243c..833e77c 100644
--- a/rkward/settings/rksettingsmoduleobjectbrowser.h
+++ b/rkward/settings/rksettingsmoduleobjectbrowser.h
@@ -55,7 +55,7 @@ public:
 
 	static bool isPackageBlacklisted (const QString &package_name);
 
-	QString helpURL () override { return ("rkward://page/rkward_workspace_browser#settings"); };
+	QUrl helpURL () override { return QUrl ("rkward://page/rkward_workspace_browser#settings"); };
 public slots:
 /** called when a checkbox has been changed. Signals change to RKSettings dialog to enable apply button */
 	void boxChanged (int);
diff --git a/rkward/settings/rksettingsmoduleplugins.cpp b/rkward/settings/rksettingsmoduleplugins.cpp
index 3e9e3ea..128794f 100644
--- a/rkward/settings/rksettingsmoduleplugins.cpp
+++ b/rkward/settings/rksettingsmoduleplugins.cpp
@@ -519,7 +519,7 @@ bool RKSettingsModulePluginsModel::setData (const QModelIndex& index, const QVar
 void RKSettingsModulePluginsModel::insertNewStrings (int above_row) {
 	RK_TRACE (SETTINGS);
 
-	QStringList files = KFileDialog::getOpenFileNames (RKCommonFunctions::getRKWardDataDir (), "*.pluginmap", static_cast<QWidget*> (QObject::parent ()), i18n ("Select .pluginmap-file"));
+	QStringList files = KFileDialog::getOpenFileNames (QUrl::fromLocalFile (RKCommonFunctions::getRKWardDataDir ()), "*.pluginmap", static_cast<QWidget*> (QObject::parent ()), i18n ("Select .pluginmap-file"));
 
 	// already known files are activated, but not added
 	for (int i = files.size () -1; i >= 0; --i) {
@@ -530,7 +530,7 @@ void RKSettingsModulePluginsModel::insertNewStrings (int above_row) {
 				emit (dataChanged (index (pos, 0), index (pos, COLUMN_COUNT - 1)));
 			}
 			files.removeAt (i);
-		} 
+		}
 	}
 
 	beginInsertRows (QModelIndex (), above_row, files.size ());
diff --git a/rkward/windows/rkcommandeditorwindow.cpp b/rkward/windows/rkcommandeditorwindow.cpp
index 7309474..1e77f53 100644
--- a/rkward/windows/rkcommandeditorwindow.cpp
+++ b/rkward/windows/rkcommandeditorwindow.cpp
@@ -105,7 +105,7 @@ RKCommandEditorWindow::RKCommandEditorWindow (QWidget *parent, bool use_r_highli
 	part->insertChildClient (m_view);
 	setPart (part);
 	fixupPartGUI ();
-	setMetaInfo (i18n ("Script Editor"), QString (), RKSettings::PageCommandEditor);
+	setMetaInfo (i18n ("Script Editor"), QUrl (), RKSettings::PageCommandEditor);
 	initializeActions (part->actionCollection ());
 	initializeActivationSignals ();
 	RKXMLGUISyncer::self()->registerChangeListener (m_view, this, SLOT (fixupPartGUI()));
diff --git a/rkward/windows/rkfilebrowser.cpp b/rkward/windows/rkfilebrowser.cpp
index 4781fcb..f00c32f 100644
--- a/rkward/windows/rkfilebrowser.cpp
+++ b/rkward/windows/rkfilebrowser.cpp
@@ -126,7 +126,7 @@ RKFileBrowserWidget::RKFileBrowserWidget (QWidget *parent) : KVBox (parent) {
 
 	connect (dir, SIGNAL (fileSelected(KFileItem)), this, SLOT (fileActivated(KFileItem)));
 
-	setURL (QDir::currentPath ());
+	setURL (QUrl::fromLocalFile (QDir::currentPath ()));
 }
 
 RKFileBrowserWidget::~RKFileBrowserWidget () {
@@ -162,7 +162,7 @@ void RKFileBrowserWidget::saveConfig () {
 	dir->writeConfig (config);
 }
 
-void RKFileBrowserWidget::setURL (const QString &url) {
+void RKFileBrowserWidget::setURL (const QUrl &url) {
 	RK_TRACE (APP);
 
 	urlbox->setUrl (url);
@@ -178,7 +178,7 @@ void RKFileBrowserWidget::urlChangedInView (const QUrl &url) {
 void RKFileBrowserWidget::urlChangedInCombo (const QString &url) {
 	RK_TRACE (APP);
 
-	dir->setUrl (url, true);
+	dir->setUrl (QUrl::fromUserInput (url, QDir::currentPath (), QUrl::AssumeLocalFile), true);
 }
 
 void RKFileBrowserWidget::urlChangedInCombo (const QUrl &url) {
diff --git a/rkward/windows/rkfilebrowser.h b/rkward/windows/rkfilebrowser.h
index 4332334..34b0a13 100644
--- a/rkward/windows/rkfilebrowser.h
+++ b/rkward/windows/rkfilebrowser.h
@@ -61,7 +61,7 @@ public:
 	explicit RKFileBrowserWidget (QWidget *widget);
 	~RKFileBrowserWidget ();
 
-	void setURL (const QString &url);
+	void setURL (const QUrl &url);
 	bool eventFilter (QObject* o, QEvent* e) override;
 public slots:
 	void urlChangedInView (const QUrl &url);
diff --git a/rkward/windows/rkhtmlwindow.cpp b/rkward/windows/rkhtmlwindow.cpp
index 16c0937..45f7715 100644
--- a/rkward/windows/rkhtmlwindow.cpp
+++ b/rkward/windows/rkhtmlwindow.cpp
@@ -169,7 +169,7 @@ RKHTMLWindow::~RKHTMLWindow () {
 QUrl RKHTMLWindow::restorableUrl () {
 	RK_TRACE (APP);
 
-	return (current_url.url ().replace (RKSettingsModuleR::helpBaseUrl(), "rkward://RHELPBASE"));
+	return QUrl ((current_url.url ().replace (RKSettingsModuleR::helpBaseUrl(), "rkward://RHELPBASE")));
 }
 
 bool RKHTMLWindow::isModified () {
@@ -518,7 +518,7 @@ void RKHTMLWindow::useMode (WindowMode new_mode) {
 		type = RKMDIWindow::OutputWindow | RKMDIWindow::DocumentWindow;
 		setWindowIcon (RKStandardIcons::getIcon (RKStandardIcons::WindowOutput));
 		part->setOutputWindowSkin ();
-		setMetaInfo (i18n ("Output Window"), "rkward://page/rkward_output", RKSettings::PageOutput);
+		setMetaInfo (i18n ("Output Window"), QUrl ("rkward://page/rkward_output"), RKSettings::PageOutput);
 		connect (page, SIGNAL(loadFinished(bool)), this, SLOT(scrollToBottom()));
 //	TODO: This would be an interesting extension, but how to deal with concurrent edits?
 //		page->setContentEditable (true);
@@ -1086,7 +1086,7 @@ void RKOutputWindowManager::fileChanged (const QString &path) {
 		if (RKSettingsModuleOutput::autoRaise ()) w->activate ();
 	} else {
 		RK_ASSERT (path == current_default_path);
-		if (RKSettingsModuleOutput::autoShow ()) RKWorkplace::mainWorkplace ()->openOutputWindow (path);
+		if (RKSettingsModuleOutput::autoShow ()) RKWorkplace::mainWorkplace ()->openOutputWindow (QUrl::fromUserInput (path, QString (), QUrl::AssumeLocalFile));
 	}
 }
 
diff --git a/rkward/windows/rkmdiwindow.cpp b/rkward/windows/rkmdiwindow.cpp
index b3bbae0..8eee005 100644
--- a/rkward/windows/rkmdiwindow.cpp
+++ b/rkward/windows/rkmdiwindow.cpp
@@ -288,7 +288,7 @@ void RKMDIWindow::enterEvent (QEvent *event) {
 	QFrame::enterEvent (event);
 }
 
-void RKMDIWindow::setMetaInfo (const QString& _generic_window_name, const QString& _help_url, RKSettings::SettingsPage _settings_page) {
+void RKMDIWindow::setMetaInfo (const QString& _generic_window_name, const QUrl& _help_url, RKSettings::SettingsPage _settings_page) {
 	RK_TRACE (APP);
 
 	// only meant to be called once
diff --git a/rkward/windows/rkmdiwindow.h b/rkward/windows/rkmdiwindow.h
index 4a718c1..20c357c 100644
--- a/rkward/windows/rkmdiwindow.h
+++ b/rkward/windows/rkmdiwindow.h
@@ -20,6 +20,7 @@
 
 #include <QFrame>
 #include <QMap>
+#include <QUrl>
 
 #include <kparts/part.h>
 
@@ -121,7 +122,7 @@ protected slots:
 	void showWindowSettings ();
 protected:
 	void setPart (KParts::Part *p) { part = p; };
-	void setMetaInfo (const QString& generic_window_name, const QString& help_url, RKSettings::SettingsPage settings_page=RKSettings::NoPage);
+	void setMetaInfo (const QString& generic_window_name, const QUrl& help_url, RKSettings::SettingsPage settings_page=RKSettings::NoPage);
 	void initializeActivationSignals ();
 	void paintEvent (QPaintEvent *e) override;
 	void changeEvent (QEvent *event) override;
@@ -146,7 +147,7 @@ friend class RKToolWindowBar;
 /** @see globalContextProperty() */
 	QMap<QString, QString> global_context_properties;
 	QString generic_window_name;
-	QString help_url;
+	QUrl help_url;
 	RKSettings::SettingsPage settings_page;
 };
 
diff --git a/rkward/windows/rkwindowcatcher.cpp b/rkward/windows/rkwindowcatcher.cpp
index d748727..fb9aaeb 100644
--- a/rkward/windows/rkwindowcatcher.cpp
+++ b/rkward/windows/rkwindowcatcher.cpp
@@ -249,7 +249,7 @@ void RKCaughtX11Window::commonInit (int device_number) {
 
 	error_dialog = new RKProgressControl (0, i18n ("An error occurred"), i18n ("An error occurred"), RKProgressControl::DetailedError);
 	setPart (new RKCaughtX11WindowPart (this));
-	setMetaInfo (i18n ("Graphics Device Window"), "rkward://page/rkward_plot_history", RKSettings::PageX11);
+	setMetaInfo (i18n ("Graphics Device Window"), QUrl ("rkward://page/rkward_plot_history"), RKSettings::PageX11);
 	initializeActivationSignals ();
 	setFocusPolicy (Qt::ClickFocus);
 	updateHistoryActions (0, 0, QStringList ());
diff --git a/rkward/windows/rkworkplace.cpp b/rkward/windows/rkworkplace.cpp
index 182c95c..3d5918a 100644
--- a/rkward/windows/rkworkplace.cpp
+++ b/rkward/windows/rkworkplace.cpp
@@ -652,8 +652,8 @@ QUrl checkAdjustRestoredUrl (const QString &_url, const QString old_base) {
 	if (QFileInfo (url.toLocalFile ()).exists ()) return (url);
 
 	// check whether a file exists for the adjusted url
-	QUrl relative = new_base_url.resolved (QDir (old_base_url.path ()).relativeFilePath (url.path ()));
-	if (QFileInfo (relative.toLocalFile ()).exists ()) return (relative);
+	QString relative = QDir (new_base_url.path ()).absoluteFilePath (QDir (old_base_url.path ()).relativeFilePath (url.path ()));
+	if (QFileInfo (relative).exists ()) return (QUrl::fromLocalFile (relative));
 	return (url);
 }
 
diff --git a/rkward/windows/robjectbrowser.cpp b/rkward/windows/robjectbrowser.cpp
index d672116..de672f9 100644
--- a/rkward/windows/robjectbrowser.cpp
+++ b/rkward/windows/robjectbrowser.cpp
@@ -59,7 +59,7 @@ RObjectBrowser::RObjectBrowser (QWidget *parent, bool tool_window, const char *n
 
 	RKDummyPart *part = new RKDummyPart (this, layout_widget);
 	setPart (part);
-	setMetaInfo (i18n ("R workspace browser"), "rkward://page/rkward_workspace_browser", RKSettings::PageObjectBrowser);
+	setMetaInfo (i18n ("R workspace browser"), QUrl ("rkward://page/rkward_workspace_browser"), RKSettings::PageObjectBrowser);
 	initializeActivationSignals ();
 
 	setCaption (i18n ("R Workspace"));



More information about the rkward-tracker mailing list