From 52818559ce020e551addd125ac8382bdda020f46 Mon Sep 17 00:00:00 2001 From: alecpl Date: Sun, 31 May 2009 11:12:04 +0000 Subject: - Added possibility to invert messages selection --- program/js/app.js | 5 ++++- program/js/list.js | 24 ++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) (limited to 'program/js') diff --git a/program/js/app.js b/program/js/app.js index 18a4f1ae3..5e323e229 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -826,7 +826,10 @@ function rcube_webmail() break; case 'select-all': - this.message_list.select_all(props); + if (props == 'invert') + this.message_list.invert_selection(); + else + this.message_list.select_all(props); break; case 'select-none': diff --git a/program/js/list.js b/program/js/list.js index addd1e652..51889fa30 100644 --- a/program/js/list.js +++ b/program/js/list.js @@ -529,6 +529,30 @@ select_all: function(filter) }, +/** + * Invert selection + */ +invert_selection: function() +{ + if (!this.rows || !this.rows.length) + return false; + + // remember old selection + var select_before = this.selection.join(','); + + for (var n in this.rows) + this.highlight_row(n, true); + + // trigger event if selection changed + if (this.selection.join(',') != select_before) + this.triggerEvent('select'); + + this.focus(); + + return true; +}, + + /** * Unselect selected row(s) */ -- cgit v1.2.3