mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-12 07:56:16 +00:00
Merge pull request #2078 from BasisOlivers/ui-bugfix
Fixed file size rule ui bug.
This commit is contained in:
commit
2a099cf87d
@ -152,6 +152,7 @@ final class FilesSetRulePanel extends javax.swing.JPanel {
|
||||
this.mimeTypeComboBox.setSelectedItem(mimeTypeCondition.getMimeType());
|
||||
}
|
||||
}
|
||||
|
||||
private void populateSizeConditionComponents(FilesSet.Rule rule) {
|
||||
FilesSet.Rule.FileSizeCondition fileSizeCondition = rule.getFileSizeCondition();
|
||||
if (fileSizeCondition != null) {
|
||||
@ -311,8 +312,7 @@ final class FilesSetRulePanel extends javax.swing.JPanel {
|
||||
DialogDisplayer.getDefault().notify(notifyDesc);
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (this.nameTextField.getText().isEmpty() || !FilesSetRulePanel.containsOnlyLegalChars(this.nameTextField.getText(), FilesSetRulePanel.ILLEGAL_FILE_NAME_CHARS)) {
|
||||
} else if (this.nameTextField.getText().isEmpty() || !FilesSetRulePanel.containsOnlyLegalChars(this.nameTextField.getText(), FilesSetRulePanel.ILLEGAL_FILE_NAME_CHARS)) {
|
||||
NotifyDescriptor notifyDesc = new NotifyDescriptor.Message(
|
||||
NbBundle.getMessage(FilesSetPanel.class, "FilesSetRulePanel.messages.invalidCharInName"),
|
||||
NotifyDescriptor.WARNING_MESSAGE);
|
||||
@ -320,7 +320,6 @@ final class FilesSetRulePanel extends javax.swing.JPanel {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// The path condition, if specified, must either be a regular expression
|
||||
// that compiles or a string without illegal file path chars.
|
||||
@ -342,8 +341,7 @@ final class FilesSetRulePanel extends javax.swing.JPanel {
|
||||
DialogDisplayer.getDefault().notify(notifyDesc);
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (this.pathTextField.getText().isEmpty() || !FilesSetRulePanel.containsOnlyLegalChars(this.pathTextField.getText(), FilesSetRulePanel.ILLEGAL_FILE_PATH_CHARS)) {
|
||||
} else if (this.pathTextField.getText().isEmpty() || !FilesSetRulePanel.containsOnlyLegalChars(this.pathTextField.getText(), FilesSetRulePanel.ILLEGAL_FILE_PATH_CHARS)) {
|
||||
NotifyDescriptor notifyDesc = new NotifyDescriptor.Message(
|
||||
NbBundle.getMessage(FilesSetPanel.class, "FilesSetRulePanel.messages.invalidCharInPath"),
|
||||
NotifyDescriptor.WARNING_MESSAGE);
|
||||
@ -351,7 +349,6 @@ final class FilesSetRulePanel extends javax.swing.JPanel {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.mimeCheck.isSelected()) {
|
||||
if (this.mimeTypeComboBox.getSelectedIndex() == 0) {
|
||||
NotifyDescriptor notifyDesc = new NotifyDescriptor.Message(
|
||||
@ -407,8 +404,7 @@ final class FilesSetRulePanel extends javax.swing.JPanel {
|
||||
logger.log(Level.SEVERE, "Attempt to get regex name condition that does not compile", ex); // NON-NLS
|
||||
throw new IllegalStateException("The files set rule panel name condition is not in a valid state"); // NON-NLS
|
||||
}
|
||||
} else {
|
||||
if (FilesSetRulePanel.containsOnlyLegalChars(this.nameTextField.getText(), FilesSetRulePanel.ILLEGAL_FILE_NAME_CHARS)) {
|
||||
} else if (FilesSetRulePanel.containsOnlyLegalChars(this.nameTextField.getText(), FilesSetRulePanel.ILLEGAL_FILE_NAME_CHARS)) {
|
||||
if (this.fullNameRadioButton.isSelected()) {
|
||||
condition = new FilesSet.Rule.FullNameCondition(this.nameTextField.getText());
|
||||
} else {
|
||||
@ -419,7 +415,6 @@ final class FilesSetRulePanel extends javax.swing.JPanel {
|
||||
throw new IllegalStateException("The files set rule panel name condition is not in a valid state"); // NON-NLS
|
||||
}
|
||||
}
|
||||
}
|
||||
return condition;
|
||||
}
|
||||
|
||||
@ -443,12 +438,14 @@ final class FilesSetRulePanel extends javax.swing.JPanel {
|
||||
*/
|
||||
FilesSet.Rule.FileSizeCondition getFileSizeCondition() {
|
||||
FilesSet.Rule.FileSizeCondition condition = null;
|
||||
if (this.fileSizeCheck.isSelected()) {
|
||||
if ((Integer) this.fileSizeSpinner.getValue() != 0 || ((String) this.equalitySymbolComboBox.getSelectedItem()).equals("=")) {
|
||||
FilesSet.Rule.FileSizeCondition.COMPARATOR comparator = FilesSet.Rule.FileSizeCondition.COMPARATOR.fromSymbol((String) this.equalitySymbolComboBox.getSelectedItem());
|
||||
FilesSet.Rule.FileSizeCondition.SIZE_UNIT unit = FilesSet.Rule.FileSizeCondition.SIZE_UNIT.fromName((String) this.fileSizeComboBox.getSelectedItem());
|
||||
int fileSizeValue = (Integer) this.fileSizeSpinner.getValue();
|
||||
condition = new FilesSet.Rule.FileSizeCondition(comparator, unit, fileSizeValue);
|
||||
}
|
||||
}
|
||||
return condition;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user