From 41105c00ef9980e5bcfc22a321e6e358be4a95cb Mon Sep 17 00:00:00 2001 From: JuliaSvinareva Date: Thu, 13 May 2021 18:37:00 +0300 Subject: [PATCH] [SSE mobile] Bug 48623 (Moved code from main controller, removed unused code) --- apps/spreadsheeteditor/mobile/locale/en.json | 29 ++-- .../mobile/src/controller/LongActions.jsx | 34 ++++- .../mobile/src/controller/Main.jsx | 127 ------------------ 3 files changed, 41 insertions(+), 149 deletions(-) diff --git a/apps/spreadsheeteditor/mobile/locale/en.json b/apps/spreadsheeteditor/mobile/locale/en.json index 8dd7c5218..55d00ec13 100644 --- a/apps/spreadsheeteditor/mobile/locale/en.json +++ b/apps/spreadsheeteditor/mobile/locale/en.json @@ -59,26 +59,7 @@ "errorProcessSaveResult": "Saving is failed.", "criticalErrorTitle": "Error", "warnProcessRightsChange": "You have been denied the right to edit the file.", - "errorAccessDeny": "You are trying to perform an action you do not have rights for.
Please contact your Document Server administrator.", - "confirmMoveCellRange": "The destination cell`s range can contain data. Continue the operation?", - "textOk": "Ok", - "confirmPutMergeRange": "The source data contains merged cells.
They will be unmerged before they are pasted into the table.", - - "openTitleText": "Opening Document", - "saveTitleText": "Saving Document", - "loadFontsTitleText": "Loading Data", - "loadImagesTitleText": "Loading Images", - "loadFontTitleText": "Loading Data", - "loadImageTitleText": "Loading Image", - "downloadTitleText": "Downloading Document", - "printTitleText": "Printing Document", - "uploadImageTitleText": "Uploading Image", - "titleRecalcFormulas": "Calculating formulas...", - "textPleaseWait": "It`s working hard. Please wait...", - "savePreparingText": "Preparing to save", - "waitText": "Please, wait...", - "txtEditingMode": "Set editing mode...", - "loadingDocumentTitleText": "Loading spreadsheet" + "errorAccessDeny": "You are trying to perform an action you do not have rights for.
Please contact your Document Server administrator." } }, "LongActions": { @@ -108,7 +89,13 @@ "txtEditingMode": "Set editing mode...", "loadingDocumentTitleText": "Loading document", "loadingDocumentTextText": "Loading document...", - "textLoadingDocument": "Loading document" + "textLoadingDocument": "Loading document", + + "notcriticalErrorTitle": "Warning", + "textOk": "Ok", + "textNo": "No", + "confirmMoveCellRange": "The destination cell`s range can contain data. Continue the operation?", + "confirmPutMergeRange": "The source data contains merged cells.
They will be unmerged before they are pasted into the table." }, "Error": { "criticalErrorTitle": "Error", diff --git a/apps/spreadsheeteditor/mobile/src/controller/LongActions.jsx b/apps/spreadsheeteditor/mobile/src/controller/LongActions.jsx index 08127984b..c5889ab5b 100644 --- a/apps/spreadsheeteditor/mobile/src/controller/LongActions.jsx +++ b/apps/spreadsheeteditor/mobile/src/controller/LongActions.jsx @@ -28,6 +28,7 @@ const LongActionsController = () => { api.asc_registerCallback('asc_onStartAction', onLongActionBegin); api.asc_registerCallback('asc_onEndAction', onLongActionEnd); api.asc_registerCallback('asc_onOpenDocumentProgress', onOpenDocument); + api.asc_registerCallback('asc_onConfirmAction', onConfirmAction); }); Common.Notifications.on('preloader:endAction', onLongActionEnd); Common.Notifications.on('preloader:beginAction', onLongActionBegin); @@ -38,6 +39,7 @@ const LongActionsController = () => { api.asc_unregisterCallback('asc_onStartAction', onLongActionBegin); api.asc_unregisterCallback('asc_onEndAction', onLongActionEnd); api.asc_unregisterCallback('asc_onOpenDocumentProgress', onOpenDocument); + api.asc_unregisterCallback('asc_onConfirmAction', onConfirmAction); Common.Notifications.off('preloader:endAction', onLongActionEnd); Common.Notifications.off('preloader:beginAction', onLongActionBegin); @@ -178,6 +180,36 @@ const LongActionsController = () => { }; + const onConfirmAction = (id, apiCallback) => { + if (id === Asc.c_oAscConfirm.ConfirmReplaceRange) { + f7.dialog.create({ + title: _t.notcriticalErrorTitle, + text: _t.confirmMoveCellRange, + buttons: [ + {text: _t.textYes, + onClick: () => { + if (apiCallback) apiCallback(true); + }}, + {text: _t.textNo, + onClick: () => { + if (apiCallback) apiCallback(false); + }} + ], + }).open(); + } else if (id === Asc.c_oAscConfirm.ConfirmPutMergeRange) { + f7.dialog.create({ + title: _t.notcriticalErrorTitle, + text: _t.confirmPutMergeRange, + buttons: [ + {text: _t.textOk, + onClick: () => { + if (apiCallback) apiCallback(); + }}, + ], + }).open(); + } + }; + const onOpenDocument = (progress) => { if (loadMask && loadMask.el) { const $title = loadMask.el.getElementsByClassName('dialog-title')[0]; @@ -185,7 +217,7 @@ const LongActionsController = () => { $title.innerHTML = `${_t.textLoadingDocument}: ${Math.min(Math.round(proc * 100), 100)}%`; } - } + }; return null; }; diff --git a/apps/spreadsheeteditor/mobile/src/controller/Main.jsx b/apps/spreadsheeteditor/mobile/src/controller/Main.jsx index 688091d58..ff4d90652 100644 --- a/apps/spreadsheeteditor/mobile/src/controller/Main.jsx +++ b/apps/spreadsheeteditor/mobile/src/controller/Main.jsx @@ -298,8 +298,6 @@ class MainController extends Component { this.api.asc_registerCallback('asc_onPrint', this.onPrint.bind(this)); this.api.asc_registerCallback('asc_onDocumentName', this.onDocumentName.bind(this)); this.api.asc_registerCallback('asc_onEndAction', this._onLongActionEnd.bind(this)); - // this.api.asc_registerCallback('asc_onStartAction', this.onLongActionBegin.bind(this)); - this.api.asc_registerCallback('asc_onConfirmAction', this.onConfirmAction.bind(this)); EditorUIController.initCellInfo && EditorUIController.initCellInfo(this.props); @@ -326,131 +324,6 @@ class MainController extends Component { } - // onLongActionBegin(type, id) { - // let action = {id: id, type: type}; - // this.setLongActionView(action); - // } - - // setLongActionView(action) { - // const _t = this._t; - // let title = ''; - - // switch (action.id) { - // case Asc.c_oAscAsyncAction.Open: - // title = _t.openTitleText; - // break; - - // case Asc.c_oAscAsyncAction.Save: - // title = _t.saveTitleText; - // break; - - // case Asc.c_oAscAsyncAction.ForceSaveTimeout: - // break; - - // case Asc.c_oAscAsyncAction.ForceSaveButton: - // break; - - // case Asc.c_oAscAsyncAction.LoadDocumentFonts: - // title = _t.loadFontsTitleText; - // break; - - // case Asc.c_oAscAsyncAction.LoadDocumentImages: - // title = _t.loadImagesTitleText; - // break; - - // case Asc.c_oAscAsyncAction.LoadFont: - // title = _t.loadFontTitleText; - // break; - - // case Asc.c_oAscAsyncAction.LoadImage: - // title = _t.loadImageTitleText; - // break; - - // case Asc.c_oAscAsyncAction.DownloadAs: - // title = _t.downloadTitleText; - // break; - - // case Asc.c_oAscAsyncAction.Print: - // title = _t.printTitleText; - // break; - - // case Asc.c_oAscAsyncAction.UploadImage: - // title = _t.uploadImageTitleText; - // break; - - // case Asc.c_oAscAsyncAction.Recalc: - // title = _t.titleRecalcFormulas; - // break; - - // case Asc.c_oAscAsyncAction.SlowOperation: - // title = _t.textPleaseWait; - // break; - - // case Asc.c_oAscAsyncAction['PrepareToSave']: - // title = _t.savePreparingText; - // break; - - // case Asc.c_oAscAsyncAction['Waiting']: - // title = _t.waitText; - // break; - - // case this.ApplyEditRights: - // title = _t.txtEditingMode; - // break; - - // case this.LoadingDocument: - // title = _t.loadingDocumentTitleText; - // break; - // default: - // if (typeof action.id == 'string'){ - // title = action.id; - // } - // break; - // } - - // if (action.type == Asc.c_oAscAsyncActionType.BlockInteraction) { - // // !this.loadMask && (this.loadMask = new Common.UI.LoadMask({owner: $$('#viewport')})); - // // this.loadMask.setTitle(title); - - // if (!this.isShowOpenDialog) { - // this.api.asc_enableKeyEvents(false); - // // this.loadMask.show(); - // } - // } - // } - - onConfirmAction(id, apiCallback) { - const _t = this._t; - - if (id == Asc.c_oAscConfirm.ConfirmReplaceRange) { - f7.dialog.create({ - title: _t.notcriticalErrorTitle, - text: _t.confirmMoveCellRange, - buttons: [ - {text: _t.textYes, - onClick: () => { - if (apiCallback) apiCallback(true); - }}, - {text: _t.textNo, - onClick: () => { - if (apiCallback) apiCallback(false); - }} - ], - }).open(); - } else if (id == Asc.c_oAscConfirm.ConfirmPutMergeRange) { - f7.dialog.create({ - title: _t.notcriticalErrorTitle, - text: _t.confirmPutMergeRange, - buttons: [ - {text: _t.textOk, - onClick: () => { - if (apiCallback) apiCallback(); - }}, - ], - }).open(); - } - } - _onLongActionEnd(type, id) { if ( type === Asc.c_oAscAsyncActionType.BlockInteraction && id == Asc.c_oAscAsyncAction.Open ) { Common.Gateway.internalMessage('documentReady', {});