Merge 13.4-release into master [release]

This commit is contained in:
crschnick
2024-12-04 13:49:32 +00:00
parent 4e88ed2fff
commit 8661018619
41 changed files with 308 additions and 37 deletions
@@ -4,6 +4,8 @@ import io.xpipe.app.browser.action.BrowserBranchAction;
import io.xpipe.app.browser.action.BrowserLeafAction;
import io.xpipe.app.browser.file.BrowserEntry;
import io.xpipe.app.browser.file.BrowserFileSystemTabModel;
import io.xpipe.app.comp.Comp;
import io.xpipe.app.comp.base.ModalOverlayComp;
import io.xpipe.app.core.AppI18n;
import io.xpipe.core.process.CommandBuilder;
import io.xpipe.core.process.OsType;
@@ -12,9 +14,11 @@ import javafx.beans.property.SimpleStringProperty;
import javafx.beans.value.ObservableValue;
import javafx.scene.Node;
import javafx.scene.control.TextField;
import org.kordamp.ikonli.javafx.FontIcon;
import java.util.List;
import java.util.stream.Stream;
public class ChgrpAction implements BrowserBranchAction {
@@ -41,13 +45,13 @@ public class ChgrpAction implements BrowserBranchAction {
@Override
public List<BrowserLeafAction> getBranchingActions(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
return model.getCache().getGroups().entrySet().stream()
return Stream.concat(model.getCache().getGroups().entrySet().stream()
.filter(e -> !e.getValue().equals("nohome")
&& !e.getValue().equals("nogroup")
&& !e.getValue().equals("nobody")
&& (e.getKey().equals(0) || e.getKey() >= 900))
.map(e -> e.getValue())
.map(s -> (BrowserLeafAction) new Chgrp(s))
.map(s -> (BrowserLeafAction) new Chgrp(s)), Stream.of(new Custom()))
.toList();
}
@@ -77,4 +81,38 @@ public class ChgrpAction implements BrowserBranchAction {
.toList()));
}
}
private static class Custom implements BrowserLeafAction {
@Override
public void execute(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
var group = new SimpleStringProperty();
model.getOverlay()
.setValue(new ModalOverlayComp.OverlayContent(
"groupName",
Comp.of(() -> {
var creationName = new TextField();
creationName.textProperty().bindBidirectional(group);
return creationName;
})
.prefWidth(350),
null,
"finish",
() -> {
model.runCommandAsync(CommandBuilder.of()
.add("chgrp", group.getValue())
.addFiles(entries.stream()
.map(browserEntry ->
browserEntry.getRawFileEntry().getPath())
.toList()), false);
},
true));
}
@Override
public ObservableValue<String> getName(
BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
return new SimpleStringProperty("...");
}
}
}
@@ -4,6 +4,9 @@ import io.xpipe.app.browser.action.BrowserBranchAction;
import io.xpipe.app.browser.action.BrowserLeafAction;
import io.xpipe.app.browser.file.BrowserEntry;
import io.xpipe.app.browser.file.BrowserFileSystemTabModel;
import io.xpipe.app.browser.icon.BrowserIcons;
import io.xpipe.app.comp.Comp;
import io.xpipe.app.comp.base.ModalOverlayComp;
import io.xpipe.app.core.AppI18n;
import io.xpipe.core.process.CommandBuilder;
import io.xpipe.core.process.OsType;
@@ -12,6 +15,7 @@ import javafx.beans.property.SimpleStringProperty;
import javafx.beans.value.ObservableValue;
import javafx.scene.Node;
import javafx.scene.control.TextField;
import org.kordamp.ikonli.javafx.FontIcon;
import java.util.List;
@@ -40,6 +44,7 @@ public class ChmodAction implements BrowserBranchAction {
@Override
public List<BrowserLeafAction> getBranchingActions(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
var custom = new Custom();
return List.of(
new Chmod("400"),
new Chmod("600"),
@@ -48,7 +53,8 @@ public class ChmodAction implements BrowserBranchAction {
new Chmod("755"),
new Chmod("777"),
new Chmod("u+x"),
new Chmod("a+x"));
new Chmod("a+x"),
custom);
}
private static class Chmod implements BrowserLeafAction {
@@ -77,4 +83,37 @@ public class ChmodAction implements BrowserBranchAction {
.toList()));
}
}
private static class Custom implements BrowserLeafAction {
@Override
public void execute(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
var permissions = new SimpleStringProperty();
model.getOverlay()
.setValue(new ModalOverlayComp.OverlayContent(
"chmodPermissions",
Comp.of(() -> {
var creationName = new TextField();
creationName.textProperty().bindBidirectional(permissions);
return creationName;
})
.prefWidth(350),
null,
"finish",
() -> {
model.runCommandAsync(CommandBuilder.of()
.add("chmod", permissions.getValue())
.addFiles(entries.stream()
.map(browserEntry ->
browserEntry.getRawFileEntry().getPath())
.toList()), false);
},
true));
}
@Override
public ObservableValue<String> getName(
BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
return new SimpleStringProperty("...");
}
}
}
@@ -4,6 +4,8 @@ import io.xpipe.app.browser.action.BrowserBranchAction;
import io.xpipe.app.browser.action.BrowserLeafAction;
import io.xpipe.app.browser.file.BrowserEntry;
import io.xpipe.app.browser.file.BrowserFileSystemTabModel;
import io.xpipe.app.comp.Comp;
import io.xpipe.app.comp.base.ModalOverlayComp;
import io.xpipe.app.core.AppI18n;
import io.xpipe.core.process.CommandBuilder;
import io.xpipe.core.process.OsType;
@@ -12,9 +14,11 @@ import javafx.beans.property.SimpleStringProperty;
import javafx.beans.value.ObservableValue;
import javafx.scene.Node;
import javafx.scene.control.TextField;
import org.kordamp.ikonli.javafx.FontIcon;
import java.util.List;
import java.util.stream.Stream;
public class ChownAction implements BrowserBranchAction {
@@ -41,12 +45,12 @@ public class ChownAction implements BrowserBranchAction {
@Override
public List<BrowserLeafAction> getBranchingActions(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
return model.getCache().getUsers().entrySet().stream()
return Stream.concat(model.getCache().getUsers().entrySet().stream()
.filter(e -> !e.getValue().equals("nohome")
&& !e.getValue().equals("nobody")
&& (e.getKey().equals(0) || e.getKey() >= 900))
.map(e -> e.getValue())
.map(s -> (BrowserLeafAction) new Chown(s))
.map(s -> (BrowserLeafAction) new Chown(s)), Stream.of(new Custom()))
.toList();
}
@@ -76,4 +80,38 @@ public class ChownAction implements BrowserBranchAction {
.toList()));
}
}
private static class Custom implements BrowserLeafAction {
@Override
public void execute(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
var user = new SimpleStringProperty();
model.getOverlay()
.setValue(new ModalOverlayComp.OverlayContent(
"userName",
Comp.of(() -> {
var creationName = new TextField();
creationName.textProperty().bindBidirectional(user);
return creationName;
})
.prefWidth(350),
null,
"finish",
() -> {
model.runCommandAsync(CommandBuilder.of()
.add("chown", user.getValue())
.addFiles(entries.stream()
.map(browserEntry ->
browserEntry.getRawFileEntry().getPath())
.toList()), false);
},
true));
}
@Override
public ObservableValue<String> getName(
BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
return new SimpleStringProperty("...");
}
}
}