From ae7529004d453e8fa011fd2f1c5ec6a8e7da4341 Mon Sep 17 00:00:00 2001 From: John Preston Date: Wed, 25 Mar 2020 13:25:42 +0400 Subject: [PATCH] Fix choose folder for Export on macOS. --- Telegram/SourceFiles/core/file_utilities.cpp | 11 +++++++---- Telegram/lib_ui | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Telegram/SourceFiles/core/file_utilities.cpp b/Telegram/SourceFiles/core/file_utilities.cpp index 3be9ae66a..e70eb1ab3 100644 --- a/Telegram/SourceFiles/core/file_utilities.cpp +++ b/Telegram/SourceFiles/core/file_utilities.cpp @@ -323,9 +323,12 @@ bool GetDefault( } QString file; + const auto resolvedParent = (parent && parent->window()->isVisible()) + ? parent->window() + : Core::App().getFileDialogParent(); Core::App().notifyFileDialogShown(true); 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(); if (!path.isEmpty() && path != cDialogLastPath()) { cSetDialogLastPath(path); @@ -333,11 +336,11 @@ bool GetDefault( } return !files.isEmpty(); } else if (type == Type::ReadFolder) { - file = QFileDialog::getExistingDirectory(Core::App().getFileDialogParent(), caption, startFile); + file = QFileDialog::getExistingDirectory(resolvedParent, caption, startFile); } else if (type == Type::WriteFile) { - file = QFileDialog::getSaveFileName(Core::App().getFileDialogParent(), caption, startFile, filter); + file = QFileDialog::getSaveFileName(resolvedParent, caption, startFile, filter); } else { - file = QFileDialog::getOpenFileName(Core::App().getFileDialogParent(), caption, startFile, filter); + file = QFileDialog::getOpenFileName(resolvedParent, caption, startFile, filter); } Core::App().notifyFileDialogShown(false); diff --git a/Telegram/lib_ui b/Telegram/lib_ui index 7224c6a19..730816ef5 160000 --- a/Telegram/lib_ui +++ b/Telegram/lib_ui @@ -1 +1 @@ -Subproject commit 7224c6a191e3203bcdc9ae92fdade3575cac4137 +Subproject commit 730816ef5219cbe7f1588bec2fe9adacd11739c8