diff options
author | Matt Corallo <matt@bluematt.me> | 2011-06-29 01:08:48 +0200 |
---|---|---|
committer | Matt Corallo <matt@bluematt.me> | 2011-07-13 02:11:25 +0200 |
commit | 81598083e7c822964815bdb1e26d6c62760e52b8 (patch) | |
tree | 3b2beb6045bdaa4563c351e397214829dde3e3bf | |
parent | 98545d2cdf53f7b6f32eba7a7f51034a9ca994c2 (diff) |
Dynamically remove/insert the Options for encryption in the menus.
-rw-r--r-- | share/uiproject.fbp | 4 | ||||
-rw-r--r-- | src/ui.cpp | 8 | ||||
-rw-r--r-- | src/uibase.cpp | 2 | ||||
-rw-r--r-- | src/uibase.h | 2 |
4 files changed, 12 insertions, 4 deletions
diff --git a/share/uiproject.fbp b/share/uiproject.fbp index cc735c6d78..d5e6b1e36b 100644 --- a/share/uiproject.fbp +++ b/share/uiproject.fbp @@ -171,7 +171,7 @@ <property name="kind">wxITEM_NORMAL</property>
<property name="label">&Encrypt Wallet...</property>
<property name="name">m_menuOptionsEncryptWallet</property>
- <property name="permission">none</property>
+ <property name="permission">public</property>
<property name="shortcut"></property>
<property name="unchecked_bitmap"></property>
<event name="OnMenuSelection">OnMenuOptionsEncryptWallet</event>
@@ -186,7 +186,7 @@ <property name="kind">wxITEM_NORMAL</property>
<property name="label">&Change Wallet Encryption Passphrase...</property>
<property name="name">m_menuOptionsChangeWalletPassphrase</property>
- <property name="permission">none</property>
+ <property name="permission">public</property>
<property name="shortcut"></property>
<property name="unchecked_bitmap"></property>
<event name="OnMenuSelection">OnMenuOptionsChangeWalletPassphrase</event>
diff --git a/src/ui.cpp b/src/ui.cpp index 52315e1fe4..9e099ae57c 100644 --- a/src/ui.cpp +++ b/src/ui.cpp @@ -368,6 +368,11 @@ CMainFrame::CMainFrame(wxWindow* parent) : CMainFrameBase(parent) if (CWalletDB(pwalletMain->strWalletFile,"r").ReadDefaultKey(vchPubKey)) m_textCtrlAddress->SetValue(PubKeyToAddress(vchPubKey)); + if (pwalletMain->IsCrypted()) + m_menuOptions->Remove(m_menuOptionsEncryptWallet); + else + m_menuOptions->Remove(m_menuOptionsChangeWalletPassphrase); + // Fill listctrl with wallet transactions RefreshListCtrl(); } @@ -1217,6 +1222,9 @@ void CMainFrame::OnMenuOptionsEncryptWallet(wxCommandEvent& event) munlock(&strWalletPass[0], strWalletPass.capacity()); munlock(&strWalletPassTest[0], strWalletPassTest.capacity()); wxMessageBox(_("Wallet Encrypted.\nRemember that encrypting your wallet cannot fully protect your bitcoins from being stolen by malware infecting your computer."), "Bitcoin"); + + m_menuOptions->Remove(m_menuOptionsEncryptWallet); + m_menuOptions->Insert(m_menuOptions->GetMenuItemCount() - 1, m_menuOptionsChangeWalletPassphrase); } void CMainFrame::OnMenuOptionsChangeWalletPassphrase(wxCommandEvent& event) diff --git a/src/uibase.cpp b/src/uibase.cpp index 9ac4ec8e65..18eec44138 100644 --- a/src/uibase.cpp +++ b/src/uibase.cpp @@ -32,11 +32,9 @@ CMainFrameBase::CMainFrameBase( wxWindow* parent, wxWindowID id, const wxString& m_menuOptionsChangeYourAddress = new wxMenuItem( m_menuOptions, wxID_ANY, wxString( _("&Your Receiving Addresses...") ) , wxEmptyString, wxITEM_NORMAL ); m_menuOptions->Append( m_menuOptionsChangeYourAddress ); - wxMenuItem* m_menuOptionsEncryptWallet; m_menuOptionsEncryptWallet = new wxMenuItem( m_menuOptions, wxID_ANY, wxString( _("&Encrypt Wallet...") ) , wxEmptyString, wxITEM_NORMAL ); m_menuOptions->Append( m_menuOptionsEncryptWallet ); - wxMenuItem* m_menuOptionsChangeWalletPassphrase; m_menuOptionsChangeWalletPassphrase = new wxMenuItem( m_menuOptions, wxID_ANY, wxString( _("&Change Wallet Encryption Passphrase...") ) , wxEmptyString, wxITEM_NORMAL ); m_menuOptions->Append( m_menuOptionsChangeWalletPassphrase ); diff --git a/src/uibase.h b/src/uibase.h index e2dbb0bd4d..ca0730b20e 100644 --- a/src/uibase.h +++ b/src/uibase.h @@ -117,6 +117,8 @@ class CMainFrameBase : public wxFrame public: wxMenu* m_menuOptions; + wxMenuItem* m_menuOptionsEncryptWallet; + wxMenuItem* m_menuOptionsChangeWalletPassphrase; wxStatusBar* m_statusBar; wxTextCtrl* m_textCtrlAddress; wxListCtrl* m_listCtrlAll; |