[common] refactoring
This commit is contained in:
parent
15431b1eae
commit
a0616e8f17
|
@ -573,6 +573,13 @@ define([
|
|||
this.trigger('toggle', this, state);
|
||||
},
|
||||
|
||||
click: function(opts) {
|
||||
if ( !this.disabled ) {
|
||||
this.doToggle();
|
||||
this.trigger('click', this, opts);
|
||||
}
|
||||
},
|
||||
|
||||
isActive: function() {
|
||||
if (this.enableToggle)
|
||||
return this.pressed;
|
||||
|
|
|
@ -104,13 +104,11 @@ define([
|
|||
if (/button:click/.test(cmd)) {
|
||||
var obj = JSON.parse(param);
|
||||
if ( !!obj.action ) {
|
||||
// TODO: add method 'click' to button
|
||||
titlebuttons[obj.action].btn.cmpEl.trigger({type:'click',which:1});
|
||||
titlebuttons[obj.action].btn.click();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// app.execCommand('webapps:events', 'loading');
|
||||
// app.execCommand('window:features', {version: config.version, action: 'request'});
|
||||
app.execCommand('webapps:features', {version: config.version, eventloading:true, titlebuttons:true});
|
||||
}
|
||||
|
@ -125,7 +123,7 @@ define([
|
|||
};
|
||||
};
|
||||
|
||||
var _onTitleButtonDasabled = function (action, e, status) {
|
||||
var _onTitleButtonDisabled = function (action, e, status) {
|
||||
titlebuttons[action].disabled = status;
|
||||
var _buttons = {};
|
||||
_buttons[action] = status;
|
||||
|
@ -174,12 +172,9 @@ define([
|
|||
'redo': {btn: header.btnRedo, disabled:false}
|
||||
};
|
||||
|
||||
var toolbar = webapp.getController('Toolbar').getView();
|
||||
if ( toolbar ) {
|
||||
toolbar.btnUndo.on('disabled', _onTitleButtonDasabled.bind(this, 'undo'));
|
||||
toolbar.btnRedo.on('disabled', _onTitleButtonDasabled.bind(this, 'redo'));
|
||||
toolbar.btnSave.on('disabled', _onTitleButtonDasabled.bind(this, 'save'));
|
||||
toolbar.btnPrint.on('disabled', _onTitleButtonDasabled.bind(this, 'print'));
|
||||
for (var i in titlebuttons) {
|
||||
titlebuttons[i].btn.options.signals = ['disabled'];
|
||||
titlebuttons[i].btn.on('disabled', _onTitleButtonDisabled.bind(this, i));
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue