diff options
Diffstat (limited to 'src/lib/Menu.js')
-rw-r--r-- | src/lib/Menu.js | 28 |
1 files changed, 6 insertions, 22 deletions
diff --git a/src/lib/Menu.js b/src/lib/Menu.js index 324838441..5aa575df7 100644 --- a/src/lib/Menu.js +++ b/src/lib/Menu.js | |||
@@ -592,26 +592,6 @@ export default class FranzMenu { | |||
592 | const tpl = _titleBarTemplateFactory(intl, this.stores.settings.app.locked); | 592 | const tpl = _titleBarTemplateFactory(intl, this.stores.settings.app.locked); |
593 | const { actions } = this; | 593 | const { actions } = this; |
594 | 594 | ||
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: [ | ||
605 | intl.formatMessage(globalMessages.yes), | ||
606 | intl.formatMessage(globalMessages.no), | ||
607 | ], | ||
608 | }); | ||
609 | } | ||
610 | if (selection === yesButtonIndex) { | ||
611 | app.quit(); | ||
612 | } | ||
613 | }; | ||
614 | |||
615 | if (!isMac) { | 595 | if (!isMac) { |
616 | tpl[1].submenu.push({ | 596 | tpl[1].submenu.push({ |
617 | label: intl.formatMessage(menuItems.autohideMenuBar), | 597 | label: intl.formatMessage(menuItems.autohideMenuBar), |
@@ -816,7 +796,9 @@ export default class FranzMenu { | |||
816 | { | 796 | { |
817 | label: intl.formatMessage(globalMessages.quit), | 797 | label: intl.formatMessage(globalMessages.quit), |
818 | accelerator: `${cmdOrCtrlShortcutKey()}+Q`, | 798 | accelerator: `${cmdOrCtrlShortcutKey()}+Q`, |
819 | click: quitApp, | 799 | click() { |
800 | app.quit(); | ||
801 | }, | ||
820 | }, | 802 | }, |
821 | ], | 803 | ], |
822 | }); | 804 | }); |
@@ -874,7 +856,9 @@ export default class FranzMenu { | |||
874 | { | 856 | { |
875 | label: intl.formatMessage(globalMessages.quit), | 857 | label: intl.formatMessage(globalMessages.quit), |
876 | accelerator: `${cmdOrCtrlShortcutKey()}+Q`, | 858 | accelerator: `${cmdOrCtrlShortcutKey()}+Q`, |
877 | click: quitApp, | 859 | click() { |
860 | app.quit(); | ||
861 | }, | ||
878 | }, | 862 | }, |
879 | ]; | 863 | ]; |
880 | 864 | ||