mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-12 16:06:15 +00:00
Merge pull request #4111 from millmanorama/1023-mark-unseen-when-group_changes
update seen status of groups when files are added
This commit is contained in:
commit
009e40dc8b
@ -42,6 +42,7 @@ import java.util.TreeSet;
|
||||
import java.util.concurrent.CancellationException;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.logging.Level;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
@ -286,17 +287,19 @@ public class GroupManager {
|
||||
group.removeFile(fileID);
|
||||
|
||||
// If we're grouping by category, we don't want to remove empty groups.
|
||||
if (groupKey.getAttribute() != DrawableAttribute.CATEGORY
|
||||
&& group.getFileIDs().isEmpty()) {
|
||||
if (analyzedGroups.contains(group)) {
|
||||
analyzedGroups.remove(group);
|
||||
sortAnalyzedGroups();
|
||||
}
|
||||
if (unSeenGroups.contains(group)) {
|
||||
unSeenGroups.remove(group);
|
||||
sortUnseenGroups();
|
||||
}
|
||||
if (group.getFileIDs().isEmpty()) {
|
||||
markGroupSeen(group, true);
|
||||
if (groupKey.getAttribute() != DrawableAttribute.CATEGORY) {
|
||||
if (analyzedGroups.contains(group)) {
|
||||
analyzedGroups.remove(group);
|
||||
sortAnalyzedGroups();
|
||||
}
|
||||
|
||||
if (unSeenGroups.contains(group)) {
|
||||
unSeenGroups.remove(group);
|
||||
sortUnseenGroups();
|
||||
}
|
||||
}
|
||||
}
|
||||
return group;
|
||||
}
|
||||
@ -501,21 +504,26 @@ public class GroupManager {
|
||||
//if there is aleady a group that was previously deemed fully analyzed, then add this newly analyzed file to it.
|
||||
group.addFile(fileID);
|
||||
}
|
||||
markGroupSeen(group, false);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
synchronized public void handleTagDeleted(ContentTagDeletedEvent evt) {
|
||||
GroupKey<?> groupKey = null;
|
||||
final ContentTagDeletedEvent.DeletedContentTagInfo deletedTagInfo = evt.getDeletedTagInfo();
|
||||
final TagName tagName = deletedTagInfo.getName();
|
||||
if (getGroupBy() == DrawableAttribute.CATEGORY && CategoryManager.isCategoryTagName(tagName)) {
|
||||
groupKey = new GroupKey<>(DrawableAttribute.CATEGORY, CategoryManager.categoryFromTagName(tagName), getDataSource());
|
||||
} else if (getGroupBy() == DrawableAttribute.TAGS && CategoryManager.isNotCategoryTagName(tagName)) {
|
||||
groupKey = new GroupKey<>(DrawableAttribute.TAGS, tagName, getDataSource());
|
||||
final TagName deletedTagName = deletedTagInfo.getName();
|
||||
if (getGroupBy() == DrawableAttribute.CATEGORY && CategoryManager.isCategoryTagName(deletedTagName)) {
|
||||
groupKey = new GroupKey<>(DrawableAttribute.CATEGORY, CategoryManager.categoryFromTagName(deletedTagName), null);
|
||||
} else if (getGroupBy() == DrawableAttribute.TAGS && CategoryManager.isNotCategoryTagName(deletedTagName)) {
|
||||
groupKey = new GroupKey<>(DrawableAttribute.TAGS, deletedTagName, null);
|
||||
}
|
||||
if (groupKey != null) {
|
||||
final long fileID = deletedTagInfo.getContentID();
|
||||
DrawableGroup g = removeFromGroup(groupKey, fileID);
|
||||
|
||||
if (controller.getCategoryManager().getTagName(DhsImageCategory.ZERO).equals(deletedTagName) == false) {
|
||||
addFileToGroup(null, new GroupKey<>(DrawableAttribute.CATEGORY, DhsImageCategory.ZERO, null), fileID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user