From fe8ff85d7eabb370d85fc31ca55b9a6c6f86a356 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Thu, 15 Oct 2015 08:58:06 +0200 Subject: [PATCH] Move skin-specific code for compose encryption button to the skin --- program/js/app.js | 2 -- skins/classic/functions.js | 4 ++++ 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 bb1dd3290..f05677a26 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -3435,8 +3435,6 @@ function rcube_webmail() } 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 4e68e9eec..5a55c9510 100644 --- a/skins/classic/functions.js +++ b/skins/classic/functions.js @@ -640,6 +640,10 @@ enable_command: function(p) 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 8b5818920..4b4d99bed 100644 --- a/skins/larry/ui.js +++ b/skins/larry/ui.js @@ -136,6 +136,7 @@ function rcube_mail_ui() 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 @@ function rcube_mail_ui() } 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 @@ function rcube_mail_ui() 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 @@ function rcube_mail_ui() 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(); + } }