* Mail - Add keyboard actions for forward & reply in the list, and send in compose

This commit is contained in:
nathangray 2017-09-25 16:12:17 -06:00
parent 2078025eea
commit 5daf70535f
3 changed files with 30 additions and 0 deletions

View File

@ -122,6 +122,7 @@ class mail_compose
'group' => ++$group,
'onExecute' => 'javaScript:app.mail.compose_submitAction',
'hint' => 'Send',
'shortcut' => array('ctrl' => true, 'keyCode' => 83, 'caption' => 'Ctrl + S'),
'toolbarDefault' => true
),
'pgp' => array(

View File

@ -1115,6 +1115,7 @@ class mail_ui
'group' => $group,
'onExecute' => 'javaScript:app.mail.mail_compose',
'allowOnMultiple' => false,
'shortcut' => array('ctrl' => true, 'shift' => true, 'keyCode' => 65, 'caption' => 'Ctrl + Shift + A'),
),
'forward' => array(
'caption' => 'Forward',
@ -1128,6 +1129,7 @@ class mail_ui
'hint' => 'forward inline',
'onExecute' => 'javaScript:app.mail.mail_compose',
'allowOnMultiple' => false,
'shortcut' => array('ctrl' => true, 'keyCode' => 70, 'caption' => 'Ctrl + F'),
'toolbarDefault' => true
),
'forwardasattach' => array(

View File

@ -284,6 +284,8 @@ app.classes.mail = AppJS.extend(
}
that.compose_resizeHandler();
});
// Init key handler
this.init_keyHandler();
//Call drag_n_drop initialization for emails on compose
this.init_dndCompose();
@ -4743,6 +4745,31 @@ app.classes.mail = AppJS.extend(
},
/**
* Keyhandler for compose window
* Use this one so we can handle keys even on inputs
*/
init_keyHandler: function()
{
jQuery(document).on('keydown', function(e) {
// Translate the given key code and make it valid
var keyCode = e.which;
keyCode = egw_keycode_translation_function(keyCode);
keyCode = egw_keycode_makeValid(keyCode);
// Only go on if this is a valid key code - call the key handler
if (keyCode != -1)
{
if (egw_keyHandler(keyCode, e.shiftKey, e.ctrlKey || e.metaKey, e.altKey))
{
// If the key handler successfully passed the key event to some
// sub component, prevent the default action
e.preventDefault();
}
}
});
},
/**
* Initialize dropping targets for draggable emails
* -