From 075574c81f6d8c1db3c2f2dba1a3f084fcb810d8 Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Mon, 14 Oct 2013 06:11:09 -0400
Subject: [PATCH] Use onclick even for status, flag and expando actions to fix issue where mouse right click would invoke action where it shouldn't

---
 program/js/list.js |   20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/program/js/list.js b/program/js/list.js
index 76582d1..f05ac1a 100644
--- a/program/js/list.js
+++ b/program/js/list.js
@@ -35,7 +35,7 @@
   this.tbody;
   this.fixed_header;
   this.frame = null;
-  this.rows = [];
+  this.rows = {};
   this.selection = [];
   this.rowcount = 0;
   this.colcount = 0;
@@ -86,7 +86,7 @@
   }
 
   if (this.tbody) {
-    this.rows = [];
+    this.rows = {};
     this.rowcount = 0;
 
     var r, len, rows = this.tbody.childNodes;
@@ -240,7 +240,7 @@
     $(this.row_tagname() + ':not(.thead)', this.tbody).remove();
   }
 
-  this.rows = [];
+  this.rows = {};
   this.rowcount = 0;
 
   if (sel)
@@ -409,14 +409,14 @@
   var evtarget = rcube_event.get_target(e),
     tagname = evtarget.tagName.toLowerCase();
 
-  if (this.dont_select || (evtarget && (tagname == 'input' || tagname == 'img')))
+  if (this.dont_select || (evtarget && (tagname == 'input' || tagname == 'img' || evtarget.onclick)))
     return true;
 
   // accept right-clicks
   if (rcube_event.get_button(e) == 2)
     return true;
 
-  this.in_selection_before = e.istouch || this.in_selection(id) ? id : false;
+  this.in_selection_before = e && e.istouch || this.in_selection(id) ? id : false;
 
   // selects currently unselected row
   if (!this.in_selection_before) {
@@ -471,7 +471,7 @@
   this.in_selection_before = false;
 
   // row was double clicked
-  if (this.rows && dblclicked && this.in_selection(id)) {
+  if (this.rowcount && dblclicked && this.in_selection(id)) {
     this.triggerEvent('dblclick');
     now = 0;
   }
@@ -703,7 +703,7 @@
  */
 get_next_row: function()
 {
-  if (!this.rows)
+  if (!this.rowcount)
     return false;
 
   var last_selected_row = this.rows[this.last_selected],
@@ -717,7 +717,7 @@
 
 get_prev_row: function()
 {
-  if (!this.rows)
+  if (!this.rowcount)
     return false;
 
   var last_selected_row = this.rows[this.last_selected],
@@ -969,7 +969,7 @@
  */
 select_all: function(filter)
 {
-  if (!this.rows || !this.rows.length)
+  if (!this.rowcount)
     return false;
 
   // reset but remember selection first
@@ -1001,7 +1001,7 @@
  */
 invert_selection: function()
 {
-  if (!this.rows || !this.rows.length)
+  if (!this.rowcount)
     return false;
 
   // remember old selection

--
Gitblit v1.9.1