From 2752dccac950fbbe72d31b59b09cb4d84878de40 Mon Sep 17 00:00:00 2001 From: apriestman Date: Mon, 1 Jun 2020 14:51:29 -0400 Subject: [PATCH 1/2] Updated links on About page. Open URLs in browser instead of Autopsy. --- .../corecomponents/AboutWindowPanel.java | 39 +++++++++++++++++-- .../autopsy/corecomponents/Bundle.properties | 2 +- .../corecomponents/Bundle.properties-MERGED | 17 +++----- .../corecomponents/Bundle_ja.properties | 2 +- 4 files changed, 43 insertions(+), 17 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/corecomponents/AboutWindowPanel.java b/Core/src/org/sleuthkit/autopsy/corecomponents/AboutWindowPanel.java index a7f8d2c095..cc352394fe 100644 --- a/Core/src/org/sleuthkit/autopsy/corecomponents/AboutWindowPanel.java +++ b/Core/src/org/sleuthkit/autopsy/corecomponents/AboutWindowPanel.java @@ -19,12 +19,17 @@ package org.sleuthkit.autopsy.corecomponents; import java.awt.Cursor; +import java.awt.Desktop; import java.awt.Window; import java.io.File; +import java.io.IOException; import java.net.MalformedURLException; +import java.net.URI; +import java.net.URISyntaxException; import java.net.URL; import java.text.MessageFormat; import java.util.Locale; +import java.util.logging.Level; import javax.swing.Icon; import javax.swing.ImageIcon; import javax.swing.JPanel; @@ -32,10 +37,10 @@ import javax.swing.SwingUtilities; import javax.swing.event.HyperlinkEvent; import javax.swing.event.HyperlinkListener; import org.netbeans.core.actions.HTMLViewAction; -import org.openide.awt.HtmlBrowser; import org.openide.modules.Places; import org.openide.util.ImageUtilities; import org.openide.util.NbBundle; +import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.PlatformUtil; import org.sleuthkit.autopsy.coreutils.Version; import org.sleuthkit.datamodel.SleuthkitJNI; @@ -47,6 +52,7 @@ import org.sleuthkit.datamodel.SleuthkitJNI; public final class AboutWindowPanel extends JPanel implements HyperlinkListener { private static final long serialVersionUID = 1L; + private static final Logger logger = Logger.getLogger(AboutWindowPanel.class.getName()); private URL url = null; private final Icon about; private boolean verboseLogging; @@ -67,12 +73,30 @@ public final class AboutWindowPanel extends JPanel implements HyperlinkListener description.setText(org.openide.util.NbBundle.getMessage(AboutWindowPanel.class, "LBL_Description", new Object[]{getProductVersionValue(), getJavaValue(), getVMValue(), getOperatingSystemValue(), getEncodingValue(), getSystemLocaleValue(), getUserDirValue(), getSleuthKitVersionValue(), Version.getNetbeansBuild(), Version.getBuildType().toString()})); - description.addHyperlinkListener(this); - copyright.addHyperlinkListener(this); copyright.setBackground(getBackground()); if (verboseLoggingIsSet()) { disableVerboseLoggingButton(); } + + AboutPanelHyperlinkListener hyperlinkListener = new AboutPanelHyperlinkListener(); + copyright.addHyperlinkListener(hyperlinkListener); + description.addHyperlinkListener(hyperlinkListener); + } + + private class AboutPanelHyperlinkListener implements HyperlinkListener { + @Override + public void hyperlinkUpdate(HyperlinkEvent e) { + if(e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { + // Try to display the URL in the user's browswer. + if(Desktop.isDesktopSupported()) { + try { + Desktop.getDesktop().browse(e.getURL().toURI()); + } catch (IOException | URISyntaxException ex) { + logger.log(Level.WARNING, "Failed to display URL in external viewer", ex); + } + } + } + } } // //GEN-BEGIN:initComponents @@ -212,7 +236,14 @@ private void logoLabelMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:e if (url != null) { org.openide.awt.StatusDisplayer.getDefault().setStatusText( NbBundle.getMessage(HTMLViewAction.class, "CTL_OpeningBrowser")); //NON-NLS - HtmlBrowser.URLDisplayer.getDefault().showURL(url); + // Try to display the URL in the user's browswer. + if(Desktop.isDesktopSupported()) { + try { + Desktop.getDesktop().browse(url.toURI()); + } catch (IOException | URISyntaxException ex) { + logger.log(Level.WARNING, "Failed to display URL in external viewer", ex); + } + } } } diff --git a/Core/src/org/sleuthkit/autopsy/corecomponents/Bundle.properties b/Core/src/org/sleuthkit/autopsy/corecomponents/Bundle.properties index 8834b0f5d7..3c4dd31f76 100644 --- a/Core/src/org/sleuthkit/autopsy/corecomponents/Bundle.properties +++ b/Core/src/org/sleuthkit/autopsy/corecomponents/Bundle.properties @@ -17,7 +17,7 @@ DataContentViewerHex.pageLabel2.text=Page # Product Information panel LBL_Description=
\n Product Version: {0} ({9})
Sleuth Kit Version: {7}
Netbeans RCP Build: {8}
Java: {1}; {2}
System: {3}; {4}; {5}
Userdir: {6}
Format_OperatingSystem_Value={0} version {1} running on {2} -LBL_Copyright=
Autopsy™ is a digital forensics platform based on The Sleuth Kit™ and other tools.
Copyright © 2003-2018.
+LBL_Copyright=
Autopsy™ is a digital forensics platform based on The Sleuth Kit™ and other tools.
Copyright © 2003-2020.
URL_ON_IMG=http://www.sleuthkit.org/ FILE_FOR_LOCAL_HELP=file:/// INDEX_FOR_LOCAL_HELP=/docs/index.html diff --git a/Core/src/org/sleuthkit/autopsy/corecomponents/Bundle.properties-MERGED b/Core/src/org/sleuthkit/autopsy/corecomponents/Bundle.properties-MERGED index f252420726..f9f63659b6 100755 --- a/Core/src/org/sleuthkit/autopsy/corecomponents/Bundle.properties-MERGED +++ b/Core/src/org/sleuthkit/autopsy/corecomponents/Bundle.properties-MERGED @@ -17,9 +17,6 @@ CTL_DataContentTopComponent=Data Content CTL_CustomAboutAction=About CTL_OfflineHelpAction=Offline Autopsy Documentation CTL_OnlineHelpAction=Online Autopsy Documentation -DataContentViewerArtifact.attrsTableHeader.sources=Source(s) -DataContentViewerArtifact.attrsTableHeader.type=Type -DataContentViewerArtifact.attrsTableHeader.value=Value DataContentViewerArtifact.failedToGetAttributes.message=Failed to get some or all attributes from case database DataContentViewerArtifact.failedToGetSourcePath.message=Failed to get source file path from case database DataContentViewerHex.copyingFile=Copying file to open in HxD... @@ -63,9 +60,9 @@ DataContentViewerHex.totalPageLabel.text_1=100 DataContentViewerHex.pageLabel2.text=Page # Product Information panel -LBL_Description=
\n Product Version: {0} ({9})
Sleuth Kit Version: {7}
Netbeans RCP Build: {8}
Java: {1}; {2}
System: {3}; {4}; {5}
Userdir: {6}
+LBL_Description=
\n Product Version: {0} ({9})
Sleuth Kit Version: {7}
Netbeans RCP Build: {8}
Java: {1}; {2}
System: {3}; {4}; {5}
Userdir: {6}
Format_OperatingSystem_Value={0} version {1} running on {2} -LBL_Copyright=
Autopsy™ is a digital forensics platform based on The Sleuth Kit™ and other tools.
Copyright © 2003-2018.
+LBL_Copyright=
Autopsy™ is a digital forensics platform based on The Sleuth Kit™ and other tools.
Copyright © 2003-2020.
SortChooser.dialogTitle=Choose Sort Criteria ThumbnailViewChildren.progress.cancelling=(Cancelling) # {0} - file name @@ -82,8 +79,6 @@ DataContentViewerArtifact.pageLabel2.text=Result DataContentViewerArtifact.nextPageButton.text= DataContentViewerArtifact.currentPageLabel.text=1 DataContentViewerArtifact.ofLabel.text=of -DataContentViewerArtifact.copyMenuItem.text=Copy -DataContentViewerArtifact.selectAllMenuItem.text=Select All DataContentViewerArtifact.pageLabel.text=Result: AdvancedConfigurationDialog.applyButton.text=OK DataContentViewerHex.goToPageTextField.text= @@ -95,7 +90,7 @@ DataResultViewerThumbnail.pageNextButton.text= DataResultViewerThumbnail.imagesLabel.text=Images: DataResultViewerThumbnail.imagesRangeLabel.text=- DataResultViewerThumbnail.pageNumLabel.text=- -DataResultViewerThumbnail.filePathLabel.text=\ +DataResultViewerThumbnail.filePathLabel.text=\ \ \ DataResultViewerThumbnail.goToPageLabel.text=Go to Page: DataResultViewerThumbnail.goToPageField.text= AdvancedConfigurationDialog.cancelButton.text=Cancel @@ -129,9 +124,9 @@ DataResultViewerThumbnail.switchPage.done.errMsg=Error making thumbnails: {0} AboutWindowPanel.actVerboseLogging.text=Activate verbose logging OptionsCategory_Name_Multi_User_Settings=Multi-User OptionsCategory_Keywords_Multi_User_Options=Multi-User Settings -MultiUserSettingsPanel.lbSolrSettings.text=Solr Settings +MultiUserSettingsPanel.lbSolrSettings.text=Solr Server Settings MultiUserSettingsPanel.cbEnableMultiUser.text=Enable multi-user cases -MultiUserSettingsPanel.lbDatabaseSettings.text=Database Settings +MultiUserSettingsPanel.lbDatabaseSettings.text=Database Server Settings MultiUserSettingsPanel.validationErrMsg.incomplete=Fill in all values MultiUserSettingsPanel.nonWindowsOs.msg=Multi-user cases are only available on Windows platforms MultiUserSettingsPanel.validationErrMsg.invalidDatabasePort=Invalid database port number @@ -159,7 +154,7 @@ MultiUserSettingsPanel.tbSolrHostname.toolTipText=Hostname or IP Address MultiUserSettingsPanel.tbSolrPort.toolTipText=Port Number MultiUserSettingsPanel.lbTestMessageService.text= MultiUserSettingsPanel.bnTestMessageService.text=Test -MultiUserSettingsPanel.lbMessageServiceSettings.text=ActiveMQ Message Service Settings +MultiUserSettingsPanel.lbMessageServiceSettings.text=ActiveMQ Message Server Settings MultiUserSettingsPanel.tbMsgPort.toolTipText=Port Number MultiUserSettingsPanel.tbMsgPort.text= MultiUserSettingsPanel.tbMsgUsername.toolTipText=User Name (optional) diff --git a/Core/src/org/sleuthkit/autopsy/corecomponents/Bundle_ja.properties b/Core/src/org/sleuthkit/autopsy/corecomponents/Bundle_ja.properties index ec91946e79..5e684d205c 100644 --- a/Core/src/org/sleuthkit/autopsy/corecomponents/Bundle_ja.properties +++ b/Core/src/org/sleuthkit/autopsy/corecomponents/Bundle_ja.properties @@ -65,7 +65,7 @@ DataContentViewerHex.pageLabel2.text=\u30da\u30fc\u30b8 # \u88fd\u54c1\u60c5\u5831\u30d1\u30cd\u30eb LBL_Description=
\n \u88fd\u54c1\u30d0\u30fc\u30b8\u30e7\u30f3: {0} ({9})
Sleuth Kit\u30d0\u30fc\u30b8\u30e7\u30f3: {7}
Netbeans RCP\u30d3\u30eb\u30c9: {8}
Java: {1}; {2}
\u30b7\u30b9\u30c6\u30e0: {3}; {4}; {5}
Userdir: {6}
Format_OperatingSystem_Value={2} \u4e0a\u3067 {0} \u30d0\u30fc\u30b8\u30e7\u30f3 {1} \u304c\u5b9f\u884c\u4e2d\u3067\u3059 -LBL_Copyright=
Autopsy™ \u306fSleuth Kit&trade\u3068\u305d\u306e\u4ed6\u30c4\u30fc\u30eb\u3092\u30d9\u30fc\u30b9\u3068\u3057\u305f\u30c7\u30b8\u30bf\u30eb\u30d5\u30a9\u30ec\u30f3\u30b8\u30c3\u30af\u30fb\u30d7\u30e9\u30c3\u30c8\u30d5\u30a9\u30fc\u30e0\u3067\u3059\u3002
\u8457\u4f5c\u6a29 © 2003-2018.
+LBL_Copyright=
Autopsy™ \u306fSleuth Kit&trade\u3068\u305d\u306e\u4ed6\u30c4\u30fc\u30eb\u3092\u30d9\u30fc\u30b9\u3068\u3057\u305f\u30c7\u30b8\u30bf\u30eb\u30d5\u30a9\u30ec\u30f3\u30b8\u30c3\u30af\u30fb\u30d7\u30e9\u30c3\u30c8\u30d5\u30a9\u30fc\u30e0\u3067\u3059\u3002
\u8457\u4f5c\u6a29 © 2003-2020.
SortChooser.dialogTitle=\u30bd\u30fc\u30c8\u6761\u4ef6\u3092\u9078\u629e ThumbnailViewChildren.progress.cancelling=(\u53d6\u308a\u6d88\u3057\u4e2d) # {0} - \u30d5\u30a1\u30a4\u30eb\u540d From 9b9bf661306e76326197c364844b1ac82eb183eb Mon Sep 17 00:00:00 2001 From: apriestman Date: Mon, 8 Jun 2020 13:54:41 -0400 Subject: [PATCH 2/2] Codacy --- .../corecomponents/AboutWindowPanel.java | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/corecomponents/AboutWindowPanel.java b/Core/src/org/sleuthkit/autopsy/corecomponents/AboutWindowPanel.java index cc352394fe..200b04a6bb 100644 --- a/Core/src/org/sleuthkit/autopsy/corecomponents/AboutWindowPanel.java +++ b/Core/src/org/sleuthkit/autopsy/corecomponents/AboutWindowPanel.java @@ -24,7 +24,6 @@ import java.awt.Window; import java.io.File; import java.io.IOException; import java.net.MalformedURLException; -import java.net.URI; import java.net.URISyntaxException; import java.net.URL; import java.text.MessageFormat; @@ -83,18 +82,20 @@ public final class AboutWindowPanel extends JPanel implements HyperlinkListener description.addHyperlinkListener(hyperlinkListener); } + /** + * Listener to display hyperlinks in an external viewer. + */ private class AboutPanelHyperlinkListener implements HyperlinkListener { @Override public void hyperlinkUpdate(HyperlinkEvent e) { - if(e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { + if(e.getEventType() == HyperlinkEvent.EventType.ACTIVATED + && Desktop.isDesktopSupported()) { // Try to display the URL in the user's browswer. - if(Desktop.isDesktopSupported()) { - try { - Desktop.getDesktop().browse(e.getURL().toURI()); - } catch (IOException | URISyntaxException ex) { - logger.log(Level.WARNING, "Failed to display URL in external viewer", ex); - } - } + try { + Desktop.getDesktop().browse(e.getURL().toURI()); + } catch (IOException | URISyntaxException ex) { + logger.log(Level.WARNING, "Failed to display URL in external viewer", ex); + } } } }