aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/Menu.js37
-rw-r--r--src/lib/Tray.js25
2 files changed, 14 insertions, 48 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 @@
1import { clipboard } from 'electron'; 1import { clipboard } from 'electron';
2import { app, Menu, dialog, systemPreferences } from '@electron/remote'; 2import { app, Menu, systemPreferences } from '@electron/remote';
3import { autorun, observable } from 'mobx'; 3import { autorun, observable } from 'mobx';
4import { defineMessages } from 'react-intl'; 4import { defineMessages } from 'react-intl';
5import { 5import {
@@ -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
diff --git a/src/lib/Tray.js b/src/lib/Tray.js
index c897d597a..7360611cd 100644
--- a/src/lib/Tray.js
+++ b/src/lib/Tray.js
@@ -1,5 +1,5 @@
1import { 1import {
2 app, Menu, nativeImage, nativeTheme, systemPreferences, Tray, ipcMain, dialog, 2 app, Menu, nativeImage, nativeTheme, systemPreferences, Tray, ipcMain,
3} from 'electron'; 3} from 'electron';
4import { join } from 'path'; 4import { join } from 'path';
5import macosVersion from 'macos-version'; 5import macosVersion from 'macos-version';
@@ -10,6 +10,7 @@ const INDICATOR_TRAY_PLAIN = 'tray';
10const INDICATOR_TRAY_UNREAD = 'tray-unread'; 10const INDICATOR_TRAY_UNREAD = 'tray-unread';
11const INDICATOR_TRAY_INDIRECT = 'tray-indirect'; 11const INDICATOR_TRAY_INDIRECT = 'tray-indirect';
12 12
13// TODO: Need to support i18n for a lot of the hard-coded strings in this file
13export default class TrayIcon { 14export default class TrayIcon {
14 trayIcon = null; 15 trayIcon = null;
15 16
@@ -43,7 +44,9 @@ export default class TrayIcon {
43 }, 44 },
44 { 45 {
45 label: 'Quit Ferdi', 46 label: 'Quit Ferdi',
46 click: this.quitApp, 47 click() {
48 app.quit();
49 },
47 }, 50 },
48 ]; 51 ];
49 52
@@ -176,22 +179,4 @@ export default class TrayIcon {
176 __dirname, '..', 'assets', 'images', type, platform, `${asset}.${FILE_EXTENSION}`, 179 __dirname, '..', 'assets', 'images', type, platform, `${asset}.${FILE_EXTENSION}`,
177 )); 180 ));
178 } 181 }
179
180 // TODO: Extract this into a reusable component and remove the duplications
181 quitApp = () => {
182 const yesButtonIndex = 0;
183 let selection = yesButtonIndex;
184 if (window.ferdi.stores.settings.app.confirmOnQuit) {
185 selection = dialog.showMessageBoxSync(app.mainWindow, {
186 // TODO: Externalize strings
187 type: 'question',
188 message: 'Quit',
189 detail: 'Do you really want to quit Ferdi?',
190 buttons: ['Yes', 'No'],
191 });
192 }
193 if (selection === yesButtonIndex) {
194 app.quit();
195 }
196 };
197} 182}