feat: add dontAddToRecent to windows showOpenDialog (#19669)
This commit is contained in:
parent
fee84de782
commit
b5798326e8
4 changed files with 14 additions and 8 deletions
|
@ -48,6 +48,7 @@ The `dialog` module has the following methods:
|
||||||
their target path.
|
their target path.
|
||||||
* `treatPackageAsDirectory` _macOS_ - Treat packages, such as `.app` folders,
|
* `treatPackageAsDirectory` _macOS_ - Treat packages, such as `.app` folders,
|
||||||
as a directory instead of a file.
|
as a directory instead of a file.
|
||||||
|
* `dontAddToRecent` _Windows_ - Do not add the item being opened to the recent documents list.
|
||||||
* `message` String (optional) _macOS_ - Message to display above input
|
* `message` String (optional) _macOS_ - Message to display above input
|
||||||
boxes.
|
boxes.
|
||||||
* `securityScopedBookmarks` Boolean (optional) _macOS_ _mas_ - Create [security scoped bookmarks](https://developer.apple.com/library/content/documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html#//apple_ref/doc/uid/TP40011183-CH3-SW16) when packaged for the Mac App Store.
|
* `securityScopedBookmarks` Boolean (optional) _macOS_ _mas_ - Create [security scoped bookmarks](https://developer.apple.com/library/content/documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html#//apple_ref/doc/uid/TP40011183-CH3-SW16) when packaged for the Mac App Store.
|
||||||
|
@ -108,6 +109,7 @@ dialog.showOpenDialogSync(mainWindow, {
|
||||||
their target path.
|
their target path.
|
||||||
* `treatPackageAsDirectory` _macOS_ - Treat packages, such as `.app` folders,
|
* `treatPackageAsDirectory` _macOS_ - Treat packages, such as `.app` folders,
|
||||||
as a directory instead of a file.
|
as a directory instead of a file.
|
||||||
|
* `dontAddToRecent` _Windows_ - Do not add the item being opened to the recent documents list.
|
||||||
* `message` String (optional) _macOS_ - Message to display above input
|
* `message` String (optional) _macOS_ - Message to display above input
|
||||||
boxes.
|
boxes.
|
||||||
* `securityScopedBookmarks` Boolean (optional) _macOS_ _mas_ - Create [security scoped bookmarks](https://developer.apple.com/library/content/documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html#//apple_ref/doc/uid/TP40011183-CH3-SW16) when packaged for the Mac App Store.
|
* `securityScopedBookmarks` Boolean (optional) _macOS_ _mas_ - Create [security scoped bookmarks](https://developer.apple.com/library/content/documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html#//apple_ref/doc/uid/TP40011183-CH3-SW16) when packaged for the Mac App Store.
|
||||||
|
|
|
@ -8,11 +8,12 @@ const fileDialogProperties = {
|
||||||
openFile: 1 << 0,
|
openFile: 1 << 0,
|
||||||
openDirectory: 1 << 1,
|
openDirectory: 1 << 1,
|
||||||
multiSelections: 1 << 2,
|
multiSelections: 1 << 2,
|
||||||
createDirectory: 1 << 3,
|
createDirectory: 1 << 3, // macOS
|
||||||
showHiddenFiles: 1 << 4,
|
showHiddenFiles: 1 << 4,
|
||||||
promptToCreate: 1 << 5,
|
promptToCreate: 1 << 5, // Windows
|
||||||
noResolveAliases: 1 << 6,
|
noResolveAliases: 1 << 6, // macOS
|
||||||
treatPackageAsDirectory: 1 << 7
|
treatPackageAsDirectory: 1 << 7, // macOS
|
||||||
|
dontAddToRecent: 1 << 8 // Windows
|
||||||
}
|
}
|
||||||
|
|
||||||
const normalizeAccessKey = (text) => {
|
const normalizeAccessKey = (text) => {
|
||||||
|
|
|
@ -28,11 +28,12 @@ enum FileDialogProperty {
|
||||||
FILE_DIALOG_OPEN_FILE = 1 << 0,
|
FILE_DIALOG_OPEN_FILE = 1 << 0,
|
||||||
FILE_DIALOG_OPEN_DIRECTORY = 1 << 1,
|
FILE_DIALOG_OPEN_DIRECTORY = 1 << 1,
|
||||||
FILE_DIALOG_MULTI_SELECTIONS = 1 << 2,
|
FILE_DIALOG_MULTI_SELECTIONS = 1 << 2,
|
||||||
FILE_DIALOG_CREATE_DIRECTORY = 1 << 3,
|
FILE_DIALOG_CREATE_DIRECTORY = 1 << 3, // macOS
|
||||||
FILE_DIALOG_SHOW_HIDDEN_FILES = 1 << 4,
|
FILE_DIALOG_SHOW_HIDDEN_FILES = 1 << 4,
|
||||||
FILE_DIALOG_PROMPT_TO_CREATE = 1 << 5,
|
FILE_DIALOG_PROMPT_TO_CREATE = 1 << 5, // Windows
|
||||||
FILE_DIALOG_NO_RESOLVE_ALIASES = 1 << 6,
|
FILE_DIALOG_NO_RESOLVE_ALIASES = 1 << 6, // macOS
|
||||||
FILE_DIALOG_TREAT_PACKAGE_APP_AS_DIRECTORY = 1 << 7,
|
FILE_DIALOG_TREAT_PACKAGE_APP_AS_DIRECTORY = 1 << 7, // macOS
|
||||||
|
FILE_DIALOG_DONT_ADD_TO_RECENT = 1 << 8, // Windows
|
||||||
};
|
};
|
||||||
|
|
||||||
struct DialogSettings {
|
struct DialogSettings {
|
||||||
|
|
|
@ -234,6 +234,8 @@ bool ShowOpenDialogSync(const DialogSettings& settings,
|
||||||
options |= FOS_FORCESHOWHIDDEN;
|
options |= FOS_FORCESHOWHIDDEN;
|
||||||
if (settings.properties & FILE_DIALOG_PROMPT_TO_CREATE)
|
if (settings.properties & FILE_DIALOG_PROMPT_TO_CREATE)
|
||||||
options |= FOS_CREATEPROMPT;
|
options |= FOS_CREATEPROMPT;
|
||||||
|
if (settings.properties & FILE_DIALOG_DONT_ADD_TO_RECENT)
|
||||||
|
options |= FOS_DONTADDTORECENT;
|
||||||
file_open_dialog->SetOptions(options);
|
file_open_dialog->SetOptions(options);
|
||||||
|
|
||||||
ApplySettings(file_open_dialog, settings);
|
ApplySettings(file_open_dialog, settings);
|
||||||
|
|
Loading…
Reference in a new issue