aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLibravatar Amine Mouafik <amine@mouafik.fr>2020-02-22 01:59:21 +0100
committerLibravatar Amine Mouafik <amine@mouafik.fr>2020-02-22 01:59:21 +0100
commit8af788f034f858e37cff273900766f337d9ecf3d (patch)
treea4be2d0d7b348e34196df91302aa1b5a88238f38 /src
parentUpdate submodule to fix build via internal-server (diff)
downloadferdium-app-8af788f034f858e37cff273900766f337d9ecf3d.tar.gz
ferdium-app-8af788f034f858e37cff273900766f337d9ecf3d.tar.zst
ferdium-app-8af788f034f858e37cff273900766f337d9ecf3d.zip
Simply update locked state
Diffstat (limited to 'src')
-rw-r--r--src/components/layout/Sidebar.js11
-rw-r--r--src/lib/Menu.js27
2 files changed, 10 insertions, 28 deletions
diff --git a/src/components/layout/Sidebar.js b/src/components/layout/Sidebar.js
index 48a83c5a1..bd10ccb4a 100644
--- a/src/components/layout/Sidebar.js
+++ b/src/components/layout/Sidebar.js
@@ -118,21 +118,12 @@ export default @inject('stores', 'actions') @observer class Sidebar extends Comp
118 type="button" 118 type="button"
119 className="sidebar__button" 119 className="sidebar__button"
120 onClick={() => { 120 onClick={() => {
121 // Disable lock first - otherwise the application might not update correctly
122 actions.settings.update({ 121 actions.settings.update({
123 type: 'app', 122 type: 'app',
124 data: { 123 data: {
125 locked: false, 124 locked: true,
126 }, 125 },
127 }); 126 });
128 setTimeout(() => {
129 actions.settings.update({
130 type: 'app',
131 data: {
132 locked: true,
133 },
134 });
135 }, 0);
136 }} 127 }}
137 data-tip={`${intl.formatMessage(messages.lockFerdi)} (${ctrlKey}+Shift+L)`} 128 data-tip={`${intl.formatMessage(messages.lockFerdi)} (${ctrlKey}+Shift+L)`}
138 > 129 >
diff --git a/src/lib/Menu.js b/src/lib/Menu.js
index f2669a106..f66dab111 100644
--- a/src/lib/Menu.js
+++ b/src/lib/Menu.js
@@ -1,15 +1,15 @@
1import { remote, shell, clipboard } from 'electron'; 1import { clipboard, remote, shell } from 'electron';
2import { observable, autorun } from 'mobx'; 2import { autorun, observable } from 'mobx';
3import { defineMessages } from 'react-intl'; 3import { defineMessages } from 'react-intl';
4 4import { cmdKey, ctrlKey, isMac } from '../environment';
5import { isMac, ctrlKey, cmdKey } from '../environment';
6import { workspaceStore } from '../features/workspaces/index';
7import { workspaceActions } from '../features/workspaces/actions';
8import { announcementActions } from '../features/announcements/actions';
9import { announcementsStore } from '../features/announcements'; 5import { announcementsStore } from '../features/announcements';
6import { announcementActions } from '../features/announcements/actions';
10import { todosStore } from '../features/todos'; 7import { todosStore } from '../features/todos';
11import { todoActions } from '../features/todos/actions'; 8import { todoActions } from '../features/todos/actions';
12import { CUSTOM_WEBSITE_ID } from '../features/webControls/constants'; 9import { CUSTOM_WEBSITE_ID } from '../features/webControls/constants';
10import { workspaceActions } from '../features/workspaces/actions';
11import { workspaceStore } from '../features/workspaces/index';
12
13 13
14const { app, Menu, dialog } = remote; 14const { app, Menu, dialog } = remote;
15 15
@@ -806,21 +806,12 @@ export default class FranzMenu {
806 accelerator: 'CmdOrCtrl+Shift+L', 806 accelerator: 'CmdOrCtrl+Shift+L',
807 enabled: this.stores.user.isLoggedIn && this.stores.settings.app.lockingFeatureEnabled, 807 enabled: this.stores.user.isLoggedIn && this.stores.settings.app.lockingFeatureEnabled,
808 click() { 808 click() {
809 // Disable lock first - otherwise the application might not update correctly
810 actions.settings.update({ 809 actions.settings.update({
811 type: 'app', 810 type: 'app',
812 data: { 811 data: {
813 locked: false, 812 locked: true,
814 }, 813 },
815 }); 814 });
816 setTimeout(() => {
817 actions.settings.update({
818 type: 'app',
819 data: {
820 locked: true,
821 },
822 });
823 }, 0);
824 }, 815 },
825 }); 816 });
826 817
@@ -967,7 +958,7 @@ export default class FranzMenu {
967 958
968 this.currentTemplate = tpl; 959 this.currentTemplate = tpl;
969 const menu = Menu.buildFromTemplate(tpl); 960 const menu = Menu.buildFromTemplate(tpl);
970 const lockedMenu = Menu.buildFromTemplate([]); 961 const lockedMenu = new Menu();
971 Menu.setApplicationMenu(this.stores.user.isLoggedIn && this.stores.settings.app.locked ? lockedMenu : menu); 962 Menu.setApplicationMenu(this.stores.user.isLoggedIn && this.stores.settings.app.locked ? lockedMenu : menu);
972 } 963 }
973 964