From b62e22c1d965dae2e89aa050299b19e662ec6b28 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 14 Jul 2014 10:11:39 +0200 Subject: Fix current directory setting in manual dialog test. It was always constructing a QUrl from the string causing the warning "Non-native QFileDialog supports only local files" with the new QUrl-based implementations of getOpenFileUrl(), etc. Change-Id: Idd9bb432a48865df137f8f39f53014dda150ffe9 Reviewed-by: David Faure --- tests/manual/dialogs/filedialogpanel.cpp | 15 ++++++++++----- tests/manual/dialogs/filedialogpanel.h | 3 ++- 2 files changed, 12 insertions(+), 6 deletions(-) (limited to 'tests/manual/dialogs') diff --git a/tests/manual/dialogs/filedialogpanel.cpp b/tests/manual/dialogs/filedialogpanel.cpp index 57624a0d37..71147e1319 100644 --- a/tests/manual/dialogs/filedialogpanel.cpp +++ b/tests/manual/dialogs/filedialogpanel.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the test suite of the Qt Toolkit. @@ -292,6 +292,11 @@ QString FileDialogPanel::filterString() const return m_nameFilters->toPlainText().trimmed().replace(QLatin1String("\n"), QLatin1String(";;")); } +QUrl FileDialogPanel::currentDirectoryUrl() const +{ + return QUrl::fromUserInput(m_directory->text().trimmed()); +} + QFileDialog::Options FileDialogPanel::options() const { QFileDialog::Options result; @@ -338,7 +343,7 @@ void FileDialogPanel::getOpenFileUrls() QString selectedFilter = m_selectedNameFilter->text().trimmed(); const QList files = QFileDialog::getOpenFileUrls(this, tr("getOpenFileNames Qt %1").arg(QLatin1String(QT_VERSION_STR)), - QUrl(m_directory->text()), filterString(), &selectedFilter, options(), + currentDirectoryUrl(), filterString(), &selectedFilter, options(), allowedSchemes()); if (!files.isEmpty()) { QString result; @@ -371,7 +376,7 @@ void FileDialogPanel::getOpenFileUrl() QString selectedFilter = m_selectedNameFilter->text().trimmed(); const QUrl file = QFileDialog::getOpenFileUrl(this, tr("getOpenFileUrl Qt %1").arg(QLatin1String(QT_VERSION_STR)), - QUrl(m_directory->text()), filterString(), &selectedFilter, options(), + currentDirectoryUrl(), filterString(), &selectedFilter, options(), allowedSchemes()); if (file.isValid()) { QString result; @@ -404,7 +409,7 @@ void FileDialogPanel::getSaveFileUrl() QString selectedFilter = m_selectedNameFilter->text().trimmed(); const QUrl file = QFileDialog::getSaveFileUrl(this, tr("getSaveFileName Qt %1").arg(QLatin1String(QT_VERSION_STR)), - QUrl(m_directory->text()), filterString(), &selectedFilter, options(), + currentDirectoryUrl(), filterString(), &selectedFilter, options(), allowedSchemes()); if (file.isValid()) { QString result; @@ -430,7 +435,7 @@ void FileDialogPanel::getExistingDirectoryUrl() #if QT_VERSION >= 0x050000 const QUrl dir = QFileDialog::getExistingDirectoryUrl(this, tr("getExistingDirectory Qt %1").arg(QLatin1String(QT_VERSION_STR)), - QUrl(m_directory->text()), options() | QFileDialog::ShowDirsOnly, + currentDirectoryUrl(), options() | QFileDialog::ShowDirsOnly, allowedSchemes()); if (!dir.isEmpty()) QMessageBox::information(this, tr("getExistingDirectory"), QLatin1String("Directory: ") + dir.toString(), QMessageBox::Ok); diff --git a/tests/manual/dialogs/filedialogpanel.h b/tests/manual/dialogs/filedialogpanel.h index 8a9d93da03..0486af7bd4 100644 --- a/tests/manual/dialogs/filedialogpanel.h +++ b/tests/manual/dialogs/filedialogpanel.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the test suite of the Qt Toolkit. @@ -86,6 +86,7 @@ private slots: void useMimeTypeFilters(bool); private: + QUrl currentDirectoryUrl() const; QString filterString() const; QFileDialog::Options options() const; QStringList allowedSchemes() const; -- cgit v1.2.3