From ed5d29f4b3c57235594931d33dde7cccaf7cd58b Mon Sep 17 00:00:00 2001
From: thomascube <thomas@roundcube.net>
Date: Thu, 25 May 2006 14:25:04 -0400
Subject: [PATCH] Finalized GoogieSpell integration

---
 program/js/app.js |   46 +++++++++++++++++++++++++++++++++++++---------
 1 files changed, 37 insertions(+), 9 deletions(-)

diff --git a/program/js/app.js b/program/js/app.js
index a6b43cb..98a30d3 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -142,7 +142,11 @@
           }  
 
         if (this.env.action=='compose')
+          {
           this.enable_command('add-attachment', 'send-attachment', 'send', true);
+          if (this.env.spellcheck)
+            this.enable_command('spellcheck', true);
+          }
           
         if (this.env.messagecount)
           this.enable_command('select-all', 'select-none', 'sort', 'expunge', true);
@@ -255,15 +259,29 @@
     };
 
   // reset last clicked if user clicks on anything other than the message table
-  this.reset_click = function()
-    {
+  this.reset_click = function() {
     this.in_message_list = false;
-    };
+	for (var n=0; n<this.selection.length; n++) {
+      id = this.selection[n];
+      if (this.list_rows[id].obj) {
+        this.set_classname(this.list_rows[id].obj, 'selected', false);
+		this.set_classname(this.list_rows[id].obj, 'unfocused', true);
+	  }
+    }
+  };
 	
   this.click_on_list = function(e)
     {
     if (!e)
       e = window.event;
+
+    for (var n=0; n<this.selection.length; n++) {
+      id = this.selection[n];
+      if (this.list_rows[id].obj) {
+        this.set_classname(this.list_rows[id].obj, 'selected', true);
+		this.set_classname(this.list_rows[id].obj, 'unfocused', false);
+	  }
+    }
 
     this.in_message_list = true;
     e.cancelBubble = true;
@@ -861,7 +879,12 @@
           parent.location.href = url;
         else
           location.href = url;
-        break;    
+        break;
+        
+      case 'spellcheck':
+        if (this.env.spellcheck && this.env.spellcheck.spellCheck)
+          this.env.spellcheck.spellCheck(this.env.spellcheck.check_link);
+        break;
 
       case 'send':
         if (!this.gui_objects.messageform)
@@ -1253,7 +1276,7 @@
       if (!this.in_selection(id))  // select row
         {
         this.selection[this.selection.length] = id;
-        this.set_classname(this.list_rows[id].obj, 'selected', true);    
+        this.set_classname(this.list_rows[id].obj, 'selected', true);
         }
       else  // unselect row
         {
@@ -1262,6 +1285,7 @@
         var a_post = this.selection.slice(p+1, this.selection.length);
         this.selection = a_pre.concat(a_post);
         this.set_classname(this.list_rows[id].obj, 'selected', false);
+        this.set_classname(this.list_rows[id].obj, 'unfocused', false);
         }
       selected = (this.selection.length==1);
       }
@@ -1334,9 +1358,10 @@
   this.clear_selection = function()
     {
     for(var n=0; n<this.selection.length; n++)
-      if (this.list_rows[this.selection[n]])
+      if (this.list_rows[this.selection[n]]) {
         this.set_classname(this.list_rows[this.selection[n]].obj, 'selected', false);
-
+        this.set_classname(this.list_rows[this.selection[n]].obj, 'unfocused', false);
+	  }
     this.selection = new Array();    
     };
 
@@ -1715,7 +1740,7 @@
       return false;
 
     if (a_uids.length==1){
-      if(this.message_rows[uid].classname.indexOf('deleted') < 0 ){
+      if(this.message_rows[a_uids[0]].classname.indexOf('deleted') < 0 ){
       	this.flag_as_deleted(a_uids)
       } else {
       	this.flag_as_undeleted(a_uids)
@@ -2075,6 +2100,7 @@
           highlight.removeAttribute('id');
           //highlight.removeAttribute('class');
           this.set_classname(highlight, 'selected', false);
+          this.set_classname(highlight, 'unfocused', false);
           }
 
         if (next)
@@ -2813,8 +2839,10 @@
       var current_li = document.getElementById('rcmbx'+s_current);
       var mbox_li = document.getElementById('rcmbx'+s_mbox);
       
-      if (current_li)
+      if (current_li) {
         this.set_classname(current_li, 'selected', false);
+        this.set_classname(current_li, 'unfocused', false);
+        }
       if (mbox_li)
         this.set_classname(mbox_li, 'selected', true);
       }

--
Gitblit v1.9.1