Browse Source

auto open recent wallets

bwt
Craig Raw 4 years ago
parent
commit
cda4e30e3f
  1. 13
      src/main/java/com/sparrowwallet/sparrow/AppController.java
  2. 11
      src/main/java/com/sparrowwallet/sparrow/io/Config.java
  3. 2
      src/main/java/com/sparrowwallet/sparrow/wallet/SendController.java
  4. 2
      src/main/resources/com/sparrowwallet/sparrow/app.fxml
  5. 2
      src/main/resources/com/sparrowwallet/sparrow/wallet/receive.fxml
  6. 8
      src/main/resources/com/sparrowwallet/sparrow/wallet/send.fxml

13
src/main/java/com/sparrowwallet/sparrow/AppController.java

@ -252,8 +252,14 @@ public class AppController implements Initializable {
openTransactionIdItem.disableProperty().bind(onlineProperty.not());
openWalletFile(new File("/Users/scy/.sparrow/wallets/sparta.json"));
openWalletFile(new File("/Users/scy/.sparrow/wallets/sparta-test.json"));
List<File> recentWalletFiles = Config.get().getRecentWalletFiles();
if(recentWalletFiles != null) {
for(File walletFile : recentWalletFiles) {
if(walletFile.exists()) {
openWalletFile(walletFile);
}
}
}
}
private ElectrumServer.ConnectionService createConnectionService() {
@ -1085,6 +1091,9 @@ public class AppController implements Initializable {
@Subscribe
public void openWallets(OpenWalletsEvent event) {
List<File> walletFiles = event.getWalletsMap().values().stream().map(storage -> storage.getWalletFile()).collect(Collectors.toList());
Config.get().setRecentWalletFiles(walletFiles);
boolean usbWallet = false;
for(Map.Entry<Wallet, Storage> entry : event.getWalletsMap().entrySet()) {
Wallet wallet = entry.getKey();

11
src/main/java/com/sparrowwallet/sparrow/io/Config.java

@ -9,6 +9,7 @@ import org.slf4j.LoggerFactory;
import java.io.*;
import java.lang.reflect.Type;
import java.util.Currency;
import java.util.List;
public class Config {
private static final Logger log = LoggerFactory.getLogger(Config.class);
@ -22,6 +23,7 @@ public class Config {
private boolean groupByAddress = true;
private boolean includeMempoolChange = true;
private boolean notifyNewTransactions = true;
private List<File> recentWalletFiles;
private Integer keyDerivationPeriod;
private File hwi;
private String electrumServer;
@ -133,6 +135,15 @@ public class Config {
flush();
}
public List<File> getRecentWalletFiles() {
return recentWalletFiles;
}
public void setRecentWalletFiles(List<File> recentWalletFiles) {
this.recentWalletFiles = recentWalletFiles;
flush();
}
public Integer getKeyDerivationPeriod() {
return keyDerivationPeriod;
}

2
src/main/java/com/sparrowwallet/sparrow/wallet/SendController.java

@ -272,8 +272,6 @@ public class SendController extends WalletFormController implements Initializabl
createButton.setDisable(walletTransaction == null || label.getText().isEmpty());
});
address.setText("19Sp9dLinHy3dKo2Xxj53ouuZWAoVGGhg8");
addValidation();
}

2
src/main/resources/com/sparrowwallet/sparrow/app.fxml

@ -22,7 +22,7 @@
<MenuItem fx:id="openTransactionIdItem" text="From ID..." onAction="#openTransactionFromId"/>
<MenuItem text="From Text..." onAction="#openTransactionFromText"/>
<MenuItem text="From QR..." onAction="#openTransactionFromQR"/>
<MenuItem text="Examples" onAction="#openExamples"/>
<!-- <MenuItem text="Examples" onAction="#openExamples"/> -->
</items>
</Menu>
<MenuItem fx:id="saveTransaction" mnemonicParsing="false" text="Save Transaction..." onAction="#saveTransaction"/>

2
src/main/resources/com/sparrowwallet/sparrow/wallet/receive.fxml

@ -27,7 +27,7 @@
</padding>
<columnConstraints>
<ColumnConstraints prefWidth="620" />
<ColumnConstraints prefWidth="150" />
<ColumnConstraints prefWidth="140" />
</columnConstraints>
<rowConstraints>
<RowConstraints />

8
src/main/resources/com/sparrowwallet/sparrow/wallet/send.fxml

@ -29,15 +29,15 @@
<Insets left="25.0" right="25.0" top="25.0" />
</padding>
<columnConstraints>
<ColumnConstraints percentWidth="50" />
<ColumnConstraints percentWidth="30" />
<ColumnConstraints percentWidth="20" />
<ColumnConstraints prefWidth="385" />
<ColumnConstraints prefWidth="225" />
<ColumnConstraints prefWidth="140" />
</columnConstraints>
<rowConstraints>
<RowConstraints />
</rowConstraints>
<Form GridPane.columnIndex="0" GridPane.rowIndex="0" GridPane.columnSpan="2">
<Fieldset inputGrow="SOMETIMES" text="Send">
<Fieldset inputGrow="ALWAYS" text="Send">
<Field text="Pay to:">
<CopyableTextField fx:id="address" styleClass="address-text-field"/>
</Field>

Loading…
Cancel
Save