mirror of
https://github.com/the-djmaze/snappymail.git
synced 2024-09-20 15:45:55 +08:00
Globalize message composer popup window
This commit is contained in:
parent
5601e100d9
commit
e7b1ce7509
|
@ -1008,8 +1008,9 @@ class AppUser extends AbstractApp {
|
|||
setTimeout(this.quota, 5000);
|
||||
setTimeout(() => Remote.appDelayStart(()=>{}), 35000);
|
||||
|
||||
// When auto-login is active
|
||||
if (
|
||||
!!Settings.get('AccountSignMe') &&
|
||||
Settings.get('AccountSignMe') &&
|
||||
navigator.registerProtocolHandler &&
|
||||
Settings.capa(Capa.Composer)
|
||||
) {
|
||||
|
@ -1023,7 +1024,7 @@ class AppUser extends AbstractApp {
|
|||
} catch (e) {} // eslint-disable-line no-empty
|
||||
|
||||
if (Settings.get('MailToEmail')) {
|
||||
mailToHelper(Settings.get('MailToEmail'), ComposePopupView);
|
||||
mailToHelper(Settings.get('MailToEmail'));
|
||||
}
|
||||
}, 500);
|
||||
}
|
||||
|
@ -1047,9 +1048,9 @@ class AppUser extends AbstractApp {
|
|||
setInterval(() => dispatchEvent(new CustomEvent('reload-time')), 60000);
|
||||
}
|
||||
|
||||
showComposePopupView(params = [])
|
||||
showMessageComposer(params = [])
|
||||
{
|
||||
showScreenPopup(ComposePopupView, params);
|
||||
Settings.capa(Capa.Composer) && showScreenPopup(ComposePopupView, params);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import { ComposeType, FolderType } from 'Common/EnumsUser';
|
||||
import { EmailModel } from 'Model/Email';
|
||||
import { showScreenPopup } from 'Knoin/Knoin';
|
||||
import { encodeHtml } from 'Common/Html';
|
||||
import { isArray } from 'Common/Utils';
|
||||
import { doc } from 'Common/Globals';
|
||||
|
@ -433,10 +432,9 @@ export function computedPaginatorHelper(koCurrentPage, koPageCount) {
|
|||
|
||||
/**
|
||||
* @param {string} mailToUrl
|
||||
* @param {Function} PopupComposeViewModel
|
||||
* @returns {boolean}
|
||||
*/
|
||||
export function mailToHelper(mailToUrl, PopupComposeViewModel) {
|
||||
export function mailToHelper(mailToUrl) {
|
||||
if (
|
||||
mailToUrl &&
|
||||
'mailto:' ===
|
||||
|
@ -445,10 +443,6 @@ export function mailToHelper(mailToUrl, PopupComposeViewModel) {
|
|||
.substr(0, 7)
|
||||
.toLowerCase()
|
||||
) {
|
||||
if (!PopupComposeViewModel) {
|
||||
return true;
|
||||
}
|
||||
|
||||
mailToUrl = mailToUrl.toString().substr(7);
|
||||
|
||||
let to = [],
|
||||
|
@ -492,7 +486,7 @@ export function mailToHelper(mailToUrl, PopupComposeViewModel) {
|
|||
bcc = EmailModel.parseEmailLine(decodeURIComponent(params.bcc));
|
||||
}
|
||||
|
||||
showScreenPopup(PopupComposeViewModel, [
|
||||
showMessageComposer([
|
||||
ComposeType.Empty,
|
||||
null,
|
||||
to,
|
||||
|
@ -507,3 +501,8 @@ export function mailToHelper(mailToUrl, PopupComposeViewModel) {
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
export function showMessageComposer(params = [])
|
||||
{
|
||||
rl.app.showScreenPopup(params);
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ import ko from 'ko';
|
|||
|
||||
import {
|
||||
SaveSettingsStep,
|
||||
Capa,
|
||||
StorageResultType,
|
||||
Notification,
|
||||
KeyState
|
||||
|
@ -11,7 +10,7 @@ import {
|
|||
import { ComposeType } from 'Common/EnumsUser';
|
||||
|
||||
import { pInt } from 'Common/Utils';
|
||||
import { delegateRunOnDestroy, computedPaginatorHelper } from 'Common/UtilsUser';
|
||||
import { delegateRunOnDestroy, computedPaginatorHelper, showMessageComposer } from 'Common/UtilsUser';
|
||||
|
||||
import { Selector } from 'Common/Selector';
|
||||
import { serverRequestRaw, serverRequest } from 'Common/Links';
|
||||
|
@ -29,7 +28,6 @@ import { ContactPropertyModel, ContactPropertyType } from 'Model/ContactProperty
|
|||
import { decorateKoCommands, hideScreenPopup } from 'Knoin/Knoin';
|
||||
import { AbstractViewPopup } from 'Knoin/AbstractViews';
|
||||
|
||||
|
||||
const CONTACTS_PER_PAGE = 50,
|
||||
propertyIsMail = prop => prop.isType(ContactPropertyType.Email),
|
||||
propertyIsName = prop => prop.isType(ContactPropertyType.FirstName) || prop.isType(ContactPropertyType.LastName);
|
||||
|
@ -164,10 +162,6 @@ class ContactsPopupView extends AbstractViewPopup {
|
|||
}
|
||||
|
||||
newMessageCommand() {
|
||||
if (!rl.settings.capa(Capa.Composer)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let aE = [],
|
||||
toEmails = null,
|
||||
ccEmails = null,
|
||||
|
@ -211,9 +205,9 @@ class ContactsPopupView extends AbstractViewPopup {
|
|||
|
||||
this.sLastComposeFocusedField = '';
|
||||
|
||||
setTimeout(() => {
|
||||
rl.app.showComposePopupView([ComposeType.Empty, null, toEmails, ccEmails, bccEmails]);
|
||||
}, 200);
|
||||
setTimeout(() =>
|
||||
showMessageComposer([ComposeType.Empty, null, toEmails, ccEmails, bccEmails])
|
||||
, 200);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -547,9 +541,7 @@ class ContactsPopupView extends AbstractViewPopup {
|
|||
if (this.bBackToCompose) {
|
||||
this.bBackToCompose = false;
|
||||
|
||||
if (rl.settings.capa(Capa.Composer)) {
|
||||
rl.app.showComposePopupView();
|
||||
}
|
||||
showMessageComposer();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ import { ThemeStore } from 'Stores/Theme';
|
|||
import { showScreenPopup } from 'Knoin/Knoin';
|
||||
import { AbstractViewLeft } from 'Knoin/AbstractViews';
|
||||
|
||||
import { ComposePopupView } from 'View/Popup/Compose';
|
||||
import { showMessageComposer } from 'Common/UtilsUser';
|
||||
import { FolderCreatePopupView } from 'View/Popup/FolderCreate';
|
||||
import { ContactsPopupView } from 'View/Popup/Contacts';
|
||||
|
||||
|
@ -38,7 +38,7 @@ export class FolderListMailBoxUserView extends AbstractViewLeft {
|
|||
|
||||
this.leftPanelDisabled = leftPanelDisabled;
|
||||
|
||||
this.allowComposer = !!Settings.capa(Capa.Composer);
|
||||
this.allowComposer = Settings.capa(Capa.Composer);
|
||||
this.allowContacts = !!AppStore.contactsIsAllowed();
|
||||
|
||||
this.folderListFocused = ko.computed(() => Focused.FolderList === AppStore.focusedState());
|
||||
|
@ -198,9 +198,7 @@ export class FolderListMailBoxUserView extends AbstractViewLeft {
|
|||
}
|
||||
|
||||
composeClick() {
|
||||
if (Settings.capa(Capa.Composer)) {
|
||||
showScreenPopup(ComposePopupView);
|
||||
}
|
||||
showMessageComposer();
|
||||
}
|
||||
|
||||
createFolder() {
|
||||
|
|
|
@ -17,7 +17,7 @@ import { UNUSED_OPTION_VALUE } from 'Common/Consts';
|
|||
|
||||
import { doc, leftPanelDisabled, moveAction, Settings } from 'Common/Globals';
|
||||
|
||||
import { computedPaginatorHelper } from 'Common/UtilsUser';
|
||||
import { computedPaginatorHelper, showMessageComposer } from 'Common/UtilsUser';
|
||||
import { FileInfo } from 'Common/File';
|
||||
|
||||
import { mailBox, serverRequest } from 'Common/Links';
|
||||
|
@ -45,7 +45,6 @@ import { decorateKoCommands, showScreenPopup, popupVisibility } from 'Knoin/Knoi
|
|||
import { AbstractViewRight } from 'Knoin/AbstractViews';
|
||||
|
||||
import { FolderClearPopupView } from 'View/Popup/FolderClear';
|
||||
import { ComposePopupView } from 'View/Popup/Compose';
|
||||
import { AdvancedSearchPopupView } from 'View/Popup/AdvancedSearch';
|
||||
|
||||
const
|
||||
|
@ -63,12 +62,12 @@ export class MessageListMailBoxUserView extends AbstractViewRight {
|
|||
|
||||
this.newMoveToFolder = !!Settings.get('NewMoveToFolder');
|
||||
|
||||
this.allowReload = !!Settings.capa(Capa.Reload);
|
||||
this.allowSearch = !!Settings.capa(Capa.Search);
|
||||
this.allowSearchAdv = !!Settings.capa(Capa.SearchAdv);
|
||||
this.allowComposer = !!Settings.capa(Capa.Composer);
|
||||
this.allowMessageListActions = !!Settings.capa(Capa.MessageListActions);
|
||||
this.allowDangerousActions = !!Settings.capa(Capa.DangerousActions);
|
||||
this.allowReload = Settings.capa(Capa.Reload);
|
||||
this.allowSearch = Settings.capa(Capa.Search);
|
||||
this.allowSearchAdv = Settings.capa(Capa.SearchAdv);
|
||||
this.allowComposer = Settings.capa(Capa.Composer);
|
||||
this.allowMessageListActions = Settings.capa(Capa.MessageListActions);
|
||||
this.allowDangerousActions = Settings.capa(Capa.DangerousActions);
|
||||
|
||||
this.popupVisibility = popupVisibility;
|
||||
|
||||
|
@ -264,12 +263,10 @@ export class MessageListMailBoxUserView extends AbstractViewRight {
|
|||
}
|
||||
|
||||
multyForwardCommand() {
|
||||
if (Settings.capa(Capa.Composer)) {
|
||||
showScreenPopup(ComposePopupView, [
|
||||
ComposeType.ForwardAsAttachment,
|
||||
MessageStore.messageListCheckedOrSelected()
|
||||
]);
|
||||
}
|
||||
showMessageComposer([
|
||||
ComposeType.ForwardAsAttachment,
|
||||
MessageStore.messageListCheckedOrSelected()
|
||||
]);
|
||||
}
|
||||
|
||||
deleteWithoutMoveCommand() {
|
||||
|
@ -349,9 +346,7 @@ export class MessageListMailBoxUserView extends AbstractViewRight {
|
|||
}
|
||||
|
||||
composeClick() {
|
||||
if (Settings.capa(Capa.Composer)) {
|
||||
showScreenPopup(ComposePopupView);
|
||||
}
|
||||
showMessageComposer();
|
||||
}
|
||||
|
||||
goToUpUpOrDownDown(up) {
|
||||
|
@ -750,13 +745,11 @@ export class MessageListMailBoxUserView extends AbstractViewRight {
|
|||
return false;
|
||||
});
|
||||
|
||||
if (Settings.capa(Capa.Composer)) {
|
||||
// write/compose (open compose popup)
|
||||
shortcuts.add('w,c,new', '', [KeyState.MessageList, KeyState.MessageView], () => {
|
||||
showScreenPopup(ComposePopupView);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
// write/compose (open compose popup)
|
||||
shortcuts.add('w,c,new', '', [KeyState.MessageList, KeyState.MessageView], () => {
|
||||
showMessageComposer();
|
||||
return false;
|
||||
});
|
||||
|
||||
if (Settings.capa(Capa.MessageListActions)) {
|
||||
// important - star/flag messages
|
||||
|
@ -806,12 +799,10 @@ export class MessageListMailBoxUserView extends AbstractViewRight {
|
|||
});
|
||||
}
|
||||
|
||||
if (Settings.capa(Capa.Composer)) {
|
||||
shortcuts.add('f,mailforward', 'shift', [KeyState.MessageList, KeyState.MessageView], () => {
|
||||
this.multyForwardCommand();
|
||||
return false;
|
||||
});
|
||||
}
|
||||
shortcuts.add('f,mailforward', 'shift', [KeyState.MessageList, KeyState.MessageView], () => {
|
||||
this.multyForwardCommand();
|
||||
return false;
|
||||
});
|
||||
|
||||
if (Settings.capa(Capa.Search)) {
|
||||
// search input focus
|
||||
|
|
|
@ -18,7 +18,7 @@ import {
|
|||
import { doc, $htmlCL, leftPanelDisabled, keyScopeReal, moveAction, Settings } from 'Common/Globals';
|
||||
|
||||
import { inFocus } from 'Common/Utils';
|
||||
import { mailToHelper } from 'Common/UtilsUser';
|
||||
import { mailToHelper, showMessageComposer } from 'Common/UtilsUser';
|
||||
|
||||
import Audio from 'Common/Audio';
|
||||
|
||||
|
@ -38,11 +38,9 @@ import * as Local from 'Storage/Client';
|
|||
|
||||
import Remote from 'Remote/User/Fetch';
|
||||
|
||||
import { decorateKoCommands, showScreenPopup, createCommand } from 'Knoin/Knoin';
|
||||
import { decorateKoCommands, createCommand } from 'Knoin/Knoin';
|
||||
import { AbstractViewRight } from 'Knoin/AbstractViews';
|
||||
|
||||
import { ComposePopupView } from 'View/Popup/Compose';
|
||||
|
||||
function isTransparent(color) {
|
||||
return 'rgba(0, 0, 0, 0)' === color || 'transparent' === color;
|
||||
}
|
||||
|
@ -82,9 +80,9 @@ class MessageViewMailBoxUserView extends AbstractViewRight {
|
|||
|
||||
this.moveAction = moveAction;
|
||||
|
||||
this.allowComposer = !!Settings.capa(Capa.Composer);
|
||||
this.allowMessageActions = !!Settings.capa(Capa.MessageActions);
|
||||
this.allowMessageListActions = !!Settings.capa(Capa.MessageListActions);
|
||||
this.allowComposer = Settings.capa(Capa.Composer);
|
||||
this.allowMessageActions = Settings.capa(Capa.MessageActions);
|
||||
this.allowMessageListActions = Settings.capa(Capa.MessageListActions);
|
||||
|
||||
this.attachmentsActions = AppStore.attachmentsActions;
|
||||
|
||||
|
@ -338,7 +336,7 @@ class MessageViewMailBoxUserView extends AbstractViewRight {
|
|||
* @returns {void}
|
||||
*/
|
||||
replyOrforward(sType) {
|
||||
Settings.capa(Capa.Composer) && showScreenPopup(ComposePopupView, [sType, MessageStore.message()]);
|
||||
showMessageComposer([sType, MessageStore.message()]);
|
||||
}
|
||||
|
||||
checkHeaderHeight() {
|
||||
|
@ -436,10 +434,7 @@ class MessageViewMailBoxUserView extends AbstractViewRight {
|
|||
if (el) {
|
||||
return !(
|
||||
0 === event.button &&
|
||||
mailToHelper(
|
||||
el.href,
|
||||
Settings.capa(Capa.Composer) ? ComposePopupView : null
|
||||
)
|
||||
mailToHelper(el.href)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -695,14 +690,12 @@ class MessageViewMailBoxUserView extends AbstractViewRight {
|
|||
}
|
||||
|
||||
composeClick() {
|
||||
if (Settings.capa(Capa.Composer)) {
|
||||
showScreenPopup(ComposePopupView);
|
||||
}
|
||||
showMessageComposer();
|
||||
}
|
||||
|
||||
editMessage() {
|
||||
if (Settings.capa(Capa.Composer) && MessageStore.message()) {
|
||||
showScreenPopup(ComposePopupView, [ComposeType.Draft, MessageStore.message()]);
|
||||
if (MessageStore.message()) {
|
||||
showMessageComposer([ComposeType.Draft, MessageStore.message()]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue