fix: defaultPath should apply on all dialog types in Linux Portal (#42655)

fix: defaultPath should apply on all dialog types in Linux Portal dialogs
This commit is contained in:
Shelley Vohr 2024-06-27 11:07:26 +02:00 committed by GitHub
parent 2b31d8459d
commit c628de52d9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -8,6 +8,9 @@ This CL adds support for the following features to //shell_dialogs:
* showHiddenFiles - Show hidden files in dialog. * showHiddenFiles - Show hidden files in dialog.
* showOverwriteConfirmation - Whether the user will be presented a confirmation dialog if the user types a file name that already exists. * showOverwriteConfirmation - Whether the user will be presented a confirmation dialog if the user types a file name that already exists.
It also:
* Changes XDG Portal implementation behavior to set default path regardless of dialog type.
This may be partially upstreamed to Chromium in the future. This may be partially upstreamed to Chromium in the future.
diff --git a/ui/gtk/select_file_dialog_linux_gtk.cc b/ui/gtk/select_file_dialog_linux_gtk.cc diff --git a/ui/gtk/select_file_dialog_linux_gtk.cc b/ui/gtk/select_file_dialog_linux_gtk.cc
@ -269,7 +272,7 @@ index c79fb47bfba9233da7d2c1438d1e26600684fc78..d7cc7cd70653aaa5b628ef456dcb48a2
&SelectFileDialogLinuxKde::OnSelectSingleFolderDialogResponse, this, &SelectFileDialogLinuxKde::OnSelectSingleFolderDialogResponse, this,
parent, params)); parent, params));
diff --git a/ui/shell_dialogs/select_file_dialog_linux_portal.cc b/ui/shell_dialogs/select_file_dialog_linux_portal.cc diff --git a/ui/shell_dialogs/select_file_dialog_linux_portal.cc b/ui/shell_dialogs/select_file_dialog_linux_portal.cc
index 65727489ddecb755eeabbd194ce843ca9eaa59c9..b15bace56639d2f914f8f76edfa1b28e33165b48 100644 index 65727489ddecb755eeabbd194ce843ca9eaa59c9..38134183309f89b76e7d2a8cda0a11f530b79d44 100644
--- a/ui/shell_dialogs/select_file_dialog_linux_portal.cc --- a/ui/shell_dialogs/select_file_dialog_linux_portal.cc
+++ b/ui/shell_dialogs/select_file_dialog_linux_portal.cc +++ b/ui/shell_dialogs/select_file_dialog_linux_portal.cc
@@ -219,6 +219,10 @@ void SelectFileDialogLinuxPortal::SelectFileImpl( @@ -219,6 +219,10 @@ void SelectFileDialogLinuxPortal::SelectFileImpl(
@ -360,7 +363,7 @@ index 65727489ddecb755eeabbd194ce843ca9eaa59c9..b15bace56639d2f914f8f76edfa1b28e
IDS_SELECT_UPLOAD_FOLDER_DIALOG_UPLOAD_BUTTON)); IDS_SELECT_UPLOAD_FOLDER_DIALOG_UPLOAD_BUTTON));
} }
@@ -563,6 +572,7 @@ void SelectFileDialogLinuxPortal::DialogInfo::AppendOptions( @@ -563,12 +572,12 @@ void SelectFileDialogLinuxPortal::DialogInfo::AppendOptions(
type == SelectFileDialog::Type::SELECT_UPLOAD_FOLDER || type == SelectFileDialog::Type::SELECT_UPLOAD_FOLDER ||
type == SelectFileDialog::Type::SELECT_EXISTING_FOLDER) { type == SelectFileDialog::Type::SELECT_EXISTING_FOLDER) {
AppendBoolOption(&options_writer, kFileChooserOptionDirectory, true); AppendBoolOption(&options_writer, kFileChooserOptionDirectory, true);
@ -368,6 +371,13 @@ index 65727489ddecb755eeabbd194ce843ca9eaa59c9..b15bace56639d2f914f8f76edfa1b28e
} else if (type == SelectFileDialog::Type::SELECT_OPEN_MULTI_FILE) { } else if (type == SelectFileDialog::Type::SELECT_OPEN_MULTI_FILE) {
AppendBoolOption(&options_writer, kFileChooserOptionMultiple, true); AppendBoolOption(&options_writer, kFileChooserOptionMultiple, true);
} }
- if (type == SelectFileDialog::Type::SELECT_SAVEAS_FILE &&
- !default_path.empty()) {
+ if (!default_path.empty()) {
if (default_path_exists) {
// If this is an existing directory, navigate to that directory, with no
// filename.
diff --git a/ui/shell_dialogs/select_file_dialog_linux_portal.h b/ui/shell_dialogs/select_file_dialog_linux_portal.h diff --git a/ui/shell_dialogs/select_file_dialog_linux_portal.h b/ui/shell_dialogs/select_file_dialog_linux_portal.h
index c487f7da19e2d05696a8eb72f2fa3e12972149f3..02a40c571570974dcc61e1b1f7ed95fbfc2bedf2 100644 index c487f7da19e2d05696a8eb72f2fa3e12972149f3..02a40c571570974dcc61e1b1f7ed95fbfc2bedf2 100644
--- a/ui/shell_dialogs/select_file_dialog_linux_portal.h --- a/ui/shell_dialogs/select_file_dialog_linux_portal.h