Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Key bindings to toggle preview and mark selected messages as (un)read/(un)flagged #18

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 42 additions & 3 deletions keyboard_shortcuts.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ function keyboard_shortcuts_show_help() {
}

$(function() {
rcmail.env.keyboard_shortcuts_mark_pending = false;

// initialize a dialog window
$('#keyboard_shortcuts_help').dialog({
Expand Down Expand Up @@ -72,7 +73,20 @@ $(function() {
case 100: // d = delete
rcmail.command('delete', '', rcmail);
return false;
case 102: // f = forward
case 70: // F = (m)ark un(F)lagged
if (rcmail.env.keyboard_shortcuts_mark_pending) {
rcmail.command('mark', 'unflagged');
clearTimeout(rcmail.env.keyboard_shortcuts_mark_pending);
rcmail.env.keyboard_shortcuts_mark_pending = false;
return false;
}
case 102: // f = forward // or (m)ark (f)lagged
if (rcmail.env.keyboard_shortcuts_mark_pending) {
rcmail.command('mark', 'flagged');
clearTimeout(rcmail.env.keyboard_shortcuts_mark_pending);
rcmail.env.keyboard_shortcuts_mark_pending = false;
return false;
}
if (rcmail.message_list.selection.length == 1)
rcmail.command('forward');
return false;
Expand All @@ -86,17 +100,42 @@ $(function() {
if (rcmail.message_list.selection.length == 1)
rcmail.command('print');
return false;
case 114: // r = reply
case 114: // r = reply // or (m)ark (r)ead
if (rcmail.env.keyboard_shortcuts_mark_pending) {
rcmail.command('mark', 'read');
clearTimeout(rcmail.env.keyboard_shortcuts_mark_pending);
rcmail.env.keyboard_shortcuts_mark_pending = false;
return false;
}
if (rcmail.message_list.selection.length == 1)
rcmail.command('reply');
return false;
case 115: // s = search
$('#quicksearchbox').focus();
$('#quicksearchbox').select();
return false;
case 117: // u = update (check for mail)
case 117: // u = update (check for mail) // or (m)ark (u)nread
if (rcmail.env.keyboard_shortcuts_mark_pending) {
rcmail.command('mark', 'unread');
clearTimeout(rcmail.env.keyboard_shortcuts_mark_pending);
rcmail.env.keyboard_shortcuts_mark_pending = false;
return false;
}
rcmail.command('checkmail');
return false;
case 118: // v = Toggle preview
$('#prevpaneswitch,#mailpreviewtoggle').click();
return false;
case 109: // m = Mark as... (read/unread/flagged/unflagged)
if (rcmail.env.keyboard_shortcuts_mark_pending != false) {
clearTimeout(rcmail.env.keyboard_shortcuts_mark_pending);
}
var that = rcmail;
rcmail.env.keyboard_shortcuts_mark_pending = setTimeout(function() {
console.log('resetting that.env.keyboard_shortcuts_mark_pending after 3s');
that.env.keyboard_shortcuts_mark_pending = false;
}, 3000);
return false;
}
} else if (rcmail.env.action == 'show' || rcmail.env.action == 'preview') {
switch (e.which) {
Expand Down
4 changes: 4 additions & 0 deletions keyboard_shortcuts.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
* R: Reply to all of message
* s: Jump to quicksearch
* u: Check for new mail (update)
* V: Toggle preview
* m: Mark as (r)ead/(u)nread/(f)lagged/un(F)lagged
*
* Shortcuts, threads view:
* E: Expand all
Expand Down Expand Up @@ -91,6 +93,8 @@ function html_output($p) {
$c .= "<div class='shortcut_key'>R</div> ".$this->gettext('replytoallmessage')."<br class='clear' />";
$c .= "<div class='shortcut_key'>s</div> ".$this->gettext('quicksearch')."<br class='clear' />";
$c .= "<div class='shortcut_key'>u</div> ".$this->gettext('checkmail')."<br class='clear' />";
$c .= "<div class='shortcut_key'>v</div> ".$this->gettext('previewpane')."<br class='clear' />";
$c .= "<div class='shortcut_key'>m</div> ".$this->gettext('keyboard_shortcuts.markmulti')."<br class='clear' />";
$c .= "<div class='shortcut_key'> </div> <br class='clear' />";
$c .= "</div>";

Expand Down
1 change: 1 addition & 0 deletions localization/en_US.inc
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ $labels['help'] = 'Help';
$labels['selectallvisiblemessages'] = 'Select all visible messages';
$labels['markallvisiblemessagesasread'] = 'Mark all visible messages as read';
$labels['title'] = 'Shortcuts';
$labels['markmulti'] = 'Mark selected as (r)ead/(u)nread/(f)lagged/un(F)lagged';

?>