[desktop] bind to modal dailog show/hide events

This commit is contained in:
Maxim Kadushkin 2019-10-30 16:30:43 +03:00
parent af1cb78840
commit 9e24e71941

View file

@ -127,7 +127,22 @@ define([
var _onTitleButtonDasabled = function (action, e, status) {
titlebuttons[action].disabled = status;
app.execCommand('title:changed', JSON.stringify({'button':action, 'disabled':status}));
var _buttons = {};
_buttons[action] = status;
app.execCommand('title:button', JSON.stringify({disabled: _buttons}));
};
var _onModalDialog = function (status) {
if ( status == 'open' ) {
app.execCommand('title:button', JSON.stringify({disabled: {'all':true}}));
} else {
var _buttons = {};
for (var i in titlebuttons) {
_buttons[i] = titlebuttons[i].disabled;
}
app.execCommand('title:button', JSON.stringify({'disabled': _buttons}));
}
};
return {
@ -167,6 +182,11 @@ define([
toolbar.btnPrint.on('disabled', _onTitleButtonDasabled.bind(this, 'print'));
}
});
Common.NotificationCenter.on({
'modal:show': _onModalDialog.bind(this, 'open'),
'modal:close': _onModalDialog.bind(this, 'close')
});
}
},
process: function (opts) {