Opening the download page is now offered in the "check for new version"

git-svn-id: https://ipscan.svn.sourceforge.net/svnroot/ipscan/trunk@407 375186e5-ef17-0410-b0b6-91563547dcda
This commit is contained in:
angryziber 2008-04-15 20:39:37 +00:00
parent ddad640661
commit 0983f02791
4 changed files with 13 additions and 8 deletions

1
TODO
View File

@ -1,6 +1,5 @@
Before 3.0:
* Check for new version must offer going to the download page
* gtk sort direction arrows
* command-line scanning start
* fetcher-specific options

View File

@ -111,7 +111,7 @@ text.scan.hosts.total=Hosts scanned:
text.scan.hosts.alive=Hosts alive:
text.scan.hosts.ports=With open ports:
text.version.latest=You are running the latest version
text.version.old=The latest stable version is %LATEST, but you are running %VERSION
text.version.old=The latest stable version is %LATEST, but you are running %VERSION.\n\nDo you want to open the download page in the browser?
text.openers.edit=Below you can edit or add new openers
text.openers.name=Opener name (menu item):
text.openers.string=Execution string:

View File

@ -16,7 +16,7 @@ import java.util.logging.Level;
public class Version {
public static final String NAME = "Angry IP Scanner";
public static final String COPYLEFT = "\u00A9 2008 Anton Keks";
public static final String COPYLEFT = "© 2008 Anton Keks";
public static final String WEBSITE = "http://www.azib.net/ipscan/";
@ -30,6 +30,8 @@ public class Version {
public static final String PLUGINS_URL = "http://www.azib.net/w/FAQ:_Plugins";
public static final String DOWNLOAD_URL = "http://www.azib.net/w/Download";
public static final String LATEST_VERSION_URL = "http://www.azib.net/ipscan/IPSCAN.VERSION";
private static String version;

View File

@ -82,14 +82,11 @@ public class HelpActions {
public void check() {
statusBar.setStatusText(Labels.getLabel("state.retrievingVersion"));
// prepare message box in advance
final MessageBox messageBox = new MessageBox(statusBar.getShell(), SWT.ICON_INFORMATION);
messageBox.setText(Version.getFullName());
Runnable checkVersionCode = new Runnable() {
public void run() {
BufferedReader reader = null;
String message = null;
int messageStyle = SWT.ICON_WARNING;
try {
URL url = new URL(Version.LATEST_VERSION_URL);
URLConnection conn = url.openConnection();
@ -102,9 +99,11 @@ public class HelpActions {
message = Labels.getLabel("text.version.old");
message = message.replaceFirst("%LATEST", latestVersion);
message = message.replaceFirst("%VERSION", Version.getVersion());
messageStyle = SWT.ICON_QUESTION | SWT.YES | SWT.NO;
}
else {
message = Labels.getLabel("text.version.latest");
messageStyle = SWT.ICON_INFORMATION;
}
}
catch (Exception e) {
@ -120,11 +119,16 @@ public class HelpActions {
// show the box in the SWT thread
final String messageToShow = message;
final int messageStyleToShow = messageStyle;
Display.getDefault().asyncExec(new Runnable() {
public void run() {
statusBar.setStatusText(null);
MessageBox messageBox = new MessageBox(statusBar.getShell(), messageStyleToShow);
messageBox.setText(Version.getFullName());
messageBox.setMessage(messageToShow);
messageBox.open();
if (messageBox.open() == SWT.YES) {
BrowserLauncher.openURL(Version.DOWNLOAD_URL);
}
}
});
}