dialogs - fill in proper options used elsewhere

This commit is contained in:
Benjamin Pasero 2021-06-15 08:21:37 +02:00
parent d0191db633
commit 71be3b3641
No known key found for this signature in database
GPG key ID: E6380CC4C8219E65
7 changed files with 61 additions and 19 deletions

View file

@ -851,6 +851,7 @@ export class CodeApplication extends Disposable {
mnemonicButtonLabel(localize({ key: 'open', comment: ['&& denotes a mnemonic'] }, "&&Yes")),
mnemonicButtonLabel(localize({ key: 'cancel', comment: ['&& denotes a mnemonic'] }, "&&No")),
],
defaultId: 0,
cancelId: 1,
message: localize('confirmOpenMessage', "An external application wants to open '{0}' in {1}. Do you want to open this file or folder?", getPathLabel(uri.fsPath, this.environmentMainService), this.productService.nameShort),
detail: localize('confirmOpenDetail', "If you did not initiate this request, it may represent an attempted attack on your system. Unless you took an explicit action to initiate this request, you should press 'No'"),
@ -1052,10 +1053,13 @@ export class CodeApplication extends Disposable {
if (!timeout) {
dialogMainService.showMessageBox({
title: this.productService.nameLong,
type: 'info',
message: localize('trace.message', "Successfully created trace."),
detail: localize('trace.detail', "Please create an issue and manually attach the following file:\n{0}", path),
buttons: [localize('trace.ok', "OK")]
buttons: [mnemonicButtonLabel(localize({ key: 'trace.ok', comment: ['&& denotes a mnemonic'] }, "&&OK"))],
defaultId: 0,
noLink: true
}, withNullAsUndefined(BrowserWindow.getFocusedWindow()));
} else {
this.logService.info(`Tracing: data recorded (after 30s timeout) to ${path}`);

View file

@ -375,6 +375,7 @@ class CodeMain {
buttons: [mnemonicButtonLabel(localize({ key: 'close', comment: ['&& denotes a mnemonic'] }, "&&Close"))],
message,
detail,
defaultId: 0,
noLink: true
});
}

View file

@ -22,6 +22,8 @@ import { FileAccess } from 'vs/base/common/network';
import { INativeHostMainService } from 'vs/platform/native/electron-main/nativeHostMainService';
import { IIPCObjectUrl, IProtocolMainService } from 'vs/platform/protocol/electron-main/protocol';
import { DisposableStore } from 'vs/base/common/lifecycle';
import { mnemonicButtonLabel } from 'vs/base/common/labels';
import { IProductService } from 'vs/platform/product/common/productService';
export const IIssueMainService = createDecorator<IIssueMainService>('issueMainService');
@ -54,7 +56,8 @@ export class IssueMainService implements ICommonIssueService {
@IDiagnosticsService private readonly diagnosticsService: IDiagnosticsService,
@IDialogMainService private readonly dialogMainService: IDialogMainService,
@INativeHostMainService private readonly nativeHostMainService: INativeHostMainService,
@IProtocolMainService private readonly protocolMainService: IProtocolMainService
@IProtocolMainService private readonly protocolMainService: IProtocolMainService,
@IProductService private readonly productService: IProductService
) {
this.registerListeners();
}
@ -99,12 +102,16 @@ export class IssueMainService implements ICommonIssueService {
ipcMain.on('vscode:issueReporterClipboard', async event => {
const messageOptions = {
title: this.productService.nameLong,
message: localize('issueReporterWriteToClipboard', "There is too much data to send to GitHub directly. The data will be copied to the clipboard, please paste it into the GitHub issue page that is opened."),
type: 'warning',
buttons: [
localize('ok', "OK"),
localize('cancel', "Cancel")
]
mnemonicButtonLabel(localize({ key: 'ok', comment: ['&& denotes a mnemonic'] }, "&&OK")),
mnemonicButtonLabel(localize({ key: 'cancel', comment: ['&& denotes a mnemonic'] }, "&&Cancel")),
],
defaultId: 0,
cancelId: 1,
noLink: true
};
if (this.issueReporterWindow) {
@ -120,12 +127,16 @@ export class IssueMainService implements ICommonIssueService {
ipcMain.on('vscode:issueReporterConfirmClose', async () => {
const messageOptions = {
title: this.productService.nameLong,
message: localize('confirmCloseIssueReporter', "Your input will not be saved. Are you sure you want to close this window?"),
type: 'warning',
buttons: [
localize('yes', "Yes"),
localize('cancel', "Cancel")
]
mnemonicButtonLabel(localize({ key: 'yes', comment: ['&& denotes a mnemonic'] }, "&&Yes")),
mnemonicButtonLabel(localize({ key: 'cancel', comment: ['&& denotes a mnemonic'] }, "&&Cancel")),
],
defaultId: 0,
cancelId: 1,
noLink: true
};
if (this.issueReporterWindow) {

View file

@ -33,6 +33,7 @@ import { memoize } from 'vs/base/common/decorators';
import { Disposable } from 'vs/base/common/lifecycle';
import { ISharedProcess } from 'vs/platform/sharedProcess/node/sharedProcess';
import { IThemeMainService } from 'vs/platform/theme/electron-main/themeMainService';
import { mnemonicButtonLabel } from 'vs/base/common/labels';
export interface INativeHostMainService extends AddFirstParameterToFunctions<ICommonNativeHostService, Promise<unknown> /* only methods, not events */, number | undefined /* window ID */> { }
@ -291,9 +292,15 @@ export class NativeHostMainService extends Disposable implements INativeHostMain
}
const { response } = await this.showMessageBox(windowId, {
title: this.productService.nameLong,
type: 'info',
message: localize('warnEscalation', "{0} will now prompt with 'osascript' for Administrator privileges to install the shell command.", this.productService.nameShort),
buttons: [localize('ok', "OK"), localize('cancel', "Cancel")],
buttons: [
mnemonicButtonLabel(localize({ key: 'ok', comment: ['&& denotes a mnemonic'] }, "&&OK")),
mnemonicButtonLabel(localize({ key: 'cancel', comment: ['&& denotes a mnemonic'] }, "&&Cancel")),
],
noLink: true,
defaultId: 0,
cancelId: 1
});
@ -317,9 +324,15 @@ export class NativeHostMainService extends Disposable implements INativeHostMain
switch (error.code) {
case 'EACCES':
const { response } = await this.showMessageBox(windowId, {
title: this.productService.nameLong,
type: 'info',
message: localize('warnEscalationUninstall', "{0} will now prompt with 'osascript' for Administrator privileges to uninstall the shell command.", this.productService.nameShort),
buttons: [localize('ok', "OK"), localize('cancel', "Cancel")],
buttons: [
mnemonicButtonLabel(localize({ key: 'ok', comment: ['&& denotes a mnemonic'] }, "&&OK")),
mnemonicButtonLabel(localize({ key: 'cancel', comment: ['&& denotes a mnemonic'] }, "&&Cancel")),
],
noLink: true,
defaultId: 0,
cancelId: 1
});

View file

@ -604,10 +604,16 @@ export class CodeWindow extends Disposable implements ICodeWindow {
const result = await this.dialogMainService.showMessageBox({
title: this.productService.nameLong,
type: 'warning',
buttons: [mnemonicButtonLabel(localize({ key: 'reopen', comment: ['&& denotes a mnemonic'] }, "&&Reopen")), mnemonicButtonLabel(localize({ key: 'wait', comment: ['&& denotes a mnemonic'] }, "&&Keep Waiting")), mnemonicButtonLabel(localize({ key: 'close', comment: ['&& denotes a mnemonic'] }, "&&Close"))],
buttons: [
mnemonicButtonLabel(localize({ key: 'reopen', comment: ['&& denotes a mnemonic'] }, "&&Reopen")),
mnemonicButtonLabel(localize({ key: 'wait', comment: ['&& denotes a mnemonic'] }, "&&Keep Waiting")),
mnemonicButtonLabel(localize({ key: 'close', comment: ['&& denotes a mnemonic'] }, "&&Close"))
],
message: localize('appStalled', "The window is no longer responding"),
detail: localize('appStalledDetail', "You can reopen or close the window or keep waiting."),
noLink: true
noLink: true,
defaultId: 0,
cancelId: 1
}, this._win);
if (!this._win) {
@ -634,10 +640,14 @@ export class CodeWindow extends Disposable implements ICodeWindow {
const result = await this.dialogMainService.showMessageBox({
title: this.productService.nameLong,
type: 'warning',
buttons: [mnemonicButtonLabel(localize({ key: 'reopen', comment: ['&& denotes a mnemonic'] }, "&&Reopen")), mnemonicButtonLabel(localize({ key: 'close', comment: ['&& denotes a mnemonic'] }, "&&Close"))],
buttons: [
mnemonicButtonLabel(localize({ key: 'reopen', comment: ['&& denotes a mnemonic'] }, "&&Reopen")),
mnemonicButtonLabel(localize({ key: 'close', comment: ['&& denotes a mnemonic'] }, "&&Close"))
],
message,
detail: localize('appCrashedDetail', "We are sorry for the inconvenience! You can reopen the window to continue where you left off."),
noLink: true
detail: localize('appCrashedDetail', "We are sorry for the inconvenience. You can reopen the window to continue where you left off."),
noLink: true,
defaultId: 0
}, this._win);
if (!this._win) {

View file

@ -41,7 +41,7 @@ import { IDialogMainService } from 'vs/platform/dialogs/electron-main/dialogMain
import { assertIsDefined, withNullAsUndefined } from 'vs/base/common/types';
import { isWindowsDriveLetter, toSlashes, parseLineAndColumnAware, sanitizeFilePath } from 'vs/base/common/extpath';
import { CharCode } from 'vs/base/common/charCode';
import { getPathLabel } from 'vs/base/common/labels';
import { getPathLabel, mnemonicButtonLabel } from 'vs/base/common/labels';
import { CancellationToken } from 'vs/base/common/cancellation';
import { IFileService } from 'vs/platform/files/common/files';
import { cwd } from 'vs/base/common/process';
@ -702,7 +702,8 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic
const options: MessageBoxOptions = {
title: this.productService.nameLong,
type: 'info',
buttons: [localize('ok', "OK")],
buttons: [mnemonicButtonLabel(localize({ key: 'ok', comment: ['&& denotes a mnemonic'] }, "&&OK"))],
defaultId: 0,
message: uri.scheme === Schemas.file ? localize('pathNotExistTitle', "Path does not exist") : localize('uriInvalidTitle', "URI can not be opened"),
detail: uri.scheme === Schemas.file ?
localize('pathNotExistDetail', "The path '{0}' does not seem to exist anymore on disk.", getPathLabel(uri.fsPath, this.environmentMainService)) :

View file

@ -26,6 +26,7 @@ import { withNullAsUndefined } from 'vs/base/common/types';
import { IBackupMainService } from 'vs/platform/backup/electron-main/backup';
import { IDialogMainService } from 'vs/platform/dialogs/electron-main/dialogMainService';
import { findWindowOnWorkspaceOrFolder } from 'vs/platform/windows/electron-main/windowsFinder';
import { mnemonicButtonLabel } from 'vs/base/common/labels';
export const IWorkspacesManagementMainService = createDecorator<IWorkspacesManagementMainService>('workspacesManagementMainService');
@ -273,10 +274,11 @@ export class WorkspacesManagementMainService extends Disposable implements IWork
const options: MessageBoxOptions = {
title: this.productService.nameLong,
type: 'info',
buttons: [localize('ok', "OK")],
buttons: [mnemonicButtonLabel(localize({ key: 'ok', comment: ['&& denotes a mnemonic'] }, "&&OK"))],
message: localize('workspaceOpenedMessage', "Unable to save workspace '{0}'", basename(workspacePath)),
detail: localize('workspaceOpenedDetail', "The workspace is already opened in another window. Please close that window first and then try again."),
noLink: true
noLink: true,
defaultId: 0
};
await this.dialogMainService.showMessageBox(options, withNullAsUndefined(BrowserWindow.getFocusedWindow()));