From e9e10de266a9f922482d47c3b1d9aee67c276654 Mon Sep 17 00:00:00 2001 From: Craig Raw Date: Thu, 20 Aug 2020 18:20:42 +0200 Subject: [PATCH] export file naming with correct extensions --- .../sparrowwallet/sparrow/control/FileWalletExportPane.java | 1 + .../java/com/sparrowwallet/sparrow/io/ColdcardMultisig.java | 5 +++++ src/main/java/com/sparrowwallet/sparrow/io/Electrum.java | 5 +++++ src/main/java/com/sparrowwallet/sparrow/io/WalletExport.java | 1 + 4 files changed, 12 insertions(+) diff --git a/src/main/java/com/sparrowwallet/sparrow/control/FileWalletExportPane.java b/src/main/java/com/sparrowwallet/sparrow/control/FileWalletExportPane.java index 26e8f5f7..01ad2199 100644 --- a/src/main/java/com/sparrowwallet/sparrow/control/FileWalletExportPane.java +++ b/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) { diff --git a/src/main/java/com/sparrowwallet/sparrow/io/ColdcardMultisig.java b/src/main/java/com/sparrowwallet/sparrow/io/ColdcardMultisig.java index 4bb1ea53..fe19d0a3 100644 --- a/src/main/java/com/sparrowwallet/sparrow/io/ColdcardMultisig.java +++ b/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(); diff --git a/src/main/java/com/sparrowwallet/sparrow/io/Electrum.java b/src/main/java/com/sparrowwallet/sparrow/io/Electrum.java index c3fff6c8..2a15fd70 100644 --- a/src/main/java/com/sparrowwallet/sparrow/io/Electrum.java +++ b/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 { diff --git a/src/main/java/com/sparrowwallet/sparrow/io/WalletExport.java b/src/main/java/com/sparrowwallet/sparrow/io/WalletExport.java index a0cb6576..95f34344 100644 --- a/src/main/java/com/sparrowwallet/sparrow/io/WalletExport.java +++ b/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(); }