mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-31 21:19:21 +03:00
Add new "Move to folder" button
This commit is contained in:
parent
2c3881abc6
commit
f0e9d1a6d5
14 changed files with 312 additions and 182 deletions
|
|
@ -6,7 +6,7 @@ import key from 'key';
|
|||
|
||||
import {trim, isNormal, isArray, windowResize} from 'Common/Utils';
|
||||
import {Capa, Focused, Layout, KeyState, EventKeyCode, Magics} from 'Common/Enums';
|
||||
import {$html, leftPanelDisabled} from 'Common/Globals';
|
||||
import {$html, leftPanelDisabled, moveAction} from 'Common/Globals';
|
||||
import {mailBox, settings} from 'Common/Links';
|
||||
import {setFolderHash} from 'Common/Cache';
|
||||
|
||||
|
|
@ -42,6 +42,8 @@ class FolderListMailBoxUserView extends AbstractViewNext
|
|||
this.folderListSystem = FolderStore.folderListSystem;
|
||||
this.foldersChanging = FolderStore.foldersChanging;
|
||||
|
||||
this.moveAction = moveAction;
|
||||
|
||||
this.foldersListWithSingleInboxRootFolder = FolderStore.foldersListWithSingleInboxRootFolder;
|
||||
|
||||
this.leftPanelDisabled = leftPanelDisabled;
|
||||
|
|
@ -71,6 +73,7 @@ class FolderListMailBoxUserView extends AbstractViewNext
|
|||
isMobile = Settings.appSettingsGet('mobile'),
|
||||
fSelectFolder = (el, event, starred) => {
|
||||
|
||||
const isMove = moveAction();
|
||||
if (isMobile)
|
||||
{
|
||||
leftPanelDisabled(true);
|
||||
|
|
@ -86,24 +89,39 @@ class FolderListMailBoxUserView extends AbstractViewNext
|
|||
const folder = ko.dataFor(el);
|
||||
if (folder)
|
||||
{
|
||||
if (Layout.NoPreview === SettingsStore.layout())
|
||||
if (isMove)
|
||||
{
|
||||
MessageStore.message(null);
|
||||
}
|
||||
|
||||
if (folder.fullNameRaw === FolderStore.currentFolderFullNameRaw())
|
||||
{
|
||||
setFolderHash(folder.fullNameRaw, '');
|
||||
}
|
||||
|
||||
if (starred)
|
||||
{
|
||||
setHash(mailBox(folder.fullNameHash, 1, 'is:flagged'));
|
||||
moveAction(false);
|
||||
getApp().moveMessagesToFolder(
|
||||
FolderStore.currentFolderFullNameRaw(),
|
||||
MessageStore.messageListCheckedOrSelectedUidsWithSubMails(),
|
||||
folder.fullNameRaw,
|
||||
false
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
setHash(mailBox(folder.fullNameHash));
|
||||
if (Layout.NoPreview === SettingsStore.layout())
|
||||
{
|
||||
MessageStore.message(null);
|
||||
}
|
||||
|
||||
if (folder.fullNameRaw === FolderStore.currentFolderFullNameRaw())
|
||||
{
|
||||
setFolderHash(folder.fullNameRaw, '');
|
||||
}
|
||||
|
||||
if (starred)
|
||||
{
|
||||
setHash(mailBox(folder.fullNameHash, 1, 'is:flagged'));
|
||||
}
|
||||
else
|
||||
{
|
||||
setHash(mailBox(folder.fullNameHash));
|
||||
}
|
||||
}
|
||||
|
||||
AppStore.focusedState(Focused.MessageList);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -186,6 +204,7 @@ class FolderListMailBoxUserView extends AbstractViewNext
|
|||
|
||||
key('esc, tab, shift+tab, right', KeyState.FolderList, () => {
|
||||
AppStore.focusedState(Focused.MessageList);
|
||||
moveAction(false);
|
||||
return false;
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,8 @@ import {
|
|||
import {
|
||||
bMobileDevice,
|
||||
popupVisibility,
|
||||
leftPanelDisabled
|
||||
leftPanelDisabled,
|
||||
moveAction
|
||||
} from 'Common/Globals';
|
||||
|
||||
import {
|
||||
|
|
@ -76,6 +77,7 @@ class MessageListMailBoxUserView extends AbstractViewNext
|
|||
this.iGoToUpUpOrDownDownTimeout = 0;
|
||||
|
||||
this.mobile = !!Settings.appSettingsGet('mobile');
|
||||
this.newMoveToFolder = AppStore.newMoveToFolder;
|
||||
|
||||
this.allowReload = !!Settings.capa(Capa.Reload);
|
||||
this.allowSearch = !!Settings.capa(Capa.Search);
|
||||
|
|
@ -350,6 +352,30 @@ class MessageListMailBoxUserView extends AbstractViewNext
|
|||
@command(canBeMovedHelper)
|
||||
moveCommand() {} // eslint-disable-line no-empty-function
|
||||
|
||||
@command(canBeMovedHelper)
|
||||
moveNewCommand(vm, event) {
|
||||
if (this.newMoveToFolder() && this.mobileCheckedStateShow())
|
||||
{
|
||||
if (vm && event && event.preventDefault) {
|
||||
event.preventDefault();
|
||||
if (event.stopPropagation) {
|
||||
event.stopPropagation();
|
||||
}
|
||||
}
|
||||
|
||||
if (moveAction())
|
||||
{
|
||||
AppStore.focusedState(Focused.MessageList);
|
||||
moveAction(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
AppStore.focusedState(Focused.FolderList);
|
||||
moveAction(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
hideLeft(item, event) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
|
|
@ -869,7 +895,16 @@ class MessageListMailBoxUserView extends AbstractViewNext
|
|||
{
|
||||
// move
|
||||
key('m', KeyState.MessageList, () => {
|
||||
this.moveDropdownTrigger(true);
|
||||
|
||||
if (this.newMoveToFolder())
|
||||
{
|
||||
this.moveNewCommand();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.moveDropdownTrigger(true);
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue