SPARK-664 Add beta releases to the upgrade notification system.

git-svn-id: http://svn.igniterealtime.org/svn/repos/spark/trunk@8070 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Derek DeMoro
2007-04-19 18:06:09 +00:00
committed by derek
parent ccbf3d40d9
commit cfe629c5e7
5 changed files with 35 additions and 4 deletions

View File

@ -140,7 +140,7 @@ public class CollapsibleTitlePane extends JPanel {
if (!isSubPane()) {
if (collapsed) {
if (!collapsed) {
preIconLabel.setIcon(SparkRes.getImageIcon(SparkRes.PANE_DOWN_ARROW_IMAGE));
}
else {

View File

@ -64,11 +64,13 @@ public class NotificationsPreference implements Preference {
boolean windowFocus = localPreferences.getWindowTakesFocus();
boolean offlineNotification = localPreferences.isOfflineNotificationsOn();
boolean onlineNotification = localPreferences.isOnlineNotificationsOn();
boolean betaChecking = localPreferences.isBetaCheckingEnabled();
panel.setShowToaster(toaster);
panel.setShowWindowPopup(windowFocus);
panel.setOfflineNotification(offlineNotification);
panel.setOnlineNotification(onlineNotification);
panel.setCheckForBeta(betaChecking);
}
};
@ -83,6 +85,7 @@ public class NotificationsPreference implements Preference {
pref.setWindowTakesFocus(panel.shouldWindowPopup());
pref.setOfflineNotifications(panel.isOfflineNotificationOn());
pref.setOnlineNotifications(panel.isOnlineNotificationOn());
pref.setCheckForBeta(panel.isBetaCheckingEnabled());
SettingsManager.saveSettings();
}

View File

@ -29,6 +29,7 @@ public class NotificationsUI extends JPanel {
private JCheckBox windowFocusBox;
private JCheckBox offlineNotificationBox;
private JCheckBox onlineNotificationBox;
private JCheckBox betaCheckBox;
public NotificationsUI() {
setLayout(new VerticalFlowLayout());
@ -48,6 +49,9 @@ public class NotificationsUI extends JPanel {
onlineNotificationBox = new JCheckBox("Notify when a user comes online.");
add(onlineNotificationBox);
betaCheckBox = new JCheckBox("Check for Beta Updates");
add(betaCheckBox);
}
public void setShowToaster(boolean show) {
@ -81,4 +85,12 @@ public class NotificationsUI extends JPanel {
public boolean isOnlineNotificationOn() {
return onlineNotificationBox.isSelected();
}
public void setCheckForBeta(boolean check) {
betaCheckBox.setSelected(check);
}
public boolean isBetaCheckingEnabled() {
return betaCheckBox.isSelected();
}
}

View File

@ -543,6 +543,14 @@ public class LocalPreferences {
return getBoolean("useSystemLookAndFeel", false);
}
public void setCheckForBeta(boolean checkForBeta) {
setBoolean("checkForBeta", checkForBeta);
}
public boolean isBetaCheckingEnabled() {
return getBoolean("checkForBeta", false);
}
private boolean getBoolean(String property, boolean defaultValue) {
return Boolean.parseBoolean(props.getProperty(property, Boolean.toString(defaultValue)));
}

View File

@ -85,7 +85,7 @@ public class CheckUpdates {
// Specify the main update url for JiveSoftware
this.mainUpdateURL = "http://www.igniterealtime.org/updater/updater";
sparkPluginInstalled = isSparkPluginInstalled(SparkManager.getConnection());
sparkPluginInstalled = false;//isSparkPluginInstalled(SparkManager.getConnection());
}
public SparkVersion newBuildAvailable() {
@ -126,6 +126,14 @@ public class CheckUpdates {
post.addParameter("os", "linux");
}
// Check to see if the beta should be included.
LocalPreferences pref = SettingsManager.getLocalPreferences();
boolean isBetaCheckingEnabled = pref.isBetaCheckingEnabled();
if (isBetaCheckingEnabled) {
post.addParameter("beta", "true");
}
Protocol.registerProtocol("https", new Protocol("https", new EasySSLProtocolSocketFactory(), 443));
HttpClient httpclient = new HttpClient();
String proxyHost = System.getProperty("http.proxyHost");
@ -462,7 +470,7 @@ public class CheckUpdates {
/**
* Returns true if the first version number is greater than the second.
*
* @param firstVersion the first version number.
* @param firstVersion the first version number.
* @param secondVersion the second version number.
* @return returns true if the first version is greater than the second.
*/
@ -495,7 +503,7 @@ public class CheckUpdates {
}
else if (versionTwoBetaOrAlpha) {
String versionTwo = getVersion(secondVersion);
return !(versionTwo.compareTo(secondVersion) >= 1);
return (firstVersion.compareTo(versionTwo) >= 1);
}