@ -53,6 +53,12 @@ public class SettingsController extends WalletFormController implements Initiali
@FXML
private Button showDescriptorQR ;
@FXML
private Button editDescriptor ;
@FXML
private Button showDescriptor ;
@FXML
private ComboBox < ScriptType > scriptType ;
@ -190,6 +196,9 @@ public class SettingsController extends WalletFormController implements Initiali
showDescriptorQR . managedProperty ( ) . bind ( showDescriptorQR . visibleProperty ( ) ) ;
showDescriptorQR . prefHeightProperty ( ) . bind ( descriptor . prefHeightProperty ( ) ) ;
showDescriptorQR . visibleProperty ( ) . bind ( scanDescriptorQR . visibleProperty ( ) . not ( ) ) ;
editDescriptor . managedProperty ( ) . bind ( editDescriptor . visibleProperty ( ) ) ;
showDescriptor . managedProperty ( ) . bind ( showDescriptor . visibleProperty ( ) ) ;
showDescriptor . visibleProperty ( ) . bind ( editDescriptor . visibleProperty ( ) . not ( ) ) ;
revert . setOnAction ( event - > {
keystoreTabs . getTabs ( ) . removeAll ( keystoreTabs . getTabs ( ) ) ;
@ -207,6 +216,7 @@ public class SettingsController extends WalletFormController implements Initiali
} ) ;
setFieldsFromWallet ( walletForm . getWallet ( ) ) ;
setInputFieldsDisabled ( ! walletForm . getWallet ( ) . isMasterWallet ( ) | | ! walletForm . getWallet ( ) . getChildWallets ( ) . isEmpty ( ) ) ;
}
private void clearKeystoreTabs ( ) {
@ -389,6 +399,16 @@ public class SettingsController extends WalletFormController implements Initiali
}
}
public void showDescriptor ( ActionEvent event ) {
OutputDescriptor outputDescriptor = OutputDescriptor . getOutputDescriptor ( walletForm . getWallet ( ) ) ;
String outputDescriptorString = outputDescriptor . toString ( walletForm . getWallet ( ) . isValid ( ) ) ;
TextAreaDialog dialog = new TextAreaDialog ( outputDescriptorString , false ) ;
dialog . setTitle ( "Show wallet output descriptor" ) ;
dialog . getDialogPane ( ) . setHeaderText ( "The wallet configuration is specified in the output descriptor.\nThis wallet is no longer editable - create a new wallet to change the descriptor." ) ;
dialog . showAndWait ( ) ;
}
public void showAdvanced ( ActionEvent event ) {
AdvancedDialog advancedDialog = new AdvancedDialog ( walletForm ) ;
Optional < Boolean > optApply = advancedDialog . showAndWait ( ) ;
@ -422,6 +442,13 @@ public class SettingsController extends WalletFormController implements Initiali
}
}
private void setInputFieldsDisabled ( boolean disabled ) {
policyType . setDisable ( disabled ) ;
scriptType . setDisable ( disabled ) ;
multisigControl . setDisable ( disabled ) ;
editDescriptor . setVisible ( ! disabled ) ;
}
@Override
protected String describeKeystore ( Keystore keystore ) {
if ( ! keystore . isValid ( ) ) {
@ -484,6 +511,13 @@ public class SettingsController extends WalletFormController implements Initiali
}
}
@Subscribe
public void childWalletAdded ( ChildWalletAddedEvent event ) {
if ( event . getMasterWalletId ( ) . equals ( walletForm . getWalletId ( ) ) ) {
setInputFieldsDisabled ( true ) ;
}
}
private void saveWallet ( boolean changePassword , boolean suggestChangePassword ) {
ECKey existingPubKey = walletForm . getStorage ( ) . getEncryptionPubKey ( ) ;