summaryrefslogtreecommitdiffstats
path: root/src/imports/dialogs/qquickabstractfiledialog.cpp
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@digia.com>2013-06-27 13:08:08 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-06-28 16:44:10 +0200
commit811337a73c160447e5218ae55e93df99ac3d9edd (patch)
treeac196f54046d031684f9ef220574656e16889ee3 /src/imports/dialogs/qquickabstractfiledialog.cpp
parent87a4a3d095f4fbabb91dade7e7313cb844256b9b (diff)
FileDialog.folder property should also be a QUrl, for consistencyv5.1.0-rc2v5.1.0
In QtQuick we never use plain file paths, because URL is more general. Also use const references for string and URL setters, and fixed the dependency between the FolderListModel's folder, the field for editing it, and the folder property of the AbstractFileDialog. Change-Id: I6e965b80b73d4eb2473712a4f4d4f816b768d802 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
Diffstat (limited to 'src/imports/dialogs/qquickabstractfiledialog.cpp')
-rw-r--r--src/imports/dialogs/qquickabstractfiledialog.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/imports/dialogs/qquickabstractfiledialog.cpp b/src/imports/dialogs/qquickabstractfiledialog.cpp
index 32442de41f..d8a75feb53 100644
--- a/src/imports/dialogs/qquickabstractfiledialog.cpp
+++ b/src/imports/dialogs/qquickabstractfiledialog.cpp
@@ -78,7 +78,7 @@ QString QQuickAbstractFileDialog::title() const
return m_options->windowTitle();
}
-void QQuickAbstractFileDialog::setTitle(QString t)
+void QQuickAbstractFileDialog::setTitle(const QString &t)
{
if (m_options->windowTitle() == t) return;
m_options->setWindowTitle(t);
@@ -106,18 +106,19 @@ void QQuickAbstractFileDialog::setSelectFolder(bool selectFolder)
updateModes();
}
-QString QQuickAbstractFileDialog::folder()
+QUrl QQuickAbstractFileDialog::folder()
{
if (m_dlgHelper && !m_dlgHelper->directory().isEmpty())
- return m_dlgHelper->directory();
- return m_options->initialDirectory();
+ return QUrl::fromLocalFile(m_dlgHelper->directory());
+ return QUrl::fromLocalFile(m_options->initialDirectory());
}
-void QQuickAbstractFileDialog::setFolder(QString f)
+void QQuickAbstractFileDialog::setFolder(const QUrl &f)
{
+ QString dir = f.path();
if (m_dlgHelper)
- m_dlgHelper->setDirectory(f);
- m_options->setInitialDirectory(f);
+ m_dlgHelper->setDirectory(dir);
+ m_options->setInitialDirectory(dir);
emit folderChanged();
}
@@ -141,7 +142,7 @@ QString QQuickAbstractFileDialog::selectedNameFilter()
return ret;
}
-void QQuickAbstractFileDialog::selectNameFilter(QString f)
+void QQuickAbstractFileDialog::selectNameFilter(const QString &f)
{
// This should work whether the dialog is currently being shown already, or ahead of time.
m_options->setInitiallySelectedNameFilter(f);