[DE][SSE] Enable closing window when save to txt/csv

This commit is contained in:
Julia Radzhabova 2018-07-25 14:40:51 +03:00
parent 990064c7ed
commit fdbdcc2fd2
3 changed files with 20 additions and 13 deletions

View file

@ -64,7 +64,8 @@ define([
} }
_.extend(_options, { _.extend(_options, {
closable : false, mode : 1, // open settings
closable : (options.mode==2), // if save settings
preview : options.preview, preview : options.preview,
warning : options.warning, warning : options.warning,
width : width, width : width,
@ -130,7 +131,7 @@ define([
'<div class="footer center">', '<div class="footer center">',
'<button class="btn normal dlg-btn primary" result="ok">' + t.okButtonText + '</button>', '<button class="btn normal dlg-btn primary" result="ok">' + t.okButtonText + '</button>',
'<% if (closable) { %>', '<% if (closable) { %>',
'<button class="btn normal dlg-btn" result="cancel" style="margin-left:10px;">' + t.closeButtonText + '</button>', '<button class="btn normal dlg-btn" result="cancel" style="margin-left:10px;">' + ((_options.mode == 1) ? t.closeButtonText : t.cancelButtonText) + '</button>',
'<% } %>', '<% } %>',
'</div>' '</div>'
].join(''); ].join('');
@ -228,7 +229,7 @@ define([
delimiter = this.cmbDelimiter ? this.cmbDelimiter.getValue() : null, delimiter = this.cmbDelimiter ? this.cmbDelimiter.getValue() : null,
delimiterChar = (delimiter == -1) ? this.inputDelimiter.getValue() : null; delimiterChar = (delimiter == -1) ? this.inputDelimiter.getValue() : null;
(delimiter == -1) && (delimiter = null); (delimiter == -1) && (delimiter = null);
this.handler.call(this, encoding, delimiter, delimiterChar); this.handler.call(this, state, encoding, delimiter, delimiterChar);
} else { } else {
this.handler.call(this, state, this.inputPwd.getValue()); this.handler.call(this, state, this.inputPwd.getValue());
} }

View file

@ -1855,23 +1855,26 @@ define([
this.getApplication().getController('Toolbar').getView().updateMetricUnit(); this.getApplication().getController('Toolbar').getView().updateMetricUnit();
}, },
onAdvancedOptions: function(advOptions) { onAdvancedOptions: function(advOptions, mode) {
if (this._state.openDlg) return; if (this._state.openDlg) return;
var type = advOptions.asc_getOptionId(), var type = advOptions.asc_getOptionId(),
me = this; me = this;
if (type == Asc.c_oAscAdvancedOptionsID.TXT) { if (type == Asc.c_oAscAdvancedOptionsID.TXT) {
me._state.openDlg = new Common.Views.OpenDialog({ me._state.openDlg = new Common.Views.OpenDialog({
mode: mode,
type: type, type: type,
preview: advOptions.asc_getOptions().asc_getData(), preview: advOptions.asc_getOptions().asc_getData(),
codepages: advOptions.asc_getOptions().asc_getCodePages(), codepages: advOptions.asc_getOptions().asc_getCodePages(),
settings: advOptions.asc_getOptions().asc_getRecommendedSettings(), settings: advOptions.asc_getOptions().asc_getRecommendedSettings(),
api: me.api, api: me.api,
handler: function (encoding) { handler: function (result, encoding) {
me.isShowOpenDialog = false; me.isShowOpenDialog = false;
if (me && me.api) { if (result == 'ok') {
me.api.asc_setAdvancedOptions(type, new Asc.asc_CTXTAdvancedOptions(encoding)); if (me && me.api) {
me.loadMask && me.loadMask.show(); me.api.asc_setAdvancedOptions(type, new Asc.asc_CTXTAdvancedOptions(encoding));
me.loadMask && me.loadMask.show();
}
} }
me._state.openDlg = null; me._state.openDlg = null;
} }

View file

@ -1525,23 +1525,26 @@ define([
return false; return false;
}, },
onAdvancedOptions: function(advOptions) { onAdvancedOptions: function(advOptions, mode) {
if (this._state.openDlg) return; if (this._state.openDlg) return;
var type = advOptions.asc_getOptionId(), var type = advOptions.asc_getOptionId(),
me = this; me = this;
if (type == Asc.c_oAscAdvancedOptionsID.CSV) { if (type == Asc.c_oAscAdvancedOptionsID.CSV) {
me._state.openDlg = new Common.Views.OpenDialog({ me._state.openDlg = new Common.Views.OpenDialog({
mode: mode,
type: type, type: type,
preview: advOptions.asc_getOptions().asc_getData(), preview: advOptions.asc_getOptions().asc_getData(),
codepages: advOptions.asc_getOptions().asc_getCodePages(), codepages: advOptions.asc_getOptions().asc_getCodePages(),
settings: advOptions.asc_getOptions().asc_getRecommendedSettings(), settings: advOptions.asc_getOptions().asc_getRecommendedSettings(),
api: me.api, api: me.api,
handler: function (encoding, delimiter, delimiterChar) { handler: function (result, encoding, delimiter, delimiterChar) {
me.isShowOpenDialog = false; me.isShowOpenDialog = false;
if (me && me.api) { if (result == 'ok') {
me.api.asc_setAdvancedOptions(type, new Asc.asc_CCSVAdvancedOptions(encoding, delimiter, delimiterChar)); if (me && me.api) {
me.loadMask && me.loadMask.show(); me.api.asc_setAdvancedOptions(type, new Asc.asc_CCSVAdvancedOptions(encoding, delimiter, delimiterChar));
me.loadMask && me.loadMask.show();
}
} }
me._state.openDlg = null; me._state.openDlg = null;
} }