Small file transfer fixes [stage]

This commit is contained in:
crschnick 2024-10-10 06:51:47 +00:00
parent 2191ccbfcc
commit 2680066c7f
3 changed files with 9 additions and 7 deletions

View file

@ -36,16 +36,17 @@ public class BrowserAlerts {
new ButtonType(AppI18n.get("renameAll"), ButtonBar.ButtonData.OTHER),
FileConflictChoice.RENAME_ALL);
}
var w = multiple ? 700 : 400;
return AppWindowHelper.showBlockingAlert(alert -> {
alert.setTitle(AppI18n.get("fileConflictAlertTitle"));
alert.setHeaderText(AppI18n.get("fileConflictAlertHeader"));
alert.setAlertType(Alert.AlertType.CONFIRMATION);
alert.getButtonTypes().clear();
alert.getDialogPane().setContent(AppWindowHelper.alertContentText(AppI18n.get(
multiple ? "fileConflictAlertContentMultiple" : "fileConflictAlertContent", file), 655));
alert.getDialogPane().setMinWidth(705);
alert.getDialogPane().setPrefWidth(705);
alert.getDialogPane().setMaxWidth(705);
multiple ? "fileConflictAlertContentMultiple" : "fileConflictAlertContent", file), w - 50));
alert.getDialogPane().setMinWidth(w);
alert.getDialogPane().setPrefWidth(w);
alert.getDialogPane().setMaxWidth(w);
map.sequencedKeySet()
.forEach(buttonType -> alert.getButtonTypes().add(buttonType));
})

View file

@ -199,7 +199,7 @@ public class BrowserFileTransferOperation {
private String renameFile(String target) {
var targetFile = new FilePath(target);
var name = targetFile.getFileName();
var pattern = Pattern.compile("(.+?) \\((\\d+)\\)\\.(.+)");
var pattern = Pattern.compile("(.+) \\((\\d+)\\)\\.(.+?)");
var matcher = pattern.matcher(name);
if (matcher.matches()) {
try {
@ -209,7 +209,8 @@ public class BrowserFileTransferOperation {
} catch (NumberFormatException e) {}
}
return targetFile.getBaseName() + " (" + 1 + ")." + targetFile.getExtension();
var noExt = targetFile.getFileName().equals(targetFile.getExtension());
return targetFile.getBaseName() + " (" + 1 + ")" + (noExt ? "" : "." + targetFile.getExtension());
}
private void handleSingleAcrossFileSystems(FileEntry source) throws Exception {

View file

@ -1 +1 @@
12.2-3
12.2-4