Use list_widget.get_selection() rather than list_widget.selection (#5879)

pull/5898/head
JohnDoh 7 years ago committed by Aleksander Machniak
parent e9eb87d6f4
commit afaaa7764b

@ -157,8 +157,8 @@ rcube_webmail.prototype.acl_list_init = function()
// ACL table row selection handler
rcube_webmail.prototype.acl_list_select = function(list)
{
rcmail.enable_command('acl-delete', list.selection.length > 0);
rcmail.enable_command('acl-edit', list.selection.length == 1);
rcmail.enable_command('acl-delete', list.get_selection().length > 0);
rcmail.enable_command('acl-edit', list.get_selection().length == 1);
list.focus();
}
@ -218,8 +218,8 @@ rcube_webmail.prototype.acl_remove_row = function(id)
$('#rcmrow'+id).remove();
this.env.acl[id] = null;
this.enable_command('acl-delete', list.selection.length > 0);
this.enable_command('acl-edit', list.selection.length == 1);
this.enable_command('acl-delete', list.get_selection().length > 0);
this.enable_command('acl-edit', list.get_selection().length == 1);
}
// Adds ACL table row

@ -273,7 +273,7 @@ rcube_webmail.prototype.enigma_keylist_select = function(list)
url = '&_action=plugin.enigmakeys&_a=info&_id=' + id;
this.enigma_loadframe(url);
this.enable_command('plugin.enigma-key-delete', 'plugin.enigma-key-export-selected', list.selection.length > 0);
this.enable_command('plugin.enigma-key-delete', 'plugin.enigma-key-export-selected', list.get_selection().length > 0);
};
rcube_webmail.prototype.enigma_keylist_keypress = function(list)

@ -37,10 +37,11 @@ function plugin_vcard_attach()
{
var id, n, contacts = [],
ts = new Date().getTime(),
args = {_uploadid: ts, _id: rcmail.env.compose_id};
args = {_uploadid: ts, _id: rcmail.env.compose_id},
selection = rcmail.contact_list.get_selection();
for (n=0; n < rcmail.contact_list.selection.length; n++) {
id = rcmail.contact_list.selection[n];
for (n=0; n < selection.length; n++) {
id = selection[n];
if (id && id.charAt(0) != 'E' && rcmail.env.contactdata[id])
contacts.push(id);
}
@ -66,7 +67,8 @@ window.rcmail && rcmail.addEventListener('init', function(evt) {
rcmail.register_command('attach-vcard', function() { plugin_vcard_attach(); });
rcmail.contact_list.addEventListener('select', function(list) {
// TODO: support attaching more than one at once
rcmail.enable_command('attach-vcard', list.selection.length == 1 && rcmail.contact_list.selection[0].charAt(0) != 'E');
var selection = list.get_selection();
rcmail.enable_command('attach-vcard', selection.length == 1 && selection[0].charAt(0) != 'E');
});
}
});

@ -1851,10 +1851,10 @@ function rcube_webmail()
}
}
// Multi-message commands
this.enable_command('delete', 'move', 'copy', 'mark', 'forward', 'forward-attachment', list.selection.length > 0);
this.enable_command('delete', 'move', 'copy', 'mark', 'forward', 'forward-attachment', list.get_selection(false).length > 0);
// reset all-pages-selection
if (selected || (list.selection.length && list.selection.length != list.rowcount))
if (selected || (list.get_selection(false).length && list.get_selection(false).length != list.rowcount))
this.select_all_mode = false;
// start timer for message preview (wait for double click)
@ -3361,7 +3361,7 @@ function rcube_webmail()
if (this.env.skip_deleted) {
count += this.update_thread(uid);
list.remove_row(uid, (this.env.display_next && i == list.selection.length-1));
list.remove_row(uid, (this.env.display_next && i == list.get_selection(false).length-1));
}
else
this.set_message(uid, 'deleted', true);
@ -4419,9 +4419,9 @@ function rcube_webmail()
this.compose_recipient_select = function(list)
{
var id, n, recipients = 0;
for (n=0; n < list.selection.length; n++) {
id = list.selection[n];
var id, n, recipients = 0, selection = list.get_selection();
for (n=0; n < selection.length; n++) {
id = selection[n];
if (this.env.contactdata[id])
recipients++;
}
@ -4436,11 +4436,11 @@ function rcube_webmail()
field = field.length ? field.attr('id').replace('_', '') : 'to';
}
var recipients = [], input = $('#_' + field);
var recipients = [], input = $('#_' + field), selection = this.contact_list.get_selection();
if (this.contact_list && this.contact_list.selection.length) {
for (var id, n=0; n < this.contact_list.selection.length; n++) {
id = this.contact_list.selection[n];
if (this.contact_list && selection.length) {
for (var id, n=0; n < selection.length; n++) {
id = selection[n];
if (id && this.env.contactdata[id]) {
recipients.push(this.env.contactdata[id]);
@ -5852,7 +5852,7 @@ function rcube_webmail()
clearTimeout(this.preview_timer);
var n, id, sid, contact, writable = false,
selected = list.selection.length,
selected = list.get_selection().length,
source = this.env.source ? this.env.address_sources[this.env.source] : null;
// we don't have dblclick handler here, so use 50 instead of this.dblclick_time
@ -5874,10 +5874,11 @@ function rcube_webmail()
this.env.selection_sources.push(this.env.source);
}
for (n in list.selection) {
contact = list.data[list.selection[n]];
var selection = list.get_selection()
for (n in selection) {
contact = list.data[selection[n]];
if (!source) {
sid = String(list.selection[n]).replace(/^[^-]+-/, '');
sid = String(selection[n]).replace(/^[^-]+-/, '');
if (sid && this.env.address_sources[sid]) {
writable = writable || (!this.env.address_sources[sid].readonly && !contact.readonly);
this.env.selection_sources.push(sid);
@ -6391,7 +6392,7 @@ function rcube_webmail()
//remove selected contacts from current active group
this.group_remove_selected = function()
{
this.http_post('group-delmembers', {_cid: this.contact_list.selection,
this.http_post('group-delmembers', {_cid: this.contact_list.get_selection(),
_source: this.env.source, _gid: this.env.group});
};

Loading…
Cancel
Save