Commit e1336fc3 authored by Thomas Friedrichsmeier's avatar Thomas Friedrichsmeier
Browse files

Activate QT_NO_URL_CAST_FROM_STRING and associated adjustments.

parent 59ca3b6d
......@@ -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)
......
......@@ -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
......
......@@ -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);
}
......
......@@ -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");
......
......@@ -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;
......
......@@ -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 ();
}
......
......@@ -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 ();
}
......
......@@ -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 ();
......
......@@ -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:
......
......@@ -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,
......
......@@ -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);
......
......@@ -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 ());
......
......@@ -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()));
......
......@@ -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) {
......
......@@ -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);
......
......@@ -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));
}
}
......
......@@ -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
......
......@@ -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;
};
......
......@@ -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 ());
......
......@@ -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);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment