From 0983f027914ab7417bc590b1c413dabd6cb0f180 Mon Sep 17 00:00:00 2001 From: angryziber Date: Tue, 15 Apr 2008 20:39:37 +0000 Subject: [PATCH] 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 --- TODO | 1 - resources/Labels.txt | 2 +- src/net/azib/ipscan/config/Version.java | 4 +++- src/net/azib/ipscan/gui/actions/HelpActions.java | 14 +++++++++----- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/TODO b/TODO index 539868c1..cef43e1f 100644 --- a/TODO +++ b/TODO @@ -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 diff --git a/resources/Labels.txt b/resources/Labels.txt index 593cf88b..cdd0abe8 100755 --- a/resources/Labels.txt +++ b/resources/Labels.txt @@ -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: diff --git a/src/net/azib/ipscan/config/Version.java b/src/net/azib/ipscan/config/Version.java index 220ee186..ec2fe435 100755 --- a/src/net/azib/ipscan/config/Version.java +++ b/src/net/azib/ipscan/config/Version.java @@ -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; diff --git a/src/net/azib/ipscan/gui/actions/HelpActions.java b/src/net/azib/ipscan/gui/actions/HelpActions.java index 4733cb12..b329d7a0 100755 --- a/src/net/azib/ipscan/gui/actions/HelpActions.java +++ b/src/net/azib/ipscan/gui/actions/HelpActions.java @@ -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); + } } }); }