diff options
author | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2015-12-04 10:13:23 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2015-12-07 19:37:37 +0000 |
commit | 60536d742175bacca2130f46d06663013c91bae2 (patch) | |
tree | 097e7dd9d5f787a3ea3bc2d32efd3bdbc13941d3 /src | |
parent | df053dc642b4cb284112f63b6572ac5cfc175b35 (diff) |
WinRT: Prepend '.' to default file suffix.
IFileSavePicker::put_DefaultFileExtension() fails when the '.'
is missing, causing the QtWidgets-based dialog to show up (Windows 10).
Change-Id: Ifcb870431b792ffa8e4a608dec999225e8383fa9
Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/platforms/winrt/qwinrtfiledialoghelper.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/plugins/platforms/winrt/qwinrtfiledialoghelper.cpp b/src/plugins/platforms/winrt/qwinrtfiledialoghelper.cpp index b0f377147e..68e0227ef5 100644 --- a/src/plugins/platforms/winrt/qwinrtfiledialoghelper.cpp +++ b/src/plugins/platforms/winrt/qwinrtfiledialoghelper.cpp @@ -444,12 +444,14 @@ bool QWinRTFileDialogHelper::show(Qt::WindowFlags windowFlags, Qt::WindowModalit } } - const QString suffix = dialogOptions->defaultSuffix(); + QString suffix = dialogOptions->defaultSuffix(); if (!suffix.isEmpty()) { + if (!suffix.startsWith(QLatin1Char('.'))) + suffix.prepend(QLatin1Char('.')); HStringReference nativeSuffix(reinterpret_cast<const wchar_t *>(suffix.utf16()), suffix.length()); hr = picker->put_DefaultFileExtension(nativeSuffix.Get()); - RETURN_FALSE_IF_FAILED("Failed to set default file extension"); + RETURN_FALSE_IF_FAILED_WITH_ARGS("Failed to set default file extension \"%s\"", qPrintable(suffix)); } const QString suggestedName = QFileInfo(d->saveFileName.toLocalFile()).fileName(); |