mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-12 16:06:15 +00:00
Merge pull request #1140 from karlmortensen/help_to_menu
Add offline help files to Help menu
This commit is contained in:
commit
4ed44abf91
@ -29,6 +29,8 @@ URL_ON_IMG=http://www.sleuthkit.org/
|
|||||||
|
|
||||||
URL_ON_HELP=http://sleuthkit.org/autopsy/docs/user-docs/3.1/
|
URL_ON_HELP=http://sleuthkit.org/autopsy/docs/user-docs/3.1/
|
||||||
|
|
||||||
|
FILE_FOR_LOCAL_HELP=file:///
|
||||||
|
INDEX_FOR_LOCAL_HELP=/docs/index.html
|
||||||
LBL_Close=Close
|
LBL_Close=Close
|
||||||
DataContentViewerString.copyMenuItem.text=Copy
|
DataContentViewerString.copyMenuItem.text=Copy
|
||||||
DataContentViewerHex.copyMenuItem.text=Copy
|
DataContentViewerHex.copyMenuItem.text=Copy
|
||||||
|
@ -0,0 +1,108 @@
|
|||||||
|
/*
|
||||||
|
* Autopsy Forensic Browser
|
||||||
|
*
|
||||||
|
* Copyright 2011-2015 Basis Technology Corp.
|
||||||
|
* Contact: carrier <at> sleuthkit <dot> org
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package org.sleuthkit.autopsy.corecomponents;
|
||||||
|
|
||||||
|
import java.awt.Desktop;
|
||||||
|
import java.awt.event.ActionEvent;
|
||||||
|
import java.awt.event.ActionListener;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.MalformedURLException;
|
||||||
|
import java.net.URI;
|
||||||
|
import org.netbeans.core.actions.HTMLViewAction;
|
||||||
|
import org.openide.awt.ActionID;
|
||||||
|
import org.openide.awt.ActionReference;
|
||||||
|
import org.openide.awt.ActionReferences;
|
||||||
|
import org.openide.awt.ActionRegistration;
|
||||||
|
import org.openide.awt.HtmlBrowser;
|
||||||
|
import org.openide.util.NbBundle;
|
||||||
|
import org.openide.util.NbBundle.Messages;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implements a hyperlink to the Offline Documentation.
|
||||||
|
*/
|
||||||
|
@ActionID(
|
||||||
|
category = "Help",
|
||||||
|
id = "org.sleuthkit.autopsy.corecomponents.OfflineHelpAction"
|
||||||
|
)
|
||||||
|
@ActionRegistration(
|
||||||
|
displayName = "#CTL_OfflineHelpAction"
|
||||||
|
)
|
||||||
|
@ActionReferences({
|
||||||
|
@ActionReference(path = "Menu/Help", position = 1),
|
||||||
|
@ActionReference(path = "Shortcuts", name = "F2")
|
||||||
|
})
|
||||||
|
@Messages("CTL_OfflineHelpAction=Offline Autopsy Documentation")
|
||||||
|
public final class OfflineHelpAction implements ActionListener {
|
||||||
|
|
||||||
|
private URI uri;
|
||||||
|
private static final Logger Logger =
|
||||||
|
org.sleuthkit.autopsy.coreutils.Logger.getLogger(AboutWindowPanel.class.getName());
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
viewOfflineHelp();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Displays the Offline Documentation in the system browser. If not
|
||||||
|
* available, displays it in the built-in OpenIDE HTML Browser.
|
||||||
|
*
|
||||||
|
* Tested and working: Chrome, Firefox, IE
|
||||||
|
* Not tested: Opera, Safari
|
||||||
|
*/
|
||||||
|
private void viewOfflineHelp() {
|
||||||
|
String fileForHelp = "";
|
||||||
|
String indexForHelp = "";
|
||||||
|
String currentDirectory = "";
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Match the form: file:///C:/some/directory/AutopsyXYZ/docs/index.html
|
||||||
|
fileForHelp = NbBundle.getMessage(OfflineHelpAction.class, "FILE_FOR_LOCAL_HELP");
|
||||||
|
indexForHelp = NbBundle.getMessage(OfflineHelpAction.class, "INDEX_FOR_LOCAL_HELP");
|
||||||
|
currentDirectory = System.getProperty("user.dir").replace("\\", "/").replace(" ", "%20"); //NON-NLS
|
||||||
|
uri = new URI(fileForHelp + currentDirectory + indexForHelp);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
Logger.log(Level.SEVERE, "Unable to load Offline Documentation: "
|
||||||
|
+ fileForHelp + currentDirectory + indexForHelp, ex); //NON-NLS
|
||||||
|
}
|
||||||
|
if (uri != null) {
|
||||||
|
// Display URL in the System browser
|
||||||
|
if (Desktop.isDesktopSupported()) {
|
||||||
|
Desktop desktop = Desktop.getDesktop();
|
||||||
|
try {
|
||||||
|
desktop.browse(uri);
|
||||||
|
} catch (IOException ex) {
|
||||||
|
Logger.log(Level.SEVERE, "Unable to launch the system browser: "
|
||||||
|
+ fileForHelp + currentDirectory + indexForHelp, ex); //NON-NLS
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
org.openide.awt.StatusDisplayer.getDefault().setStatusText(
|
||||||
|
NbBundle.getMessage(HTMLViewAction.class, "CTL_OpeningBrowser")); //NON-NLS
|
||||||
|
try {
|
||||||
|
HtmlBrowser.URLDisplayer.getDefault().showURL(uri.toURL());
|
||||||
|
} catch (MalformedURLException ex) {
|
||||||
|
Logger.log(Level.SEVERE, "Unable to launch the built-in browser: "
|
||||||
|
+ fileForHelp + currentDirectory + indexForHelp, ex); //NON-NLS
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -51,7 +51,7 @@ import java.util.logging.Logger;
|
|||||||
@ActionReference(path = "Menu/Help", position = 0),
|
@ActionReference(path = "Menu/Help", position = 0),
|
||||||
@ActionReference(path = "Shortcuts", name = "F1")
|
@ActionReference(path = "Shortcuts", name = "F1")
|
||||||
})
|
})
|
||||||
@Messages("CTL_OnlineHelpAction=Online Documentation")
|
@Messages("CTL_OnlineHelpAction=Online Autopsy Documentation")
|
||||||
public final class OnlineHelpAction implements ActionListener {
|
public final class OnlineHelpAction implements ActionListener {
|
||||||
|
|
||||||
private URI uri;
|
private URI uri;
|
||||||
|
@ -69,9 +69,12 @@
|
|||||||
<copy file="${basedir}/LICENSE-2.0.txt" tofile="${zip-tmp}/${app.name}/LICENSE-2.0.txt"/>
|
<copy file="${basedir}/LICENSE-2.0.txt" tofile="${zip-tmp}/${app.name}/LICENSE-2.0.txt"/>
|
||||||
<copy file="${basedir}/NEWS.txt" tofile="${zip-tmp}/${app.name}/NEWS.txt"/>
|
<copy file="${basedir}/NEWS.txt" tofile="${zip-tmp}/${app.name}/NEWS.txt"/>
|
||||||
<copy file="${basedir}/KNOWN_ISSUES.txt" tofile="${zip-tmp}/${app.name}/KNOWN_ISSUES.txt"/>
|
<copy file="${basedir}/KNOWN_ISSUES.txt" tofile="${zip-tmp}/${app.name}/KNOWN_ISSUES.txt"/>
|
||||||
|
|
||||||
<unzip src="${thirdparty.dir}/gstreamer/${os.family}/i386/0.10.7/gstreamer.zip" dest="${zip-tmp}/${app.name}/gstreamer"/>
|
<unzip src="${thirdparty.dir}/gstreamer/${os.family}/i386/0.10.7/gstreamer.zip" dest="${zip-tmp}/${app.name}/gstreamer"/>
|
||||||
<copy file="${basedir}/icons/icon.ico" tofile="${zip-tmp}/${app.name}/icon.ico" overwrite="true"/>
|
<copy file="${basedir}/icons/icon.ico" tofile="${zip-tmp}/${app.name}/icon.ico" overwrite="true"/>
|
||||||
|
<!-- Copy the Autopsy documentation to the docs folder -->
|
||||||
|
<copy flatten="true" todir="${zip-tmp}/${app.name}/docs">
|
||||||
|
<fileset dir="${basedir}/docs/doxygen-user/user-docs"/>
|
||||||
|
</copy>
|
||||||
|
|
||||||
<antcall target="copyLibsToZip"/>
|
<antcall target="copyLibsToZip"/>
|
||||||
|
|
||||||
@ -229,7 +232,7 @@
|
|||||||
|
|
||||||
<target name="versioning-script" depends="check-release, versioning-script-if-release, versioning-script-if-not-release"/>
|
<target name="versioning-script" depends="check-release, versioning-script-if-release, versioning-script-if-not-release"/>
|
||||||
|
|
||||||
<target name="build-installer" depends="getProps, build-zip" description="Builds Autopsy installer.">
|
<target name="build-installer" depends="getProps, doxygen, build-zip" description="Builds Autopsy installer.">
|
||||||
<delete dir="${nbdist.dir}/${app.name}-installer" quiet="true"/>
|
<delete dir="${nbdist.dir}/${app.name}-installer" quiet="true"/>
|
||||||
<unzip src="${nbdist.dir}/${app.name}-${app.version}.zip" dest="${nbdist.dir}/${app.name}-installer"/>
|
<unzip src="${nbdist.dir}/${app.name}-${app.version}.zip" dest="${nbdist.dir}/${app.name}-installer"/>
|
||||||
<antcall target="build-installer-${os.family}" />
|
<antcall target="build-installer-${os.family}" />
|
||||||
|
Loading…
x
Reference in New Issue
Block a user