Compare commits

...

2 commits

Author SHA1 Message Date
crschnick
66f6b69cbe Fix move transfer operation 2024-05-07 00:09:51 +00:00
crschnick
9212871db9 Indent category move menu. Closes #249 2024-05-07 00:09:31 +00:00
2 changed files with 13 additions and 4 deletions

View file

@ -111,13 +111,19 @@ public class BrowserFileTransferOperation {
}
for (var file : files) {
if (file.getFileSystem().equals(target.getFileSystem())) {
if (same) {
handleSingleOnSameFileSystem(file);
updateProgress(BrowserTransferProgress.finished(file.getName(), file.getSize()));
} else {
handleSingleAcrossFileSystems(file);
}
}
if (!same && doesMove) {
for (var file : files) {
deleteSingle(file);
}
}
}
private void handleSingleOnSameFileSystem(FileSystem.FileEntry source)
@ -143,8 +149,7 @@ public class BrowserFileTransferOperation {
return;
}
var same = files.getFirst().getFileSystem().equals(target.getFileSystem());
var doesMove = transferMode == BrowserFileTransferMode.MOVE || (same && transferMode == BrowserFileTransferMode.NORMAL);
var doesMove = transferMode == BrowserFileTransferMode.MOVE || transferMode == BrowserFileTransferMode.NORMAL;
if (doesMove) {
target.getFileSystem().move(sourceFile, targetFile);
} else {
@ -266,6 +271,10 @@ public class BrowserFileTransferOperation {
updateProgress(BrowserTransferProgress.finished(source.getName(), totalSize.get()));
}
private void deleteSingle(FileSystem.FileEntry source) throws Exception {
source.getFileSystem().delete(source.getPath());
}
private static final int DEFAULT_BUFFER_SIZE = 1024;
private void transferFile(

View file

@ -389,7 +389,7 @@ public abstract class StoreEntryComp extends SimpleComp {
.getSortedCategories(wrapper.getCategory().getValue().getRoot())
.forEach(storeCategoryWrapper -> {
MenuItem m = new MenuItem();
m.textProperty().bind(storeCategoryWrapper.nameProperty());
m.textProperty().setValue(" ".repeat(storeCategoryWrapper.getDepth()) + storeCategoryWrapper.getName().getValue());
m.setOnAction(event -> {
wrapper.moveTo(storeCategoryWrapper.getCategory());
event.consume();