From fe8ff85d7eabb370d85fc31ca55b9a6c6f86a356 Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Thu, 15 Oct 2015 02:58:06 -0400
Subject: [PATCH] Move skin-specific code for compose encryption button to the skin

---
 skins/classic/functions.js |    4 ++++
 program/js/app.js          |    2 --
 skins/larry/ui.js          |   10 +++++++---
 3 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/program/js/app.js b/program/js/app.js
index bb1dd32..f05677a 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -3435,8 +3435,6 @@
     }
     else if (action == 'compose') {
       this.env.compose_commands.push('compose-encrypted');
-      // display the toolbar button
-      $('#' + this.buttons['compose-encrypted'][0].id).show();
 
       var is_html = $('input[name="_is_html"]').val() > 0;
 
diff --git a/skins/classic/functions.js b/skins/classic/functions.js
index 4e68e9e..5a55c95 100644
--- a/skins/classic/functions.js
+++ b/skins/classic/functions.js
@@ -640,6 +640,10 @@
     var label = rcmail.gettext(p.status ? 'replylist' : 'replyall');
     $('a.button.replyAll').attr('title', label);
   }
+  else if (p.command == 'compose-encrypted') {
+    // show the toolbar button for Mailvelope
+    $('#messagetoolbar > a.encrypt').show();
+  }
 },
 
 folder_search_init: function(container)
diff --git a/skins/larry/ui.js b/skins/larry/ui.js
index 8b58189..4b4d99b 100644
--- a/skins/larry/ui.js
+++ b/skins/larry/ui.js
@@ -136,6 +136,7 @@
       rcmail.addEventListener('menu-open', menu_toggle)
         .addEventListener('menu-close', menu_toggle)
         .addEventListener('menu-save', save_listoptions)
+        .addEventListener('enable-command', enable_command)
         .addEventListener('responseafterlist', function(e){ switch_view_mode(rcmail.env.threading ? 'thread' : 'list', true) })
         .addEventListener('responseaftersearch', function(e){ switch_view_mode(rcmail.env.threading ? 'thread' : 'list', true) });
 
@@ -146,9 +147,9 @@
       }
 
       if (rcmail.env.action == 'show' || rcmail.env.action == 'preview') {
-        rcmail.addEventListener('enable-command', enable_command)
-          .addEventListener('aftershow-headers', function() { layout_messageview(); })
+        rcmail.addEventListener('aftershow-headers', function() { layout_messageview(); })
           .addEventListener('afterhide-headers', function() { layout_messageview(); });
+
         $('#previewheaderstoggle').click(function(e) {
             toggle_preview_headers();
             if (this.blur && !rcube_event.is_keyboard(e))
@@ -238,7 +239,6 @@
         rcmail.init_pagejumper('#pagejumper');
 
         rcmail.addEventListener('setquota', update_quota)
-          .addEventListener('enable-command', enable_command)
           .addEventListener('afterimport-messages', show_uploadform);
       }
       else if (rcmail.env.action == 'get') {
@@ -601,6 +601,10 @@
       else
         $('a.button.reply-all').text(label).attr('title', label);
     }
+    else if (p.command == 'compose-encrypted') {
+      // show the toolbar button for Mailvelope
+      $('a.button.encrypt').show();
+    }
   }
 
 

--
Gitblit v1.9.1