From 52818559ce020e551addd125ac8382bdda020f46 Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Sun, 31 May 2009 07:12:04 -0400
Subject: [PATCH] - Added possibility to invert messages selection

---
 program/js/list.js                    |   24 ++++++++++++++++++++++++
 CHANGELOG                             |    1 +
 skins/default/templates/mail.html     |    2 ++
 program/localization/fi_FI/labels.inc |    1 -
 program/localization/et_EE/labels.inc |    1 -
 program/localization/en_US/labels.inc |    2 +-
 program/localization/pl_PL/labels.inc |    3 ++-
 program/localization/nl_NL/labels.inc |    1 -
 program/js/app.js                     |    5 ++++-
 program/localization/en_GB/labels.inc |    2 +-
 10 files changed, 35 insertions(+), 7 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index e5872b2..74181f5 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,7 @@
 CHANGELOG RoundCube Webmail
 ===========================
 
+- Added possibility to invert messages selection
 - After move/delete from 'show' action display next message instead of messages list (#1485887)
 - Fixed problem with double quote at the end of folder name (#1485884)
 - Speedup UI by using CSS sprites and etags/expires/deflate in Apache config (#1484858,#1485800)
diff --git a/program/js/app.js b/program/js/app.js
index 18a4f1a..5e323e2 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -826,7 +826,10 @@
         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 addd1e6..51889fa 100644
--- a/program/js/list.js
+++ b/program/js/list.js
@@ -530,6 +530,30 @@
 
 
 /**
+ * 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)
  */
 clear_selection: function(id)
diff --git a/program/localization/en_GB/labels.inc b/program/localization/en_GB/labels.inc
index 26af229..5f09567 100644
--- a/program/localization/en_GB/labels.inc
+++ b/program/localization/en_GB/labels.inc
@@ -116,13 +116,13 @@
 $labels['markunread'] = 'As unread';
 $labels['markflagged'] = 'As flagged';
 $labels['markunflagged'] = 'As unflagged';
-$labels['messagemenu'] = 'Message menu';
 $labels['select'] = 'Select';
 $labels['all'] = 'All';
 $labels['none'] = 'None';
 $labels['unread'] = 'Unread';
 $labels['flagged'] = 'Flagged';
 $labels['unanswered'] = 'Unanswered';
+$labels['invert'] = 'Invert';
 $labels['filter'] = 'Filter';
 $labels['compact'] = 'Compact';
 $labels['empty'] = 'Empty';
diff --git a/program/localization/en_US/labels.inc b/program/localization/en_US/labels.inc
index 0e26fc6..a18bef1 100644
--- a/program/localization/en_US/labels.inc
+++ b/program/localization/en_US/labels.inc
@@ -143,7 +143,6 @@
 $labels['markflagged']      = 'As flagged';
 $labels['markunflagged']    = 'As unflagged';
 $labels['messageactions']   = 'More actions...';
-$labels['messagemenu']      = 'Message menu';
 
 $labels['select'] = 'Select';
 $labels['all'] = 'All';
@@ -151,6 +150,7 @@
 $labels['unread'] = 'Unread';
 $labels['flagged'] = 'Flagged';
 $labels['unanswered'] = 'Unanswered';
+$labels['invert'] = 'Invert';
 $labels['filter'] = 'Filter';
 
 $labels['compact'] = 'Compact';
diff --git a/program/localization/et_EE/labels.inc b/program/localization/et_EE/labels.inc
index 08a8a48..7644ce5 100644
--- a/program/localization/et_EE/labels.inc
+++ b/program/localization/et_EE/labels.inc
@@ -116,7 +116,6 @@
 $labels['markunread'] = 'Mitte loetuks';
 $labels['markflagged'] = 'Lisa lipik';
 $labels['markunflagged'] = 'Eemalda lipik';
-$labels['messagemenu'] = 'Kirjade menüü';
 $labels['select'] = 'Vali';
 $labels['all'] = 'kõik';
 $labels['none'] = 'mitte midagi';
diff --git a/program/localization/fi_FI/labels.inc b/program/localization/fi_FI/labels.inc
index eba03a1..e783758 100644
--- a/program/localization/fi_FI/labels.inc
+++ b/program/localization/fi_FI/labels.inc
@@ -118,7 +118,6 @@
 $labels['markunread'] = 'ei-luetuiksi';
 $labels['markflagged'] = 'korostetuiksi';
 $labels['markunflagged'] = 'ei-korostetuiksi';
-$labels['messagemenu'] = 'Viestilista';
 $labels['select'] = 'Valitse';
 $labels['all'] = 'Kaikki';
 $labels['none'] = 'Ei mitään';
diff --git a/program/localization/nl_NL/labels.inc b/program/localization/nl_NL/labels.inc
index f6c602e..1fabaff 100644
--- a/program/localization/nl_NL/labels.inc
+++ b/program/localization/nl_NL/labels.inc
@@ -119,7 +119,6 @@
 $labels['markflagged'] = 'Selecteren';
 $labels['markunflagged'] = 'Niet selecteren';
 $labels['messageactions'] = 'Meer acties...';
-$labels['messagemenu'] = 'Berichtenmenu';
 $labels['select'] = 'Selecteer';
 $labels['all'] = 'Allemaal';
 $labels['none'] = 'Geen';
diff --git a/program/localization/pl_PL/labels.inc b/program/localization/pl_PL/labels.inc
index 41910d6..1f2a0d2 100644
--- a/program/localization/pl_PL/labels.inc
+++ b/program/localization/pl_PL/labels.inc
@@ -127,13 +127,14 @@
 $labels['markunread'] = 'Jako nieprzeczytane';
 $labels['markflagged'] = 'Jako oflagowane';
 $labels['markunflagged'] = 'Jako nieoflagowane';
-$labels['messagemenu'] = 'Menu wiadomości';
+$labels['messageactions'] = 'Więcej akcji...';
 $labels['select'] = 'Zaznacz';
 $labels['all'] = 'Wszystkie';
 $labels['none'] = 'Anuluj';
 $labels['unread'] = 'Nieprzeczytane';
 $labels['flagged'] = 'Oznaczone';
 $labels['unanswered'] = 'Bez odpowiedzi';
+$labels['invert'] = 'Odwróć';
 $labels['filter'] = 'Filtr';
 $labels['compact'] = 'Porządkuj';
 $labels['empty'] = 'Opróżnij';
diff --git a/skins/default/templates/mail.html b/skins/default/templates/mail.html
index d3d8e23..29116f7 100644
--- a/skins/default/templates/mail.html
+++ b/skins/default/templates/mail.html
@@ -88,7 +88,9 @@
 <roundcube:label name="select" />:&nbsp;
 <roundcube:button command="select-all" label="all" classAct="active" />&nbsp;
 <roundcube:button command="select-all" prop="unread" label="unread" classAct="active" />&nbsp;
+<roundcube:button command="select-all" prop="invert" label="invert" classAct="active" />&nbsp;
 <roundcube:button command="select-none" label="none" classAct="active" /> &nbsp;
+<roundcube:container name="listcontrols" id="listcontrols" />
 </span>
 <roundcube:if condition="env:quota" />
 <span id="quotabox">

--
Gitblit v1.9.1