mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-14 17:06:16 +00:00
Merge remote-tracking branch 'upstream/release-4.6.0' into develop
This commit is contained in:
commit
5ea22d574b
@ -365,81 +365,84 @@ class GlobalListsManagementPanel extends javax.swing.JPanel implements OptionsPa
|
|||||||
chooser.addChoosableFileFilter(autopsyFilter);
|
chooser.addChoosableFileFilter(autopsyFilter);
|
||||||
chooser.addChoosableFileFilter(encaseFilter);
|
chooser.addChoosableFileFilter(encaseFilter);
|
||||||
chooser.setAcceptAllFileFilterUsed(false);
|
chooser.setAcceptAllFileFilterUsed(false);
|
||||||
|
chooser.setMultiSelectionEnabled(true);
|
||||||
chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
|
chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
|
||||||
|
|
||||||
String listName = null;
|
String listName = null;
|
||||||
int returnVal = chooser.showOpenDialog(this);
|
int returnVal = chooser.showOpenDialog(this);
|
||||||
if (returnVal == JFileChooser.APPROVE_OPTION) {
|
if (returnVal == JFileChooser.APPROVE_OPTION) {
|
||||||
File selFile = chooser.getSelectedFile();
|
File[] selFiles = chooser.getSelectedFiles();
|
||||||
if (selFile == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//force append extension if not given
|
for (File file : selFiles) {
|
||||||
String fileAbs = selFile.getAbsolutePath();
|
if (file == null) {
|
||||||
|
continue;
|
||||||
final KeywordSearchList reader;
|
}
|
||||||
|
|
||||||
if (KeywordSearchUtil.isXMLList(fileAbs)) {
|
//force append extension if not given
|
||||||
reader = new XmlKeywordSearchList(fileAbs);
|
String fileAbs = file.getAbsolutePath();
|
||||||
} else {
|
final KeywordSearchList reader;
|
||||||
reader = new EnCaseKeywordSearchList(fileAbs);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!reader.load()) {
|
|
||||||
KeywordSearchUtil.displayDialog(
|
|
||||||
NbBundle.getMessage(this.getClass(), "KeywordSearch.listImportFeatureTitle"), NbBundle.getMessage(this.getClass(), "KeywordSearch.importListFileDialogMsg", fileAbs), KeywordSearchUtil.DIALOG_MESSAGE_TYPE.ERROR);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
List<KeywordList> toImport = reader.getListsL();
|
|
||||||
List<KeywordList> toImportConfirmed = new ArrayList<>();
|
|
||||||
|
|
||||||
final XmlKeywordSearchList writer = XmlKeywordSearchList.getCurrent();
|
|
||||||
|
|
||||||
for (KeywordList list : toImport) {
|
|
||||||
//check name collisions
|
|
||||||
listName = list.getName();
|
|
||||||
if (writer.listExists(listName)) {
|
|
||||||
String[] options;
|
|
||||||
if (toImport.size() == 1) { //only give them cancel and yes buttons for single list imports
|
|
||||||
options = new String[]{NbBundle.getMessage(this.getClass(), "KeywordSearch.yesOwMsg"),
|
|
||||||
NbBundle.getMessage(this.getClass(), "KeywordSearch.cancelImportMsg")};
|
|
||||||
} else {
|
|
||||||
options = new String[]{NbBundle.getMessage(this.getClass(), "KeywordSearch.yesOwMsg"),
|
|
||||||
NbBundle.getMessage(this.getClass(), "KeywordSearch.noSkipMsg"),
|
|
||||||
NbBundle.getMessage(this.getClass(), "KeywordSearch.cancelImportMsg")};
|
|
||||||
}
|
|
||||||
int choice = JOptionPane.showOptionDialog(this,
|
|
||||||
NbBundle.getMessage(this.getClass(), "KeywordSearch.overwriteListPrompt", listName),
|
|
||||||
NbBundle.getMessage(this.getClass(), "KeywordSearch.importOwConflict"),
|
|
||||||
JOptionPane.YES_NO_CANCEL_OPTION,
|
|
||||||
JOptionPane.QUESTION_MESSAGE,
|
|
||||||
null,
|
|
||||||
options,
|
|
||||||
options[0]);
|
|
||||||
if (choice == JOptionPane.OK_OPTION) {
|
|
||||||
toImportConfirmed.add(list);
|
|
||||||
} else if (choice == JOptionPane.CANCEL_OPTION) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (KeywordSearchUtil.isXMLList(fileAbs)) {
|
||||||
|
reader = new XmlKeywordSearchList(fileAbs);
|
||||||
} else {
|
} else {
|
||||||
//no conflict
|
reader = new EnCaseKeywordSearchList(fileAbs);
|
||||||
toImportConfirmed.add(list);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
if (!reader.load()) {
|
||||||
|
KeywordSearchUtil.displayDialog(
|
||||||
|
NbBundle.getMessage(this.getClass(), "KeywordSearch.listImportFeatureTitle"), NbBundle.getMessage(this.getClass(), "KeywordSearch.importListFileDialogMsg", fileAbs), KeywordSearchUtil.DIALOG_MESSAGE_TYPE.ERROR);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (toImportConfirmed.isEmpty()) {
|
List<KeywordList> toImport = reader.getListsL();
|
||||||
return;
|
List<KeywordList> toImportConfirmed = new ArrayList<>();
|
||||||
}
|
|
||||||
|
|
||||||
if (!writer.writeLists(toImportConfirmed)) {
|
final XmlKeywordSearchList writer = XmlKeywordSearchList.getCurrent();
|
||||||
KeywordSearchUtil.displayDialog(
|
|
||||||
NbBundle.getMessage(this.getClass(), "KeywordSearch.listImportFeatureTitle"), NbBundle.getMessage(this.getClass(), "KeywordSearch.kwListFailImportMsg"), KeywordSearchUtil.DIALOG_MESSAGE_TYPE.INFO);
|
for (KeywordList list : toImport) {
|
||||||
|
//check name collisions
|
||||||
|
listName = list.getName();
|
||||||
|
if (writer.listExists(listName)) {
|
||||||
|
String[] options;
|
||||||
|
if (toImport.size() == 1) { //only give them cancel and yes buttons for single list imports
|
||||||
|
options = new String[]{NbBundle.getMessage(this.getClass(), "KeywordSearch.yesOwMsg"),
|
||||||
|
NbBundle.getMessage(this.getClass(), "KeywordSearch.cancelImportMsg")};
|
||||||
|
} else {
|
||||||
|
options = new String[]{NbBundle.getMessage(this.getClass(), "KeywordSearch.yesOwMsg"),
|
||||||
|
NbBundle.getMessage(this.getClass(), "KeywordSearch.noSkipMsg"),
|
||||||
|
NbBundle.getMessage(this.getClass(), "KeywordSearch.cancelImportMsg")};
|
||||||
|
}
|
||||||
|
int choice = JOptionPane.showOptionDialog(this,
|
||||||
|
NbBundle.getMessage(this.getClass(), "KeywordSearch.overwriteListPrompt", listName),
|
||||||
|
NbBundle.getMessage(this.getClass(), "KeywordSearch.importOwConflict"),
|
||||||
|
JOptionPane.YES_NO_CANCEL_OPTION,
|
||||||
|
JOptionPane.QUESTION_MESSAGE,
|
||||||
|
null,
|
||||||
|
options,
|
||||||
|
options[0]);
|
||||||
|
if (choice == JOptionPane.OK_OPTION) {
|
||||||
|
toImportConfirmed.add(list);
|
||||||
|
} else if (choice == JOptionPane.CANCEL_OPTION) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
//no conflict
|
||||||
|
toImportConfirmed.add(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (toImportConfirmed.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!writer.writeLists(toImportConfirmed)) {
|
||||||
|
KeywordSearchUtil.displayDialog(
|
||||||
|
NbBundle.getMessage(this.getClass(), "KeywordSearch.listImportFeatureTitle"), NbBundle.getMessage(this.getClass(), "KeywordSearch.kwListFailImportMsg"), KeywordSearchUtil.DIALOG_MESSAGE_TYPE.INFO);
|
||||||
|
}
|
||||||
|
ModuleSettings.setConfigSetting(ModuleSettings.MAIN_SETTINGS, LAST_KEYWORD_LIST_PATH_KEY, file.getParent());
|
||||||
}
|
}
|
||||||
ModuleSettings.setConfigSetting(ModuleSettings.MAIN_SETTINGS, LAST_KEYWORD_LIST_PATH_KEY, selFile.getParent());
|
|
||||||
}
|
}
|
||||||
tableModel.resync();
|
tableModel.resync();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user