From 2b0fc8af7b93609e3f91af89067a65028c639a97 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 6 Aug 2019 16:12:07 +0300 Subject: [PATCH] [SSE] Lock data group buttons --- apps/spreadsheeteditor/main/app/controller/DataTab.js | 7 +++++++ apps/spreadsheeteditor/main/app/view/DataTab.js | 4 ++-- apps/spreadsheeteditor/main/app/view/Toolbar.js | 3 ++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/controller/DataTab.js b/apps/spreadsheeteditor/main/app/controller/DataTab.js index 3f967f4ad..d1875df19 100644 --- a/apps/spreadsheeteditor/main/app/controller/DataTab.js +++ b/apps/spreadsheeteditor/main/app/controller/DataTab.js @@ -78,6 +78,7 @@ define([ if (api) { this.api = api; this.api.asc_registerCallback('asc_onSelectionChanged', _.bind(this.onSelectionChanged, this)); + this.api.asc_registerCallback('asc_onWorksheetLocked', _.bind(this.onWorksheetLocked, this)); this.api.asc_registerCallback('asc_onCoAuthoringDisconnect',_.bind(this.onCoAuthoringDisconnect, this)); Common.NotificationCenter.on('api:disconnect', _.bind(this.onCoAuthoringDisconnect, this)); } @@ -192,6 +193,12 @@ define([ this.api.asc_changeGroupDetails(false); }, + onWorksheetLocked: function(index,locked) { + if (index == this.api.asc_getActiveWorksheetIndex()) { + Common.Utils.lockControls(SSE.enumLock.sheetLock, locked, {array: [this.view.btnGroup, this.view.btnUngroup]}); + } + }, + textWizard: 'Text to Columns Wizard' }, SSE.Controllers.DataTab || {})); diff --git a/apps/spreadsheeteditor/main/app/view/DataTab.js b/apps/spreadsheeteditor/main/app/view/DataTab.js index afd26586a..a44b30e1a 100644 --- a/apps/spreadsheeteditor/main/app/view/DataTab.js +++ b/apps/spreadsheeteditor/main/app/view/DataTab.js @@ -107,7 +107,7 @@ define([ caption: this.capBtnGroup, split: false, disabled: true, - lock: [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth] + lock: [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.sheetLock, _set.lostConnect, _set.coAuth] }); Common.Utils.injectComponent($host.find('#slot-btn-group'), this.btnGroup); this.lockedControls.push(this.btnGroup); @@ -119,7 +119,7 @@ define([ split: true, menu: true, disabled: true, - lock: [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth] + lock: [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.sheetLock, _set.lostConnect, _set.coAuth] }); Common.Utils.injectComponent($host.find('#slot-btn-ungroup'), this.btnUngroup); this.lockedControls.push(this.btnUngroup); diff --git a/apps/spreadsheeteditor/main/app/view/Toolbar.js b/apps/spreadsheeteditor/main/app/view/Toolbar.js index 32cc23def..0e7bb6053 100644 --- a/apps/spreadsheeteditor/main/app/view/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/view/Toolbar.js @@ -89,7 +89,8 @@ define([ printAreaLock: 'print-area-lock', namedRangeLock: 'named-range-lock', multiselectCols:'is-multiselect-cols', - headerLock: 'header-lock' + headerLock: 'header-lock', + sheetLock: 'sheet-lock' }; SSE.Views.Toolbar = Common.UI.Mixtbar.extend(_.extend({