export file naming with correct extensions

This commit is contained in:
Craig Raw 2020-08-20 18:20:42 +02:00
parent ab5fdef919
commit e9e10de266
4 changed files with 12 additions and 0 deletions

View file

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

View file

@ -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"; return "Import file created by using the Settings > Multisig Wallets > Export XPUB feature on your Coldcard";
} }
@Override
public String getExportFileExtension() {
return "txt";
}
@Override @Override
public Wallet importWallet(InputStream inputStream, String password) throws ImportException { public Wallet importWallet(InputStream inputStream, String password) throws ImportException {
Wallet wallet = new Wallet(); Wallet wallet = new Wallet();

View file

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

View file

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