1
0
mirror of https://github.com/moparisthebest/davmail synced 2024-12-13 11:12:22 -05:00

Implement davmail.smtpSaveInSent option and reorganize tabs

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1706 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2011-06-17 10:26:06 +00:00
parent 63fdfb111c
commit 4ef3725409
6 changed files with 46 additions and 20 deletions

View File

@ -154,6 +154,7 @@ public final class Settings {
SETTINGS.put("davmail.forceActiveSyncUpdate", Boolean.FALSE.toString());
SETTINGS.put("davmail.showStartupBanner", Boolean.TRUE.toString());
SETTINGS.put("davmail.imapAutoExpunge", Boolean.TRUE.toString());
SETTINGS.put("davmail.smtpSaveInSent", Boolean.TRUE.toString());
SETTINGS.put("davmail.ssl.keystoreType", "");
SETTINGS.put("davmail.ssl.keystoreFile", "");
SETTINGS.put("davmail.ssl.keystorePass", "");

View File

@ -1706,6 +1706,10 @@ public class DavExchangeSession extends ExchangeSession {
public void moveItem(String sourcePath, String targetPath) throws IOException {
MoveMethod method = new MoveMethod(URIUtil.encodePath(getFolderPath(sourcePath)),
URIUtil.encodePath(getFolderPath(targetPath)), false);
moveItem(method);
}
protected void moveItem(MoveMethod method) throws IOException {
try {
int statusCode = httpClient.executeMethod(method);
if (statusCode == HttpStatus.SC_PRECONDITION_FAILED) {
@ -2419,7 +2423,13 @@ public class DavExchangeSession extends ExchangeSession {
properties.put("messageFormat", "2");
}
createMessage(DRAFTS, itemName, properties, mimeMessage);
moveItem(DRAFTS + '/' + itemName, SENDMSG);
MoveMethod method = new MoveMethod(URIUtil.encodePath(getFolderPath(DRAFTS + '/' + itemName)),
URIUtil.encodePath(getFolderPath(SENDMSG)), false);
// set header if saveInSent is disabled
if (!Settings.getBooleanProperty("davmail.smtpSaveInSent", true)) {
method.setRequestHeader("Saveinsent", "f");
}
moveItem(method);
} catch (MessagingException e) {
throw new IOException(e.getMessage());
}

View File

@ -429,7 +429,14 @@ public class EwsExchangeSession extends ExchangeSession {
item.type = "Message";
item.mimeContent = Base64.encodeBase64(messageBody);
CreateItemMethod createItemMethod = new CreateItemMethod(MessageDisposition.SendAndSaveCopy, getFolderId(SENT), item);
MessageDisposition messageDisposition;
if (Settings.getBooleanProperty("davmail.smtpSaveInSent", true)) {
messageDisposition = MessageDisposition.SendAndSaveCopy;
} else {
messageDisposition = MessageDisposition.SendOnly;
}
CreateItemMethod createItemMethod = new CreateItemMethod(messageDisposition, getFolderId(SENT), item);
executeMethod(createItemMethod);
}

View File

@ -98,6 +98,7 @@ public class SettingsFrame extends JFrame {
JCheckBox showStartupBannerCheckBox;
JCheckBox imapAutoExpungeCheckBox;
JCheckBox enableEwsCheckBox;
JCheckBox smtpSaveInSentCheckBox;
protected void addSettingComponent(JPanel panel, String label, JComponent component) {
addSettingComponent(panel, label, component, null);
@ -370,7 +371,7 @@ public class SettingsFrame extends JFrame {
}
protected JPanel getNetworkSettingsPanel() {
JPanel networkSettingsPanel = new JPanel(new GridLayout(4, 2));
JPanel networkSettingsPanel = new JPanel(new GridLayout(3, 2));
networkSettingsPanel.setBorder(BorderFactory.createTitledBorder(BundleMessage.format("UI_NETWORK")));
allowRemoteField = new JCheckBox();
@ -380,25 +381,22 @@ public class SettingsFrame extends JFrame {
certHashField = new JTextField(Settings.getProperty("davmail.server.certificate.hash"), 15);
disableUpdateCheck = new JCheckBox();
disableUpdateCheck.setSelected(Settings.getBooleanProperty("davmail.disableUpdateCheck"));
addSettingComponent(networkSettingsPanel, BundleMessage.format("UI_BIND_ADDRESS"), bindAddressField,
BundleMessage.format("UI_BIND_ADDRESS_HELP"));
addSettingComponent(networkSettingsPanel, BundleMessage.format("UI_ALLOW_REMOTE_CONNECTION"), allowRemoteField,
BundleMessage.format("UI_ALLOW_REMOTE_CONNECTION_HELP"));
addSettingComponent(networkSettingsPanel, BundleMessage.format("UI_SERVER_CERTIFICATE_HASH"), certHashField,
BundleMessage.format("UI_SERVER_CERTIFICATE_HASH_HELP"));
addSettingComponent(networkSettingsPanel, BundleMessage.format("UI_DISABLE_UPDATE_CHECK"), disableUpdateCheck,
BundleMessage.format("UI_DISABLE_UPDATE_CHECK_HELP"));
updateMaximumSize(networkSettingsPanel);
return networkSettingsPanel;
}
protected JPanel getOtherSettingsPanel() {
JPanel otherSettingsPanel = new JPanel(new GridLayout(7, 2));
JPanel otherSettingsPanel = new JPanel(new GridLayout(9, 2));
otherSettingsPanel.setBorder(BorderFactory.createTitledBorder(BundleMessage.format("UI_OTHER")));
enableEwsCheckBox = new JCheckBox();
enableEwsCheckBox.setSelected(Settings.getBooleanProperty("davmail.enableEws", false));
caldavEditNotificationsField = new JCheckBox();
caldavEditNotificationsField.setSelected(Settings.getBooleanProperty("davmail.caldavEditNotifications"));
caldavAlarmSoundField = new JTextField(Settings.getProperty("davmail.caldavAlarmSound"), 15);
@ -409,9 +407,13 @@ public class SettingsFrame extends JFrame {
showStartupBannerCheckBox.setSelected(Settings.getBooleanProperty("davmail.showStartupBanner", true));
imapAutoExpungeCheckBox = new JCheckBox();
imapAutoExpungeCheckBox.setSelected(Settings.getBooleanProperty("davmail.imapAutoExpunge", true));
enableEwsCheckBox = new JCheckBox();
enableEwsCheckBox.setSelected(Settings.getBooleanProperty("davmail.enableEws", false));
smtpSaveInSentCheckBox = new JCheckBox();
smtpSaveInSentCheckBox.setSelected(Settings.getBooleanProperty("davmail.smtpSaveInSent", true));
disableUpdateCheck = new JCheckBox();
disableUpdateCheck.setSelected(Settings.getBooleanProperty("davmail.disableUpdateCheck"));
addSettingComponent(otherSettingsPanel, BundleMessage.format("UI_ENABLE_EWS"), enableEwsCheckBox,
BundleMessage.format("UI_ENABLE_EWS_HELP"));
addSettingComponent(otherSettingsPanel, BundleMessage.format("UI_CALDAV_EDIT_NOTIFICATIONS"), caldavEditNotificationsField,
BundleMessage.format("UI_CALDAV_EDIT_NOTIFICATIONS_HELP"));
addSettingComponent(otherSettingsPanel, BundleMessage.format("UI_CALDAV_ALARM_SOUND"), caldavAlarmSoundField,
@ -424,8 +426,10 @@ public class SettingsFrame extends JFrame {
BundleMessage.format("UI_SHOW_STARTUP_BANNER_HELP"));
addSettingComponent(otherSettingsPanel, BundleMessage.format("UI_IMAP_AUTO_EXPUNGE"), imapAutoExpungeCheckBox,
BundleMessage.format("UI_IMAP_AUTO_EXPUNGE_HELP"));
addSettingComponent(otherSettingsPanel, BundleMessage.format("UI_ENABLE_EWS"), enableEwsCheckBox,
BundleMessage.format("UI_ENABLE_EWS_HELP"));
addSettingComponent(otherSettingsPanel, BundleMessage.format("UI_SAVE_IN_SENT"), smtpSaveInSentCheckBox,
BundleMessage.format("UI_SAVE_IN_SENT_HELP"));
addSettingComponent(otherSettingsPanel, BundleMessage.format("UI_DISABLE_UPDATE_CHECK"), disableUpdateCheck,
BundleMessage.format("UI_DISABLE_UPDATE_CHECK_HELP"));
Dimension preferredSize = otherSettingsPanel.getPreferredSize();
preferredSize.width = Integer.MAX_VALUE;
@ -528,6 +532,7 @@ public class SettingsFrame extends JFrame {
showStartupBannerCheckBox.setSelected(Settings.getBooleanProperty("davmail.showStartupBanner", true));
imapAutoExpungeCheckBox.setSelected(Settings.getBooleanProperty("davmail.imapAutoExpunge", true));
enableEwsCheckBox.setSelected(Settings.getBooleanProperty("davmail.enableEws", false));
smtpSaveInSentCheckBox.setSelected(Settings.getBooleanProperty("davmail.smtpSaveInSent", true));
keystoreTypeCombo.setSelectedItem(Settings.getProperty("davmail.ssl.keystoreType"));
keystoreFileField.setText(Settings.getProperty("davmail.ssl.keystoreFile"));
@ -594,9 +599,8 @@ public class SettingsFrame extends JFrame {
JPanel proxyPanel = new JPanel();
proxyPanel.setLayout(new BoxLayout(proxyPanel, BoxLayout.Y_AXIS));
proxyPanel.add(getProxyPanel());
// empty panel
proxyPanel.add(new JPanel());
tabbedPane.add(BundleMessage.format("UI_TAB_PROXY"), proxyPanel);
proxyPanel.add(getNetworkSettingsPanel());
tabbedPane.add(BundleMessage.format("UI_TAB_NETWORK"), proxyPanel);
JPanel encryptionPanel = new JPanel();
encryptionPanel.setLayout(new BoxLayout(encryptionPanel, BoxLayout.Y_AXIS));
@ -617,7 +621,6 @@ public class SettingsFrame extends JFrame {
JPanel advancedPanel = new JPanel();
advancedPanel.setLayout(new BoxLayout(advancedPanel, BoxLayout.Y_AXIS));
advancedPanel.add(getNetworkSettingsPanel());
advancedPanel.add(getOtherSettingsPanel());
// empty panel
advancedPanel.add(new JPanel());
@ -667,6 +670,7 @@ public class SettingsFrame extends JFrame {
Settings.setProperty("davmail.showStartupBanner", String.valueOf(showStartupBannerCheckBox.isSelected()));
Settings.setProperty("davmail.imapAutoExpunge", String.valueOf(imapAutoExpungeCheckBox.isSelected()));
Settings.setProperty("davmail.enableEws", String.valueOf(enableEwsCheckBox.isSelected()));
Settings.setProperty("davmail.smtpSaveInSent", String.valueOf(smtpSaveInSentCheckBox.isSelected()));
Settings.setProperty("davmail.ssl.keystoreType", (String) keystoreTypeCombo.getSelectedItem());
Settings.setProperty("davmail.ssl.keystoreFile", keystoreFileField.getText());

View File

@ -226,7 +226,7 @@ UI_SMTP_PORT_HELP=Local SMTP server port to configure in mail client
UI_TAB_ADVANCED=Advanced
UI_TAB_ENCRYPTION=Encryption
UI_TAB_MAIN=Main
UI_TAB_PROXY=Proxy
UI_TAB_NETWORK=Network
UI_UNTRUSTED_CERTIFICATE=Server provided an untrusted certificate,\n you can choose to accept or deny access.\n Accept certificate (y/n)?
UI_UNTRUSTED_CERTIFICATE_HTML=<html><b>Server provided an untrusted certificate,<br> you can choose to accept or deny access</b></html>
UI_VALID_FROM=Valid from
@ -274,4 +274,6 @@ UI_NOTIFICATION_BODY=Caldav notification comment
UI_CALDAV_EDIT_NOTIFICATIONS=Edit Caldav notifications:
UI_CALDAV_EDIT_NOTIFICATIONS_HELP=Enable interactive Caldav edit notification window
LOG_SEARCH_RESULT=Found {0} item(s)
UI_LOG_FILE_SIZE=Log file size:
UI_LOG_FILE_SIZE=Log file size:
UI_SAVE_IN_SENT=SMTP save in sent:
UI_SAVE_IN_SENT_HELP=Save messages sent over SMTP in server Sent folder

View File

@ -203,7 +203,7 @@ UI_SMTP_PORT_HELP=Port SMTP local
UI_TAB_ADVANCED=Avancé
UI_TAB_ENCRYPTION=Chiffrement
UI_TAB_MAIN=Général
UI_TAB_PROXY=Proxy
UI_TAB_NETWORK=Réseau
UI_UNTRUSTED_CERTIFICATE=Le certificat fourni par le serveur n''est certifié par aucune autorité de confiance,\n vous pouvez choisir d''accepter ou de rejeter l''accès
UI_UNTRUSTED_CERTIFICATE_HTML=<html><b>Le certificat fourni par le serveur n''est certifié par aucune autorité de confiance,<br> vous pouvez choisir d''accepter ou de rejeter l''accès</b></html>
UI_VALID_FROM=Emis le
@ -274,3 +274,5 @@ UI_CC_HELP=Destinataires en copie
UI_CALDAV_EDIT_NOTIFICATIONS=Edition notifications Caldav :
UI_CALDAV_EDIT_NOTIFICATIONS_HELP=Activer le fenêtre d'édition interactive des notifications
LOG_SEARCH_RESULT={0} élément(s) trouvé(s)
UI_SAVE_IN_SENT=SMTP copie dans Envoyés :
UI_SAVE_IN_SENT_HELP=Créer une copie des messages envoyés via SMTP dans le dossier serveur "Envoyés"