2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-30 14:17:45 +00:00

Fix choose folder for Export on macOS.

This commit is contained in:
John Preston
2020-03-25 13:25:42 +04:00
parent f38e9763b6
commit ae7529004d
2 changed files with 8 additions and 5 deletions

View File

@@ -323,9 +323,12 @@ bool GetDefault(
} }
QString file; QString file;
const auto resolvedParent = (parent && parent->window()->isVisible())
? parent->window()
: Core::App().getFileDialogParent();
Core::App().notifyFileDialogShown(true); Core::App().notifyFileDialogShown(true);
if (type == Type::ReadFiles) { if (type == Type::ReadFiles) {
files = QFileDialog::getOpenFileNames(Core::App().getFileDialogParent(), caption, startFile, filter); files = QFileDialog::getOpenFileNames(resolvedParent, caption, startFile, filter);
QString path = files.isEmpty() ? QString() : QFileInfo(files.back()).absoluteDir().absolutePath(); QString path = files.isEmpty() ? QString() : QFileInfo(files.back()).absoluteDir().absolutePath();
if (!path.isEmpty() && path != cDialogLastPath()) { if (!path.isEmpty() && path != cDialogLastPath()) {
cSetDialogLastPath(path); cSetDialogLastPath(path);
@@ -333,11 +336,11 @@ bool GetDefault(
} }
return !files.isEmpty(); return !files.isEmpty();
} else if (type == Type::ReadFolder) { } else if (type == Type::ReadFolder) {
file = QFileDialog::getExistingDirectory(Core::App().getFileDialogParent(), caption, startFile); file = QFileDialog::getExistingDirectory(resolvedParent, caption, startFile);
} else if (type == Type::WriteFile) { } else if (type == Type::WriteFile) {
file = QFileDialog::getSaveFileName(Core::App().getFileDialogParent(), caption, startFile, filter); file = QFileDialog::getSaveFileName(resolvedParent, caption, startFile, filter);
} else { } else {
file = QFileDialog::getOpenFileName(Core::App().getFileDialogParent(), caption, startFile, filter); file = QFileDialog::getOpenFileName(resolvedParent, caption, startFile, filter);
} }
Core::App().notifyFileDialogShown(false); Core::App().notifyFileDialogShown(false);