open files and uris after initial wallet loading

This commit is contained in:
Craig Raw 2024-03-05 14:09:52 +02:00
parent 914afe9a8d
commit 55e7689f7c
4 changed files with 23 additions and 3 deletions

View file

@ -280,7 +280,7 @@ public class AppController implements Initializable {
rootStack.setOnDragOver(event -> { rootStack.setOnDragOver(event -> {
if(event.getGestureSource() != rootStack && event.getDragboard().hasFiles()) { if(event.getGestureSource() != rootStack && event.getDragboard().hasFiles()) {
event.acceptTransferModes(TransferMode.COPY_OR_MOVE); event.acceptTransferModes(TransferMode.LINK);
} }
event.consume(); event.consume();
}); });

View file

@ -33,6 +33,7 @@ import javafx.beans.property.SimpleBooleanProperty;
import javafx.beans.value.ChangeListener; import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue; import javafx.beans.value.ObservableValue;
import javafx.concurrent.ScheduledService; import javafx.concurrent.ScheduledService;
import javafx.concurrent.Service;
import javafx.concurrent.Task; import javafx.concurrent.Task;
import javafx.concurrent.Worker; import javafx.concurrent.Worker;
import javafx.fxml.FXMLLoader; import javafx.fxml.FXMLLoader;
@ -859,6 +860,25 @@ public class AppServices {
} }
} }
public static void openFileUriArgumentsAfterWalletLoading(Window window) {
if(!argFiles.isEmpty() || !argUris.isEmpty()) {
Service<Void> service = new Service<>() {
@Override
protected Task<Void> createTask() {
return new Task<>() {
@Override
protected Void call() {
return null;
}
};
}
};
service.setExecutor(Storage.LoadWalletService.getSingleThreadedExecutor());
service.setOnSucceeded(event -> openFileUriArguments(window));
service.start();
}
}
public static void openFileUriArguments(Window window) { public static void openFileUriArguments(Window window) {
openFiles(argFiles, window); openFiles(argFiles, window);
argFiles.clear(); argFiles.clear();

View file

@ -108,7 +108,7 @@ public class SparrowDesktop extends Application {
} }
} }
AppServices.openFileUriArguments(stage); AppServices.openFileUriArgumentsAfterWalletLoading(stage);
AppServices.get().start(); AppServices.get().start();
} }

View file

@ -231,7 +231,7 @@ public class DownloadVerifierDialog extends Dialog<ButtonBar.ButtonData> {
private void setupDrag(DialogPane dialogPane) { private void setupDrag(DialogPane dialogPane) {
dialogPane.setOnDragOver(event -> { dialogPane.setOnDragOver(event -> {
if(event.getGestureSource() != dialogPane && event.getDragboard().hasFiles()) { if(event.getGestureSource() != dialogPane && event.getDragboard().hasFiles()) {
event.acceptTransferModes(TransferMode.COPY_OR_MOVE); event.acceptTransferModes(TransferMode.LINK);
} }
event.consume(); event.consume();
}); });