diff --git a/apps/documenteditor/main/app/controller/ViewTab.js b/apps/documenteditor/main/app/controller/ViewTab.js index 36bed734ad..36beb7c6d3 100644 --- a/apps/documenteditor/main/app/controller/ViewTab.js +++ b/apps/documenteditor/main/app/controller/ViewTab.js @@ -60,6 +60,7 @@ define([ this._state = {}; Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this)); Common.NotificationCenter.on('contenttheme:dark', this.onContentThemeChangedToDark.bind(this)); + Common.NotificationCenter.on('uitheme:changed', this.onThemeChanged.bind(this)); }, setApi: function (api) { @@ -203,5 +204,15 @@ define([ this.view && this.view.btnDarkDocument.toggle(isdark, true); }, + onThemeChanged: function () { + if (this.view) { + var current_theme = Common.UI.Themes.currentThemeId() || Common.UI.Themes.defaultThemeId(), + menu_item = _.findWhere(this.view.btnInterfaceTheme.menu.items, {value: current_theme}); + this.view.btnInterfaceTheme.menu.clearAll(); + menu_item.setChecked(true, true); + this.view.btnDarkDocument.setDisabled(!Common.UI.Themes.isDarkTheme()); + } + }, + }, DE.Controllers.ViewTab || {})); }); \ No newline at end of file diff --git a/apps/documenteditor/main/app/view/ViewTab.js b/apps/documenteditor/main/app/view/ViewTab.js index 5b58ab1d0a..8e2710c58e 100644 --- a/apps/documenteditor/main/app/view/ViewTab.js +++ b/apps/documenteditor/main/app/view/ViewTab.js @@ -49,7 +49,7 @@ define([ return { options: {}, - setEvents() { + setEvents: function () { var me = this; me.btnNavigation.on('click', function (btn, e) { me.fireEvent('viewtab:navigation', [btn.pressed]); diff --git a/apps/presentationeditor/main/app/controller/ViewTab.js b/apps/presentationeditor/main/app/controller/ViewTab.js index 124e05aff6..dd0ebd4237 100644 --- a/apps/presentationeditor/main/app/controller/ViewTab.js +++ b/apps/presentationeditor/main/app/controller/ViewTab.js @@ -62,6 +62,7 @@ define([ zoom_percent: undefined }; Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this)); + Common.NotificationCenter.on('uitheme:changed', this.onThemeChanged.bind(this)); }, setApi: function (api) { @@ -195,7 +196,16 @@ define([ Common.localStorage.setBool('pe-hidden-notes', !checked); this.view.fireEvent('notes:hide', [!checked]); Common.NotificationCenter.trigger('edit:complete', this.view); - } + }, + + onThemeChanged: function () { + if (this.view) { + var current_theme = Common.UI.Themes.currentThemeId() || Common.UI.Themes.defaultThemeId(), + menu_item = _.findWhere(this.view.btnInterfaceTheme.menu.items, {value: current_theme}); + this.view.btnInterfaceTheme.menu.clearAll(); + menu_item.setChecked(true, true); + } + }, }, PE.Controllers.ViewTab || {})); }); \ No newline at end of file diff --git a/apps/spreadsheeteditor/main/app/controller/ViewTab.js b/apps/spreadsheeteditor/main/app/controller/ViewTab.js index 033dcab237..3558a63143 100644 --- a/apps/spreadsheeteditor/main/app/controller/ViewTab.js +++ b/apps/spreadsheeteditor/main/app/controller/ViewTab.js @@ -59,6 +59,7 @@ define([ }, onLaunch: function () { this._state = {}; + Common.NotificationCenter.on('uitheme:changed', this.onThemeChanged.bind(this)); }, setApi: function (api) { @@ -246,6 +247,16 @@ define([ onApiZoomChange: function(zf, type){ var value = Math.floor((zf + .005) * 100); this.view.cmbZoom.setValue(value, value + '%'); + }, + + onThemeChanged: function () { + if (this.view) { + var current_theme = Common.UI.Themes.currentThemeId() || Common.UI.Themes.defaultThemeId(), + menu_item = _.findWhere(this.view.btnInterfaceTheme.menu.items, {value: current_theme}); + this.view.btnInterfaceTheme.menu.clearAll(); + menu_item.setChecked(true, true); + } } + }, SSE.Controllers.ViewTab || {})); }); \ No newline at end of file