diff --git a/TODO.md b/TODO.md
index f6e1d08..460bb34 100644
--- a/TODO.md
+++ b/TODO.md
@@ -13,10 +13,12 @@
- [x] Make **EP Wasteland** the default theme for new users.
- [x] Move theme selection into Settings and save the selection so the chosen theme is applied every time the program starts.
-- [x] Move the display name field from general Settings into Account Settings.
+- [x] Keep the display name in Account Settings and make it available while adding a mailbox.
## Account settings
-- [ ] Add an **Edit** button for each connected mail account so its account settings can be changed after setup.
+- [x] Add an **Edit** button for each connected mail account so its account settings can be changed after setup.
- [ ] Move CalDAV and CardDAV server configuration into Account Settings, removing the server settings controls from the Calendar and Contacts views.
- [x] Keep general Settings focused on appearance and other app-wide preferences rather than the display name.
+- [ ] Display name must be set per account.
+- [ ] Remove the display name initials from the bottom-left corner.
diff --git a/account-ui.js b/account-ui.js
index fe24b16..c91c731 100644
--- a/account-ui.js
+++ b/account-ui.js
@@ -3,7 +3,7 @@ async function openAccountManager(){
try{
const data=await window.daybreakMail.listAccounts();
const accounts=data.accounts||[];
- const rows=accounts.map(account=>`
Your password is encrypted with this computer's credential storage. Connections require TLS.
IMAP uses STARTTLS on port 143 · SMTP uses STARTTLS on port 587.${editing ? ' Leave the password empty to keep the saved password.' : ' Your display name is also used as the sender name.'}
`;
const close = () => { root.innerHTML = ''; };
$$('.modal-close').forEach(button => button.onclick = close);
$('.modal-overlay').addEventListener('click', event => { if (event.target.classList.contains('modal-overlay')) close(); });
- $('#disconnect-mail').onclick = async () => {
- close();
- };
+ $('#disconnect-mail').onclick = close;
$('#connect-mail').onclick = async () => {
const button = $('#connect-mail');
const status = $('#mail-account-status');
const password = $('#mail-account-password').value;
- if (!password) { status.textContent = 'Enter the mailbox password to connect.'; $('#mail-account-password').focus(); return; }
+ const name = $('#mail-account-display-name').value.trim();
+ if (!editing && !password) { status.textContent = 'Enter the mailbox password to connect.'; $('#mail-account-password').focus(); return; }
button.disabled = true;
- button.textContent = 'Checking secure connections…';
- status.textContent = 'Checking IMAP and SMTP sign-in. This may take a moment.';
+ button.textContent = editing ? 'Checking updated settings…' : 'Checking secure connections…';
+ status.textContent = editing ? 'Testing the updated mailbox settings before saving.' : 'Checking IMAP and SMTP sign-in. This may take a moment.';
try {
- const account = await window.daybreakMail.connect({
+ const details = {
email: $('#mail-account-email').value,
password,
imapHost: $('#mail-account-imap').value,
smtpHost: $('#mail-account-smtp').value
- });
- connectedMailAccount = account;
- updateAccountCard(account);
- close();
- toast('Mailbox connected securely');
- await syncMailbox(true);
+ };
+ const account = editing
+ ? await window.daybreakMail.updateAccount(existingAccount.id, details)
+ : await window.daybreakMail.connect(details);
+ if (name) setProfileName(name);
+ if (editing) {
+ const accountList = await window.daybreakMail.listAccounts();
+ if (accountList.activeId === account.id) {
+ connectedMailAccount = account;
+ updateAccountCard(account);
+ mailPageOffset = 0;
+ close();
+ await syncMailbox(false, { offset: 0 });
+ } else {
+ close();
+ }
+ toast('Mailbox settings updated');
+ } else {
+ connectedMailAccount = account;
+ updateAccountCard(account);
+ close();
+ toast('Mailbox connected securely');
+ await syncMailbox(true);
+ }
} catch (error) {
status.textContent = error.message || 'Could not connect. Check the account details and try again.';
button.disabled = false;
- button.textContent = 'Test & connect';
+ button.textContent = editing ? 'Save & reconnect' : 'Test & connect';
}
};
$('#mail-account-email').focus();
}
-
async function syncMailbox(showToast, options = {}) {
if (!connectedMailAccount || !window.daybreakMail) {
openMailAccount();
@@ -138,7 +155,8 @@ if (window.daybreakMail) {
to: recipient,
cc: $('#compose-cc').value,
subject: $('#compose-subject').value.trim(),
- text: $('#compose-body').value
+ text: $('#compose-body').value,
+ displayName: profileSettings.name
});
$('#modal-root').innerHTML = '';
toast(result.savedToSent ? 'Message sent and saved in Sent' : 'Message sent, but its Sent copy could not be saved');