mirror of
https://github.com/xpipe-io/xpipe.git
synced 2024-09-30 09:07:03 +13:00
Confirm git share of file
This commit is contained in:
parent
2dead13d4d
commit
715d36336c
2 changed files with 14 additions and 0 deletions
|
@ -3,6 +3,8 @@ package io.xpipe.app.fxcomps.impl;
|
||||||
import atlantafx.base.theme.Styles;
|
import atlantafx.base.theme.Styles;
|
||||||
import io.xpipe.app.browser.StandaloneFileBrowser;
|
import io.xpipe.app.browser.StandaloneFileBrowser;
|
||||||
import io.xpipe.app.comp.base.ButtonComp;
|
import io.xpipe.app.comp.base.ButtonComp;
|
||||||
|
import io.xpipe.app.core.AppI18n;
|
||||||
|
import io.xpipe.app.core.AppWindowHelper;
|
||||||
import io.xpipe.app.fxcomps.SimpleComp;
|
import io.xpipe.app.fxcomps.SimpleComp;
|
||||||
import io.xpipe.app.fxcomps.util.BindingsHelper;
|
import io.xpipe.app.fxcomps.util.BindingsHelper;
|
||||||
import io.xpipe.app.fxcomps.util.SimpleChangeListener;
|
import io.xpipe.app.fxcomps.util.SimpleChangeListener;
|
||||||
|
@ -18,6 +20,7 @@ import javafx.beans.binding.Bindings;
|
||||||
import javafx.beans.property.Property;
|
import javafx.beans.property.Property;
|
||||||
import javafx.beans.property.SimpleObjectProperty;
|
import javafx.beans.property.SimpleObjectProperty;
|
||||||
import javafx.beans.value.ObservableValue;
|
import javafx.beans.value.ObservableValue;
|
||||||
|
import javafx.scene.control.Alert;
|
||||||
import javafx.scene.layout.HBox;
|
import javafx.scene.layout.HBox;
|
||||||
import javafx.scene.layout.Priority;
|
import javafx.scene.layout.Priority;
|
||||||
import javafx.scene.layout.Region;
|
import javafx.scene.layout.Region;
|
||||||
|
@ -80,6 +83,15 @@ public class ContextualFileReferenceChoiceComp extends SimpleComp {
|
||||||
var f = data.resolve(FileNames.getFileName(filePath.getValue()));
|
var f = data.resolve(FileNames.getFileName(filePath.getValue()));
|
||||||
var source = Path.of(filePath.getValue());
|
var source = Path.of(filePath.getValue());
|
||||||
if (Files.exists(source)) {
|
if (Files.exists(source)) {
|
||||||
|
var shouldCopy = AppWindowHelper.showBlockingAlert(alert -> {
|
||||||
|
alert.setTitle(AppI18n.get("confirmGitShareTitle"));
|
||||||
|
alert.setHeaderText(AppI18n.get("confirmGitShareHeader"));
|
||||||
|
alert.setAlertType(Alert.AlertType.CONFIRMATION);
|
||||||
|
}).map(buttonType -> buttonType.getButtonData().isDefaultButton()).orElse(false);
|
||||||
|
if (!shouldCopy) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Files.copy(source, f, StandardCopyOption.REPLACE_EXISTING);
|
Files.copy(source, f, StandardCopyOption.REPLACE_EXISTING);
|
||||||
Platform.runLater(() -> {
|
Platform.runLater(() -> {
|
||||||
filePath.setValue(f.toString());
|
filePath.setValue(f.toString());
|
||||||
|
|
|
@ -5,6 +5,8 @@ appearance=Appearance
|
||||||
integrations=Integrations
|
integrations=Integrations
|
||||||
uiOptions=UI Options
|
uiOptions=UI Options
|
||||||
theme=Theme
|
theme=Theme
|
||||||
|
confirmGitShareTitle=Confirm git sharing
|
||||||
|
confirmGitShareHeader=This will copy the file into your git vault and commit your changes. Do you want to continue?
|
||||||
gitShareFileTooltip=Add file to the git vault data directory so that it is automatically synced.\n\nThis action can only be used when the git vault is enabled in the settings.
|
gitShareFileTooltip=Add file to the git vault data directory so that it is automatically synced.\n\nThis action can only be used when the git vault is enabled in the settings.
|
||||||
performanceMode=Performance mode
|
performanceMode=Performance mode
|
||||||
performanceModeDescription=Disables all visual effects that are not required to improve the application performance.
|
performanceModeDescription=Disables all visual effects that are not required to improve the application performance.
|
||||||
|
|
Loading…
Reference in a new issue