fix bug 44815

This commit is contained in:
Maxim Kadushkin 2020-03-13 17:46:10 +03:00
parent 6c5f2b39d7
commit aa984412b2

View file

@ -148,12 +148,11 @@ define([
action: action, action: action,
icon: config.icon || undefined, icon: config.icon || undefined,
hint: config.btn.options.hint, hint: config.btn.options.hint,
disabled: config.disabled disabled: config.btn.isDisabled()
}; };
}; };
var _onTitleButtonDisabled = function (action, e, status) { var _onTitleButtonDisabled = function (action, e, status) {
titlebuttons[action].disabled = status;
var _buttons = {}; var _buttons = {};
_buttons[action] = status; _buttons[action] = status;
native.execCommand('title:button', JSON.stringify({disabled: _buttons})); native.execCommand('title:button', JSON.stringify({disabled: _buttons}));
@ -169,7 +168,7 @@ define([
} else { } else {
var _buttons = {}; var _buttons = {};
for (var i in titlebuttons) { for (var i in titlebuttons) {
_buttons[i] = titlebuttons[i].disabled; _buttons[i] = titlebuttons[i].btn.isDisabled();
} }
native.execCommand('title:button', JSON.stringify({'disabled': _buttons})); native.execCommand('title:button', JSON.stringify({'disabled': _buttons}));
@ -200,20 +199,20 @@ define([
var header = webapp.getController('Viewport').getView('Common.Views.Header'); var header = webapp.getController('Viewport').getView('Common.Views.Header');
titlebuttons = {}; titlebuttons = {};
if ( !!header.btnSave ) { if ( !!header.btnSave ) {
titlebuttons['save'] = {btn: header.btnSave, disabled:false}; titlebuttons['save'] = {btn: header.btnSave};
var iconname = /\s?([^\s]+)$/.exec(titlebuttons.save.btn.$icon.attr('class')); var iconname = /\s?([^\s]+)$/.exec(titlebuttons.save.btn.$icon.attr('class'));
!!iconname && iconname.length && (titlebuttons.save.icon = btnsave_icons[iconname]); !!iconname && iconname.length && (titlebuttons.save.icon = btnsave_icons[iconname]);
} }
if ( !!header.btnPrint ) if ( !!header.btnPrint )
titlebuttons['print'] = {btn: header.btnPrint, disabled:false}; titlebuttons['print'] = {btn: header.btnPrint};
if ( !!header.btnUndo ) if ( !!header.btnUndo )
titlebuttons['undo'] = {btn: header.btnUndo, disabled:false}; titlebuttons['undo'] = {btn: header.btnUndo};
if ( !!header.btnRedo ) if ( !!header.btnRedo )
titlebuttons['redo'] = {btn: header.btnRedo, disabled:false}; titlebuttons['redo'] = {btn: header.btnRedo};
for (var i in titlebuttons) { for (var i in titlebuttons) {
titlebuttons[i].btn.options.signals = ['disabled']; titlebuttons[i].btn.options.signals = ['disabled'];