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 <david.faure@kdab.com>
This commit is contained in:
parent
0fe2713e26
commit
b62e22c1d9
@ -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<QUrl> 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);
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user