From fdbdcc2fd2bb77e80e9aac381c1f769d534d1fce Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 25 Jul 2018 14:40:51 +0300 Subject: [PATCH] [DE][SSE] Enable closing window when save to txt/csv --- apps/common/main/lib/view/OpenDialog.js | 7 ++++--- apps/documenteditor/main/app/controller/Main.js | 13 ++++++++----- apps/spreadsheeteditor/main/app/controller/Main.js | 13 ++++++++----- 3 files changed, 20 insertions(+), 13 deletions(-) diff --git a/apps/common/main/lib/view/OpenDialog.js b/apps/common/main/lib/view/OpenDialog.js index f70e6defd..5c4ead4d9 100644 --- a/apps/common/main/lib/view/OpenDialog.js +++ b/apps/common/main/lib/view/OpenDialog.js @@ -64,7 +64,8 @@ define([ } _.extend(_options, { - closable : false, + mode : 1, // open settings + closable : (options.mode==2), // if save settings preview : options.preview, warning : options.warning, width : width, @@ -130,7 +131,7 @@ define([ '' ].join(''); @@ -228,7 +229,7 @@ define([ delimiter = this.cmbDelimiter ? this.cmbDelimiter.getValue() : null, delimiterChar = (delimiter == -1) ? this.inputDelimiter.getValue() : null; (delimiter == -1) && (delimiter = null); - this.handler.call(this, encoding, delimiter, delimiterChar); + this.handler.call(this, state, encoding, delimiter, delimiterChar); } else { this.handler.call(this, state, this.inputPwd.getValue()); } diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index 9db9586a6..0e1c790c3 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -1855,23 +1855,26 @@ define([ this.getApplication().getController('Toolbar').getView().updateMetricUnit(); }, - onAdvancedOptions: function(advOptions) { + onAdvancedOptions: function(advOptions, mode) { if (this._state.openDlg) return; var type = advOptions.asc_getOptionId(), me = this; if (type == Asc.c_oAscAdvancedOptionsID.TXT) { me._state.openDlg = new Common.Views.OpenDialog({ + mode: mode, type: type, preview: advOptions.asc_getOptions().asc_getData(), codepages: advOptions.asc_getOptions().asc_getCodePages(), settings: advOptions.asc_getOptions().asc_getRecommendedSettings(), api: me.api, - handler: function (encoding) { + handler: function (result, encoding) { me.isShowOpenDialog = false; - if (me && me.api) { - me.api.asc_setAdvancedOptions(type, new Asc.asc_CTXTAdvancedOptions(encoding)); - me.loadMask && me.loadMask.show(); + if (result == 'ok') { + if (me && me.api) { + me.api.asc_setAdvancedOptions(type, new Asc.asc_CTXTAdvancedOptions(encoding)); + me.loadMask && me.loadMask.show(); + } } me._state.openDlg = null; } diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index 1d8a658d1..a64362d46 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -1525,23 +1525,26 @@ define([ return false; }, - onAdvancedOptions: function(advOptions) { + onAdvancedOptions: function(advOptions, mode) { if (this._state.openDlg) return; var type = advOptions.asc_getOptionId(), me = this; if (type == Asc.c_oAscAdvancedOptionsID.CSV) { me._state.openDlg = new Common.Views.OpenDialog({ + mode: mode, type: type, preview: advOptions.asc_getOptions().asc_getData(), codepages: advOptions.asc_getOptions().asc_getCodePages(), settings: advOptions.asc_getOptions().asc_getRecommendedSettings(), api: me.api, - handler: function (encoding, delimiter, delimiterChar) { + handler: function (result, encoding, delimiter, delimiterChar) { me.isShowOpenDialog = false; - if (me && me.api) { - me.api.asc_setAdvancedOptions(type, new Asc.asc_CCSVAdvancedOptions(encoding, delimiter, delimiterChar)); - me.loadMask && me.loadMask.show(); + if (result == 'ok') { + if (me && me.api) { + me.api.asc_setAdvancedOptions(type, new Asc.asc_CCSVAdvancedOptions(encoding, delimiter, delimiterChar)); + me.loadMask && me.loadMask.show(); + } } me._state.openDlg = null; }