Add a new setting to disable startup notification window (contribution from jsquyres)

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@991 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2010-04-07 20:23:48 +00:00
parent 2227622a9f
commit 12c8ab9e49
6 changed files with 1149 additions and 1111 deletions

View File

@ -141,8 +141,11 @@ public final class DavGateway {
}
final String currentVersion = getCurrentVersion();
boolean showStartupBanner = Settings.getBooleanProperty("davmail.showStartupBanner", true);
if (showStartupBanner) {
DavGatewayTray.info(new BundleMessage("LOG_DAVMAIL_GATEWAY_LISTENING",
currentVersion == null ? "" : currentVersion, messages));
}
if (!errorMessages.isEmpty()) {
DavGatewayTray.error(new BundleMessage("LOG_MESSAGE", errorMessages));
}
@ -181,6 +184,7 @@ public final class DavGateway {
/**
* Get current DavMail version.
*
* @return current version
*/
public static String getCurrentVersion() {
@ -190,6 +194,7 @@ public final class DavGateway {
/**
* Get latest released version from SourceForge.
*
* @return latest version
*/
public static String getReleasedVersion() {

View File

@ -148,7 +148,8 @@ public final class Settings {
SETTINGS.put("davmail.server", Boolean.FALSE.toString());
SETTINGS.put("davmail.server.certificate.hash", "");
SETTINGS.put("davmail.caldavAlarmSound", "");
SETTINGS.put("davmail.forceActiveSyncUpdate", "Boolean.FALSE.toString()");
SETTINGS.put("davmail.forceActiveSyncUpdate", Boolean.FALSE.toString());
SETTINGS.put("davmail.showStartupBanner", Boolean.TRUE.toString());
SETTINGS.put("davmail.ssl.keystoreType", "");
SETTINGS.put("davmail.ssl.keystoreFile", "");
SETTINGS.put("davmail.ssl.keystorePass", "");
@ -344,6 +345,22 @@ public final class Settings {
return Boolean.parseBoolean(propertyValue);
}
/**
* Get a property value as boolean.
*
* @param property property name
* @param defaultValue default property value
* @return property value
*/
public static synchronized boolean getBooleanProperty(String property, boolean defaultValue) {
boolean value = defaultValue;
String propertyValue = SETTINGS.getProperty(property);
if (propertyValue != null && propertyValue.length() > 0) {
value = Boolean.parseBoolean(propertyValue);
}
return value;
}
/**
* Build logging properties prefix.
*

View File

@ -83,8 +83,9 @@ public class SettingsFrame extends JFrame {
JTextField logFilePathField;
JTextField caldavAlarmSoundField;
JCheckBox forceActiveSyncUpdateField;
JCheckBox forceActiveSyncUpdateCheckBox;
JTextField defaultDomainField;
JCheckBox showStartupBannerCheckBox;
protected void addSettingComponent(JPanel panel, String label, JComponent component) {
addSettingComponent(panel, label, component, null);
@ -364,20 +365,24 @@ public class SettingsFrame extends JFrame {
}
protected JPanel getOtherSettingsPanel() {
JPanel otherSettingsPanel = new JPanel(new GridLayout(3, 2));
JPanel otherSettingsPanel = new JPanel(new GridLayout(4, 2));
otherSettingsPanel.setBorder(BorderFactory.createTitledBorder(BundleMessage.format("UI_OTHER")));
caldavAlarmSoundField = new JTextField(Settings.getProperty("davmail.caldavAlarmSound"), 15);
forceActiveSyncUpdateField = new JCheckBox();
forceActiveSyncUpdateField.setSelected(Settings.getBooleanProperty("davmail.forceActiveSyncUpdate"));
forceActiveSyncUpdateCheckBox = new JCheckBox();
forceActiveSyncUpdateCheckBox.setSelected(Settings.getBooleanProperty("davmail.forceActiveSyncUpdate"));
defaultDomainField = new JTextField(Settings.getProperty("davmail.defaultDomain"), 15);
showStartupBannerCheckBox = new JCheckBox();
showStartupBannerCheckBox.setSelected(Settings.getBooleanProperty("davmail.showStartupBanner", true));
addSettingComponent(otherSettingsPanel, BundleMessage.format("UI_CALDAV_ALARM_SOUND"), caldavAlarmSoundField,
BundleMessage.format("UI_CALDAV_ALARM_SOUND_HELP"));
addSettingComponent(otherSettingsPanel, BundleMessage.format("UI_FORCE_ACTIVESYNC_UPDATE"), forceActiveSyncUpdateField,
addSettingComponent(otherSettingsPanel, BundleMessage.format("UI_FORCE_ACTIVESYNC_UPDATE"), forceActiveSyncUpdateCheckBox,
BundleMessage.format("UI_FORCE_ACTIVESYNC_UPDATE_HELP"));
addSettingComponent(otherSettingsPanel, BundleMessage.format("UI_DEFAULT_DOMAIN"), defaultDomainField,
BundleMessage.format("UI_DEFAULT_DOMAIN_HELP"));
addSettingComponent(otherSettingsPanel, BundleMessage.format("UI_SHOW_STARTUP_BANNER"), showStartupBannerCheckBox,
BundleMessage.format("UI_SHOW_STARTUP_BANNER_HELP"));
Dimension preferredSize = otherSettingsPanel.getPreferredSize();
preferredSize.width = Integer.MAX_VALUE;
@ -466,8 +471,9 @@ public class SettingsFrame extends JFrame {
disableUpdateCheck.setSelected(Settings.getBooleanProperty(("davmail.disableUpdateCheck")));
caldavAlarmSoundField.setText(Settings.getProperty("davmail.caldavAlarmSound"));
forceActiveSyncUpdateField.setSelected(Settings.getBooleanProperty("davmail.forceActiveSyncUpdate"));
forceActiveSyncUpdateCheckBox.setSelected(Settings.getBooleanProperty("davmail.forceActiveSyncUpdate"));
defaultDomainField.setText(Settings.getProperty("davmail.defaultDomain"));
showStartupBannerCheckBox.setSelected(Settings.getBooleanProperty("davmail.showStartupBanner", true));
keystoreTypeCombo.setSelectedItem(Settings.getProperty("davmail.ssl.keystoreType"));
keystoreFileField.setText(Settings.getProperty("davmail.ssl.keystoreFile"));
@ -575,8 +581,9 @@ public class SettingsFrame extends JFrame {
Settings.setProperty("davmail.disableUpdateCheck", String.valueOf(disableUpdateCheck.isSelected()));
Settings.setProperty("davmail.caldavAlarmSound", String.valueOf(caldavAlarmSoundField.getText()));
Settings.setProperty("davmail.forceActiveSyncUpdate", String.valueOf(forceActiveSyncUpdateField.isSelected()));
Settings.setProperty("davmail.forceActiveSyncUpdate", String.valueOf(forceActiveSyncUpdateCheckBox.isSelected()));
Settings.setProperty("davmail.defaultDomain", String.valueOf(defaultDomainField.getText()));
Settings.setProperty("davmail.showStartupBanner", String.valueOf(showStartupBannerCheckBox.isSelected()));
Settings.setProperty("davmail.ssl.keystoreType", (String) keystoreTypeCombo.getSelectedItem());
Settings.setProperty("davmail.ssl.keystoreFile", keystoreFileField.getText());

View File

@ -249,3 +249,5 @@ UI_FORCE_ACTIVESYNC_UPDATE_HELP=Force update of Caldav events for ActiveSync con
UI_DEFAULT_DOMAIN=Default domain:
UI_DEFAULT_DOMAIN_HELP=Default windows domain name
UI_USE_SYSTEM_PROXIES=Use system proxy settings :
UI_SHOW_STARTUP_BANNER=Display startup banner
UI_SHOW_STARTUP_BANNER_HELP=Whether to show the initial startup notification window or not

View File

@ -249,3 +249,5 @@ UI_DEFAULT_DOMAIN_HELP=Nom du domaine windows par d
EXCEPTION_UNSUPPORTED_PARAMETER=Paramètre non supporté : {0}
EXCEPTION_INVALID_PARAMETER=Paramètre invalide : {0}
UI_USE_SYSTEM_PROXIES=Utiliser la configuration système :
UI_SHOW_STARTUP_BANNER=Notification au lancement
UI_SHOW_STARTUP_BANNER_HELP=Afficher ou non la fenêtre de notification au démarrage

View File

@ -81,6 +81,11 @@
<td>Use double event update to trigger ActiveSync mobile phones sync</td>
<td>false</td>
</tr>
<tr>
<td>Display startup banner</td>
<td>Whether to show the initial startup notification window or not</td>
<td>true</td>
</tr>
<tr>
<td>Caldav alarm sound</td>
<td>Convert Caldav alarm to sound alarm supported by iCal, e.g. Basso. Leave empty for no conversion</td>