add preference option to load recent wallets

This commit is contained in:
Craig Raw 2021-03-17 11:59:58 +02:00
parent 211e5952aa
commit 6fbd332b4d
5 changed files with 25 additions and 2 deletions

View file

@ -540,7 +540,7 @@ public class AppServices {
Platform.runLater(() -> {
if(!Window.getWindows().isEmpty()) {
List<File> walletFiles = allWallets.stream().map(walletTabData -> walletTabData.getStorage().getWalletFile()).collect(Collectors.toList());
Config.get().setRecentWalletFiles(walletFiles);
Config.get().setRecentWalletFiles(Config.get().isLoadRecentWallets() ? walletFiles : Collections.emptyList());
}
});

View file

@ -25,6 +25,7 @@ public class Config {
private FeeRatesSelection feeRatesSelection;
private Currency fiatCurrency;
private ExchangeSource exchangeSource;
private boolean loadRecentWallets = true;
private boolean validateDerivationPaths = true;
private boolean groupByAddress = true;
private boolean includeMempoolChange = true;
@ -155,6 +156,15 @@ public class Config {
flush();
}
public boolean isLoadRecentWallets() {
return loadRecentWallets;
}
public void setLoadRecentWallets(boolean loadRecentWallets) {
this.loadRecentWallets = loadRecentWallets;
flush();
}
public boolean isValidateDerivationPaths() {
return validateDerivationPaths;
}

View file

@ -33,6 +33,9 @@ public class GeneralPreferencesController extends PreferencesDetailController {
@FXML
private ComboBox<ExchangeSource> exchangeSource;
@FXML
private UnlabeledToggleSwitch loadRecentWallets;
@FXML
private UnlabeledToggleSwitch validateDerivationPaths;
@ -97,6 +100,12 @@ public class GeneralPreferencesController extends PreferencesDetailController {
updateCurrencies(exchangeSource.getSelectionModel().getSelectedItem());
loadRecentWallets.setSelected(config.isLoadRecentWallets());
loadRecentWallets.selectedProperty().addListener((observableValue, oldValue, newValue) -> {
config.setLoadRecentWallets(newValue);
EventManager.get().post(new RequestOpenWalletsEvent());
});
validateDerivationPaths.setSelected(config.isValidateDerivationPaths());
validateDerivationPaths.selectedProperty().addListener((observableValue, oldValue, newValue) -> {
config.setValidateDerivationPaths(newValue);

View file

@ -47,7 +47,7 @@ public class PreferencesDialog extends Dialog<Boolean> {
}
dialogPane.setPrefWidth(750);
dialogPane.setPrefHeight(600);
dialogPane.setPrefHeight(630);
preferencesController.reconnectOnClosingProperty().set(AppServices.isConnecting() || AppServices.isConnected());
setOnCloseRequest(event -> {

View file

@ -72,6 +72,10 @@
</Field>
</Fieldset>
<Fieldset inputGrow="SOMETIMES" text="Wallet" styleClass="wideLabelFieldSet">
<Field text="Load recent wallets:">
<UnlabeledToggleSwitch fx:id="loadRecentWallets" />
<HelpLabel helpText="Keep a record of open wallets, and reopen them on startup."/>
</Field>
<Field text="Validate derivations:">
<UnlabeledToggleSwitch fx:id="validateDerivationPaths" />
<HelpLabel helpText="Disallow keystores to have derivation paths that match the defaults for other script types."/>