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

View file

@ -199,7 +199,7 @@ public class BrowserFileTransferOperation {
private String renameFile(String target) { private String renameFile(String target) {
var targetFile = new FilePath(target); var targetFile = new FilePath(target);
var name = targetFile.getFileName(); var name = targetFile.getFileName();
var pattern = Pattern.compile("(.+?) \\((\\d+)\\)\\.(.+)"); var pattern = Pattern.compile("(.+) \\((\\d+)\\)\\.(.+?)");
var matcher = pattern.matcher(name); var matcher = pattern.matcher(name);
if (matcher.matches()) { if (matcher.matches()) {
try { try {
@ -209,7 +209,8 @@ public class BrowserFileTransferOperation {
} catch (NumberFormatException e) {} } 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 { private void handleSingleAcrossFileSystems(FileEntry source) throws Exception {

View file

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