[desktop] send 'quickaccess:changed' message to native

This commit is contained in:
maxkadushkin
2024-04-16 21:33:48 +03:00
parent eae525ed32
commit ea0e56ebad
2 changed files with 14 additions and 3 deletions

View File

@ -463,6 +463,9 @@ define([
if (!!header.btnRedo)
titlebuttons['redo'] = {btn: header.btnRedo};
if (!!header.btnQuickAccess)
titlebuttons['quickaccess'] = {btn: header.btnQuickAccess};
for (var i in titlebuttons) {
titlebuttons[i].btn.options.signals = ['disabled'];
titlebuttons[i].btn.on('disabled', _onTitleButtonDisabled.bind(this, i));
@ -519,6 +522,10 @@ define([
console.log('open recent');
}
const _onChangeQuickAccess = function (props) {
native.execCommand("quickaccess:changed", JSON.stringify(props));
}
const _extend_menu_file = function (args) {
console.log('extend menu file')
@ -576,6 +583,7 @@ define([
}
},
'hints:show': _onHintsShow.bind(this),
'quickaccess:changed': _onChangeQuickAccess.bind(this),
});
webapp.addListeners({

View File

@ -311,7 +311,7 @@ define([
}
}
function onChangeQuickAccess(props) {
function onChangeQuickAccess(caller, props) {
if (props.save !== undefined) {
this.btnSave[props.save ? 'show' : 'hide']();
Common.localStorage.setBool(this.appPrefix + 'quick-access-save', props.save);
@ -333,6 +333,9 @@ define([
Common.localStorage.setBool(this.appPrefix + 'quick-access-redo', props.redo);
}
Common.NotificationCenter.trigger('edit:complete');
if ( caller && caller == 'header' )
Common.NotificationCenter.trigger('quickaccess:changed', props);
}
function onAppReady(mode) {
@ -530,9 +533,9 @@ define([
props.redo = item.checked;
break;
}
onChangeQuickAccess.call(me, props);
onChangeQuickAccess.call(me, 'header', props);
});
Common.NotificationCenter.on('quickaccess:changed', onChangeQuickAccess.bind(me));
Common.NotificationCenter.on('quickaccess:changed', onChangeQuickAccess.bind(me, 'settings'));
}
if ( !appConfig.twoLevelHeader ) {