提交 e663710f 编写于 作者: S SteVen Batten

fixes #52284

上级 04cda435
......@@ -169,6 +169,7 @@ export interface IWindowsService {
// TODO: this is a bit backwards
startCrashReporter(config: CrashReporterStartOptions): TPromise<void>;
openAccessibilityOptions(): TPromise<void>;
openAboutDialog(): TPromise<void>;
}
......
......@@ -65,6 +65,7 @@ export interface IWindowsChannel extends IChannel {
call(command: 'showItemInFolder', arg: string): TPromise<void>;
call(command: 'openExternal', arg: string): TPromise<boolean>;
call(command: 'startCrashReporter', arg: CrashReporterStartOptions): TPromise<void>;
call(command: 'openAccessibilityOptions'): TPromise<void>;
call(command: 'openAboutDialog'): TPromise<void>;
call(command: string, arg?: any): TPromise<any>;
}
......@@ -152,6 +153,7 @@ export class WindowsChannel implements IWindowsChannel {
case 'showItemInFolder': return this.service.showItemInFolder(arg);
case 'openExternal': return this.service.openExternal(arg);
case 'startCrashReporter': return this.service.startCrashReporter(arg);
case 'openAccessibilityOptions': return this.service.openAccessibilityOptions();
case 'openAboutDialog': return this.service.openAboutDialog();
}
return undefined;
......@@ -367,6 +369,10 @@ export class WindowsChannelClient implements IWindowsService {
return this.channel.call('updateTouchBar', [windowId, items]);
}
openAccessibilityOptions(): TPromise<void> {
return this.channel.call('openAccessibilityOptions');
}
openAboutDialog(): TPromise<void> {
return this.channel.call('openAboutDialog');
}
......
......@@ -13,7 +13,7 @@ import URI from 'vs/base/common/uri';
import product from 'vs/platform/node/product';
import { IWindowsService, OpenContext, INativeOpenDialogOptions, IEnterWorkspaceResult, IMessageBoxResult, IDevToolsOptions } from 'vs/platform/windows/common/windows';
import { IEnvironmentService, ParsedArgs } from 'vs/platform/environment/common/environment';
import { shell, crashReporter, app, Menu, clipboard } from 'electron';
import { shell, crashReporter, app, Menu, clipboard, BrowserWindow } from 'electron';
import { Event, fromNodeEventEmitter, mapEvent, filterEvent, anyEvent } from 'vs/base/common/event';
import { IURLService, IURLHandler } from 'vs/platform/url/common/url';
import { ILifecycleService } from 'vs/platform/lifecycle/electron-main/lifecycleMain';
......@@ -468,6 +468,29 @@ export class WindowsService implements IWindowsService, IURLHandler, IDisposable
return TPromise.as(null);
}
openAccessibilityOptions(): TPromise<void> {
this.logService.trace('windowsService#openAccessibilityOptions');
const win = new BrowserWindow({
alwaysOnTop: true,
skipTaskbar: true,
resizable: false,
width: 450,
height: 300,
show: true,
title: nls.localize('accessibilityOptionsWindowTitle', "Accessibility Options"),
webPreferences: {
disableBlinkFeatures: 'Auxclick'
}
});
win.setMenuBarVisibility(false);
win.loadURL('chrome://accessibility');
return TPromise.as(null);
}
openAboutDialog(): TPromise<void> {
this.logService.trace('windowsService#openAboutDialog');
const lastActiveWindow = this.windowsMainService.getFocusedWindow() || this.windowsMainService.getLastActiveWindow();
......
......@@ -1378,7 +1378,7 @@ function helpMenuRegistration() {
MenuRegistry.appendMenuItem(MenuId.MenubarHelpMenu, {
group: '1_welcome',
command: {
id: 'workbench.action.showCurrentReleaseNotes',
id: 'update.showCurrentReleaseNotes',
title: nls.localize({ key: 'miReleaseNotes', comment: ['&& denotes a mnemonic'] }, "&&Release Notes")
},
order: 4
......@@ -1416,7 +1416,7 @@ function helpMenuRegistration() {
MenuRegistry.appendMenuItem(MenuId.MenubarHelpMenu, {
group: '3_feedback',
command: {
id: 'openTwitterUrl',
id: 'workbench.action.openTwitterUrl',
title: nls.localize({ key: 'miTwitter', comment: ['&& denotes a mnemonic'] }, "&&Join us on Twitter")
},
order: 1
......@@ -1425,7 +1425,7 @@ function helpMenuRegistration() {
MenuRegistry.appendMenuItem(MenuId.MenubarHelpMenu, {
group: '3_feedback',
command: {
id: 'openUserVoiceUrl',
id: 'workbench.action.openRequestFeatureUrl',
title: nls.localize({ key: 'miUserVoice', comment: ['&& denotes a mnemonic'] }, "&&Search Feature Requests")
},
order: 2
......@@ -1434,7 +1434,7 @@ function helpMenuRegistration() {
MenuRegistry.appendMenuItem(MenuId.MenubarHelpMenu, {
group: '3_feedback',
command: {
id: 'openReportIssues',
id: 'workbench.action.openIssueReporter',
title: nls.localize({ key: 'miReportIssue', comment: ['&& denotes a mnemonic', 'Translate this to "Report Issue in English" in all languages please!'] }, "Report &&Issue")
},
order: 3
......@@ -1444,7 +1444,7 @@ function helpMenuRegistration() {
MenuRegistry.appendMenuItem(MenuId.MenubarHelpMenu, {
group: '4_legal',
command: {
id: 'openLicenseUrl',
id: 'workbench.action.openLicenseUrl',
title: nls.localize({ key: 'miLicense', comment: ['&& denotes a mnemonic'] }, "View &&License")
},
order: 1
......@@ -1453,7 +1453,7 @@ function helpMenuRegistration() {
MenuRegistry.appendMenuItem(MenuId.MenubarHelpMenu, {
group: '4_legal',
command: {
id: 'openPrivacyStatement',
id: 'workbench.action.openPrivacyStatementUrl',
title: nls.localize({ key: 'miPrivacyStatement', comment: ['&& denotes a mnemonic'] }, "&&Privacy Statement")
},
order: 2
......@@ -1481,7 +1481,7 @@ function helpMenuRegistration() {
MenuRegistry.appendMenuItem(MenuId.MenubarHelpMenu, {
group: '5_tools',
command: {
id: 'accessibilityOptions',
id: 'workbench.action.showAccessibilityOptions',
title: nls.localize({ key: 'miAccessibilityOptions', comment: ['&& denotes a mnemonic'] }, "Accessibility &&Options")
},
order: 3
......
......@@ -20,7 +20,7 @@ import { IEnvironmentService } from 'vs/platform/environment/common/environment'
import { IConfigurationService, ConfigurationTarget } from 'vs/platform/configuration/common/configuration';
import { IWorkspaceConfigurationService } from 'vs/workbench/services/configuration/common/configuration';
import * as paths from 'vs/base/common/paths';
import { isMacintosh, isLinux } from 'vs/base/common/platform';
import { isMacintosh, isLinux, language } from 'vs/base/common/platform';
import { IQuickOpenService, IFilePickOpenEntry, ISeparator, IPickOpenAction, IPickOpenItem } from 'vs/platform/quickOpen/common/quickOpen';
import * as browser from 'vs/base/browser/browser';
import { IIntegrityService } from 'vs/platform/integrity/common/integrity';
......@@ -32,7 +32,7 @@ import { IPartService, Parts, Position as PartPosition } from 'vs/workbench/serv
import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import * as os from 'os';
import { webFrame } from 'electron';
import { webFrame, shell } from 'electron';
import { getPathLabel, getBaseLabel } from 'vs/base/common/labels';
import { IViewlet } from 'vs/workbench/common/viewlet';
import { IPanel } from 'vs/workbench/common/panel';
......@@ -1542,6 +1542,121 @@ export class ToggleWindowTabsBar extends Action {
}
}
export class OpenTwitterUrlAction extends Action {
public static readonly ID = 'workbench.action.openTwitterUrl';
public static LABEL = nls.localize('openTwitterUrl', "Join us on Twitter", product.applicationName);
constructor(
id: string,
label: string
) {
super(id, label);
}
run(): TPromise<boolean> {
if (product.twitterUrl) {
return TPromise.as(shell.openExternal(product.twitterUrl));
}
return TPromise.as(false);
}
}
export class OpenRequestFeatureUrlAction extends Action {
public static readonly ID = 'workbench.action.openRequestFeatureUrl';
public static LABEL = nls.localize('openUserVoiceUrl', "Search Feature Requests");
constructor(
id: string,
label: string
) {
super(id, label);
}
run(): TPromise<boolean> {
if (product.requestFeatureUrl) {
return TPromise.as(shell.openExternal(product.requestFeatureUrl));
}
return TPromise.as(false);
}
}
export class OpenLicenseUrlAction extends Action {
public static readonly ID = 'workbench.action.openLicenseUrl';
public static LABEL = nls.localize('openLicenseUrl', "View License");
constructor(
id: string,
label: string
) {
super(id, label);
}
run(): TPromise<boolean> {
if (product.licenseUrl) {
if (language) {
const queryArgChar = product.licenseUrl.indexOf('?') > 0 ? '&' : '?';
return TPromise.as(shell.openExternal(`${product.licenseUrl}${queryArgChar}lang=${language}`));
} else {
return TPromise.as(shell.openExternal(product.licenseUrl));
}
}
return TPromise.as(false);
}
}
export class OpenPrivacyStatementUrlAction extends Action {
public static readonly ID = 'workbench.action.openPrivacyStatementUrl';
public static LABEL = nls.localize('openPrivacyStatement', "Privacy Statement");
constructor(
id: string,
label: string
) {
super(id, label);
}
run(): TPromise<boolean> {
if (product.privacyStatementUrl) {
if (language) {
const queryArgChar = product.privacyStatementUrl.indexOf('?') > 0 ? '&' : '?';
return TPromise.as(shell.openExternal(`${product.privacyStatementUrl}${queryArgChar}lang=${language}`));
} else {
return TPromise.as(shell.openExternal(product.privacyStatementUrl));
}
}
return TPromise.as(false);
}
}
export class ShowAccessibilityOptionsAction extends Action {
public static readonly ID = 'workbench.action.showAccessibilityOptions';
public static LABEL = nls.localize('accessibilityOptions', "Accessibility Options");
constructor(
id: string,
label: string,
@IWindowsService private windowsService: IWindowsService
) {
super(id, label);
}
run(): TPromise<void> {
return this.windowsService.openAccessibilityOptions();
}
}
export class ShowAboutDialogAction extends Action {
public static readonly ID = 'workbench.action.showAboutDialog';
......
......@@ -14,7 +14,7 @@ import { IConfigurationRegistry, Extensions as ConfigurationExtensions, Configur
import { IWorkbenchActionRegistry, Extensions } from 'vs/workbench/common/actions';
import { KeyMod, KeyChord, KeyCode } from 'vs/base/common/keyCodes';
import { isWindows, isLinux, isMacintosh } from 'vs/base/common/platform';
import { KeybindingsReferenceAction, OpenDocumentationUrlAction, OpenIntroductoryVideosUrlAction, OpenTipsAndTricksUrlAction, OpenIssueReporterAction, ReportPerformanceIssueUsingReporterAction, ZoomResetAction, ZoomOutAction, ZoomInAction, ToggleFullScreenAction, ToggleMenuBarAction, CloseWorkspaceAction, CloseCurrentWindowAction, SwitchWindow, NewWindowAction, NavigateUpAction, NavigateDownAction, NavigateLeftAction, NavigateRightAction, IncreaseViewSizeAction, DecreaseViewSizeAction, ShowStartupPerformance, ToggleSharedProcessAction, QuickSwitchWindow, QuickOpenRecentAction, inRecentFilesPickerContextKey, ShowAboutDialogAction, InspectContextKeysAction, OpenProcessExplorer } from 'vs/workbench/electron-browser/actions';
import { KeybindingsReferenceAction, OpenDocumentationUrlAction, OpenIntroductoryVideosUrlAction, OpenTipsAndTricksUrlAction, OpenIssueReporterAction, ReportPerformanceIssueUsingReporterAction, ZoomResetAction, ZoomOutAction, ZoomInAction, ToggleFullScreenAction, ToggleMenuBarAction, CloseWorkspaceAction, CloseCurrentWindowAction, SwitchWindow, NewWindowAction, NavigateUpAction, NavigateDownAction, NavigateLeftAction, NavigateRightAction, IncreaseViewSizeAction, DecreaseViewSizeAction, ShowStartupPerformance, ToggleSharedProcessAction, QuickSwitchWindow, QuickOpenRecentAction, inRecentFilesPickerContextKey, ShowAboutDialogAction, InspectContextKeysAction, OpenProcessExplorer, OpenTwitterUrlAction, OpenRequestFeatureUrlAction, OpenPrivacyStatementUrlAction, OpenLicenseUrlAction, ShowAccessibilityOptionsAction } from 'vs/workbench/electron-browser/actions';
import { registerCommands } from 'vs/workbench/electron-browser/commands';
import { AddRootFolderAction, GlobalRemoveRootFolderAction, OpenWorkspaceAction, SaveWorkspaceAsAction, OpenWorkspaceConfigFileAction, DuplicateWorkspaceInNewWindowAction, OpenFileFolderAction, OpenFileAction, OpenFolderAction } from 'vs/workbench/browser/actions/workspaceActions';
import { ContextKeyExpr, RawContextKey } from 'vs/platform/contextkey/common/contextkey';
......@@ -69,6 +69,17 @@ if (OpenTipsAndTricksUrlAction.AVAILABLE) {
workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(OpenTipsAndTricksUrlAction, OpenTipsAndTricksUrlAction.ID, OpenTipsAndTricksUrlAction.LABEL), 'Help: Tips and Tricks', helpCategory);
}
workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(OpenTwitterUrlAction, OpenTwitterUrlAction.ID, OpenTwitterUrlAction.LABEL), 'Help: Join us on Twitter', helpCategory);
workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(OpenRequestFeatureUrlAction, OpenRequestFeatureUrlAction.ID,
OpenRequestFeatureUrlAction.LABEL), 'Help: Search Feature Requests', helpCategory);
workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(OpenLicenseUrlAction, OpenLicenseUrlAction.ID, OpenLicenseUrlAction.LABEL), 'Help: View License', helpCategory);
workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(OpenPrivacyStatementUrlAction, OpenPrivacyStatementUrlAction.ID, OpenPrivacyStatementUrlAction.LABEL), 'Help: Privacy Statement', helpCategory);
workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(ShowAccessibilityOptionsAction, ShowAccessibilityOptionsAction.ID, ShowAccessibilityOptionsAction.LABEL), 'Help: Accessibility Options', helpCategory);
workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(ShowAboutDialogAction, ShowAboutDialogAction.ID, ShowAboutDialogAction.LABEL), 'Help: About', helpCategory);
workbenchActionsRegistry.registerWorkbenchAction(
......
......@@ -1316,6 +1316,10 @@ export class TestWindowsService implements IWindowsService {
return TPromise.as(void 0);
}
openAccessibilityOptions(): TPromise<void> {
return TPromise.as(void 0);
}
openAboutDialog(): TPromise<void> {
return TPromise.as(void 0);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册