🍎 Add additional options for Mac's open dialog
Support an additional attributes available in macOS's NSOpenPanel: message.
This commit is contained in:
parent
cc22149beb
commit
36209ddd90
8 changed files with 29 additions and 9 deletions
|
@ -43,6 +43,7 @@ bool ShowOpenDialog(atom::NativeWindow* parent_window,
|
|||
const base::FilePath& default_path,
|
||||
const Filters& filters,
|
||||
int properties,
|
||||
const std::string& message,
|
||||
std::vector<base::FilePath>* paths);
|
||||
|
||||
void ShowOpenDialog(atom::NativeWindow* parent_window,
|
||||
|
@ -51,6 +52,7 @@ void ShowOpenDialog(atom::NativeWindow* parent_window,
|
|||
const base::FilePath& default_path,
|
||||
const Filters& filters,
|
||||
int properties,
|
||||
const std::string& message,
|
||||
const OpenDialogCallback& callback);
|
||||
|
||||
bool ShowSaveDialog(atom::NativeWindow* parent_window,
|
||||
|
|
|
@ -236,6 +236,7 @@ bool ShowOpenDialog(atom::NativeWindow* parent_window,
|
|||
const base::FilePath& default_path,
|
||||
const Filters& filters,
|
||||
int properties,
|
||||
const std::string& message,
|
||||
std::vector<base::FilePath>* paths) {
|
||||
GtkFileChooserAction action = GTK_FILE_CHOOSER_ACTION_OPEN;
|
||||
if (properties & FILE_DIALOG_OPEN_DIRECTORY)
|
||||
|
@ -260,6 +261,7 @@ void ShowOpenDialog(atom::NativeWindow* parent_window,
|
|||
const base::FilePath& default_path,
|
||||
const Filters& filters,
|
||||
int properties,
|
||||
const std::string& message,
|
||||
const OpenDialogCallback& callback) {
|
||||
GtkFileChooserAction action = GTK_FILE_CHOOSER_ACTION_OPEN;
|
||||
if (properties & FILE_DIALOG_OPEN_DIRECTORY)
|
||||
|
|
|
@ -134,12 +134,14 @@ bool ShowOpenDialog(atom::NativeWindow* parent_window,
|
|||
const base::FilePath& default_path,
|
||||
const Filters& filters,
|
||||
int properties,
|
||||
const std::string& message,
|
||||
std::vector<base::FilePath>* paths) {
|
||||
DCHECK(paths);
|
||||
NSOpenPanel* dialog = [NSOpenPanel openPanel];
|
||||
|
||||
// TODO yamgent: Fix this
|
||||
SetupDialog(dialog, title, button_label, default_path, filters, "", "", false);
|
||||
SetupDialog(dialog, title, button_label, default_path, filters, message,
|
||||
// NSOpenPanel does not support name_field_label and shows_tag_field
|
||||
"", false);
|
||||
SetupDialogForProperties(dialog, properties);
|
||||
|
||||
int chosen = RunModalDialog(dialog, parent_window);
|
||||
|
@ -156,11 +158,13 @@ void ShowOpenDialog(atom::NativeWindow* parent_window,
|
|||
const base::FilePath& default_path,
|
||||
const Filters& filters,
|
||||
int properties,
|
||||
const std::string& message,
|
||||
const OpenDialogCallback& c) {
|
||||
NSOpenPanel* dialog = [NSOpenPanel openPanel];
|
||||
|
||||
// TODO yamgent: Fix this
|
||||
SetupDialog(dialog, title, button_label, default_path, filters, "", "", false);
|
||||
SetupDialog(dialog, title, button_label, default_path, filters, message,
|
||||
// NSOpenPanel does not support name_field_label and shows_tag_field
|
||||
"", false);
|
||||
SetupDialogForProperties(dialog, properties);
|
||||
|
||||
// Duplicate the callback object here since c is a reference and gcd would
|
||||
|
|
|
@ -198,6 +198,7 @@ bool ShowOpenDialog(atom::NativeWindow* parent_window,
|
|||
const base::FilePath& default_path,
|
||||
const Filters& filters,
|
||||
int properties,
|
||||
const std::string& message,
|
||||
std::vector<base::FilePath>* paths) {
|
||||
int options = FOS_FORCEFILESYSTEM | FOS_FILEMUSTEXIST;
|
||||
if (properties & FILE_DIALOG_OPEN_DIRECTORY)
|
||||
|
@ -250,6 +251,7 @@ void ShowOpenDialog(atom::NativeWindow* parent,
|
|||
const base::FilePath& default_path,
|
||||
const Filters& filters,
|
||||
int properties,
|
||||
const std::string& message,
|
||||
const OpenDialogCallback& callback) {
|
||||
RunState run_state;
|
||||
if (!CreateDialogThread(&run_state)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue