From 24b03043f42a5e8f95c718f245de47d53b736bd2 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 23 May 2018 14:43:30 +0300 Subject: [PATCH] Fix Bug 37511 --- .../mobile/app/controller/DocumentHolder.js | 1 + apps/documenteditor/mobile/app/controller/Main.js | 1 + .../mobile/app/controller/Toolbar.js | 7 +++++++ .../mobile/app/controller/DocumentHolder.js | 1 + .../mobile/app/controller/Toolbar.js | 7 +++++++ .../mobile/app/controller/CellEditor.js | 15 +++------------ .../mobile/app/controller/DocumentHolder.js | 1 + .../mobile/app/controller/Main.js | 1 + .../mobile/app/controller/Statusbar.js | 2 +- .../mobile/app/controller/Toolbar.js | 7 +++++++ 10 files changed, 30 insertions(+), 13 deletions(-) diff --git a/apps/documenteditor/mobile/app/controller/DocumentHolder.js b/apps/documenteditor/mobile/app/controller/DocumentHolder.js index 429e52262..ebb27a41a 100644 --- a/apps/documenteditor/mobile/app/controller/DocumentHolder.js +++ b/apps/documenteditor/mobile/app/controller/DocumentHolder.js @@ -89,6 +89,7 @@ define([ me.api.asc_registerCallback('asc_onConnectionStateChanged', _.bind(me.onApiUserConnection, me)); me.api.asc_registerCallback('asc_onDocumentContentReady', _.bind(me.onApiDocumentContentReady, me)); Common.NotificationCenter.on('api:disconnect', _.bind(me.onCoAuthoringDisconnect, me)); + me.api.asc_registerCallback('asc_onCoAuthoringDisconnect', _.bind(me.onCoAuthoringDisconnect,me)); me.api.asc_coAuthoringGetUsers(); }, diff --git a/apps/documenteditor/mobile/app/controller/Main.js b/apps/documenteditor/mobile/app/controller/Main.js index bf1613b60..c50b29815 100644 --- a/apps/documenteditor/mobile/app/controller/Main.js +++ b/apps/documenteditor/mobile/app/controller/Main.js @@ -278,6 +278,7 @@ define([ old_rights = this._state.lostEditingRights; this._state.lostEditingRights = !this._state.lostEditingRights; this.api.asc_coAuthoringDisconnect(); + Common.NotificationCenter.trigger('api:disconnect'); if (!old_rights) { uiApp.alert( diff --git a/apps/documenteditor/mobile/app/controller/Toolbar.js b/apps/documenteditor/mobile/app/controller/Toolbar.js index d4fc90d9d..4293e2b3e 100644 --- a/apps/documenteditor/mobile/app/controller/Toolbar.js +++ b/apps/documenteditor/mobile/app/controller/Toolbar.js @@ -79,6 +79,7 @@ define([ this.api.asc_registerCallback('asc_onCanUndo', _.bind(this.onApiCanRevert, this, 'undo')); this.api.asc_registerCallback('asc_onCanRedo', _.bind(this.onApiCanRevert, this, 'redo')); this.api.asc_registerCallback('asc_onFocusObject', _.bind(this.onApiFocusObject, this)); + this.api.asc_registerCallback('asc_onCoAuthoringDisconnect', _.bind(this.onCoAuthoringDisconnect, this)); Common.NotificationCenter.on('api:disconnect', _.bind(this.onCoAuthoringDisconnect, this)); }, @@ -176,6 +177,12 @@ define([ onCoAuthoringDisconnect: function() { this.isDisconnected = true; + this.deactivateEditControls(); + $('#toolbar-undo').toggleClass('disabled', true); + $('#toolbar-redo').toggleClass('disabled', true); + DE.getController('AddContainer').hideModal(); + DE.getController('EditContainer').hideModal(); + DE.getController('Settings').hideModal(); }, dlgLeaveTitleText : 'You leave the application', diff --git a/apps/presentationeditor/mobile/app/controller/DocumentHolder.js b/apps/presentationeditor/mobile/app/controller/DocumentHolder.js index b99d25e59..0746d7c6a 100644 --- a/apps/presentationeditor/mobile/app/controller/DocumentHolder.js +++ b/apps/presentationeditor/mobile/app/controller/DocumentHolder.js @@ -82,6 +82,7 @@ define([ me.api.asc_registerCallback('asc_onHidePopMenu', _.bind(me.onApiHidePopMenu, me)); me.api.asc_registerCallback('asc_onDocumentContentReady', _.bind(me.onApiDocumentContentReady, me)); Common.NotificationCenter.on('api:disconnect', _.bind(me.onCoAuthoringDisconnect, me)); + me.api.asc_registerCallback('asc_onCoAuthoringDisconnect', _.bind(me.onCoAuthoringDisconnect,me)); }, setMode: function (mode) { diff --git a/apps/presentationeditor/mobile/app/controller/Toolbar.js b/apps/presentationeditor/mobile/app/controller/Toolbar.js index 86a943b5b..65670c686 100644 --- a/apps/presentationeditor/mobile/app/controller/Toolbar.js +++ b/apps/presentationeditor/mobile/app/controller/Toolbar.js @@ -79,6 +79,7 @@ define([ this.api.asc_registerCallback('asc_onCanUndo', _.bind(this.onApiCanRevert, this, 'undo')); this.api.asc_registerCallback('asc_onCanRedo', _.bind(this.onApiCanRevert, this, 'redo')); this.api.asc_registerCallback('asc_onFocusObject', _.bind(this.onApiFocusObject, this)); + this.api.asc_registerCallback('asc_onCoAuthoringDisconnect', _.bind(this.onCoAuthoringDisconnect, this)); Common.NotificationCenter.on('api:disconnect', _.bind(this.onCoAuthoringDisconnect, this)); }, @@ -187,6 +188,12 @@ define([ onCoAuthoringDisconnect: function() { this.isDisconnected = true; + this.deactivateEditControls(); + $('#toolbar-undo').toggleClass('disabled', true); + $('#toolbar-redo').toggleClass('disabled', true); + PE.getController('AddContainer').hideModal(); + PE.getController('EditContainer').hideModal(); + PE.getController('Settings').hideModal(); }, dlgLeaveTitleText : 'You leave the application', diff --git a/apps/spreadsheeteditor/mobile/app/controller/CellEditor.js b/apps/spreadsheeteditor/mobile/app/controller/CellEditor.js index 211fbbf82..082b2c530 100644 --- a/apps/spreadsheeteditor/mobile/app/controller/CellEditor.js +++ b/apps/spreadsheeteditor/mobile/app/controller/CellEditor.js @@ -84,8 +84,8 @@ define([ this.api.asc_registerCallback('asc_onSelectionNameChanged', _.bind(this.onApiCellSelection, this)); this.api.asc_registerCallback('asc_onEditCell', _.bind(this.onApiEditCell, this)); this.api.asc_registerCallback('asc_onFormulaCompleteMenu', _.bind(this.onFormulaCompleteMenu, this)); - // this.api.asc_registerCallback('asc_onCoAuthoringDisconnect', _.bind(this.onApiDisconnect,this)); - // Common.NotificationCenter.on('api:disconnect', _.bind(this.onApiDisconnect, this)); + this.api.asc_registerCallback('asc_onCoAuthoringDisconnect', _.bind(this.onApiDisconnect,this)); + Common.NotificationCenter.on('api:disconnect', _.bind(this.onApiDisconnect, this)); // Common.NotificationCenter.on('cells:range', _.bind(this.onCellsRange, this)); // this.api.asc_registerCallback('asc_onInputKeyDown', _.bind(this.onInputKeyDown, this)); @@ -133,16 +133,7 @@ define([ onApiDisconnect: function() { this.mode.isEdit = false; - - var controller = this.getApplication().getController('FormulaDialog'); - if (controller) { - controller.hideDialog(); - } - - if (!this.mode.isEdit) { - $('#ce-func-label', this.editor.el).addClass('disabled'); - this.editor.btnNamedRanges.setVisible(false); - } + $('#ce-function').addClass('disabled'); }, onCellsRange: function(status) { diff --git a/apps/spreadsheeteditor/mobile/app/controller/DocumentHolder.js b/apps/spreadsheeteditor/mobile/app/controller/DocumentHolder.js index 033f64527..5064e153b 100644 --- a/apps/spreadsheeteditor/mobile/app/controller/DocumentHolder.js +++ b/apps/spreadsheeteditor/mobile/app/controller/DocumentHolder.js @@ -83,6 +83,7 @@ define([ this.api.asc_registerCallback('asc_onShowPopMenu', _.bind(this.onApiShowPopMenu, this)); this.api.asc_registerCallback('asc_onHidePopMenu', _.bind(this.onApiHidePopMenu, this)); Common.NotificationCenter.on('api:disconnect', _.bind(this.onCoAuthoringDisconnect, this)); + this.api.asc_registerCallback('asc_onCoAuthoringDisconnect', _.bind(this.onCoAuthoringDisconnect,this)); }, setMode: function (mode) { diff --git a/apps/spreadsheeteditor/mobile/app/controller/Main.js b/apps/spreadsheeteditor/mobile/app/controller/Main.js index e7abc7cfd..227af72ff 100644 --- a/apps/spreadsheeteditor/mobile/app/controller/Main.js +++ b/apps/spreadsheeteditor/mobile/app/controller/Main.js @@ -279,6 +279,7 @@ define([ old_rights = this._state.lostEditingRights; this._state.lostEditingRights = !this._state.lostEditingRights; this.api.asc_coAuthoringDisconnect(); + Common.NotificationCenter.trigger('api:disconnect'); if (!old_rights) { uiApp.alert( diff --git a/apps/spreadsheeteditor/mobile/app/controller/Statusbar.js b/apps/spreadsheeteditor/mobile/app/controller/Statusbar.js index 5a7307c1c..af7700a4c 100644 --- a/apps/spreadsheeteditor/mobile/app/controller/Statusbar.js +++ b/apps/spreadsheeteditor/mobile/app/controller/Statusbar.js @@ -100,7 +100,7 @@ define([ setApi: function(api) { this.api = api; this.api.asc_registerCallback('asc_onCoAuthoringDisconnect', _.bind(this.onApiDisconnect, this)); - // Common.NotificationCenter.on('api:disconnect', _.bind(this.onApiDisconnect, this)); + Common.NotificationCenter.on('api:disconnect', _.bind(this.onApiDisconnect, this)); // this.api.asc_registerCallback('asc_onUpdateTabColor', _.bind(this.onApiUpdateTabColor, this)); // this.api.asc_registerCallback('asc_onEditCell', _.bind(this.onApiEditCell, this)); this.api.asc_registerCallback('asc_onWorkbookLocked', _.bind(this.onWorkbookLocked, this)); diff --git a/apps/spreadsheeteditor/mobile/app/controller/Toolbar.js b/apps/spreadsheeteditor/mobile/app/controller/Toolbar.js index caa7c8596..b64e3c87f 100644 --- a/apps/spreadsheeteditor/mobile/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/mobile/app/controller/Toolbar.js @@ -86,6 +86,7 @@ define([ this.api.asc_registerCallback('asc_onWorkbookLocked', _.bind(this.onApiWorkbookLocked, this)); this.api.asc_registerCallback('asc_onWorksheetLocked', _.bind(this.onApiWorksheetLocked, this)); this.api.asc_registerCallback('asc_onActiveSheetChanged', _.bind(this.onApiActiveSheetChanged, this)); + this.api.asc_registerCallback('asc_onCoAuthoringDisconnect', _.bind(this.onCoAuthoringDisconnect, this)); Common.NotificationCenter.on('api:disconnect', _.bind(this.onCoAuthoringDisconnect, this)); Common.NotificationCenter.on('sheet:active', this.onApiActiveSheetChanged.bind(this)); @@ -210,6 +211,12 @@ define([ onCoAuthoringDisconnect: function() { this.isDisconnected = true; + this.deactivateEditControls(); + $('#toolbar-undo').toggleClass('disabled', true); + $('#toolbar-redo').toggleClass('disabled', true); + SSE.getController('AddContainer').hideModal(); + SSE.getController('EditContainer').hideModal(); + SSE.getController('Settings').hideModal(); }, dlgLeaveTitleText : 'You leave the application',