From 2ef7eb63c01b018a3dd8175134b43cb8221883d5 Mon Sep 17 00:00:00 2001 From: greymond1 Date: Sat, 15 Aug 2020 13:47:49 +0800 Subject: [PATCH] Key reference from help menu is modified. Instead of accessing into the url, now will just display the shortcut keys by using dialog. --- src/dialog.js | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ src/menu/help.js | 2 +- 2 files changed, 49 insertions(+), 1 deletion(-) diff --git a/src/dialog.js b/src/dialog.js index 1237b34..5e2c38f 100644 --- a/src/dialog.js +++ b/src/dialog.js @@ -7,6 +7,37 @@ const file = require('./file'); const settings = require('./settings'); class Dialog { + + get _keyReferenceInfo() { + return [ + `Add due date: Cmd+Shift+T`, + `Add my day: Cmd+K`, + `Complete todo: Cmd+Shift+N`, + `Delete list: Cmd+Shift+D`, + `Delete todo: Cmd+D`, + `Global create todo: Cmd+Alt+C`, + `Global search todo: Cmd+Alt+F`, + `Global toggle window: Cmd+Alt+A`, + `Hide todo: Cmd+Shift+H`, + `Important: Cmd+I`, + `My day: Cmd+M`, + `New list: Cmd+L`, + `New todo: Cmd+N`, + `Planned: Cmd+P`, + `Rename list: Cmd+Y`, + `Rename todo: Cmd+T`, + `Return: Esc`, + `Set reminder: Cmd+Shift+E`, + `Settings: Cmd+,`, + `Sign out: Cmd+Alt+Q`, + `Tasks: Cmd+J`, + `Toggle black mode: Cmd+B`, + `Toggle dark mode: Cmd+H`, + `Toggle sepia mode: Cmd+G`, + `Toggle sidebar: Cmd+O` + ].join('\n'); + } + get _systemInfo() { return [ `Version: ${app.getVersion()}`, @@ -18,6 +49,17 @@ class Dialog { ].join('\n'); } + + _keyRef() { + return this._create({ + buttons: ['Done', 'Copy'], + detail: `Created by Greymond.\n\n${this._keyReferenceInfo}`, + message: `Ao ${app.getVersion()} (${os.arch()})`, + title: 'Shortcut Key Reference' + }); + } + + _about() { return this._create({ buttons: ['Done', 'Copy'], @@ -79,6 +121,12 @@ class Dialog { } } + confirmKey() { + if (this._keyRef() === 1) { + clipboard.writeText(this._keyReferenceInfo); + } + } + confirmExit() { if (settings.get('requestExitConfirmation')) { if (this._exit() === 0) { diff --git a/src/menu/help.js b/src/menu/help.js index a1a5170..24247f5 100644 --- a/src/menu/help.js +++ b/src/menu/help.js @@ -77,7 +77,7 @@ module.exports = { }, { label: 'Keyboard Shortcuts Reference', click() { - shell.openExternal(url.keyboardShortcutsRef); + dialog.confirmKey(); } }, { type: 'separator'