putting it to bed before minor refactoring

Realized delete was not rightly part of the frame
And close rightly part of the frame, rather than
the rightly part of the wallet display, so, putting
current work to bed before changing those things
This commit is contained in:
Cheng 2022-05-20 20:12:37 +10:00
parent 5a00115c56
commit 25ec24936f
No known key found for this signature in database
GPG Key ID: D51301E176B31828
3 changed files with 10 additions and 7 deletions

View File

@ -103,4 +103,5 @@ void display_wallet::OnClose(wxCloseEvent& event) {
Destroy(); //Default handler will destroy the window. This is our handler for the user calling close, Destroy(); //Default handler will destroy the window. This is our handler for the user calling close,
// replacing the default handler.' // replacing the default handler.'
if (singletonFrame->m_panel ==this)singletonFrame->m_panel = nullptr; if (singletonFrame->m_panel ==this)singletonFrame->m_panel = nullptr;
} }

View File

@ -128,11 +128,9 @@ try {
menuFile->Append(wxID_OPEN, menu_strings[0].tail[2][0], menu_strings[0].tail[2][1]); menuFile->Append(wxID_OPEN, menu_strings[0].tail[2][0], menu_strings[0].tail[2][1]);
menuFile->Bind(wxEVT_MENU, &Frame::OnFileOpen, this, wxID_OPEN); menuFile->Bind(wxEVT_MENU, &Frame::OnFileOpen, this, wxID_OPEN);
menuFile->Append(wxID_DELETE, menu_strings[0].tail[3][0], menu_strings[0].tail[3][1] + m_LastUsedSqlite.GetFullPath()); menuFile->Append(wxID_DELETE, menu_strings[0].tail[3][0], menu_strings[0].tail[3][1] + m_LastUsedSqlite.GetFullPath());
wxLogMessage(m_LastUsedSqlite.GetFullPath()+" wallet path"); wxLogMessage(m_LastUsedSqlite.GetFullPath()+" wallet path");
menuFile->Bind(wxEVT_MENU, &Frame::OnDelete, this, wxID_DELETE); menuFile->Bind(wxEVT_MENU, &Frame::OnDelete, this, wxID_DELETE); menuFile->Append(myID_DELETECONFIG, menu_strings[0].tail[4][0], menu_strings[0].tail[4][1] + m_LastUsedSqlite.GetFullPath());
menuFile->Append(myID_DELETECONFIG, menu_strings[0].tail[4][0], menu_strings[0].tail[4][1] + m_LastUsedSqlite.GetFullPath());
menuFile->Bind(wxEVT_MENU, &Frame::OnDeleteConfiguration, this, myID_DELETECONFIG); menuFile->Bind(wxEVT_MENU, &Frame::OnDeleteConfiguration, this, myID_DELETECONFIG);
menuFile->Append(myID_MYEXIT,"my exit, testing destruction"); menuFile->Append(myID_MYEXIT,"my exit, testing destruction");
menuFile->Bind(wxEVT_MENU, &Frame::OnMyCloseMpanel, this, myID_MYEXIT); menuFile->Bind(wxEVT_MENU, &Frame::OnMyCloseMpanel, this, myID_MYEXIT);
@ -346,6 +344,7 @@ void Frame::OnDelete(wxCommandEvent& WXUNUSED(event))
if (LastUsedSqlite.IsOk() && LastUsedSqlite.FileExists()) { if (LastUsedSqlite.IsOk() && LastUsedSqlite.FileExists()) {
if (wxRemoveFile(LastUsedSqlite.GetFullPath()))wxLogMessage(_T("Deleting % s"), LastUsedSqlite.GetFullPath()); if (wxRemoveFile(LastUsedSqlite.GetFullPath()))wxLogMessage(_T("Deleting % s"), LastUsedSqlite.GetFullPath());
} }
LastUsedSqlite.Clear();
} }
void Frame::OnMenuOpen(wxMenuEvent& evt) { void Frame::OnMenuOpen(wxMenuEvent& evt) {
@ -356,11 +355,13 @@ void Frame::OnMenuOpen(wxMenuEvent& evt) {
} }
} }
Frame::~Frame(){ Frame::~Frame() {
assert(singletonFrame == this); assert(singletonFrame == this);
singletonFrame = nullptr; singletonFrame = nullptr;
wxConfigBase *pConfig = wxConfigBase::Get(); wxConfigBase* pConfig = wxConfigBase::Get();
if (pConfig == nullptr)return; if (pConfig == nullptr)return;
StorePositionToConfig(); StorePositionToConfig();
pConfig->Write(_T("/Wallet/LastUsed"), m_LastUsedSqlite.GetFullPath()); if (singletonApp->pConfig->Read(_T("/Wallet/LastUsed"), _T("")) != m_LastUsedSqlite.GetFullPath()) {
pConfig->Write(_T("/Wallet/LastUsed"), m_LastUsedSqlite.GetFullPath());
}
} }

View File

@ -75,6 +75,7 @@ private:
void OnDeleteConfiguration(wxCommandEvent&); void OnDeleteConfiguration(wxCommandEvent&);
void OnMyCloseMpanel(wxCommandEvent&); void OnMyCloseMpanel(wxCommandEvent&);
public: public:
void OnSaveNew(wxCommandEvent&); void OnSaveNew(wxCommandEvent&);
void NewWallet(wxFileName&, ristretto255::hash<256>&); void NewWallet(wxFileName&, ristretto255::hash<256>&);
@ -82,9 +83,9 @@ public:
void OnFileOpen(wxCommandEvent&); void OnFileOpen(wxCommandEvent&);
private: private:
void OnDelete(wxCommandEvent&);
void OnMenuOpen(wxMenuEvent&); void OnMenuOpen(wxMenuEvent&);
public: public:
void OnDelete(wxCommandEvent&);
void OnFirstUse(wxCommandEvent&); void OnFirstUse(wxCommandEvent&);
public: public: