Fix category move updates

This commit is contained in:
crschnick 2024-10-04 16:53:55 +00:00
parent d7527b40e6
commit a565c795cf
3 changed files with 11 additions and 0 deletions

View file

@ -281,6 +281,13 @@ public class StoreViewState {
}
});
}
@Override
public void onEntryCategoryChange(DataStoreCategory from, DataStoreCategory to) {
synchronized (this) {
categories.getList().forEach(storeCategoryWrapper -> storeCategoryWrapper.update());
}
}
});
}

View file

@ -350,9 +350,11 @@ public abstract class DataStorage {
return;
}
var oldCat = getStoreCategoryIfPresent(entry.getCategoryUuid()).orElse(getDefaultConnectionsCategory());
entry.setCategoryUuid(newCategory.getUuid());
var children = getDeepStoreChildren(entry);
children.forEach(child -> child.setCategoryUuid(newCategory.getUuid()));
listeners.forEach(storageListener -> storageListener.onEntryCategoryChange(oldCat, newCategory));
listeners.forEach(storageListener -> storageListener.onStoreListUpdate());
saveAsync();
}

View file

@ -11,4 +11,6 @@ public interface StorageListener {
void onCategoryAdd(DataStoreCategory category);
void onCategoryRemove(DataStoreCategory category);
void onEntryCategoryChange(DataStoreCategory from, DataStoreCategory to);
}