Windows file dialogs: Use FOS_NOREADONLYRETURN only for mode AcceptSave.
Task-number: QTBUG-36886 Change-Id: I727abb92675187f15d1357b1df60f2fb609dc4d5 Reviewed-by: Andy Shaw <andy.shaw@digia.com> Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
This commit is contained in:
parent
32794abe72
commit
a0ebaca9cb
@ -880,7 +880,7 @@ public:
|
||||
inline static QWindowsNativeFileDialogBase *create(QFileDialogOptions::AcceptMode am, const QWindowsFileDialogSharedData &data);
|
||||
|
||||
virtual void setWindowTitle(const QString &title);
|
||||
inline void setMode(QFileDialogOptions::FileMode mode, QFileDialogOptions::FileDialogOptions options);
|
||||
inline void setMode(QFileDialogOptions::FileMode mode, QFileDialogOptions::AcceptMode acceptMode, QFileDialogOptions::FileDialogOptions options);
|
||||
inline void setDirectory(const QString &directory);
|
||||
inline void updateDirectory() { setDirectory(m_data.directory().toLocalFile()); }
|
||||
inline QString directory() const;
|
||||
@ -1037,14 +1037,17 @@ void QWindowsNativeFileDialogBase::doExec(HWND owner)
|
||||
}
|
||||
}
|
||||
|
||||
void QWindowsNativeFileDialogBase::setMode(QFileDialogOptions::FileMode mode, QFileDialogOptions::FileDialogOptions options)
|
||||
void QWindowsNativeFileDialogBase::setMode(QFileDialogOptions::FileMode mode,
|
||||
QFileDialogOptions::AcceptMode acceptMode,
|
||||
QFileDialogOptions::FileDialogOptions options)
|
||||
{
|
||||
DWORD flags = FOS_PATHMUSTEXIST | FOS_FORCESHOWHIDDEN;
|
||||
if (options & QFileDialogOptions::DontResolveSymlinks)
|
||||
flags |= FOS_NODEREFERENCELINKS;
|
||||
switch (mode) {
|
||||
case QFileDialogOptions::AnyFile:
|
||||
flags |= FOS_NOREADONLYRETURN;
|
||||
if (acceptMode == QFileDialogOptions::AcceptSave)
|
||||
flags |= FOS_NOREADONLYRETURN;
|
||||
if (!(options & QFileDialogOptions::DontConfirmOverwrite))
|
||||
flags |= FOS_OVERWRITEPROMPT;
|
||||
break;
|
||||
@ -1059,8 +1062,9 @@ void QWindowsNativeFileDialogBase::setMode(QFileDialogOptions::FileMode mode, QF
|
||||
flags |= FOS_FILEMUSTEXIST | FOS_ALLOWMULTISELECT;
|
||||
break;
|
||||
}
|
||||
qCDebug(lcQpaDialogs) << __FUNCTION__ << " mode=" << mode << " options"
|
||||
<< options << " results in 0x" << flags;
|
||||
qCDebug(lcQpaDialogs) << __FUNCTION__ << "mode=" << mode
|
||||
<< "acceptMode=" << acceptMode << "options=" << options
|
||||
<< "results in" << showbase << hex << flags;
|
||||
|
||||
if (FAILED(m_fileDialog->SetOptions(flags)))
|
||||
qErrnoWarning("%s: SetOptions() failed", __FUNCTION__);
|
||||
@ -1592,7 +1596,7 @@ QWindowsNativeDialogBase *QWindowsFileDialogHelper::createNativeDialog()
|
||||
m_data.fromOptions(opts);
|
||||
const QFileDialogOptions::FileMode mode = opts->fileMode();
|
||||
result->setWindowTitle(opts->windowTitle());
|
||||
result->setMode(mode, opts->options());
|
||||
result->setMode(mode, opts->acceptMode(), opts->options());
|
||||
result->setHideFiltersDetails(opts->testOption(QFileDialogOptions::HideNameFilterDetails));
|
||||
const QStringList nameFilters = opts->nameFilters();
|
||||
if (!nameFilters.isEmpty())
|
||||
|
Loading…
Reference in New Issue
Block a user