[desktop] fix system theme applying
This commit is contained in:
parent
9ee7a7054f
commit
e9c2445afe
|
@ -291,9 +291,13 @@ define([
|
|||
'modal:show': _onModalDialog.bind(this, 'open'),
|
||||
'modal:close': _onModalDialog.bind(this, 'close'),
|
||||
'uitheme:changed' : function (name) {
|
||||
var theme = Common.UI.Themes.get(name);
|
||||
if ( theme )
|
||||
native.execCommand("uitheme:changed", JSON.stringify({name:name, type:theme.type}));
|
||||
if (Common.localStorage.getBool('ui-theme-use-system', false)) {
|
||||
native.execCommand("system:changed", JSON.stringify({'colorscheme':name}));
|
||||
} else {
|
||||
var theme = Common.UI.Themes.get(name);
|
||||
if ( theme )
|
||||
native.execCommand("uitheme:changed", JSON.stringify({name:name, type:theme.type}));
|
||||
}
|
||||
},
|
||||
'hints:show': _onHintsShow.bind(this),
|
||||
});
|
||||
|
|
|
@ -302,7 +302,9 @@ define([
|
|||
$(window).on('storage', function (e) {
|
||||
if ( e.key == 'ui-theme' || e.key == 'ui-theme-id' ) {
|
||||
if ( !!e.originalEvent.newValue ) {
|
||||
me.setTheme(e.originalEvent.newValue, true);
|
||||
if (Common.localStorage.getBool('ui-theme-use-system', false)) {
|
||||
me.setTheme('theme-system');
|
||||
} else me.setTheme(e.originalEvent.newValue, true);
|
||||
}
|
||||
} else
|
||||
if ( e.key == 'content-theme' ) {
|
||||
|
|
|
@ -65,6 +65,7 @@ if ( window.desktop ) {
|
|||
if ( theme.id == 'theme-system' ) {
|
||||
localStorage.setItem("ui-theme-use-system", "1");
|
||||
localStorage.removeItem("ui-theme-id");
|
||||
delete params.uitheme;
|
||||
} else {
|
||||
localStorage.setItem("ui-theme-id", theme.id);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue