Fix Overwrite/Skip buttons in copy/move dialog (Bifrost#T57654)

This commit is contained in:
Aleksander Machniak 2017-11-09 12:41:48 +01:00
parent d5d0248a58
commit 65726f4217

View file

@ -890,9 +890,9 @@ function kolab_dialog_submit_handler()
}; };
// Hides dialog // Hides dialog
function kolab_dialog_close(dialog) function kolab_dialog_close(dialog, destroy)
{ {
(rcmail.is_framed() ? window.parent : window).$(dialog).dialog('close'); (rcmail.is_framed() ? window.parent : window).$(dialog).dialog(destroy ? 'destroy' : 'close');
}; };
// smart upload button // smart upload button
@ -3147,7 +3147,7 @@ function kolab_files_ui()
this.file_move_ask_user = function(list, move) this.file_move_ask_user = function(list, move)
{ {
var file = list[0], buttons = {}, var file = list[0], buttons = {},
text = rcmail.gettext('kolab_files.filemoveconfirm').replace('$file', file.dst) text = rcmail.gettext('kolab_files.filemoveconfirm').replace('$file', file.dst),
dialog = $('<div></div>'); dialog = $('<div></div>');
buttons[rcmail.gettext('kolab_files.fileoverwrite')] = function() { buttons[rcmail.gettext('kolab_files.fileoverwrite')] = function() {
@ -3157,7 +3157,8 @@ function kolab_files_ui()
f[file.src] = file.dst; f[file.src] = file.dst;
file_api.file_move_ask_list = list; file_api.file_move_ask_list = list;
file_api.file_move_ask_mode = move; file_api.file_move_ask_mode = move;
dialog.dialog('destroy').remove(); kolab_dialog_close(this, true);
file_api.req = file_api.set_busy(true, move ? 'kolab_files.filemoving' : 'kolab_files.filecopying'); file_api.req = file_api.set_busy(true, move ? 'kolab_files.filemoving' : 'kolab_files.filecopying');
file_api.request(action, {file: f, overwrite: 1}, 'file_move_ask_user_response'); file_api.request(action, {file: f, overwrite: 1}, 'file_move_ask_user_response');
}; };
@ -3167,14 +3168,15 @@ function kolab_files_ui()
var f = {}, action = move ? 'file_move' : 'file_copy'; var f = {}, action = move ? 'file_move' : 'file_copy';
$.each(list, function() { f[this.src] = this.dst; }); $.each(list, function() { f[this.src] = this.dst; });
dialog.dialog('destroy').remove(); kolab_dialog_close(this, true);
file_api.req = file_api.set_busy(true, move ? 'kolab_files.filemoving' : 'kolab_files.filecopying'); file_api.req = file_api.set_busy(true, move ? 'kolab_files.filemoving' : 'kolab_files.filecopying');
file_api.request(action, {file: f, overwrite: 1}, action + '_response'); file_api.request(action, {file: f, overwrite: 1}, action + '_response');
}; };
var skip_func = function() { var skip_func = function() {
list.shift(); list.shift();
dialog.dialog('destroy').remove(); kolab_dialog_close(this, true);
if (list.length) if (list.length)
file_api.file_move_ask_user(list, move); file_api.file_move_ask_user(list, move);
@ -3186,7 +3188,7 @@ function kolab_files_ui()
if (list.length > 1) if (list.length > 1)
buttons[rcmail.gettext('kolab_files.fileskipall')] = function() { buttons[rcmail.gettext('kolab_files.fileskipall')] = function() {
dialog.dialog('destroy').remove(); kolab_dialog_close(this, true);
if (move) if (move)
file_api.file_list(); file_api.file_list();
}; };
@ -3195,6 +3197,7 @@ function kolab_files_ui()
kolab_dialog_show(dialog.html(text), { kolab_dialog_show(dialog.html(text), {
close: skip_func, close: skip_func,
buttons: buttons, buttons: buttons,
height: 50,
minWidth: 400, minWidth: 400,
width: 400 width: 400
}); });