From 196d04f4884ff9dd4dc6d59e5b392a06f14caa6d Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Fri, 27 Aug 2010 06:21:19 -0400
Subject: [PATCH] - Fix "Select all" causes message to be opened in folder with exactly one message (#1486913)

---
 CHANGELOG         |    1 +
 program/js/app.js |    4 +++-
 2 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index c4f5fc4..8bb15ad 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -8,6 +8,7 @@
 - Remove redundant date in syslog messages (#1486945)
 - Fix contacts list page controls when a group is selected (#1486946)
 - Fix SMTP test in Installer (#1486952)
+- Fix "Select all" causes message to be opened in folder with exactly one message (#1486913)
 
 RELEASE 0.4
 -----------
diff --git a/program/js/app.js b/program/js/app.js
index 4df147b..b129e98 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -715,10 +715,12 @@
 
       case 'select-all':
         this.select_all_mode = props ? false : true;
+        this.dummy_select = true; // prevent msg opening if there's only one msg on the list
         if (props == 'invert')
           this.message_list.invert_selection();
         else
           this.message_list.select_all(props == 'page' ? '' : props);
+        this.dummy_select = null;
         break;
 
       case 'select-none':
@@ -1370,7 +1372,7 @@
       this.select_all_mode = false;
 
     // start timer for message preview (wait for double click)
-    if (selected && this.env.contentframe && !list.multi_selecting)
+    if (selected && this.env.contentframe && !list.multi_selecting && !this.dummy_select)
       this.preview_timer = window.setTimeout(function(){ ref.msglist_get_preview(); }, 200);
     else if (this.env.contentframe)
       this.show_contentframe(false);

--
Gitblit v1.9.1