Skip to content

Commit 5b97cd0

Browse files
Merge branch '#23' into dev
2 parents 8f9fd4c + 62ae1a8 commit 5b97cd0

File tree

61 files changed

+7065
-4805
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+7065
-4805
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
1+
/**
2+
* conjoon
3+
* extjs-app-webmail
4+
* Copyright (C) 2022 Thorsten Suckow-Homberg https://github.com/conjoon/extjs-app-webmail
5+
*
6+
* Permission is hereby granted, free of charge, to any person
7+
* obtaining a copy of this software and associated documentation
8+
* files (the "Software"), to deal in the Software without restriction,
9+
* including without limitation the rights to use, copy, modify, merge,
10+
* publish, distribute, sublicense, and/or sell copies of the Software,
11+
* and to permit persons to whom the Software is furnished to do so,
12+
* subject to the following conditions:
13+
*
14+
* The above copyright notice and this permission notice shall be included
15+
* in all copies or substantial portions of the Software.
16+
*
17+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
19+
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20+
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
21+
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
22+
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
23+
* USE OR OTHER DEALINGS IN THE SOFTWARE.
24+
*/
25+
26+
27+
/**
28+
* Handler representing Strategy for adding MailAccounts.
29+
*/Ext.define("conjoon.cn_mail.view.mail.account.MailAccountHandler", {
30+
31+
32+
requires: [
33+
// @define
34+
"l8",
35+
"conjoon.cn_mail.store.mail.folder.MailFolderTreeStore",
36+
"conjoon.cn_mail.view.mail.account.MailAccountWizard",
37+
"coon.comp.component.MessageMask"
38+
],
39+
40+
/**
41+
* @type {conjoon.cn_mail.app.PackageController} mailPackageController
42+
* @private
43+
*/
44+
45+
enabled () {
46+
return true;
47+
},
48+
49+
50+
invoke (btn) {
51+
const
52+
me = this,
53+
mailView = me.getMailMainPackageView();
54+
55+
const accountWizard = me.createOrReturnAccountWizard();
56+
accountWizard.on("close", () => btn.setDisabled(false), me, {single: true});
57+
58+
mailView.add(accountWizard);
59+
btn.setDisabled(true);
60+
61+
accountWizard.show();
62+
},
63+
64+
65+
createOrReturnAccountWizard () {
66+
const me = this;
67+
68+
if (!me.accountWizard || me.accountWizard.destroyed) {
69+
me.accountWizard = null;
70+
let accountWizard = Ext.create("conjoon.cn_mail.view.mail.account.MailAccountWizard");
71+
accountWizard.on("accountavailable", me.onAccountAvailable, me);
72+
me.accountWizard = accountWizard;
73+
}
74+
75+
return me.accountWizard;
76+
},
77+
78+
79+
onAccountAvailable (wizard, mailAccount) {
80+
const
81+
me = this,
82+
store = me.getMailFolderStore();
83+
84+
wizard.setBusy(true, "Saving...");
85+
86+
// add mailAccount first since store might update its name
87+
store.addMailAccount(mailAccount);
88+
89+
// ... then save
90+
mailAccount.save({
91+
success: me.onMailAccountSaveSuccess,
92+
failure: me.onMailAccountSaveFailure,
93+
scope: me
94+
});
95+
},
96+
97+
98+
onMailAccountSaveSuccess (mailAccount) {
99+
const me = this;
100+
101+
me.accountWizard.close();
102+
me.getMailFolderTreeSelectionModel().select(mailAccount);
103+
},
104+
105+
106+
onMailAccountSaveFailure () {
107+
108+
const me = this;
109+
110+
me.accountWizard.setBusy(false);
111+
me.accountWizard.hide();
112+
113+
me.showFailureMask();
114+
},
115+
116+
117+
showFailureMask () {
118+
119+
const me = this;
120+
121+
let myMask = Ext.create("coon.comp.component.MessageMask", {
122+
title: "Saving failed",
123+
message: "Creating the Mail Account failed. Retry?",
124+
target: me.getMailMainPackageView(),
125+
buttons: coon.comp.component.MessageMask.YESNO,
126+
icon: coon.comp.component.MessageMask.FAILURE,
127+
callback: function (btnAction) {
128+
const me = this;
129+
if (btnAction === "noButton") {
130+
me.accountWizard.close();
131+
myMask.close();
132+
return;
133+
}
134+
135+
myMask.close();
136+
me.accountWizard.show();
137+
},
138+
scope: me
139+
});
140+
141+
myMask.show();
142+
},
143+
144+
145+
/**
146+
* @private
147+
*/
148+
getMailFolderTreeSelectionModel () {
149+
return this.getMailPackageController().getMailFolderTree().getSelectionModel();
150+
},
151+
152+
153+
/**
154+
* @private
155+
*/
156+
getMailMainPackageView () {
157+
return this.getMailPackageController().getMainPackageView();
158+
},
159+
160+
161+
/**
162+
* @private
163+
*/
164+
getMailPackageController () {
165+
const me = this;
166+
if (!me.mailPackageController) {
167+
me.mailPackageController = Ext.getApplication().getController("conjoon.cn_mail.app.PackageController");
168+
}
169+
170+
return me.mailPackageController;
171+
},
172+
173+
174+
/**
175+
* @private
176+
* @returns {conjoon.cn_mail.store.mail.folder.MailFolderTreeStore}
177+
*/
178+
getMailFolderStore () {
179+
return conjoon.cn_mail.store.mail.folder.MailFolderTreeStore.getInstance();
180+
}
181+
182+
});

classic/src/view/mail/account/MailAccountView.js

+54-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* conjoon
33
* extjs-app-webmail
4-
* Copyright (C) 2017-2022 Thorsten Suckow-Homberg https://github.com/conjoon/extjs-app-webmail
4+
* Copyright (C) 2017-2023 Thorsten Suckow-Homberg https://github.com/conjoon/extjs-app-webmail
55
*
66
* Permission is hereby granted, free of charge, to any person
77
* obtaining a copy of this software and associated documentation
@@ -34,6 +34,8 @@ Ext.define("conjoon.cn_mail.view.mail.account.MailAccountView", {
3434

3535
requires: [
3636
"Ext.form.FieldSet",
37+
"coon.comp.component.MessageMask",
38+
"coon.comp.component.LoadMask",
3739
"conjoon.cn_mail.view.mail.account.MailAccountViewModel",
3840
"conjoon.cn_mail.view.mail.account.MailAccountViewController"
3941
],
@@ -152,6 +154,15 @@ Ext.define("conjoon.cn_mail.view.mail.account.MailAccountView", {
152154
bind: {
153155
value: "{processReplyTo}"
154156
}
157+
}, {
158+
xtype: "checkbox",
159+
labelWidth: 160,
160+
inputValue: true,
161+
fieldLabel: "Active",
162+
name: "active",
163+
bind: {
164+
value: "{mailAccount.active}"
165+
}
155166
}]
156167
}, {
157168
xtype: "fieldset",
@@ -310,6 +321,31 @@ Ext.define("conjoon.cn_mail.view.mail.account.MailAccountView", {
310321
value: "{mailAccount.outbox_password}"
311322
}
312323
}]}]
324+
}, {
325+
xtype: "fieldset",
326+
title: "Subscriptions",
327+
listeners: {
328+
// fix for tagfield growing horizontally
329+
afterrender: cmp => cmp.setWidth(1)
330+
},
331+
items: [{
332+
xtype: "tagfield",
333+
flex: 1,
334+
labelWidth: 160,
335+
fieldLabel: " ",
336+
name: "subscriptions",
337+
queryMode: "local",
338+
forceSelection: false,
339+
triggerOnClick: false,
340+
createNewOnEnter: true,
341+
hideTrigger: true,
342+
createNewOnBlur: true,
343+
bind: {
344+
value: "{mailAccount.subscriptions}",
345+
store: "{subscriptionStore}"
346+
}
347+
}]
348+
313349
}]
314350
}],
315351

@@ -420,6 +456,23 @@ Ext.define("conjoon.cn_mail.view.mail.account.MailAccountView", {
420456
mask.loopProgress();
421457

422458
return mask;
459+
},
460+
461+
462+
showMailAccountNotValidMessage () {
463+
464+
const me = this;
465+
466+
let myMask = Ext.create("coon.comp.component.MessageMask", {
467+
title: "Invalid configuration",
468+
message: "Please make sure that an account name is specified which does not already exist.",
469+
target: me,
470+
buttons: coon.comp.component.MessageMask.OK,
471+
icon: coon.comp.component.MessageMask.ERROR
472+
});
473+
474+
myMask.show();
475+
423476
}
424477

425478
});

classic/src/view/mail/account/MailAccountWizard.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,14 @@ Ext.define("conjoon.cn_mail.view.mail.account.MailAccountWizard", {
6262

6363
autoShow: false,
6464

65+
shadow: false,
66+
6567
resizable: false,
6668

6769
width: 400,
6870

71+
modal: true,
72+
6973
height: 600,
7074

7175
header: false,
@@ -188,7 +192,7 @@ Ext.define("conjoon.cn_mail.view.mail.account.MailAccountWizard", {
188192
],
189193

190194

191-
setBusy (show = true) {
195+
setBusy (show = true, msg = "Loading configuration") {
192196
const me = this;
193197

194198
let mask = me.busyMask;
@@ -205,7 +209,7 @@ Ext.define("conjoon.cn_mail.view.mail.account.MailAccountWizard", {
205209
/**
206210
* @i18n
207211
*/
208-
msg: "Loading configuration",
212+
msg,
209213
msgAction: "Please wait...",
210214
glyphCls: "fa fa-spin fa-gear",
211215
target: me
@@ -214,6 +218,7 @@ Ext.define("conjoon.cn_mail.view.mail.account.MailAccountWizard", {
214218
}
215219

216220
mask.show();
221+
mask.updateMsg(msg);
217222
mask.loopProgress();
218223
return mask;
219224
}

classic/src/view/mail/message/editor/MessageEditor.js

+38-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* conjoon
33
* extjs-app-webmail
4-
* Copyright (C) 2019-2022 Thorsten Suckow-Homberg https://github.com/conjoon/extjs-app-webmail
4+
* Copyright (C) 2019-2023 Thorsten Suckow-Homberg https://github.com/conjoon/extjs-app-webmail
55
*
66
* Permission is hereby granted, free of charge, to any person
77
* obtaining a copy of this software and associated documentation
@@ -267,7 +267,7 @@ Ext.define("conjoon.cn_mail.view.mail.message.editor.MessageEditor", {
267267
bind: {
268268
disabled: "{!isPhantom}",
269269
store: "{mailAccountStore}",
270-
value: "{messageDraft.mailAccountId}"
270+
value: "{messageDraft.mailAccountId || null}"
271271
},
272272
/**
273273
* @i18n
@@ -758,6 +758,42 @@ Ext.define("conjoon.cn_mail.view.mail.message.editor.MessageEditor", {
758758
},
759759

760760

761+
/**
762+
* Shows a notice that the either an account is missing for the message being edited,
763+
* or this account's state is invalid.
764+
*
765+
* @return {coon.comp.component.MessageMask}
766+
*/
767+
showAccountInvalidNotice (closeEditor = false) {
768+
769+
closeEditor = !!closeEditor;
770+
771+
const
772+
me = this,
773+
mask = Ext.create("coon.comp.component.MessageMask", {
774+
/**
775+
* @i18n
776+
*/
777+
title: `Valid Mail Account missing ${closeEditor ? " - Cannot open Message" : ""}`,
778+
message: "Please make sure an active Mail Account is used for this message.",
779+
buttons: coon.comp.component.MessageMask.OK,
780+
target: me,
781+
callback: function (btnAction, value) {
782+
mask.close();
783+
if (closeEditor === true) {
784+
me.close();
785+
}
786+
},
787+
icon: coon.comp.component.MessageMask.ERROR,
788+
dialogStyle: true
789+
});
790+
791+
mask.show();
792+
793+
return mask;
794+
},
795+
796+
761797
/**
762798
* Shows a message that savin the current message failed.
763799
*

docs/README.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ and appearance of the email client:
7575
"editor": "resources/templates/html/editor.html.tpl",
7676
"reader": "resources/templates/html/reader.html.tpl"
7777
}
78-
}
78+
},
79+
"mailServerPresets": "resources/mailserverpresets.conf.json"
7980
},
8081
"service": {
8182
"rest-api-email": {
@@ -96,6 +97,8 @@ appearance of the email client. The dot-notation for the configuration options i
9697
- `resources.sounds.notifications.newEmail` - a notification sound to play when new email messages are coming in.
9798
- `templates.html.editor` - an html-template to use with the message editor.
9899
- `templates.html.reader` - an html-template to use with the message reader.
100+
- `mailServerPresets` - a file containing json configuration for mail server presets used with the **MailAccountWizard**
101+
99102

100103
#### Plugins
101104
There are several plugins preconfigured for **extjs-app-webmail**. Please consult the documentation

0 commit comments

Comments
 (0)