mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-20 03:24:55 +00:00
add View in New Window button to attachments tab of MessageContentViewer
This commit is contained in:
parent
cc448531f8
commit
3ab2dca596
@ -31,3 +31,5 @@ MessageContentViewer.subjectLabel.text=Subject:
|
|||||||
MessageContentViewer.subjectText.text=subject goes here
|
MessageContentViewer.subjectText.text=subject goes here
|
||||||
MessageContentViewer.directionText.text=direction
|
MessageContentViewer.directionText.text=direction
|
||||||
MessageContentViewer.ccLabel.text=CC:
|
MessageContentViewer.ccLabel.text=CC:
|
||||||
|
MessageContentViewer.attachmentsPanel.TabConstraints.tabTitle=Attachments
|
||||||
|
MessageContentViewer.viewInNewWindowButton.text=View in new Window
|
||||||
|
@ -336,6 +336,64 @@
|
|||||||
</Component>
|
</Component>
|
||||||
</SubComponents>
|
</SubComponents>
|
||||||
</Container>
|
</Container>
|
||||||
|
<Container class="javax.swing.JPanel" name="attachmentsPanel">
|
||||||
|
<Constraints>
|
||||||
|
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout$JTabbedPaneConstraintsDescription">
|
||||||
|
<JTabbedPaneConstraints tabName="Attachments">
|
||||||
|
<Property name="tabTitle" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||||
|
<ResourceString bundle="org/sleuthkit/autopsy/contentviewers/Bundle.properties" key="MessageContentViewer.attachmentsPanel.TabConstraints.tabTitle" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||||
|
</Property>
|
||||||
|
</JTabbedPaneConstraints>
|
||||||
|
</Constraint>
|
||||||
|
</Constraints>
|
||||||
|
|
||||||
|
<Layout>
|
||||||
|
<DimensionLayout dim="0">
|
||||||
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
|
<Group type="102" attributes="0">
|
||||||
|
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
|
||||||
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
|
<Group type="102" alignment="1" attributes="0">
|
||||||
|
<Component id="viewInNewWindowButton" min="-2" max="-2" attributes="0"/>
|
||||||
|
<EmptySpace min="-2" pref="3" max="-2" attributes="0"/>
|
||||||
|
</Group>
|
||||||
|
<Group type="102" alignment="1" attributes="0">
|
||||||
|
<Component id="attachmentsScrollPane" pref="647" max="32767" attributes="0"/>
|
||||||
|
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
|
||||||
|
</Group>
|
||||||
|
</Group>
|
||||||
|
</Group>
|
||||||
|
</Group>
|
||||||
|
</DimensionLayout>
|
||||||
|
<DimensionLayout dim="1">
|
||||||
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
|
<Group type="102" alignment="0" attributes="0">
|
||||||
|
<EmptySpace min="-2" pref="0" max="-2" attributes="0"/>
|
||||||
|
<Component id="viewInNewWindowButton" min="-2" max="-2" attributes="0"/>
|
||||||
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
|
<Component id="attachmentsScrollPane" pref="327" max="32767" attributes="0"/>
|
||||||
|
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
|
||||||
|
</Group>
|
||||||
|
</Group>
|
||||||
|
</DimensionLayout>
|
||||||
|
</Layout>
|
||||||
|
<SubComponents>
|
||||||
|
<Component class="javax.swing.JButton" name="viewInNewWindowButton">
|
||||||
|
<Properties>
|
||||||
|
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||||
|
<ResourceString bundle="org/sleuthkit/autopsy/contentviewers/Bundle.properties" key="MessageContentViewer.viewInNewWindowButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||||
|
</Property>
|
||||||
|
</Properties>
|
||||||
|
<Events>
|
||||||
|
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="viewInNewWindowButtonActionPerformed"/>
|
||||||
|
</Events>
|
||||||
|
</Component>
|
||||||
|
<Container class="javax.swing.JScrollPane" name="attachmentsScrollPane">
|
||||||
|
|
||||||
|
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
|
||||||
|
</Container>
|
||||||
|
</SubComponents>
|
||||||
|
</Container>
|
||||||
</SubComponents>
|
</SubComponents>
|
||||||
</Container>
|
</Container>
|
||||||
</SubComponents>
|
</SubComponents>
|
||||||
|
@ -29,6 +29,7 @@ import java.util.stream.Collectors;
|
|||||||
import javax.swing.text.JTextComponent;
|
import javax.swing.text.JTextComponent;
|
||||||
import org.jsoup.Jsoup;
|
import org.jsoup.Jsoup;
|
||||||
import org.jsoup.nodes.Document;
|
import org.jsoup.nodes.Document;
|
||||||
|
import org.openide.explorer.ExplorerManager;
|
||||||
import org.openide.nodes.AbstractNode;
|
import org.openide.nodes.AbstractNode;
|
||||||
import org.openide.nodes.Children;
|
import org.openide.nodes.Children;
|
||||||
import org.openide.nodes.Node;
|
import org.openide.nodes.Node;
|
||||||
@ -41,6 +42,7 @@ import org.sleuthkit.autopsy.corecomponents.TableFilterNode;
|
|||||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||||
import org.sleuthkit.autopsy.datamodel.FileNode;
|
import org.sleuthkit.autopsy.datamodel.FileNode;
|
||||||
import org.sleuthkit.autopsy.directorytree.DataResultFilterNode;
|
import org.sleuthkit.autopsy.directorytree.DataResultFilterNode;
|
||||||
|
import org.sleuthkit.autopsy.directorytree.NewWindowViewAction;
|
||||||
import org.sleuthkit.datamodel.AbstractFile;
|
import org.sleuthkit.datamodel.AbstractFile;
|
||||||
import org.sleuthkit.datamodel.BlackboardArtifact;
|
import org.sleuthkit.datamodel.BlackboardArtifact;
|
||||||
import static org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_EMAIL_MSG;
|
import static org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_EMAIL_MSG;
|
||||||
@ -75,6 +77,7 @@ public class MessageContentViewer extends javax.swing.JPanel implements DataCont
|
|||||||
private static final int TEXT_TAB_INDEX = 1;
|
private static final int TEXT_TAB_INDEX = 1;
|
||||||
private static final int HTML_TAB_INDEX = 2;
|
private static final int HTML_TAB_INDEX = 2;
|
||||||
private static final int RTF_TAB_INDEX = 3;
|
private static final int RTF_TAB_INDEX = 3;
|
||||||
|
private static final int ATTM_TAB_INDEX = 4;
|
||||||
private final List<JTextComponent> textAreas;
|
private final List<JTextComponent> textAreas;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -82,13 +85,13 @@ public class MessageContentViewer extends javax.swing.JPanel implements DataCont
|
|||||||
*/
|
*/
|
||||||
private BlackboardArtifact artifact;
|
private BlackboardArtifact artifact;
|
||||||
private DataResultPanel drp;
|
private DataResultPanel drp;
|
||||||
|
private final ExplorerManager drpExplorerManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates new MessageContentViewer
|
* Creates new MessageContentViewer
|
||||||
*/
|
*/
|
||||||
public MessageContentViewer() {
|
public MessageContentViewer() {
|
||||||
initComponents();
|
initComponents();
|
||||||
|
|
||||||
drp = DataResultPanel.createInstanceUninitialized("Attachments", "", Node.EMPTY, 0, new DataContent() {
|
drp = DataResultPanel.createInstanceUninitialized("Attachments", "", Node.EMPTY, 0, new DataContent() {
|
||||||
@Override
|
@Override
|
||||||
public void setNode(Node selectedNode) {
|
public void setNode(Node selectedNode) {
|
||||||
@ -101,7 +104,8 @@ public class MessageContentViewer extends javax.swing.JPanel implements DataCont
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
msgbodyTabbedPane.addTab("Attachments", drp);
|
|
||||||
|
attachmentsScrollPane.setViewportView(drp);
|
||||||
msgbodyTabbedPane.setEnabledAt(4, true);
|
msgbodyTabbedPane.setEnabledAt(4, true);
|
||||||
|
|
||||||
textAreas = Arrays.asList(headersTextArea, textbodyTextArea, htmlbodyTextPane, rtfbodyTextPane);
|
textAreas = Arrays.asList(headersTextArea, textbodyTextArea, htmlbodyTextPane, rtfbodyTextPane);
|
||||||
@ -111,6 +115,10 @@ public class MessageContentViewer extends javax.swing.JPanel implements DataCont
|
|||||||
resetComponent();
|
resetComponent();
|
||||||
|
|
||||||
drp.open();
|
drp.open();
|
||||||
|
drpExplorerManager = drp.getExplorerManager();
|
||||||
|
drpExplorerManager.addPropertyChangeListener(evt
|
||||||
|
-> viewInNewWindowButton.setEnabled(drpExplorerManager.getSelectedNodes().length == 1));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -144,6 +152,9 @@ public class MessageContentViewer extends javax.swing.JPanel implements DataCont
|
|||||||
showImagesToggleButton = new javax.swing.JToggleButton();
|
showImagesToggleButton = new javax.swing.JToggleButton();
|
||||||
rtfbodyScrollPane = new javax.swing.JScrollPane();
|
rtfbodyScrollPane = new javax.swing.JScrollPane();
|
||||||
rtfbodyTextPane = new javax.swing.JTextPane();
|
rtfbodyTextPane = new javax.swing.JTextPane();
|
||||||
|
attachmentsPanel = new javax.swing.JPanel();
|
||||||
|
viewInNewWindowButton = new javax.swing.JButton();
|
||||||
|
attachmentsScrollPane = new javax.swing.JScrollPane();
|
||||||
|
|
||||||
envelopePanel.setBackground(new java.awt.Color(204, 204, 204));
|
envelopePanel.setBackground(new java.awt.Color(204, 204, 204));
|
||||||
|
|
||||||
@ -287,6 +298,39 @@ public class MessageContentViewer extends javax.swing.JPanel implements DataCont
|
|||||||
|
|
||||||
msgbodyTabbedPane.addTab(org.openide.util.NbBundle.getMessage(MessageContentViewer.class, "MessageContentViewer.rtfbodyScrollPane.TabConstraints.tabTitle"), rtfbodyScrollPane); // NOI18N
|
msgbodyTabbedPane.addTab(org.openide.util.NbBundle.getMessage(MessageContentViewer.class, "MessageContentViewer.rtfbodyScrollPane.TabConstraints.tabTitle"), rtfbodyScrollPane); // NOI18N
|
||||||
|
|
||||||
|
org.openide.awt.Mnemonics.setLocalizedText(viewInNewWindowButton, org.openide.util.NbBundle.getMessage(MessageContentViewer.class, "MessageContentViewer.viewInNewWindowButton.text")); // NOI18N
|
||||||
|
viewInNewWindowButton.addActionListener(new java.awt.event.ActionListener() {
|
||||||
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||||
|
viewInNewWindowButtonActionPerformed(evt);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
javax.swing.GroupLayout attachmentsPanelLayout = new javax.swing.GroupLayout(attachmentsPanel);
|
||||||
|
attachmentsPanel.setLayout(attachmentsPanelLayout);
|
||||||
|
attachmentsPanelLayout.setHorizontalGroup(
|
||||||
|
attachmentsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
|
.addGroup(attachmentsPanelLayout.createSequentialGroup()
|
||||||
|
.addGap(0, 0, 0)
|
||||||
|
.addGroup(attachmentsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
|
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, attachmentsPanelLayout.createSequentialGroup()
|
||||||
|
.addComponent(viewInNewWindowButton)
|
||||||
|
.addGap(3, 3, 3))
|
||||||
|
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, attachmentsPanelLayout.createSequentialGroup()
|
||||||
|
.addComponent(attachmentsScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 647, Short.MAX_VALUE)
|
||||||
|
.addGap(0, 0, 0))))
|
||||||
|
);
|
||||||
|
attachmentsPanelLayout.setVerticalGroup(
|
||||||
|
attachmentsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
|
.addGroup(attachmentsPanelLayout.createSequentialGroup()
|
||||||
|
.addGap(0, 0, 0)
|
||||||
|
.addComponent(viewInNewWindowButton)
|
||||||
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
|
.addComponent(attachmentsScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 327, Short.MAX_VALUE)
|
||||||
|
.addGap(0, 0, 0))
|
||||||
|
);
|
||||||
|
|
||||||
|
msgbodyTabbedPane.addTab(org.openide.util.NbBundle.getMessage(MessageContentViewer.class, "MessageContentViewer.attachmentsPanel.TabConstraints.tabTitle"), attachmentsPanel); // NOI18N
|
||||||
|
|
||||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||||
this.setLayout(layout);
|
this.setLayout(layout);
|
||||||
layout.setHorizontalGroup(
|
layout.setHorizontalGroup(
|
||||||
@ -329,8 +373,15 @@ public class MessageContentViewer extends javax.swing.JPanel implements DataCont
|
|||||||
}
|
}
|
||||||
}//GEN-LAST:event_showImagesToggleButtonActionPerformed
|
}//GEN-LAST:event_showImagesToggleButtonActionPerformed
|
||||||
|
|
||||||
|
private void viewInNewWindowButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_viewInNewWindowButtonActionPerformed
|
||||||
|
|
||||||
|
new NewWindowViewAction("View in new window", drpExplorerManager.getSelectedNodes()[0]).actionPerformed(evt);
|
||||||
|
}//GEN-LAST:event_viewInNewWindowButtonActionPerformed
|
||||||
|
|
||||||
|
|
||||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||||
|
private javax.swing.JPanel attachmentsPanel;
|
||||||
|
private javax.swing.JScrollPane attachmentsScrollPane;
|
||||||
private javax.swing.JLabel ccLabel;
|
private javax.swing.JLabel ccLabel;
|
||||||
private javax.swing.JLabel ccText;
|
private javax.swing.JLabel ccText;
|
||||||
private javax.swing.JLabel datetimeText;
|
private javax.swing.JLabel datetimeText;
|
||||||
@ -353,6 +404,7 @@ public class MessageContentViewer extends javax.swing.JPanel implements DataCont
|
|||||||
private javax.swing.JTextArea textbodyTextArea;
|
private javax.swing.JTextArea textbodyTextArea;
|
||||||
private javax.swing.JLabel toLabel;
|
private javax.swing.JLabel toLabel;
|
||||||
private javax.swing.JLabel toText;
|
private javax.swing.JLabel toText;
|
||||||
|
private javax.swing.JButton viewInNewWindowButton;
|
||||||
// End of variables declaration//GEN-END:variables
|
// End of variables declaration//GEN-END:variables
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -480,12 +532,16 @@ public class MessageContentViewer extends javax.swing.JPanel implements DataCont
|
|||||||
configureTextArea(TSK_EMAIL_CONTENT_PLAIN, TEXT_TAB_INDEX);
|
configureTextArea(TSK_EMAIL_CONTENT_PLAIN, TEXT_TAB_INDEX);
|
||||||
configureTextArea(TSK_EMAIL_CONTENT_HTML, HTML_TAB_INDEX);
|
configureTextArea(TSK_EMAIL_CONTENT_HTML, HTML_TAB_INDEX);
|
||||||
configureTextArea(TSK_EMAIL_CONTENT_RTF, RTF_TAB_INDEX);
|
configureTextArea(TSK_EMAIL_CONTENT_RTF, RTF_TAB_INDEX);
|
||||||
|
|
||||||
|
//TODO: Replace this with code to get the actual attachements!
|
||||||
final Set<AbstractFile> attachments = artifact.getDataSource().getChildren().stream()
|
final Set<AbstractFile> attachments = artifact.getDataSource().getChildren().stream()
|
||||||
.filter(AbstractFile.class::isInstance)
|
.filter(AbstractFile.class::isInstance)
|
||||||
.map(AbstractFile.class::cast)
|
.map(AbstractFile.class::cast)
|
||||||
.collect(Collectors.toSet());
|
.collect(Collectors.toSet());
|
||||||
|
final int numberOfAttachments = attachments.size();
|
||||||
|
|
||||||
|
msgbodyTabbedPane.setEnabledAt(4, numberOfAttachments > 0);
|
||||||
|
msgbodyTabbedPane.setTitleAt(4, "Attachments (" + numberOfAttachments + ")");
|
||||||
drp.setNode(new TableFilterNode(new DataResultFilterNode(new AbstractNode(
|
drp.setNode(new TableFilterNode(new DataResultFilterNode(new AbstractNode(
|
||||||
new AttachmentsChildren(attachments)), null), true));
|
new AttachmentsChildren(attachments)), null), true));
|
||||||
|
|
||||||
@ -519,7 +575,10 @@ public class MessageContentViewer extends javax.swing.JPanel implements DataCont
|
|||||||
msgbodyTabbedPane.setEnabledAt(HTML_TAB_INDEX, false);
|
msgbodyTabbedPane.setEnabledAt(HTML_TAB_INDEX, false);
|
||||||
msgbodyTabbedPane.setEnabledAt(RTF_TAB_INDEX, false);
|
msgbodyTabbedPane.setEnabledAt(RTF_TAB_INDEX, false);
|
||||||
msgbodyTabbedPane.setEnabledAt(HDR_TAB_INDEX, false);
|
msgbodyTabbedPane.setEnabledAt(HDR_TAB_INDEX, false);
|
||||||
|
msgbodyTabbedPane.setEnabledAt(HDR_TAB_INDEX, false);
|
||||||
configureTextArea(TSK_TEXT, TEXT_TAB_INDEX);
|
configureTextArea(TSK_TEXT, TEXT_TAB_INDEX);
|
||||||
|
msgbodyTabbedPane.setEnabledAt(ATTM_TAB_INDEX, false);
|
||||||
|
msgbodyTabbedPane.setTitleAt(ATTM_TAB_INDEX, "Attachments");
|
||||||
} catch (TskCoreException ex) {
|
} catch (TskCoreException ex) {
|
||||||
LOGGER.log(Level.WARNING, "Failed to get attributes for message.", ex); //NON-NLS
|
LOGGER.log(Level.WARNING, "Failed to get attributes for message.", ex); //NON-NLS
|
||||||
}
|
}
|
||||||
|
@ -65,7 +65,7 @@ import org.sleuthkit.autopsy.datamodel.NodeSelectionInfo;
|
|||||||
* normally docked into the lower right hand side of the main window, underneath
|
* normally docked into the lower right hand side of the main window, underneath
|
||||||
* the results view. A custom content view may be specified instead.
|
* the results view. A custom content view may be specified instead.
|
||||||
*/
|
*/
|
||||||
public class DataResultPanel extends javax.swing.JPanel implements DataResult, ChangeListener {
|
public class DataResultPanel extends javax.swing.JPanel implements DataResult, ChangeListener, ExplorerManager.Provider {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
private static final int NO_TAB_SELECTED = -1;
|
private static final int NO_TAB_SELECTED = -1;
|
||||||
@ -521,6 +521,11 @@ public class DataResultPanel extends javax.swing.JPanel implements DataResult, C
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ExplorerManager getExplorerManager() {
|
||||||
|
return explorerManager;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Responds to node selection change events from the explorer manager.
|
* Responds to node selection change events from the explorer manager.
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user