mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-10-01 01:26:01 -04:00
Make sure we use the native file dialog on Windows and OS X.
This commit is contained in:
parent
e75efb8bfb
commit
0b43607aa1
@ -65,6 +65,12 @@ QString FileDialog::getSaveFileName(QWidget* parent, const QString& caption, QSt
|
|||||||
dir = config()->get("LastDir").toString();
|
dir = config()->get("LastDir").toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString result;
|
||||||
|
#if defined(Q_OS_MAC) || defined(Q_OS_WIN)
|
||||||
|
// the native dialogs on these platforms already append the file extension
|
||||||
|
result = QFileDialog::getSaveFileName(parent, caption, dir, filter,
|
||||||
|
selectedFilter, options);
|
||||||
|
#else
|
||||||
QFileDialog dialog(parent, caption, dir, filter);
|
QFileDialog dialog(parent, caption, dir, filter);
|
||||||
dialog.setAcceptMode(QFileDialog::AcceptSave);
|
dialog.setAcceptMode(QFileDialog::AcceptSave);
|
||||||
dialog.setFileMode(QFileDialog::AnyFile);
|
dialog.setFileMode(QFileDialog::AnyFile);
|
||||||
@ -74,7 +80,6 @@ QString FileDialog::getSaveFileName(QWidget* parent, const QString& caption, QSt
|
|||||||
dialog.setOptions(options);
|
dialog.setOptions(options);
|
||||||
dialog.setDefaultSuffix(defaultExtension);
|
dialog.setDefaultSuffix(defaultExtension);
|
||||||
|
|
||||||
QString result;
|
|
||||||
QStringList results;
|
QStringList results;
|
||||||
if (dialog.exec()) {
|
if (dialog.exec()) {
|
||||||
results = dialog.selectedFiles();
|
results = dialog.selectedFiles();
|
||||||
@ -82,6 +87,7 @@ QString FileDialog::getSaveFileName(QWidget* parent, const QString& caption, QSt
|
|||||||
result = results[0];
|
result = results[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// on Mac OS X the focus is lost after closing the native dialog
|
// on Mac OS X the focus is lost after closing the native dialog
|
||||||
if (parent) {
|
if (parent) {
|
||||||
|
Loading…
Reference in New Issue
Block a user