From eb684206067a151a8b417bb1e4f7e48d4a56e5bf Mon Sep 17 00:00:00 2001
From: thomascube <thomas@roundcube.net>
Date: Sun, 09 Sep 2007 14:49:23 -0400
Subject: [PATCH] Fixed wrong delete button tooltip (#1483965)

---
 program/localization/de_DE/labels.inc |    3 ++-
 CHANGELOG                             |    1 +
 program/steps/mail/func.inc           |    2 +-
 program/localization/en_US/labels.inc |    3 ++-
 program/localization/de_CH/labels.inc |    3 ++-
 program/js/app.js                     |   35 ++++++++++++++++++++++++++++-------
 6 files changed, 36 insertions(+), 11 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index 2ebe78b..12d7872 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -3,6 +3,7 @@
 
 2007/09/09 (thomasb)
 ----------
+- Fixed wrong delete button tooltip (#1483965)
 - Fixed charset encoding bug (#1484429)
 - Applied patch for LDAP version (#1484552)
 - Improved XHTML validation
diff --git a/program/js/app.js b/program/js/app.js
index 581e255..5af98a2 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -164,6 +164,9 @@
             this.enable_command('firstmessage', true);
             }
           }
+
+        if (this.env.trash_mailbox && this.env.mailbox != this.env.trash_mailbox)
+          this.set_alttext('delete', 'movemessagetotrash');
         
         // make preview/message frame visible
         if (this.env.action == 'preview' && this.env.framed && parent.rcmail)
@@ -482,6 +485,9 @@
             this.reset_qsearch();
 
           this.list_mailbox(props);
+
+          if (this.env.trash_mailbox)
+            this.set_alttext('delete', this.env.mailbox != this.env.trash_mailbox ? 'movemessagetotrash' : 'deletemessage');
           }
         else if (this.task=='addressbook')
           {
@@ -2835,6 +2841,28 @@
       }
     };
 
+  // display a specific alttext
+  this.set_alttext = function(command, label)
+    {
+      if (!this.buttons[command] || !this.buttons[command].length)
+        return;
+      
+      var button, obj, link;
+      for (var n=0; n<this.buttons[command].length; n++)
+      {
+        button = this.buttons[command][n];
+        obj = document.getElementById(button.id);
+        
+        if (button.type=='image' && obj)
+        {
+          obj.setAttribute('alt', this.get_label(label));
+          if ((link = obj.parentNode) && link.tagName == 'A')
+            link.setAttribute('title', this.get_label(label));
+        }
+        else if (obj)
+          obj.setAttribute('title', this.get_label(label));
+      }
+    };
 
   // mouse over button
   this.button_over = function(command, id)
@@ -2908,13 +2936,6 @@
       obj.className = obj.className.replace(reg, '');
     else if (set && !obj.className.match(reg))
       obj.className += ' '+classname;
-    };
-
-
-  // display a specific alttext
-  this.alttext = function(text)
-    {
-    
     };
 
 
diff --git a/program/localization/de_CH/labels.inc b/program/localization/de_CH/labels.inc
index e39ac96..d5e088e 100644
--- a/program/localization/de_CH/labels.inc
+++ b/program/localization/de_CH/labels.inc
@@ -97,7 +97,8 @@
 $labels['replytomessage']   = 'Antwort verfassen';
 $labels['replytoallmessage'] = 'Antwort an Absender und alle Empfänger';
 $labels['forwardmessage']   = 'Nachricht weiterleiten';
-$labels['deletemessage']    = 'In den Papierkorb verschieben';
+$labels['deletemessage']    = 'Nachricht löschen';
+$labels['movemessagetotrash'] = 'Nachricht in den Papierkorb verschieben';
 $labels['printmessage']     = 'Diese Nachricht drucken';
 $labels['previousmessage']  = 'Vorherige Nachricht anzeigen';
 $labels['previousmessages'] = 'Vorherige Nachrichten anzeigen';
diff --git a/program/localization/de_DE/labels.inc b/program/localization/de_DE/labels.inc
index a54e491..f8d52bd 100644
--- a/program/localization/de_DE/labels.inc
+++ b/program/localization/de_DE/labels.inc
@@ -74,7 +74,8 @@
 $labels['replytomessage'] = 'Antwort verfassen';
 $labels['replytoallmessage'] = 'Antwort an Absender und alle Empfänger';
 $labels['forwardmessage'] = 'Nachricht weiterleiten';
-$labels['deletemessage'] = 'Nachricht in den Papierkorb verschieben';
+$labels['deletemessage']    = 'Nachricht löschen';
+$labels['movemessagetotrash'] = 'Nachricht in den Papierkorb verschieben';
 $labels['printmessage'] = 'Diese Nachricht drucken';
 $labels['previousmessage'] = 'Vorherige Nachricht anzeigen';
 $labels['previousmessages'] = 'Vorherige Nachrichten anzeigen';
diff --git a/program/localization/en_US/labels.inc b/program/localization/en_US/labels.inc
index 201af0b..adf8f29 100644
--- a/program/localization/en_US/labels.inc
+++ b/program/localization/en_US/labels.inc
@@ -96,7 +96,8 @@
 $labels['replytomessage']   = 'Reply to the message';
 $labels['replytoallmessage'] = 'Reply to sender and all recipients';
 $labels['forwardmessage']   = 'Forward the message';
-$labels['deletemessage']    = 'Move message to trash';
+$labels['deletemessage']    = 'Delete message';
+$labels['movemessagetotrash'] = 'Move message to trash';
 $labels['printmessage']     = 'Print this message';
 $labels['previousmessage']  = 'Show the previous message';
 $labels['previousmessages'] = 'Show previous set of messages';
diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc
index 7306062..9f4c714 100644
--- a/program/steps/mail/func.inc
+++ b/program/steps/mail/func.inc
@@ -73,7 +73,7 @@
   $OUTPUT->set_env('junk_mailbox', $CONFIG['junk_mbox']);
 
 if (!$OUTPUT->ajax_call)
-  rcube_add_label('checkingmail');
+  rcube_add_label('checkingmail', 'deletemessage', 'movemessagetotrash');
 
 
 

--
Gitblit v1.9.1