(js) New hotkeys for message controller

Fixes #3834
This commit is contained in:
Francis Lachapelle
2016-10-17 15:10:40 -04:00
parent aa124d3273
commit 9a050620f0
4 changed files with 38 additions and 2 deletions

View File

@@ -373,5 +373,17 @@
/* Hotkey to write a new message */
"hotkey_compose" = "w";
/* Hotkey to mark selected message(s) as junk */
"hotkey_junk" = "j";
/* Hotkey to flag a message */
"hotkey_flag" = "f";
"hotkey_flag" = "*";
/* Hotkey to reply to a message */
"hotkey_reply" = "r";
/* Hotkey to reply to all recipients of a message */
"hotkey_replyall" = "a";
/* Hotkey to forward to a message */
"hotkey_forward" = "f";

View File

@@ -24,7 +24,7 @@
<md-icon>close</md-icon>
</md-button>
<div class="md-flex"><!-- spacer --></div>
<md-button class="sg-icon-button" label:aria-label="flagged" ng-click="viewer.message.toggleFlag()">
<md-button class="sg-icon-button" label:aria-label="Flagged" ng-click="viewer.message.toggleFlag()">
<md-icon ng-class="{'icon-star md-accent md-hue-2': viewer.message.isflagged,
'icon-star-border': !viewer.message.isflagged}"><!-- flag --></md-icon>
</md-button>

View File

@@ -72,6 +72,11 @@
description: l('Write a new message'),
callback: newMessage
}));
keys.push(sgHotkeys.createHotkey({
key: l('hotkey_junk'),
description: l('Mark the selected messages as junk'),
callback: markOrUnMarkMessagesAsJunk
}));
keys.push(sgHotkeys.createHotkey({
key: 'space',
description: l('Toggle item'),
@@ -334,6 +339,8 @@
function markOrUnMarkMessagesAsJunk() {
var moveSelectedMessage = vm.selectedFolder.hasSelectedMessage();
var selectedMessages = vm.selectedFolder.$selectedMessages();
if (_.size(selectedMessages) === 0 && moveSelectedMessage)
selectedMessages = [vm.selectedFolder.$selectedMessage()];
if (_.size(selectedMessages) > 0)
vm.selectedFolder.$markOrUnMarkMessagesAsJunk(selectedMessages).then(function() {
var dstFolder = '/' + vm.account.id + '/folderINBOX';

View File

@@ -39,6 +39,7 @@
vm.convertToEvent = convertToEvent;
vm.convertToTask = convertToTask;
_registerHotkeys(hotkeys);
// One-way refresh of the parent window when modifying the message from a popup window.
@@ -104,8 +105,24 @@
function _registerHotkeys(keys) {
keys.push(sgHotkeys.createHotkey({
key: l('hotkey_reply'),
description: l('Reply to the message'),
callback: reply
}));
keys.push(sgHotkeys.createHotkey({
key: l('hotkey_replyall'),
description: l('Reply to sender and all recipients'),
callback: replyAll
}));
keys.push(sgHotkeys.createHotkey({
key: l('hotkey_forward'),
description: l('Forward selected message'),
callback: forward
}));
keys.push(sgHotkeys.createHotkey({
key: l('hotkey_flag'),
description: l('Flagged'),
callback: angular.bind(stateMessage, stateMessage.toggleFlag)
}));
keys.push(sgHotkeys.createHotkey({