diff --git a/apps/common/main/lib/controller/Desktop.js b/apps/common/main/lib/controller/Desktop.js index f96088cf4..9ec4c277f 100644 --- a/apps/common/main/lib/controller/Desktop.js +++ b/apps/common/main/lib/controller/Desktop.js @@ -45,7 +45,8 @@ define([ version: '{{PRODUCT_VERSION}}', eventloading: true, titlebuttons: true, - uithemes: true + uithemes: true, + quickprint: true, }; var native = window.desktop || window.AscDesktopEditor; @@ -166,7 +167,8 @@ define([ action: action, icon: config.icon || undefined, hint: config.btn.options.hint, - disabled: config.btn.isDisabled() + disabled: config.btn.isDisabled(), + visible: config.visible, }; }; @@ -217,6 +219,19 @@ define([ } } + const _onApplySettings = function (menu) { + if ( !!titlebuttons.printquick ) { + if ( titlebuttons.printquick.visible != titlebuttons.printquick.btn.isVisible() ) { + const obj = { + visible: { + quickprint: titlebuttons.printquick.btn.isVisible(), + } + }; + native.execCommand('title:button', JSON.stringify(obj)); + } + } + } + return { init: function (opts) { _.extend(config, opts); @@ -283,8 +298,12 @@ define([ if (!!header.btnPrint) titlebuttons['print'] = {btn: header.btnPrint}; - if (!!header.btnPrintQuick) - titlebuttons['printquick'] = {btn: header.btnPrintQuick}; + if (!!header.btnPrintQuick) { + titlebuttons['printquick'] = { + btn: header.btnPrintQuick, + visible: header.btnPrintQuick.isVisible(), + }; + } if (!!header.btnUndo) titlebuttons['undo'] = {btn: header.btnUndo}; @@ -340,6 +359,7 @@ define([ menu.hide(); } }, + 'settings:apply': _onApplySettings.bind(this), }, }, {id: 'desktop'});