Various fixes

This commit is contained in:
crschnick
2026-01-31 20:40:17 +00:00
parent 9796565eba
commit bcd715e35a
6 changed files with 38 additions and 6 deletions
@@ -22,6 +22,8 @@ import javafx.beans.property.SimpleStringProperty;
import javafx.collections.ListChangeListener;
import javafx.geometry.Insets;
import javafx.scene.Node;
import javafx.scene.input.KeyCode;
import javafx.scene.input.KeyEvent;
import javafx.scene.layout.Region;
import javafx.scene.layout.VBox;
@@ -212,6 +214,13 @@ public class StoreChoicePopover<T extends DataStore> {
popover.setAutoHide(!AppPrefs.get().limitedTouchscreenMode().get());
AppFontSizes.xs(popover.getContentNode());
popover.addEventFilter(KeyEvent.KEY_PRESSED, event -> {
if (event.getCode() == KeyCode.ESCAPE) {
popover.hide();
event.consume();
}
});
// Hide on connection creation dialog
AppDialog.getModalOverlays().addListener((ListChangeListener<? super ModalOverlay>) c -> {
popover.hide();
@@ -71,6 +71,29 @@ public interface ElevationFunction {
};
}
static ElevationFunction cached(String key, ElevationFunction elevationFunction) {
return new ElevationFunction() {
@Override
public String getPrefix() {
return elevationFunction.getPrefix();
}
@Override
public boolean isSpecified() {
return elevationFunction.isSpecified();
}
@Override
public boolean apply(ShellControl shellControl) throws Exception {
var view = shellControl.view();
return view.getCachedPredicate(key, () -> {
return elevationFunction.apply(shellControl);
});
}
};
}
static ElevationFunction none() {
return new ElevationFunction() {
@Override
@@ -1379,7 +1379,7 @@ public abstract class DataStorage {
}
if (!entry.getValidity().isUsable()) {
return "Unknown";
return entry.getName();
}
return entry.getProvider().displayName(entry);
@@ -94,7 +94,7 @@ public final class FilePath {
}
public FilePath removeTrailingSlash() {
if (value.equals("/")) {
if (value.equals("/") || value.equals("\\")) {
return FilePath.of(value);
}
@@ -21,7 +21,7 @@ public class IncusCommandView extends CommandViewBase {
}
private static ElevationFunction requiresElevation() {
return new ElevationFunction() {
return ElevationFunction.cached("incusRequiresElevation", new ElevationFunction() {
@Override
public String getPrefix() {
return "Incus";
@@ -44,7 +44,7 @@ public class IncusCommandView extends CommandViewBase {
+ "test -S /var/lib/incus/unix.socket.user && test -w /var/lib/incus/unix.socket.user")
.executeAndCheck();
}
};
});
}
private static String formatErrorMessage(String s) {
@@ -22,7 +22,7 @@ public class LxdCommandView extends CommandViewBase {
}
private static ElevationFunction requiresElevation() {
return new ElevationFunction() {
return ElevationFunction.cached("lxdRequiresElevation", new ElevationFunction() {
@Override
public String getPrefix() {
return "LXD";
@@ -44,7 +44,7 @@ public class LxdCommandView extends CommandViewBase {
+ ".socket && test -w /var/snap/lxd/common/lxd/unix.socket")
.executeAndCheck();
}
};
});
}
private static String formatErrorMessage(String s) {