diff --git a/Core/src/org/sleuthkit/autopsy/filesearch/DateSearchFilter.java b/Core/src/org/sleuthkit/autopsy/filesearch/DateSearchFilter.java index be42035087..507edfe973 100644 --- a/Core/src/org/sleuthkit/autopsy/filesearch/DateSearchFilter.java +++ b/Core/src/org/sleuthkit/autopsy/filesearch/DateSearchFilter.java @@ -67,7 +67,8 @@ class DateSearchFilter extends AbstractFileSearchFilter { @Override public boolean isEnabled() { - return this.getComponent().getDateCheckBox().isSelected(); + return this.getComponent().getDateCheckBox().isSelected() && + this.getComponent().isSearchable(); } @Override diff --git a/Core/src/org/sleuthkit/autopsy/filesearch/DateSearchPanel.form b/Core/src/org/sleuthkit/autopsy/filesearch/DateSearchPanel.form index 2d09e16507..e92d57fdd9 100644 --- a/Core/src/org/sleuthkit/autopsy/filesearch/DateSearchPanel.form +++ b/Core/src/org/sleuthkit/autopsy/filesearch/DateSearchPanel.form @@ -236,6 +236,9 @@ + + + @@ -244,6 +247,9 @@ + + + @@ -252,6 +258,9 @@ + + + @@ -260,6 +269,9 @@ + + + diff --git a/Core/src/org/sleuthkit/autopsy/filesearch/DateSearchPanel.java b/Core/src/org/sleuthkit/autopsy/filesearch/DateSearchPanel.java index a852fddfa3..718eaa8b8f 100644 --- a/Core/src/org/sleuthkit/autopsy/filesearch/DateSearchPanel.java +++ b/Core/src/org/sleuthkit/autopsy/filesearch/DateSearchPanel.java @@ -222,15 +222,35 @@ class DateSearchPanel extends javax.swing.JPanel { modifiedCheckBox.setSelected(true); modifiedCheckBox.setText(org.openide.util.NbBundle.getMessage(DateSearchPanel.class, "DateSearchPanel.modifiedCheckBox.text")); // NOI18N + modifiedCheckBox.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + modifiedCheckBoxActionPerformed(evt); + } + }); changedCheckBox.setSelected(true); changedCheckBox.setText(org.openide.util.NbBundle.getMessage(DateSearchPanel.class, "DateSearchPanel.changedCheckBox.text")); // NOI18N + changedCheckBox.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + changedCheckBoxActionPerformed(evt); + } + }); accessedCheckBox.setSelected(true); accessedCheckBox.setText(org.openide.util.NbBundle.getMessage(DateSearchPanel.class, "DateSearchPanel.accessedCheckBox.text")); // NOI18N + accessedCheckBox.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + accessedCheckBoxActionPerformed(evt); + } + }); createdCheckBox.setSelected(true); createdCheckBox.setText(org.openide.util.NbBundle.getMessage(DateSearchPanel.class, "DateSearchPanel.createdCheckBox.text")); // NOI18N + createdCheckBox.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + createdCheckBoxActionPerformed(evt); + } + }); dateFromButtonCalendar.setText(org.openide.util.NbBundle.getMessage(DateSearchPanel.class, "DateSearchPanel.dateFromButtonCalendar.text")); // NOI18N dateFromButtonCalendar.addPropertyChangeListener(new java.beans.PropertyChangeListener() { @@ -365,6 +385,22 @@ class DateSearchPanel extends javax.swing.JPanel { pcs.firePropertyChange(FileSearchPanel.EVENT.CHECKED.toString(), null, null); }//GEN-LAST:event_dateCheckBoxActionPerformed + private void modifiedCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_modifiedCheckBoxActionPerformed + pcs.firePropertyChange(FileSearchPanel.EVENT.CHECKED.toString(), null, null); + }//GEN-LAST:event_modifiedCheckBoxActionPerformed + + private void accessedCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_accessedCheckBoxActionPerformed + pcs.firePropertyChange(FileSearchPanel.EVENT.CHECKED.toString(), null, null); + }//GEN-LAST:event_accessedCheckBoxActionPerformed + + private void createdCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_createdCheckBoxActionPerformed + pcs.firePropertyChange(FileSearchPanel.EVENT.CHECKED.toString(), null, null); + }//GEN-LAST:event_createdCheckBoxActionPerformed + + private void changedCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_changedCheckBoxActionPerformed + pcs.firePropertyChange(FileSearchPanel.EVENT.CHECKED.toString(), null, null); + }//GEN-LAST:event_changedCheckBoxActionPerformed + /** * Validate and set the datetime field on the screen given a datetime * string. @@ -393,6 +429,13 @@ class DateSearchPanel extends javax.swing.JPanel { dateToTextField.setText(dateStringResult); dateToButtonCalendar.setTargetDate(date); } + + boolean isSearchable() { + return this.accessedCheckBox.isSelected() || + this.changedCheckBox.isSelected() || + this.createdCheckBox.isSelected() || + this.modifiedCheckBox.isSelected(); + } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JCheckBox accessedCheckBox; private javax.swing.JCheckBox changedCheckBox; diff --git a/Core/src/org/sleuthkit/autopsy/filesearch/KnownStatusSearchFilter.java b/Core/src/org/sleuthkit/autopsy/filesearch/KnownStatusSearchFilter.java index 8bd74d02fa..b40eedf845 100644 --- a/Core/src/org/sleuthkit/autopsy/filesearch/KnownStatusSearchFilter.java +++ b/Core/src/org/sleuthkit/autopsy/filesearch/KnownStatusSearchFilter.java @@ -40,7 +40,8 @@ class KnownStatusSearchFilter extends AbstractFileSearchFilter + + + @@ -83,6 +86,9 @@ + + + diff --git a/Core/src/org/sleuthkit/autopsy/filesearch/KnownStatusSearchPanel.java b/Core/src/org/sleuthkit/autopsy/filesearch/KnownStatusSearchPanel.java index 89e12481b1..4791d8c4fb 100644 --- a/Core/src/org/sleuthkit/autopsy/filesearch/KnownStatusSearchPanel.java +++ b/Core/src/org/sleuthkit/autopsy/filesearch/KnownStatusSearchPanel.java @@ -77,6 +77,10 @@ class KnownStatusSearchPanel extends javax.swing.JPanel { pcs.removePropertyChangeListener(pcl); } + boolean isSearchable() { + return this.unknownOptionCheckBox.isSelected() || this.knownBadOptionCheckBox.isSelected() || this.knownOptionCheckBox.isSelected(); + } + /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always @@ -100,6 +104,11 @@ class KnownStatusSearchPanel extends javax.swing.JPanel { unknownOptionCheckBox.setSelected(true); unknownOptionCheckBox.setText(org.openide.util.NbBundle.getMessage(KnownStatusSearchPanel.class, "KnownStatusSearchPanel.unknownOptionCheckBox.text")); // NOI18N + unknownOptionCheckBox.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + unknownOptionCheckBoxActionPerformed(evt); + } + }); knownOptionCheckBox.setSelected(true); knownOptionCheckBox.setText(org.openide.util.NbBundle.getMessage(KnownStatusSearchPanel.class, "KnownStatusSearchPanel.knownOptionCheckBox.text")); // NOI18N @@ -111,6 +120,11 @@ class KnownStatusSearchPanel extends javax.swing.JPanel { knownBadOptionCheckBox.setSelected(true); knownBadOptionCheckBox.setText(org.openide.util.NbBundle.getMessage(KnownStatusSearchPanel.class, "KnownStatusSearchPanel.knownBadOptionCheckBox.text")); // NOI18N + knownBadOptionCheckBox.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + knownBadOptionCheckBoxActionPerformed(evt); + } + }); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); @@ -141,7 +155,7 @@ class KnownStatusSearchPanel extends javax.swing.JPanel { }// //GEN-END:initComponents private void knownOptionCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_knownOptionCheckBoxActionPerformed - // TODO add your handling code here: + pcs.firePropertyChange(FileSearchPanel.EVENT.CHECKED.toString(), null, null); }//GEN-LAST:event_knownOptionCheckBoxActionPerformed private void knownCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_knownCheckBoxActionPerformed @@ -149,6 +163,14 @@ class KnownStatusSearchPanel extends javax.swing.JPanel { pcs.firePropertyChange(FileSearchPanel.EVENT.CHECKED.toString(), null, null); }//GEN-LAST:event_knownCheckBoxActionPerformed + private void unknownOptionCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_unknownOptionCheckBoxActionPerformed + pcs.firePropertyChange(FileSearchPanel.EVENT.CHECKED.toString(), null, null); + }//GEN-LAST:event_unknownOptionCheckBoxActionPerformed + + private void knownBadOptionCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_knownBadOptionCheckBoxActionPerformed + pcs.firePropertyChange(FileSearchPanel.EVENT.CHECKED.toString(), null, null); + }//GEN-LAST:event_knownBadOptionCheckBoxActionPerformed + // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JCheckBox knownBadOptionCheckBox; private javax.swing.JCheckBox knownCheckBox; diff --git a/Core/src/org/sleuthkit/autopsy/filesearch/NameSearchFilter.java b/Core/src/org/sleuthkit/autopsy/filesearch/NameSearchFilter.java index 2433a71ba3..40e10701cc 100644 --- a/Core/src/org/sleuthkit/autopsy/filesearch/NameSearchFilter.java +++ b/Core/src/org/sleuthkit/autopsy/filesearch/NameSearchFilter.java @@ -19,7 +19,6 @@ package org.sleuthkit.autopsy.filesearch; import java.awt.event.ActionListener; - import org.openide.util.NbBundle; import org.sleuthkit.autopsy.filesearch.FileSearchFilter.FilterValidationException; @@ -42,7 +41,8 @@ class NameSearchFilter extends AbstractFileSearchFilter { @Override public boolean isEnabled() { - return this.getComponent().getNameCheckBox().isSelected(); + return this.getComponent().getNameCheckBox().isSelected() && + !this.getComponent().getSearchTextField().getText().isEmpty(); } @Override diff --git a/Core/src/org/sleuthkit/autopsy/filesearch/NameSearchPanel.java b/Core/src/org/sleuthkit/autopsy/filesearch/NameSearchPanel.java index dd7a3d008f..4ffc2c86f7 100644 --- a/Core/src/org/sleuthkit/autopsy/filesearch/NameSearchPanel.java +++ b/Core/src/org/sleuthkit/autopsy/filesearch/NameSearchPanel.java @@ -31,6 +31,8 @@ import java.beans.PropertyChangeSupport; import javax.swing.JCheckBox; import javax.swing.JMenuItem; import javax.swing.JTextField; +import javax.swing.event.DocumentEvent; +import javax.swing.event.DocumentListener; /** * @@ -71,6 +73,22 @@ class NameSearchPanel extends javax.swing.JPanel { copyMenuItem.addActionListener(actList); pasteMenuItem.addActionListener(actList); selectAllMenuItem.addActionListener(actList); + this.searchTextField.getDocument().addDocumentListener(new DocumentListener() { + @Override + public void insertUpdate(DocumentEvent e) { + pcs.firePropertyChange(FileSearchPanel.EVENT.CHECKED.toString(), null, null); + } + + @Override + public void removeUpdate(DocumentEvent e) { + pcs.firePropertyChange(FileSearchPanel.EVENT.CHECKED.toString(), null, null); + } + + @Override + public void changedUpdate(DocumentEvent e) { + pcs.firePropertyChange(FileSearchPanel.EVENT.CHECKED.toString(), null, null); + } + }); }