WinRT: Use the fallbacks for getting the save file name
To bring it in line with the other platforms, then it needs to check if the initially selected files are set and use the first one. Otherwise it can fall back to the initial directory if that happens to include a filename. Change-Id: If34ae0e7e10b6a3c25e9422d9b4f2c21e6bfc8d1 Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>bb10
parent
37a66236d2
commit
20167a7fe9
|
|
@ -397,7 +397,15 @@ bool QWinRTFileDialogHelper::show(Qt::WindowFlags windowFlags, Qt::WindowModalit
|
|||
RETURN_FALSE_IF_FAILED_WITH_ARGS("Failed to set default file extension \"%s\"", qPrintable(suffix));
|
||||
}
|
||||
|
||||
const QString suggestedName = QFileInfo(d->saveFileName.toLocalFile()).fileName();
|
||||
QString suggestedName = QFileInfo(d->saveFileName.toLocalFile()).fileName();
|
||||
if (suggestedName.isEmpty() && dialogOptions->initiallySelectedFiles().size() > 0)
|
||||
suggestedName = QFileInfo(dialogOptions->initiallySelectedFiles().first().toLocalFile())
|
||||
.fileName();
|
||||
if (suggestedName.isEmpty()) {
|
||||
const auto fileInfo = QFileInfo(dialogOptions->initialDirectory().toLocalFile());
|
||||
if (!fileInfo.isDir())
|
||||
suggestedName = fileInfo.fileName();
|
||||
}
|
||||
if (!suggestedName.isEmpty()) {
|
||||
HStringReference nativeSuggestedName(reinterpret_cast<const wchar_t *>(suggestedName.utf16()),
|
||||
uint(suggestedName.length()));
|
||||
|
|
|
|||
Loading…
Reference in New Issue