From 7bd2011e086f6d108e25b4738f2d7cf354ad885d Mon Sep 17 00:00:00 2001 From: Maxim Kadushkin Date: Tue, 21 Apr 2020 11:20:15 +0300 Subject: [PATCH] [desktop] fix bug 45170 --- apps/common/main/lib/controller/Desktop.js | 43 ++++++++++++---------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/apps/common/main/lib/controller/Desktop.js b/apps/common/main/lib/controller/Desktop.js index d5dafa7ea..1e5670f1f 100644 --- a/apps/common/main/lib/controller/Desktop.js +++ b/apps/common/main/lib/controller/Desktop.js @@ -209,32 +209,37 @@ define([ Common.NotificationCenter.trigger('app:config', {canUndock: true}); } - var header = webapp.getController('Viewport').getView('Common.Views.Header'); titlebuttons = {}; - if ( !!header.btnSave ) { - titlebuttons['save'] = {btn: header.btnSave}; + if ( !mode.isEdit ) { + native.execCommand('webapps:features', JSON.stringify( + {version: config.version, eventloading:true, titlebuttons:true, viewmode:true} )); + } else { + var header = webapp.getController('Viewport').getView('Common.Views.Header'); + if (!!header.btnSave) { + titlebuttons['save'] = {btn: header.btnSave}; - var iconname = /\s?([^\s]+)$/.exec(titlebuttons.save.btn.$icon.attr('class')); - !!iconname && iconname.length && (titlebuttons.save.icon = btnsave_icons[iconname]); - } + var iconname = /\s?([^\s]+)$/.exec(titlebuttons.save.btn.$icon.attr('class')); + !!iconname && iconname.length && (titlebuttons.save.icon = btnsave_icons[iconname]); + } - if ( !!header.btnPrint ) - titlebuttons['print'] = {btn: header.btnPrint}; + if (!!header.btnPrint) + titlebuttons['print'] = {btn: header.btnPrint}; - if ( !!header.btnUndo ) - titlebuttons['undo'] = {btn: header.btnUndo}; + if (!!header.btnUndo) + titlebuttons['undo'] = {btn: header.btnUndo}; - if ( !!header.btnRedo ) - titlebuttons['redo'] = {btn: header.btnRedo}; + if (!!header.btnRedo) + titlebuttons['redo'] = {btn: header.btnRedo}; - for (var i in titlebuttons) { - titlebuttons[i].btn.options.signals = ['disabled']; - titlebuttons[i].btn.on('disabled', _onTitleButtonDisabled.bind(this, i)); - } + for (var i in titlebuttons) { + titlebuttons[i].btn.options.signals = ['disabled']; + titlebuttons[i].btn.on('disabled', _onTitleButtonDisabled.bind(this, i)); + } - if (!!titlebuttons.save) { - titlebuttons.save.btn.options.signals.push('icon:changed'); - titlebuttons.save.btn.on('icon:changed', _onSaveIconChanged.bind(this)); + if (!!titlebuttons.save) { + titlebuttons.save.btn.options.signals.push('icon:changed'); + titlebuttons.save.btn.on('icon:changed', _onSaveIconChanged.bind(this)); + } } if ( !!config.callback_editorconfig ) {