mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-10 15:08:28 +03:00
Dropdown menu keyboard navigation
Keyboard shortcuts help popup (Shift + / )
This commit is contained in:
parent
f52be6fb66
commit
d961fa480a
47 changed files with 5598 additions and 583 deletions
|
|
@ -13,8 +13,9 @@ function AbstractSystemDropDownViewModel()
|
|||
this.accounts = oData.accounts;
|
||||
this.accountEmail = oData.accountEmail;
|
||||
this.accountsLoading = oData.accountsLoading;
|
||||
this.accountMenuFocus = oData.accountMenuFocus;
|
||||
|
||||
|
||||
this.accountMenuDropdownTrigger = ko.observable(false);
|
||||
|
||||
this.allowAddAccount = RL.settingsGet('AllowAdditionalAccounts');
|
||||
|
||||
this.loading = ko.computed(function () {
|
||||
|
|
@ -22,14 +23,6 @@ function AbstractSystemDropDownViewModel()
|
|||
}, this);
|
||||
|
||||
this.accountClick = _.bind(this.accountClick, this);
|
||||
|
||||
key('`', function () {
|
||||
if (oData.useKeyboardShortcuts() && !RL.popupVisibility() &&
|
||||
!oData.accountMenuFocus())
|
||||
{
|
||||
oData.accountMenuFocus(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
_.extend(AbstractSystemDropDownViewModel.prototype, KnoinAbstractViewModel.prototype);
|
||||
|
|
@ -76,4 +69,15 @@ AbstractSystemDropDownViewModel.prototype.logoutClick = function ()
|
|||
|
||||
RL.loginAndLogoutReload(true, RL.settingsGet('ParentEmail') && 0 < RL.settingsGet('ParentEmail').length);
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
AbstractSystemDropDownViewModel.prototype.onBuild = function ()
|
||||
{
|
||||
var self = this;
|
||||
key('`', [Enums.KeyState.MessageList, Enums.KeyState.MessageView, Enums.KeyState.Settings], function () {
|
||||
if (RL.data().useKeyboardShortcuts() && !RL.popupVisibility() && !Globals.dropdownVisibility() && self.viewModelVisibility())
|
||||
{
|
||||
self.accountMenuDropdownTrigger(true);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -42,6 +42,9 @@ function MailBoxMessageListViewModel()
|
|||
this.userUsageSize = oData.userUsageSize;
|
||||
this.userUsageProc = oData.userUsageProc;
|
||||
|
||||
this.moveDropdownTrigger = ko.observable(false);
|
||||
this.moreDropdownTrigger = ko.observable(false);
|
||||
|
||||
// append drag and drop
|
||||
this.dragOver = ko.observable(false).extend({'throttle': 1});
|
||||
this.dragOverEnter = ko.observable(false).extend({'throttle': 1});
|
||||
|
|
@ -518,7 +521,7 @@ MailBoxMessageListViewModel.prototype.flagMessages = function (oCurrentMessage)
|
|||
}
|
||||
};
|
||||
|
||||
MailBoxMessageListViewModel.prototype.flagMessagesFast = function ()
|
||||
MailBoxMessageListViewModel.prototype.flagMessagesFast = function (bFlag)
|
||||
{
|
||||
var
|
||||
aChecked = this.messageListCheckedOrSelected(),
|
||||
|
|
@ -531,24 +534,43 @@ MailBoxMessageListViewModel.prototype.flagMessagesFast = function ()
|
|||
return oMessage.flagged();
|
||||
});
|
||||
|
||||
this.setAction(aChecked[0].folderFullNameRaw,
|
||||
aChecked.length === aFlagged.length ? Enums.MessageSetAction.UnsetFlag : Enums.MessageSetAction.SetFlag, aChecked);
|
||||
if (Utils.isUnd(bFlag))
|
||||
{
|
||||
this.setAction(aChecked[0].folderFullNameRaw,
|
||||
aChecked.length === aFlagged.length ? Enums.MessageSetAction.UnsetFlag : Enums.MessageSetAction.SetFlag, aChecked);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.setAction(aChecked[0].folderFullNameRaw,
|
||||
!bFlag ? Enums.MessageSetAction.UnsetFlag : Enums.MessageSetAction.SetFlag, aChecked);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
MailBoxMessageListViewModel.prototype.seenMessagesFast = function ()
|
||||
MailBoxMessageListViewModel.prototype.seenMessagesFast = function (bSeen)
|
||||
{
|
||||
var
|
||||
aChecked = this.messageListCheckedOrSelected(),
|
||||
aUnseen = []
|
||||
;
|
||||
|
||||
aUnseen = _.filter(aChecked, function (oMessage) {
|
||||
return oMessage.unseen();
|
||||
});
|
||||
if (0 < aChecked.length)
|
||||
{
|
||||
aUnseen = _.filter(aChecked, function (oMessage) {
|
||||
return oMessage.unseen();
|
||||
});
|
||||
|
||||
this.setAction(aChecked[0].folderFullNameRaw,
|
||||
0 < aUnseen.length ? Enums.MessageSetAction.SetSeen : Enums.MessageSetAction.UnsetSeen, aChecked);
|
||||
if (Utils.isUnd(bSeen))
|
||||
{
|
||||
this.setAction(aChecked[0].folderFullNameRaw,
|
||||
0 < aUnseen.length ? Enums.MessageSetAction.SetSeen : Enums.MessageSetAction.UnsetSeen, aChecked);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.setAction(aChecked[0].folderFullNameRaw,
|
||||
bSeen ? Enums.MessageSetAction.SetSeen : Enums.MessageSetAction.UnsetSeen, aChecked);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
MailBoxMessageListViewModel.prototype.onBuild = function (oDom)
|
||||
|
|
@ -648,6 +670,14 @@ MailBoxMessageListViewModel.prototype.initShortcuts = function ()
|
|||
}
|
||||
});
|
||||
|
||||
key('z', [Enums.KeyState.MessageList, Enums.KeyState.MessageView], function () {
|
||||
if (oData.useKeyboardShortcuts())
|
||||
{
|
||||
self.moreDropdownTrigger(true);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
// delete
|
||||
key('delete, shift+delete', Enums.KeyState.MessageList, function (event, handler) {
|
||||
if (oData.useKeyboardShortcuts() && event)
|
||||
|
|
@ -677,8 +707,8 @@ MailBoxMessageListViewModel.prototype.initShortcuts = function ()
|
|||
}
|
||||
});
|
||||
|
||||
// new message (open compose popup)
|
||||
key('c,n', [Enums.KeyState.MessageList, Enums.KeyState.MessageView], function () {
|
||||
// write/compose (open compose popup)
|
||||
key('w,c', [Enums.KeyState.MessageList, Enums.KeyState.MessageView], function () {
|
||||
if (oData.useKeyboardShortcuts())
|
||||
{
|
||||
kn.showScreenPopup(PopupsComposeViewModel);
|
||||
|
|
@ -686,8 +716,8 @@ MailBoxMessageListViewModel.prototype.initShortcuts = function ()
|
|||
}
|
||||
});
|
||||
|
||||
// star/flag messages
|
||||
key('s', [Enums.KeyState.MessageList, Enums.KeyState.MessageView], function () {
|
||||
// important - star/flag messages
|
||||
key('i', [Enums.KeyState.MessageList, Enums.KeyState.MessageView], function () {
|
||||
if (oData.useKeyboardShortcuts())
|
||||
{
|
||||
self.flagMessagesFast();
|
||||
|
|
@ -695,11 +725,29 @@ MailBoxMessageListViewModel.prototype.initShortcuts = function ()
|
|||
}
|
||||
});
|
||||
|
||||
// mark as read/unread
|
||||
key('m', [Enums.KeyState.MessageList, Enums.KeyState.MessageView], function () {
|
||||
// move
|
||||
key('m', Enums.KeyState.MessageList, function () {
|
||||
if (oData.useKeyboardShortcuts())
|
||||
{
|
||||
self.seenMessagesFast();
|
||||
self.moveDropdownTrigger(true);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
// read
|
||||
key('q', [Enums.KeyState.MessageList, Enums.KeyState.MessageView], function () {
|
||||
if (oData.useKeyboardShortcuts())
|
||||
{
|
||||
self.seenMessagesFast(true);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
// unread
|
||||
key('u', [Enums.KeyState.MessageList, Enums.KeyState.MessageView], function () {
|
||||
if (oData.useKeyboardShortcuts())
|
||||
{
|
||||
self.seenMessagesFast(false);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ function MailBoxMessageViewViewModel()
|
|||
this.fullScreenMode = oData.messageFullScreenMode;
|
||||
|
||||
this.showFullInfo = ko.observable(false);
|
||||
this.moreDropdownTrigger = ko.observable(false);
|
||||
this.messageDomFocused = ko.observable(false).extend({'rateLimit': 0});
|
||||
|
||||
this.messageVisibility = ko.computed(function () {
|
||||
|
|
@ -360,6 +361,13 @@ MailBoxMessageViewViewModel.prototype.onBuild = function (oDom)
|
|||
this.messageDomFocused(!!bValue);
|
||||
}, this);
|
||||
|
||||
this.messageDomFocused.subscribe(function (bValue) {
|
||||
if (!bValue && Enums.KeyState.MessageView === this.keyScope())
|
||||
{
|
||||
this.message.focused(false);
|
||||
}
|
||||
}, this);
|
||||
|
||||
this.keyScope.subscribe(function (sValue) {
|
||||
if (Enums.KeyState.MessageView === sValue && this.message.focused())
|
||||
{
|
||||
|
|
@ -384,10 +392,14 @@ MailBoxMessageViewViewModel.prototype.escShortcuts = function ()
|
|||
{
|
||||
this.fullScreenMode(false);
|
||||
}
|
||||
else
|
||||
else if (Enums.Layout.NoPreview === RL.data().layout())
|
||||
{
|
||||
this.message(null);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.message.focused(false);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
@ -412,6 +424,14 @@ MailBoxMessageViewViewModel.prototype.initShortcuts = function ()
|
|||
}
|
||||
});
|
||||
|
||||
key('x', [Enums.KeyState.MessageList, Enums.KeyState.MessageView], function () {
|
||||
if (oData.useKeyboardShortcuts())
|
||||
{
|
||||
self.moreDropdownTrigger(true);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
// reply
|
||||
key('r', [Enums.KeyState.MessageList, Enums.KeyState.MessageView], function () {
|
||||
if (oData.useKeyboardShortcuts() && oData.message())
|
||||
|
|
@ -440,13 +460,13 @@ MailBoxMessageViewViewModel.prototype.initShortcuts = function ()
|
|||
});
|
||||
|
||||
// message information
|
||||
key('i', [Enums.KeyState.MessageList, Enums.KeyState.MessageView], function () {
|
||||
if (oData.useKeyboardShortcuts())
|
||||
{
|
||||
self.showFullInfo(!self.showFullInfo());
|
||||
return false;
|
||||
}
|
||||
});
|
||||
// key('i', [Enums.KeyState.MessageList, Enums.KeyState.MessageView], function () {
|
||||
// if (oData.useKeyboardShortcuts())
|
||||
// {
|
||||
// self.showFullInfo(!self.showFullInfo());
|
||||
// return false;
|
||||
// }
|
||||
// });
|
||||
|
||||
// toggle message blockquotes
|
||||
key('b', [Enums.KeyState.MessageList, Enums.KeyState.MessageView], function () {
|
||||
|
|
|
|||
|
|
@ -13,6 +13,17 @@ function SettingsPaneViewModel()
|
|||
|
||||
Utils.extendAsViewModel('SettingsPaneViewModel', SettingsPaneViewModel);
|
||||
|
||||
SettingsPaneViewModel.prototype.onBuild = function ()
|
||||
{
|
||||
var self = this;
|
||||
key('esc', Enums.KeyState.Settings, function () {
|
||||
if (RL.data().useKeyboardShortcuts())
|
||||
{
|
||||
self.backToMailBoxClick();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
SettingsPaneViewModel.prototype.onShow = function ()
|
||||
{
|
||||
RL.data().message(null);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue