mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-31 21:19:21 +03:00
New styles for toltips (Opentip)
Selector new functionality x-script tag support for templates
This commit is contained in:
parent
c1c817c837
commit
80c5e35a29
47 changed files with 2641 additions and 315 deletions
|
|
@ -13,6 +13,7 @@
|
|||
Links = require('Common/Links'),
|
||||
|
||||
AccountStore = require('Stores/User/Account'),
|
||||
MessageStore = require('Stores/User/Message'),
|
||||
|
||||
Settings = require('Storage/Settings'),
|
||||
|
||||
|
|
@ -88,6 +89,8 @@
|
|||
key('`', [Enums.KeyState.MessageList, Enums.KeyState.MessageView, Enums.KeyState.Settings], function () {
|
||||
if (self.viewModelVisibility())
|
||||
{
|
||||
MessageStore.messageFullScreenMode(false);
|
||||
|
||||
self.accountMenuDropdownTrigger(true);
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -52,6 +52,10 @@
|
|||
|
||||
this.allowContacts = !!AppStore.contactsIsAllowed();
|
||||
|
||||
this.folderListFocused = ko.computed(function () {
|
||||
return Enums.Focused.FolderList === AppStore.focusedState();
|
||||
});
|
||||
|
||||
kn.constructorEnd(this);
|
||||
}
|
||||
|
||||
|
|
@ -144,7 +148,7 @@
|
|||
var $items = $('.b-folders .e-item .e-link:not(.hidden).focused', oDom);
|
||||
if ($items.length && $items[0])
|
||||
{
|
||||
FolderStore.folderList.focused(false);
|
||||
AppStore.focusedState(Enums.Focused.MessageList);
|
||||
$items.click();
|
||||
}
|
||||
|
||||
|
|
@ -168,13 +172,13 @@
|
|||
});
|
||||
|
||||
key('esc, tab, shift+tab, right', Enums.KeyState.FolderList, function () {
|
||||
FolderStore.folderList.focused(false);
|
||||
AppStore.focusedState(Enums.Focused.MessageList);
|
||||
return false;
|
||||
});
|
||||
|
||||
FolderStore.folderList.focused.subscribe(function (bValue) {
|
||||
AppStore.focusedState.subscribe(function (mValue) {
|
||||
$('.b-folders .e-item .e-link.focused', oDom).removeClass('focused');
|
||||
if (bValue)
|
||||
if (Enums.Focused.FolderList === mValue)
|
||||
{
|
||||
$('.b-folders .e-item .e-link.selected', oDom).addClass('focused');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
'use strict';
|
||||
|
||||
var
|
||||
window = require('window'),
|
||||
_ = require('_'),
|
||||
$ = require('$'),
|
||||
ko = require('ko'),
|
||||
|
|
@ -22,6 +23,7 @@
|
|||
|
||||
Cache = require('Common/Cache'),
|
||||
|
||||
AppStore = require('Stores/User/App'),
|
||||
QuotaStore = require('Stores/User/Quota'),
|
||||
SettingsStore = require('Stores/User/Settings'),
|
||||
FolderStore = require('Stores/User/Folder'),
|
||||
|
|
@ -53,7 +55,9 @@
|
|||
this.message = MessageStore.message;
|
||||
this.messageList = MessageStore.messageList;
|
||||
this.messageListDisableAutoSelect = MessageStore.messageListDisableAutoSelect;
|
||||
|
||||
this.folderList = FolderStore.folderList;
|
||||
|
||||
this.selectorMessageSelected = MessageStore.selectorMessageSelected;
|
||||
this.selectorMessageFocused = MessageStore.selectorMessageFocused;
|
||||
this.isMessageSelected = MessageStore.isMessageSelected;
|
||||
|
|
@ -187,6 +191,10 @@
|
|||
return this.isSpamFolder() && !this.isSpamDisabled() && !this.isDraftFolder() && !this.isSentFolder();
|
||||
}, this);
|
||||
|
||||
this.messageListFocused = ko.computed(function () {
|
||||
return Enums.Focused.MessageList === AppStore.focusedState();
|
||||
});
|
||||
|
||||
this.canBeMoved = this.hasCheckedOrSelectedLines;
|
||||
|
||||
this.clearCommand = Utils.createCommand(this, function () {
|
||||
|
|
@ -255,15 +263,16 @@
|
|||
return this.useAutoSelect();
|
||||
}, this));
|
||||
|
||||
// this.selector.on('onUpUpOrDownDown', _.bind(function (bV) {
|
||||
// }, this));
|
||||
this.selector.on('onUpUpOrDownDown', _.bind(function (bV) {
|
||||
this.goToUpUpOrDownDown(bV);
|
||||
}, this));
|
||||
|
||||
Events
|
||||
.sub('mailbox.message-list.selector.go-down', function () {
|
||||
this.selector.goDown(true);
|
||||
.sub('mailbox.message-list.selector.go-down', function (bSelect) {
|
||||
this.selector.goDown(bSelect);
|
||||
}, this)
|
||||
.sub('mailbox.message-list.selector.go-up', function () {
|
||||
this.selector.goUp(true);
|
||||
.sub('mailbox.message-list.selector.go-up', function (bSelect) {
|
||||
this.selector.goUp(bSelect);
|
||||
}, this)
|
||||
;
|
||||
|
||||
|
|
@ -282,6 +291,67 @@
|
|||
*/
|
||||
MessageListMailBoxUserView.prototype.emptySubjectValue = '';
|
||||
|
||||
MessageListMailBoxUserView.prototype.iGoToUpUpOrDownDownTimeout = 0;
|
||||
|
||||
MessageListMailBoxUserView.prototype.goToUpUpOrDownDown = function (bUp)
|
||||
{
|
||||
var self = this;
|
||||
|
||||
window.clearTimeout(this.iGoToUpUpOrDownDownTimeout);
|
||||
this.iGoToUpUpOrDownDownTimeout = window.setTimeout(function () {
|
||||
|
||||
var
|
||||
oPrev = null,
|
||||
oNext = null,
|
||||
oTemp = null,
|
||||
oCurrent = null,
|
||||
aPages = self.messageListPagenator()
|
||||
;
|
||||
|
||||
_.find(aPages, function (oItem) {
|
||||
|
||||
if (oItem)
|
||||
{
|
||||
if (oCurrent)
|
||||
{
|
||||
oNext = oItem;
|
||||
}
|
||||
|
||||
if (oItem.current)
|
||||
{
|
||||
oCurrent = oItem;
|
||||
oPrev = oTemp;
|
||||
}
|
||||
|
||||
if (oNext)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
oTemp = oItem;
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
if (Enums.Layout.NoPreview === SettingsStore.layout() && !self.message())
|
||||
{
|
||||
self.selector.iFocusedNextHelper = bUp ? -1 : 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
self.selector.iSelectNextHelper = bUp ? -1 : 1;
|
||||
}
|
||||
|
||||
if (bUp ? oPrev : oNext)
|
||||
{
|
||||
self.selector.unselect();
|
||||
self.gotoPage(bUp ? oPrev : oNext);
|
||||
}
|
||||
|
||||
}, 350);
|
||||
};
|
||||
|
||||
MessageListMailBoxUserView.prototype.useAutoSelect = function ()
|
||||
{
|
||||
if (this.messageListDisableAutoSelect())
|
||||
|
|
@ -534,6 +604,18 @@
|
|||
}
|
||||
};
|
||||
|
||||
MessageListMailBoxUserView.prototype.gotoPage = function (oPage)
|
||||
{
|
||||
if (oPage)
|
||||
{
|
||||
kn.setHash(Links.mailBox(
|
||||
FolderStore.currentFolderFullNameHash(),
|
||||
oPage.value,
|
||||
MessageStore.messageListSearch()
|
||||
));
|
||||
}
|
||||
};
|
||||
|
||||
MessageListMailBoxUserView.prototype.onBuild = function (oDom)
|
||||
{
|
||||
var self = this;
|
||||
|
|
@ -545,21 +627,13 @@
|
|||
|
||||
oDom
|
||||
.on('click', '.messageList .b-message-list-wrapper', function () {
|
||||
if (self.message.focused())
|
||||
if (Enums.Focused.MessageView === AppStore.focusedState())
|
||||
{
|
||||
self.message.focused(false);
|
||||
AppStore.focusedState(Enums.Focused.MessageList);
|
||||
}
|
||||
})
|
||||
.on('click', '.e-pagenator .e-page', function () {
|
||||
var oPage = ko.dataFor(this);
|
||||
if (oPage)
|
||||
{
|
||||
kn.setHash(Links.mailBox(
|
||||
FolderStore.currentFolderFullNameHash(),
|
||||
oPage.value,
|
||||
MessageStore.messageListSearch()
|
||||
));
|
||||
}
|
||||
self.gotoPage(ko.dataFor(this));
|
||||
})
|
||||
.on('click', '.messageList .checkboxCkeckAll', function () {
|
||||
self.checkAll(!self.checkAll());
|
||||
|
|
@ -691,11 +765,11 @@
|
|||
key('tab, shift+tab, left, right', Enums.KeyState.MessageList, function (event, handler) {
|
||||
if (event && handler && ('shift+tab' === handler.shortcut || 'left' === handler.shortcut))
|
||||
{
|
||||
FolderStore.folderList.focused(true);
|
||||
AppStore.focusedState(Enums.Focused.FolderList);
|
||||
}
|
||||
else if (self.message())
|
||||
{
|
||||
self.message.focused(true);
|
||||
AppStore.focusedState(Enums.Focused.MessageView);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
Cache = require('Common/Cache'),
|
||||
|
||||
AppStore = require('Stores/User/App'),
|
||||
SettingsStore = require('Stores/User/Settings'),
|
||||
AccountStore = require('Stores/User/Account'),
|
||||
FolderStore = require('Stores/User/Folder'),
|
||||
|
|
@ -98,6 +99,12 @@
|
|||
this.moreDropdownTrigger = ko.observable(false);
|
||||
this.messageDomFocused = ko.observable(false).extend({'rateLimit': 0});
|
||||
|
||||
// TODO
|
||||
// ko.computed(function () {
|
||||
// window.console.log('focus:' + AppStore.focusedState() + ', dom:' +
|
||||
// this.messageDomFocused() + ', key:' + Globals.keyScope() + ' ~ ' + Globals.keyScopeReal());
|
||||
// }, this).extend({'throttle': 1});
|
||||
|
||||
this.messageVisibility = ko.computed(function () {
|
||||
return !this.messageLoadingThrottle() && !!this.message();
|
||||
}, this);
|
||||
|
|
@ -341,13 +348,6 @@
|
|||
!this.messageListOfThreadsLoading();
|
||||
});
|
||||
|
||||
this.threadsDropdownTrigger.subscribe(function (bValue) {
|
||||
if (bValue && this.message())
|
||||
{
|
||||
this.threadListCommand();
|
||||
}
|
||||
}, this);
|
||||
|
||||
// PGP
|
||||
this.viewPgpPassword = ko.observable('');
|
||||
this.viewPgpSignedVerifyStatus = ko.computed(function () {
|
||||
|
|
@ -480,12 +480,28 @@
|
|||
|
||||
this.messageLoadingThrottle.subscribe(Utils.windowResizeCallback);
|
||||
|
||||
this.messageFocused = ko.computed(function () {
|
||||
return Enums.Focused.MessageView === AppStore.focusedState();
|
||||
});
|
||||
|
||||
this.messageListAndMessageViewLoading = ko.computed(function () {
|
||||
return MessageStore.messageListCompleteLoadingThrottle() || MessageStore.messageLoadingThrottle();
|
||||
});
|
||||
|
||||
this.goUpCommand = Utils.createCommand(this, function () {
|
||||
Events.pub('mailbox.message-list.selector.go-up');
|
||||
Events.pub('mailbox.message-list.selector.go-up', [
|
||||
Enums.Layout.NoPreview === this.layout() ? !!this.message() : true
|
||||
]);
|
||||
}, function () {
|
||||
return !this.messageListAndMessageViewLoading();
|
||||
});
|
||||
|
||||
this.goDownCommand = Utils.createCommand(this, function () {
|
||||
Events.pub('mailbox.message-list.selector.go-down');
|
||||
Events.pub('mailbox.message-list.selector.go-down', [
|
||||
Enums.Layout.NoPreview === this.layout() ? !!this.message() : true
|
||||
]);
|
||||
}, function () {
|
||||
return !this.messageListAndMessageViewLoading();
|
||||
});
|
||||
|
||||
Events.sub('mailbox.message-view.toggle-full-screen', function () {
|
||||
|
|
@ -604,9 +620,9 @@
|
|||
;
|
||||
|
||||
this.fullScreenMode.subscribe(function (bValue) {
|
||||
if (bValue)
|
||||
if (bValue && self.message())
|
||||
{
|
||||
self.message.focused(true);
|
||||
AppStore.focusedState(Enums.Focused.MessageView);
|
||||
}
|
||||
}, this);
|
||||
|
||||
|
|
@ -718,8 +734,23 @@
|
|||
oEvent.stopPropagation();
|
||||
}
|
||||
})
|
||||
.on('click', '.thread-list .more-threads', function () {
|
||||
.on('click', '.thread-list .more-threads', function (e) {
|
||||
|
||||
var oLast = null;
|
||||
if (!e || 0 === e.clientX) // probably enter
|
||||
{
|
||||
// It's a bad bad hack :(
|
||||
oLast = $('.thread-list .e-item.thread-list-message.real-msg.more-that:first a.e-link', oDom);
|
||||
}
|
||||
|
||||
self.viewThreadMessages.showMore(true);
|
||||
self.threadsDropdownTrigger(true);
|
||||
|
||||
if (oLast)
|
||||
{
|
||||
oLast.focus();
|
||||
}
|
||||
|
||||
return false;
|
||||
})
|
||||
.on('click', '.thread-list .thread-list-message', function () {
|
||||
|
|
@ -745,28 +776,16 @@
|
|||
})
|
||||
;
|
||||
|
||||
this.message.focused.subscribe(function (bValue) {
|
||||
if (bValue && !Utils.inFocus()) {
|
||||
this.messageDomFocused(true);
|
||||
} else {
|
||||
this.messageDomFocused(false);
|
||||
AppStore.focusedState.subscribe(function (sValue) {
|
||||
if (Enums.Focused.MessageView !== sValue)
|
||||
{
|
||||
this.scrollMessageToTop();
|
||||
this.scrollMessageToLeft();
|
||||
}
|
||||
}, this);
|
||||
|
||||
this.messageDomFocused.subscribe(function (bValue) {
|
||||
if (!bValue && Enums.KeyState.MessageView === Globals.keyScope())
|
||||
{
|
||||
this.message.focused(false);
|
||||
}
|
||||
}, this);
|
||||
|
||||
Globals.keyScope.subscribe(function (sValue) {
|
||||
if (Enums.KeyState.MessageView === sValue && this.message.focused())
|
||||
{
|
||||
this.messageDomFocused(true);
|
||||
}
|
||||
Globals.keyScopeReal.subscribe(function (sValue) {
|
||||
this.messageDomFocused(Enums.KeyState.MessageView === sValue && !Utils.inFocus());
|
||||
}, this);
|
||||
|
||||
this.oMessageScrollerDom = oDom.find('.messageItem .content');
|
||||
|
|
@ -801,7 +820,7 @@
|
|||
|
||||
if (Enums.Layout.NoPreview !== this.layout())
|
||||
{
|
||||
this.message.focused(false);
|
||||
AppStore.focusedState(Enums.Focused.MessageList);
|
||||
}
|
||||
}
|
||||
else if (Enums.Layout.NoPreview === this.layout())
|
||||
|
|
@ -810,7 +829,7 @@
|
|||
}
|
||||
else
|
||||
{
|
||||
this.message.focused(false);
|
||||
AppStore.focusedState(Enums.Focused.MessageList);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
@ -878,9 +897,10 @@
|
|||
});
|
||||
|
||||
key('t', [Enums.KeyState.MessageList, Enums.KeyState.MessageView], function () {
|
||||
if (MessageStore.message())
|
||||
if (MessageStore.message() && self.viewThreadsControlVisibility())
|
||||
{
|
||||
self.threadsDropdownTrigger(true);
|
||||
self.threadListCommand();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
|
@ -943,11 +963,11 @@
|
|||
return true;
|
||||
}
|
||||
|
||||
self.message.focused(false);
|
||||
AppStore.focusedState(Enums.Focused.MessageList);
|
||||
}
|
||||
else
|
||||
{
|
||||
self.message.focused(false);
|
||||
AppStore.focusedState(Enums.Focused.MessageList);
|
||||
}
|
||||
}
|
||||
else if (self.message() && Enums.Layout.NoPreview === self.layout() && event && handler && 'left' === handler.shortcut)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue