mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-12 16:06:15 +00:00
Fixed a minor bug with the properties file.
This commit is contained in:
parent
d9b45b0f01
commit
773203f5c0
@ -37,6 +37,9 @@ import org.sleuthkit.autopsy.directorytree.DirectoryTreeTopComponent;
|
|||||||
public final class CasePreferences {
|
public final class CasePreferences {
|
||||||
|
|
||||||
private static final String SETTINGS_FILE = "CasePreferences.properties"; //NON-NLS
|
private static final String SETTINGS_FILE = "CasePreferences.properties"; //NON-NLS
|
||||||
|
private static final String KEY_GROUP_BY_DATA_SOURCE = "groupByDataSource"; //NON-NLS
|
||||||
|
private static final String VALUE_TRUE = "true"; //NON-NLS
|
||||||
|
private static final String VALUE_FALSE = "false"; //NON-NLS
|
||||||
|
|
||||||
private static final Logger logger = Logger.getLogger(CasePreferences.class.getName());
|
private static final Logger logger = Logger.getLogger(CasePreferences.class.getName());
|
||||||
|
|
||||||
@ -94,10 +97,17 @@ public final class CasePreferences {
|
|||||||
try (InputStream inputStream = Files.newInputStream(settingsFile)) {
|
try (InputStream inputStream = Files.newInputStream(settingsFile)) {
|
||||||
Properties props = new Properties();
|
Properties props = new Properties();
|
||||||
props.load(inputStream);
|
props.load(inputStream);
|
||||||
if (props.getProperty("groupByDataSource", "false").equals("true")) {
|
String groupByDataSourceValue = props.getProperty(KEY_GROUP_BY_DATA_SOURCE);
|
||||||
groupItemsInTreeByDataSource = true;
|
switch (groupByDataSourceValue) {
|
||||||
} else {
|
case VALUE_TRUE:
|
||||||
groupItemsInTreeByDataSource = false;
|
groupItemsInTreeByDataSource = true;
|
||||||
|
break;
|
||||||
|
case VALUE_FALSE:
|
||||||
|
groupItemsInTreeByDataSource = false;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
groupItemsInTreeByDataSource = null;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
logger.log(Level.SEVERE, "Error reading settings file", ex);
|
logger.log(Level.SEVERE, "Error reading settings file", ex);
|
||||||
@ -119,7 +129,7 @@ public final class CasePreferences {
|
|||||||
Path settingsFile = Paths.get(currentCase.getConfigDirectory(), SETTINGS_FILE); //NON-NLS
|
Path settingsFile = Paths.get(currentCase.getConfigDirectory(), SETTINGS_FILE); //NON-NLS
|
||||||
Properties props = new Properties();
|
Properties props = new Properties();
|
||||||
if (groupItemsInTreeByDataSource != null) {
|
if (groupItemsInTreeByDataSource != null) {
|
||||||
props.setProperty("groupByDataSource", (groupItemsInTreeByDataSource ? "true" : "false"));
|
props.setProperty(KEY_GROUP_BY_DATA_SOURCE, (groupItemsInTreeByDataSource ? VALUE_TRUE : VALUE_FALSE));
|
||||||
}
|
}
|
||||||
|
|
||||||
try (OutputStream fos = Files.newOutputStream(settingsFile)) {
|
try (OutputStream fos = Files.newOutputStream(settingsFile)) {
|
||||||
|
@ -427,10 +427,9 @@ public final class DirectoryTreeTopComponent extends TopComponent implements Dat
|
|||||||
* Ask the user if they want to group by data source when opening a large
|
* Ask the user if they want to group by data source when opening a large
|
||||||
* case.
|
* case.
|
||||||
*
|
*
|
||||||
* @param currentCase
|
* @param dataSourceCount The number of data sources in the case.
|
||||||
* @param dataSourceCount
|
|
||||||
*/
|
*/
|
||||||
private void promptForDataSourceGrouping(Case currentCase, int dataSourceCount) {
|
private void promptForDataSourceGrouping(int dataSourceCount) {
|
||||||
if (CasePreferences.getGroupItemsInTreeByDataSource() == null) {
|
if (CasePreferences.getGroupItemsInTreeByDataSource() == null) {
|
||||||
GroupDataSourcesDialog dialog = new GroupDataSourcesDialog(dataSourceCount);
|
GroupDataSourcesDialog dialog = new GroupDataSourcesDialog(dataSourceCount);
|
||||||
dialog.display();
|
dialog.display();
|
||||||
@ -486,7 +485,7 @@ public final class DirectoryTreeTopComponent extends TopComponent implements Dat
|
|||||||
int dataSourceCount = currentCase.getDataSources().size();
|
int dataSourceCount = currentCase.getDataSources().size();
|
||||||
if (!Objects.equals(CasePreferences.getGroupItemsInTreeByDataSource(), true)
|
if (!Objects.equals(CasePreferences.getGroupItemsInTreeByDataSource(), true)
|
||||||
&& dataSourceCount > threshold) {
|
&& dataSourceCount > threshold) {
|
||||||
promptForDataSourceGrouping(currentCase, dataSourceCount);
|
promptForDataSourceGrouping(dataSourceCount);
|
||||||
}
|
}
|
||||||
} catch (TskCoreException ex) {
|
} catch (TskCoreException ex) {
|
||||||
LOGGER.log(Level.SEVERE, "Error loading data sources", ex);
|
LOGGER.log(Level.SEVERE, "Error loading data sources", ex);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user