2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Fix save dialog in macOS for streamed videos.

This commit is contained in:
John Preston
2019-10-07 14:34:40 +03:00
parent 883d6dcede
commit 17baac710e
5 changed files with 33 additions and 15 deletions

View File

@@ -360,11 +360,13 @@ bool GetDefault(
Platform::FileDialog::InitLastPath();
}
remoteContent = QByteArray();
remoteContent = QByteArray();
if (startFile.isEmpty() || startFile.at(0) != '/') {
startFile = cDialogLastPath() + '/' + startFile;
}
QString file;
Core::App().notifyFileDialogShown(true);
if (type == Type::ReadFiles) {
files = QFileDialog::getOpenFileNames(Core::App().getFileDialogParent(), caption, startFile, filter);
QString path = files.isEmpty() ? QString() : QFileInfo(files.back()).absoluteDir().absolutePath();
@@ -373,17 +375,19 @@ bool GetDefault(
Local::writeUserSettings();
}
return !files.isEmpty();
} else if (type == Type::ReadFolder) {
} else if (type == Type::ReadFolder) {
file = QFileDialog::getExistingDirectory(Core::App().getFileDialogParent(), caption, startFile);
} else if (type == Type::WriteFile) {
} else if (type == Type::WriteFile) {
file = QFileDialog::getSaveFileName(Core::App().getFileDialogParent(), caption, startFile, filter);
} else {
} else {
file = QFileDialog::getOpenFileName(Core::App().getFileDialogParent(), caption, startFile, filter);
}
if (file.isEmpty()) {
files = QStringList();
return false;
}
}
Core::App().notifyFileDialogShown(false);
if (file.isEmpty()) {
files = QStringList();
return false;
}
if (type != Type::ReadFolder) {
// Save last used directory for all queries except directory choosing.
auto path = QFileInfo(file).absoluteDir().absolutePath();