2 commits - plugins/kolab_shortcuts

Aleksander Machniak machniak at kolabsys.com
Thu Feb 19 09:35:02 CET 2015


 plugins/kolab_shortcuts/kolab_shortcuts.js |   31 ++++++++++++++++++++++++-----
 1 file changed, 26 insertions(+), 5 deletions(-)

New commits:
commit 95a85c121680322ad29ceef38d59eef85bfe605e
Author: Aleksander Machniak <alec at alec.pl>
Date:   Thu Feb 19 09:34:23 2015 +0100

    Add shortcuts for mail forward action

diff --git a/plugins/kolab_shortcuts/kolab_shortcuts.js b/plugins/kolab_shortcuts/kolab_shortcuts.js
index f09d82a..7f624c3 100644
--- a/plugins/kolab_shortcuts/kolab_shortcuts.js
+++ b/plugins/kolab_shortcuts/kolab_shortcuts.js
@@ -127,6 +127,16 @@ var kolab_shortcuts = {
         active: function(e) { return rcmail.task == 'mail'; },
         action: function(e) { return rcmail.command('reply', '', e.target, e); }
     },
+    'mail.forward-attachment': {
+        key: 102, // f
+        active: function(e) { return rcmail.task == 'mail'; },
+        action: function(e) { return rcmail.command('forward-attachment', 'sub', e.target, e); }
+    },
+    'mail.forward-inline': {
+        key: 70, // F
+        active: function(e) { return rcmail.task == 'mail'; },
+        action: function(e) { return rcmail.command('forward-inline', 'sub', e.target, e); }
+    },
     'mail.html2text': {
         key: 72, // H
         active: function(e) { return rcmail.task == 'mail'; },
@@ -175,7 +185,7 @@ var kolab_shortcuts_keypress = function(e)
 {
     var i, handler, key = e.which, alt = e.altKey, ctrl = e.ctrlKey;
 
-    // console.log(e.which);
+    console.log(e.which);
 
     // do nothing on input elements
     if ($(e.target).is('textarea,input')) {


commit 317bd4da63bd4d7c9c14d41aca373fc095efc3a3
Author: Aleksander Machniak <alec at alec.pl>
Date:   Thu Feb 19 09:27:35 2015 +0100

    Fix Shift+H shortcut so it does what it should and make it really working

diff --git a/plugins/kolab_shortcuts/kolab_shortcuts.js b/plugins/kolab_shortcuts/kolab_shortcuts.js
index 123494b..f09d82a 100644
--- a/plugins/kolab_shortcuts/kolab_shortcuts.js
+++ b/plugins/kolab_shortcuts/kolab_shortcuts.js
@@ -129,12 +129,22 @@ var kolab_shortcuts = {
     },
     'mail.html2text': {
         key: 72, // H
-        active: function(e) { return rcmail.task == 'mail' && rcmail.env.action == 'compose'; },
+        active: function(e) { return rcmail.task == 'mail'; },
         action: function(e) {
-            var selector = $('[name="editorSelector"]'),
-                data = {id: 'composebody', html: selector.val() != 'html'};
+            var rc = rcmail;
+
+            // we're in list mode, get reference to preview window
+            if (rc.env.contentframe) {
+                var win = rc.get_frame_window(rc.env.contentframe);
+                if (!win || !win.rcmail)
+                    return false;
+                rc = win.rcmail;
+            }
 
-            return rcmail.command('toggle-editor', data, selector, e);
+            if (rc.env.optional_format) {
+                var format = rc.env.optional_format == 'html' ? 'html' : 'text';
+                return rc.command('change-format', format, e.target, e);
+            }
         }
     }
 };
@@ -190,6 +200,7 @@ var kolab_shortcuts_keypress = function(e)
                 // execute action, the real check if action is active
                 // will be done in .action() or in rcmail.command()
                 handler.action(e);
+                e.preventDefault();
                 return false;
             }
 




More information about the commits mailing list