mac: Add showHiddenFiles property for showOpenDialog

This commit is contained in:
Cheng Zhao 2016-07-11 13:30:18 +09:00
parent 33e8d5e0aa
commit f08ac07737
3 changed files with 10 additions and 6 deletions

View file

@ -23,10 +23,11 @@ typedef std::pair<std::string, std::vector<std::string> > Filter;
typedef std::vector<Filter> Filters;
enum FileDialogProperty {
FILE_DIALOG_OPEN_FILE = 1 << 0,
FILE_DIALOG_OPEN_DIRECTORY = 1 << 1,
FILE_DIALOG_MULTI_SELECTIONS = 1 << 2,
FILE_DIALOG_CREATE_DIRECTORY = 1 << 3,
FILE_DIALOG_OPEN_FILE = 1 << 0,
FILE_DIALOG_OPEN_DIRECTORY = 1 << 1,
FILE_DIALOG_MULTI_SELECTIONS = 1 << 2,
FILE_DIALOG_CREATE_DIRECTORY = 1 << 3,
FILE_DIALOG_SHOW_HIDDEN_FILES = 1 << 4,
};
typedef base::Callback<void(

View file

@ -86,6 +86,8 @@ void SetupDialogForProperties(NSOpenPanel* dialog, int properties) {
[dialog setCanCreateDirectories:YES];
if (properties & FILE_DIALOG_MULTI_SELECTIONS)
[dialog setAllowsMultipleSelection:YES];
if (properties & FILE_DIALOG_SHOW_HIDDEN_FILES)
[dialog setShowsHiddenFiles:YES];
}
// Run modal dialog with parent window and return user's choice.

View file

@ -6,11 +6,12 @@ const v8Util = process.atomBinding('v8_util')
var includes = [].includes
var fileDialogProperties = {
const fileDialogProperties = {
openFile: 1 << 0,
openDirectory: 1 << 1,
multiSelections: 1 << 2,
createDirectory: 1 << 3
createDirectory: 1 << 3,
showHiddenFiles: 1 << 4
}
var messageBoxTypes = ['none', 'info', 'warning', 'error', 'question']