diff options
Diffstat (limited to 'src/lib/Menu.js')
-rw-r--r-- | src/lib/Menu.js | 37 |
1 files changed, 9 insertions, 28 deletions
diff --git a/src/lib/Menu.js b/src/lib/Menu.js index 2c24b696b..5dae56544 100644 --- a/src/lib/Menu.js +++ b/src/lib/Menu.js | |||
@@ -1,5 +1,5 @@ | |||
1 | import { clipboard } from 'electron'; | 1 | import { clipboard } from 'electron'; |
2 | import { app, Menu, dialog, systemPreferences } from '@electron/remote'; | 2 | import { app, Menu, systemPreferences } from '@electron/remote'; |
3 | import { autorun, observable } from 'mobx'; | 3 | import { autorun, observable } from 'mobx'; |
4 | import { defineMessages } from 'react-intl'; | 4 | import { defineMessages } from 'react-intl'; |
5 | import { | 5 | import { |
@@ -14,7 +14,6 @@ import { | |||
14 | settingsShortcutKey, | 14 | settingsShortcutKey, |
15 | isLinux, | 15 | isLinux, |
16 | isMac, | 16 | isMac, |
17 | aboutAppDetails, | ||
18 | lockFerdiShortcutKey, | 17 | lockFerdiShortcutKey, |
19 | todosToggleShortcutKey, | 18 | todosToggleShortcutKey, |
20 | workspaceToggleShortcutKey, | 19 | workspaceToggleShortcutKey, |
@@ -592,23 +591,6 @@ export default class FranzMenu { | |||
592 | const tpl = _titleBarTemplateFactory(intl, this.stores.settings.app.locked); | 591 | const tpl = _titleBarTemplateFactory(intl, this.stores.settings.app.locked); |
593 | const { actions } = this; | 592 | const { actions } = this; |
594 | 593 | ||
595 | // TODO: Extract this into a reusable component and remove the duplications | ||
596 | const quitApp = () => { | ||
597 | const yesButtonIndex = 0; | ||
598 | let selection = yesButtonIndex; | ||
599 | if (window.ferdi.stores.settings.app.confirmOnQuit) { | ||
600 | selection = dialog.showMessageBoxSync(app.mainWindow, { | ||
601 | type: 'question', | ||
602 | message: intl.formatMessage(globalMessages.quit), | ||
603 | detail: intl.formatMessage(globalMessages.quitConfirmation), | ||
604 | buttons: [intl.formatMessage(globalMessages.yes), intl.formatMessage(globalMessages.no)], | ||
605 | }); | ||
606 | } | ||
607 | if (selection === yesButtonIndex) { | ||
608 | app.quit(); | ||
609 | } | ||
610 | }; | ||
611 | |||
612 | if (!isMac) { | 594 | if (!isMac) { |
613 | tpl[1].submenu.push({ | 595 | tpl[1].submenu.push({ |
614 | label: intl.formatMessage(menuItems.autohideMenuBar), | 596 | label: intl.formatMessage(menuItems.autohideMenuBar), |
@@ -813,7 +795,9 @@ export default class FranzMenu { | |||
813 | { | 795 | { |
814 | label: intl.formatMessage(globalMessages.quit), | 796 | label: intl.formatMessage(globalMessages.quit), |
815 | accelerator: `${cmdOrCtrlShortcutKey()}+Q`, | 797 | accelerator: `${cmdOrCtrlShortcutKey()}+Q`, |
816 | click: quitApp, | 798 | click() { |
799 | app.quit(); | ||
800 | }, | ||
817 | }, | 801 | }, |
818 | ], | 802 | ], |
819 | }); | 803 | }); |
@@ -821,12 +805,7 @@ export default class FranzMenu { | |||
821 | const about = { | 805 | const about = { |
822 | label: intl.formatMessage(menuItems.about), | 806 | label: intl.formatMessage(menuItems.about), |
823 | click: () => { | 807 | click: () => { |
824 | dialog.showMessageBox({ | 808 | app.showAboutPanel(); |
825 | type: 'info', | ||
826 | title: 'Franz Ferdinand', | ||
827 | message: 'Ferdi', | ||
828 | detail: aboutAppDetails(), | ||
829 | }); | ||
830 | }, | 809 | }, |
831 | }; | 810 | }; |
832 | 811 | ||
@@ -857,7 +836,7 @@ export default class FranzMenu { | |||
857 | } else { | 836 | } else { |
858 | tpl[0].submenu = [ | 837 | tpl[0].submenu = [ |
859 | { | 838 | { |
860 | label: intl.formatMessage(menuItems.settings), | 839 | label: intl.formatMessage(globalMessages.settings), |
861 | accelerator: `${settingsShortcutKey()}`, | 840 | accelerator: `${settingsShortcutKey()}`, |
862 | click: () => { | 841 | click: () => { |
863 | this.actions.ui.openSettings({ path: 'app' }); | 842 | this.actions.ui.openSettings({ path: 'app' }); |
@@ -871,7 +850,9 @@ export default class FranzMenu { | |||
871 | { | 850 | { |
872 | label: intl.formatMessage(globalMessages.quit), | 851 | label: intl.formatMessage(globalMessages.quit), |
873 | accelerator: `${cmdOrCtrlShortcutKey()}+Q`, | 852 | accelerator: `${cmdOrCtrlShortcutKey()}+Q`, |
874 | click: quitApp, | 853 | click() { |
854 | app.quit(); | ||
855 | }, | ||
875 | }, | 856 | }, |
876 | ]; | 857 | ]; |
877 | 858 | ||