/hg/icedtea-web: Links in AppTrustWarningPanel are now clickable.

jvanek at icedtea.classpath.org jvanek at icedtea.classpath.org
Mon May 5 15:12:09 UTC 2014


changeset de898c0d6d5f in /hg/icedtea-web
details: http://icedtea.classpath.org/hg/icedtea-web?cmd=changeset;node=de898c0d6d5f
author: Jiri Vanek <jvanek at redhat.com>
date: Mon May 05 17:11:45 2014 +0200

	Links in AppTrustWarningPanel are now clickable.


diffstat:

 ChangeLog                                                                                                |  10 +++
 netx/net/sourceforge/jnlp/resources/Messages.properties                                                  |   2 +-
 netx/net/sourceforge/jnlp/security/dialogs/apptrustwarningpanel/AppTrustWarningPanel.java                |  27 +++++++++-
 netx/net/sourceforge/jnlp/security/dialogs/apptrustwarningpanel/PartiallySignedAppTrustWarningPanel.java |   6 +-
 4 files changed, 39 insertions(+), 6 deletions(-)

diffs (123 lines):

diff -r 7e5db2ce19da -r de898c0d6d5f ChangeLog
--- a/ChangeLog	Mon May 05 15:52:03 2014 +0200
+++ b/ChangeLog	Mon May 05 17:11:45 2014 +0200
@@ -1,3 +1,13 @@
+2014-05-05  Jiri Vanek  <jvanek at redhat.com>
+
+	Links in AppTrustWarningPanel are now clickable.
+	* netx/net/sourceforge/jnlp/resources/Messages.properties: (SUnsignedDetail)
+	codebase and url changed to href.
+	* netx/net/sourceforge/jnlp/security/dialogs/apptrustwarningpanel/AppTrustWarningPanel.java:
+	infoLabel redeclared from JLabel to JEditorPane. Added hyperlinkListener.
+	* netx/net/sourceforge/jnlp/security/dialogs/apptrustwarningpanel/PartiallySignedAppTrustWarningPanel.java:
+	publisher string allowed to use href.
+
 2014-05-05  Jiri Vanek  <jvanek at redhat.com>
 
 	Properly disconnect all connected http connections
diff -r 7e5db2ce19da -r de898c0d6d5f netx/net/sourceforge/jnlp/resources/Messages.properties
--- a/netx/net/sourceforge/jnlp/resources/Messages.properties	Mon May 05 15:52:03 2014 +0200
+++ b/netx/net/sourceforge/jnlp/resources/Messages.properties	Mon May 05 17:11:45 2014 +0200
@@ -292,7 +292,7 @@
 SRememberAppletOnly=For applet
 SRememberCodebase=For site <u>{0}</u>
 SUnsignedSummary=An unsigned Java application wants to run
-SUnsignedDetail=An unsigned application from the following location wants to run:<br/>  <u>{0}</u><br/>The page which made the request was:<br/>  <u>{1}</u><br/><br/><b>It is recommended you only run applications from sites you trust.</b> 
+SUnsignedDetail=An unsigned application from the following location wants to run:<br/>  <u><a href="{0}" >{0}</a></u><br/>The page which made the request was:<br/>  <u><a href="{1}" >{1}</a></u><br/><br/><b>It is recommended you only run applications from sites you trust.</b> 
 SUnsignedAllowedBefore=<font color="green">You have accepted this applet previously.</font>
 SUnsignedRejectedBefore=<font color="red">You have rejected this applet previously.</font>
 SUnsignedQuestion=Allow the applet to run?
diff -r 7e5db2ce19da -r de898c0d6d5f netx/net/sourceforge/jnlp/security/dialogs/apptrustwarningpanel/AppTrustWarningPanel.java
--- a/netx/net/sourceforge/jnlp/security/dialogs/apptrustwarningpanel/AppTrustWarningPanel.java	Mon May 05 15:52:03 2014 +0200
+++ b/netx/net/sourceforge/jnlp/security/dialogs/apptrustwarningpanel/AppTrustWarningPanel.java	Mon May 05 17:11:45 2014 +0200
@@ -40,12 +40,15 @@
 
 import java.awt.BorderLayout;
 import java.awt.Color;
+import java.awt.Desktop;
 import java.awt.Dimension;
 import java.awt.FlowLayout;
 import java.awt.Font;
 import java.awt.GridLayout;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
+import java.io.IOException;
+import java.net.URISyntaxException;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -56,15 +59,19 @@
 import javax.swing.JButton;
 import javax.swing.JCheckBox;
 import javax.swing.JDialog;
+import javax.swing.JEditorPane;
 import javax.swing.JLabel;
 import javax.swing.JPanel;
 import javax.swing.JRadioButton;
 import javax.swing.SwingConstants;
+import javax.swing.event.HyperlinkEvent;
+import javax.swing.event.HyperlinkListener;
 
 import net.sourceforge.jnlp.JNLPFile;
 import net.sourceforge.jnlp.security.appletextendedsecurity.ExecuteAppletAction;
 import net.sourceforge.jnlp.security.appletextendedsecurity.ExtendedAppletSecurityHelp;
 import net.sourceforge.jnlp.util.ScreenFinder;
+import net.sourceforge.jnlp.util.logging.OutputController;
 
 /*
  * This class is meant to provide a common layout and functionality for warning dialogs
@@ -212,15 +219,31 @@
     }
 
     private void setupInfoPanel() {
+        JPanel infoPanel = new JPanel(new BorderLayout());
         String titleText = getAppletTitle();
         JLabel titleLabel = new JLabel(titleText);
         titleLabel.setFont(new Font(titleLabel.getFont().getName(), Font.BOLD, 18));
 
         String infoLabelText = getInfoPanelText();
-        JLabel infoLabel = new JLabel(infoLabelText);
+        JEditorPane infoLabel = new JEditorPane("text/html", htmlWrap(infoLabelText));
+        infoLabel.setBackground(infoPanel.getBackground());
+        infoLabel.setEditable(false);
+        infoLabel.addHyperlinkListener(new HyperlinkListener() {
+            @Override
+            public void hyperlinkUpdate(HyperlinkEvent e) {
+                try {
+                    if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
+                        Desktop.getDesktop().browse(e.getURL().toURI());
+                    }
+                } catch (IOException ex) {
+                    OutputController.getLogger().log(ex);
+                } catch (URISyntaxException ex) {
+                    OutputController.getLogger().log(ex);
+                }
+            }
+        });
 
         int panelHeight = titleLabel.getHeight() + INFO_PANEL_HEIGHT + INFO_PANEL_HINT_HEIGHT;
-        JPanel infoPanel = new JPanel(new BorderLayout());
         infoPanel.add(titleLabel, BorderLayout.PAGE_START);
         infoPanel.add(infoLabel, BorderLayout.CENTER);
         infoPanel.setPreferredSize(new Dimension(PANE_WIDTH, panelHeight));
diff -r 7e5db2ce19da -r de898c0d6d5f netx/net/sourceforge/jnlp/security/dialogs/apptrustwarningpanel/PartiallySignedAppTrustWarningPanel.java
--- a/netx/net/sourceforge/jnlp/security/dialogs/apptrustwarningpanel/PartiallySignedAppTrustWarningPanel.java	Mon May 05 15:52:03 2014 +0200
+++ b/netx/net/sourceforge/jnlp/security/dialogs/apptrustwarningpanel/PartiallySignedAppTrustWarningPanel.java	Mon May 05 17:11:45 2014 +0200
@@ -109,14 +109,14 @@
 
         try {
             if (file instanceof PluginBridge) {
-                from = file.getCodeBase().getHost();
+                from = file.getCodeBase().toExternalForm();
             } else {
-                from = file.getInformation().getHomepage().toString();
+                from = file.getInformation().getHomepage().toExternalForm();
             }
         } catch (Exception e) {
         }
 
-        return "<br>" + R("Publisher") + ":  " + publisher + "<br>" + R("From") + ": " + from;
+        return "<br>" + R("Publisher") + ":  " + publisher + "<br>" + R("From") + ": <a href='"+from+"'>" + from + "</a>";
     }
 
     private String getSigningInfo() {


More information about the distro-pkg-dev mailing list