Fixed wallet to use the default wallet location
if available, rather than asking for a location
This commit is contained in:
parent
1d7ce60cf7
commit
3d805aa7c5
@ -374,6 +374,10 @@ COMMIT;
|
|||||||
|
|
||||||
void Frame::OnSaveNew(wxCommandEvent& WXUNUSED(event))
|
void Frame::OnSaveNew(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
|
wxFileName wxFileWallet;
|
||||||
|
if (m_DefaultWalletLocation.FileExists()) {
|
||||||
|
// OK, the default wallet exists, so we need a new
|
||||||
|
// name and wallet location
|
||||||
wxString wxstrWalletPath;
|
wxString wxstrWalletPath;
|
||||||
wxString wxstrWalletName(wxEmptyString);
|
wxString wxstrWalletName(wxEmptyString);
|
||||||
if (!m_LastUsedWallet.IsOk() || !m_LastUsedWallet.DirExists()) {
|
if (!m_LastUsedWallet.IsOk() || !m_LastUsedWallet.DirExists()) {
|
||||||
@ -404,15 +408,25 @@ void Frame::OnSaveNew(wxCommandEvent& WXUNUSED(event))
|
|||||||
dialog.GetPath(),
|
dialog.GetPath(),
|
||||||
dialog.GetFilterIndex()
|
dialog.GetFilterIndex()
|
||||||
);
|
);
|
||||||
wxFileName wxFileWallet(dialog.GetPath());
|
wxFileWallet.Assign(dialog.GetPath());
|
||||||
ristretto255::hash<256> WalletSecret( wxFileWallet.GetFullPath().ToUTF8());
|
m_FileDialogFilterIndex = dialog.GetFilterIndex();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// Default does not exist, so we go right
|
||||||
|
// ahead without asking the user to invent
|
||||||
|
// a name and select a directory
|
||||||
|
RecursiveCreateDirectory(m_DefaultWalletLocation);
|
||||||
|
wxFileWallet = m_DefaultWalletLocation;
|
||||||
|
}
|
||||||
|
if (wxFileWallet.IsOk()) {
|
||||||
|
ristretto255::hash<256> WalletSecret(wxFileWallet.GetFullPath().ToUTF8());
|
||||||
NewWallet(wxFileWallet, WalletSecret);
|
NewWallet(wxFileWallet, WalletSecret);
|
||||||
wxLogMessage("new wallet created: %s", wxFileWallet.GetFullPath());
|
wxLogMessage("new wallet created: %s", wxFileWallet.GetFullPath());
|
||||||
if (m_panel)m_panel->Close(true);
|
if (m_panel)m_panel->Close(true);
|
||||||
m_panel = nullptr;
|
m_panel = nullptr;
|
||||||
auto panel = new display_wallet(this, wxFileWallet);
|
auto panel = new display_wallet(this, wxFileWallet);
|
||||||
m_panel = panel;
|
m_panel = panel;
|
||||||
m_FileDialogFilterIndex = dialog.GetFilterIndex();
|
|
||||||
m_LastUsedWallet = wxFileWallet; //We do this last, so that if an exception occurs the filename is forgotten.
|
m_LastUsedWallet = wxFileWallet; //We do this last, so that if an exception occurs the filename is forgotten.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user