mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-19 19:14:55 +00:00
Merge branch 'develop' of https://github.com/sleuthkit/autopsy into develop
This commit is contained in:
commit
417815a1c2
@ -80,7 +80,16 @@ final class LocalDiskPanel extends JPanel {
|
||||
NbBundle.getMessage(this.getClass(), "LocalDiskPanel.moduleErr.msg"),
|
||||
MessageNotifyUtil.MessageType.ERROR);
|
||||
}
|
||||
|
||||
} else { //The selection changed to nothing valid being selected, such as with ctrl+click
|
||||
enableNext = false;
|
||||
try {
|
||||
firePropertyChange(DataSourceProcessor.DSP_PANEL_EVENT.UPDATE_UI.toString(), false, true);
|
||||
} catch (Exception ex) {
|
||||
logger.log(Level.SEVERE, "LocalDiskPanel listener threw exception", e); //NON-NLS
|
||||
MessageNotifyUtil.Notify.show(NbBundle.getMessage(this.getClass(), "LocalDiskPanel.moduleErr"),
|
||||
NbBundle.getMessage(this.getClass(), "LocalDiskPanel.moduleErr.msg"),
|
||||
MessageNotifyUtil.MessageType.ERROR);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -261,7 +270,7 @@ final class LocalDiskPanel extends JPanel {
|
||||
// set the current directory of the FileChooser if the ImagePath Field is valid
|
||||
File currentFile = new File(oldText);
|
||||
if ((currentFile.getParentFile() != null) && (currentFile.getParentFile().exists())) {
|
||||
fc.setCurrentDirectory(currentFile.getParentFile());
|
||||
fc.setSelectedFile(currentFile);
|
||||
}
|
||||
|
||||
int retval = fc.showOpenDialog(this);
|
||||
@ -335,13 +344,29 @@ final class LocalDiskPanel extends JPanel {
|
||||
subDirectory.mkdirs();
|
||||
}
|
||||
|
||||
String path = disk.getName().replaceAll("[:]", "");
|
||||
String path = disk.getName();
|
||||
|
||||
// Remove all non-ASCII characters
|
||||
path = path.replaceAll("[^\\p{ASCII}]", ""); //NON-NLS
|
||||
|
||||
// Remove all control characters
|
||||
path = path.replaceAll("[\\p{Cntrl}]", ""); //NON-NLS
|
||||
|
||||
// Remove / \ : ? ' "
|
||||
path = path.replaceAll("[/?:'\"\\\\]", ""); //NON-NLS
|
||||
|
||||
path += " " + System.currentTimeMillis();
|
||||
path += ".vhd";
|
||||
pathTextField.setText(Paths.get(getDefaultImageWriterFolder(), path).toString());
|
||||
}
|
||||
|
||||
private boolean imageWriterPathIsValid() {
|
||||
private boolean imageWriterPathIsValid() {
|
||||
if((! copyImageCheckbox.isSelected()) || ! (diskTable.getSelectedRow() >= 0 && diskTable.getSelectedRow() < disks.size())){
|
||||
imageWriterErrorLabel.setVisible(false);
|
||||
imageWriterErrorLabel.setText("");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (pathTextField.getText().isEmpty()) {
|
||||
imageWriterErrorLabel.setVisible(true);
|
||||
imageWriterErrorLabel.setText(NbBundle.getMessage(this.getClass(), "LocalDiskPanel.imageWriterEmptyPathError.text"));
|
||||
@ -385,8 +410,7 @@ final class LocalDiskPanel extends JPanel {
|
||||
* @return true if panel is valid
|
||||
*/
|
||||
boolean validatePanel() {
|
||||
if (copyImageCheckbox.isSelected()
|
||||
&& !imageWriterPathIsValid()) {
|
||||
if (!imageWriterPathIsValid()) {
|
||||
return false;
|
||||
}
|
||||
return enableNext;
|
||||
@ -433,6 +457,7 @@ final class LocalDiskPanel extends JPanel {
|
||||
|
||||
// set the selected timezone
|
||||
timeZoneComboBox.setSelectedItem(formatted);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -608,6 +633,10 @@ final class LocalDiskPanel extends JPanel {
|
||||
diskTable.setEnabled(true);
|
||||
diskTable.clearSelection();
|
||||
}
|
||||
pathTextField.setText("");
|
||||
errorLabel.setText("");
|
||||
errorLabel.setVisible(false);
|
||||
fireUpdateEvent();
|
||||
ready = true;
|
||||
} else {
|
||||
logger.log(Level.INFO, "Loading local disks was canceled, which should not be possible."); //NON-NLS
|
||||
|
@ -98,29 +98,30 @@ class DirectoryTreeFilterNode extends FilterNode {
|
||||
|
||||
/**
|
||||
* This method gets the number of visible children. Depending on the user
|
||||
* preferences, slack files will either be included or purged in the count.
|
||||
* preferences, known and/or slack files will either be included or purged
|
||||
* in the count.
|
||||
*
|
||||
* @param file The AbstractFile object whose children will be counted.
|
||||
*
|
||||
* @return The number of visible children.
|
||||
*/
|
||||
private int getVisibleChildCount(AbstractFile file) throws TskCoreException {
|
||||
int numVisibleChildren = 0;
|
||||
List<Content> childList = file.getChildren();
|
||||
|
||||
int numVisibleChildren = file.getChildrenCount();
|
||||
boolean purgeKnownFiles = UserPreferences.hideKnownFilesInDataSourcesTree();
|
||||
boolean purgeSlackFiles = UserPreferences.hideSlackFilesInDataSourcesTree();
|
||||
|
||||
if(UserPreferences.hideSlackFilesInDataSourcesTree()) {
|
||||
// Purge slack files from the file count
|
||||
if(purgeKnownFiles || purgeSlackFiles) {
|
||||
// Purge known and/or slack files from the file count
|
||||
for(int i=0; i < childList.size(); i++) {
|
||||
AbstractFile childFile = (AbstractFile)childList.get(i);
|
||||
if(childFile.getType() != TskData.TSK_DB_FILES_TYPE_ENUM.SLACK) {
|
||||
numVisibleChildren++;
|
||||
if((purgeKnownFiles && childFile.getKnown() == TskData.FileKnown.KNOWN)
|
||||
|| (purgeSlackFiles && childFile.getType() == TskData.TSK_DB_FILES_TYPE_ENUM.SLACK)) {
|
||||
numVisibleChildren--;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Include slack files in the file count
|
||||
numVisibleChildren = file.getChildrenCount();
|
||||
}
|
||||
|
||||
return numVisibleChildren;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user