[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, {
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([
'<div class="footer center">',
'<button class="btn normal dlg-btn primary" result="ok">' + t.okButtonText + '</button>',
'<% 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>'
].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());
}

View file

@ -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;
}

View file

@ -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;
}