diff options
author | Amine Mouafik <amine@mouafik.fr> | 2020-02-22 01:59:21 +0100 |
---|---|---|
committer | Amine Mouafik <amine@mouafik.fr> | 2020-02-22 01:59:21 +0100 |
commit | 8af788f034f858e37cff273900766f337d9ecf3d (patch) | |
tree | a4be2d0d7b348e34196df91302aa1b5a88238f38 | |
parent | Update submodule to fix build via internal-server (diff) | |
download | ferdium-app-8af788f034f858e37cff273900766f337d9ecf3d.tar.gz ferdium-app-8af788f034f858e37cff273900766f337d9ecf3d.tar.zst ferdium-app-8af788f034f858e37cff273900766f337d9ecf3d.zip |
Simply update locked state
-rw-r--r-- | src/components/layout/Sidebar.js | 11 | ||||
-rw-r--r-- | src/lib/Menu.js | 27 |
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 @@ | |||
1 | import { remote, shell, clipboard } from 'electron'; | 1 | import { clipboard, remote, shell } from 'electron'; |
2 | import { observable, autorun } from 'mobx'; | 2 | import { autorun, observable } from 'mobx'; |
3 | import { defineMessages } from 'react-intl'; | 3 | import { defineMessages } from 'react-intl'; |
4 | 4 | import { cmdKey, ctrlKey, isMac } from '../environment'; | |
5 | import { isMac, ctrlKey, cmdKey } from '../environment'; | ||
6 | import { workspaceStore } from '../features/workspaces/index'; | ||
7 | import { workspaceActions } from '../features/workspaces/actions'; | ||
8 | import { announcementActions } from '../features/announcements/actions'; | ||
9 | import { announcementsStore } from '../features/announcements'; | 5 | import { announcementsStore } from '../features/announcements'; |
6 | import { announcementActions } from '../features/announcements/actions'; | ||
10 | import { todosStore } from '../features/todos'; | 7 | import { todosStore } from '../features/todos'; |
11 | import { todoActions } from '../features/todos/actions'; | 8 | import { todoActions } from '../features/todos/actions'; |
12 | import { CUSTOM_WEBSITE_ID } from '../features/webControls/constants'; | 9 | import { CUSTOM_WEBSITE_ID } from '../features/webControls/constants'; |
10 | import { workspaceActions } from '../features/workspaces/actions'; | ||
11 | import { workspaceStore } from '../features/workspaces/index'; | ||
12 | |||
13 | 13 | ||
14 | const { app, Menu, dialog } = remote; | 14 | const { 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 | ||