Browse Source

export file naming with correct extensions

bwt
Craig Raw 4 years ago
parent
commit
e9e10de266
  1. 1
      src/main/java/com/sparrowwallet/sparrow/control/FileWalletExportPane.java
  2. 5
      src/main/java/com/sparrowwallet/sparrow/io/ColdcardMultisig.java
  3. 5
      src/main/java/com/sparrowwallet/sparrow/io/Electrum.java
  4. 1
      src/main/java/com/sparrowwallet/sparrow/io/WalletExport.java

1
src/main/java/com/sparrowwallet/sparrow/control/FileWalletExportPane.java

@ -44,6 +44,7 @@ public class FileWalletExportPane extends TitledDescriptionPane {
FileChooser fileChooser = new FileChooser();
fileChooser.setTitle("Export " + exporter.getWalletModel().toDisplayString() + " File");
fileChooser.setInitialFileName(wallet.getName() + "-" + exporter.getWalletModel().toDisplayString().toLowerCase() + "." + exporter.getExportFileExtension());
File file = fileChooser.showSaveDialog(window);
if(file != null) {

5
src/main/java/com/sparrowwallet/sparrow/io/ColdcardMultisig.java

@ -71,6 +71,11 @@ public class ColdcardMultisig implements WalletImport, KeystoreFileImport, Walle
return "Import file created by using the Settings > Multisig Wallets > Export XPUB feature on your Coldcard";
}
@Override
public String getExportFileExtension() {
return "txt";
}
@Override
public Wallet importWallet(InputStream inputStream, String password) throws ImportException {
Wallet wallet = new Wallet();

5
src/main/java/com/sparrowwallet/sparrow/io/Electrum.java

@ -184,6 +184,11 @@ public class Electrum implements KeystoreFileImport, WalletImport, WalletExport
return "Import an Electrum wallet";
}
@Override
public String getExportFileExtension() {
return "json";
}
@Override
public void exportWallet(Wallet wallet, OutputStream outputStream) throws ExportException {
try {

1
src/main/java/com/sparrowwallet/sparrow/io/WalletExport.java

@ -7,4 +7,5 @@ import java.io.OutputStream;
public interface WalletExport extends Export {
void exportWallet(Wallet wallet, OutputStream outputStream) throws ExportException;
String getWalletExportDescription();
String getExportFileExtension();
}

Loading…
Cancel
Save