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,7 +408,18 @@ void Frame::OnSaveNew(wxCommandEvent& WXUNUSED(event))
|
|||||||
dialog.GetPath(),
|
dialog.GetPath(),
|
||||||
dialog.GetFilterIndex()
|
dialog.GetFilterIndex()
|
||||||
);
|
);
|
||||||
wxFileName wxFileWallet(dialog.GetPath());
|
wxFileWallet.Assign(dialog.GetPath());
|
||||||
|
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());
|
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());
|
||||||
@ -412,7 +427,6 @@ void Frame::OnSaveNew(wxCommandEvent& WXUNUSED(event))
|
|||||||
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