|
|
@ -1186,6 +1186,7 @@ void CMainFrame::OnButtonNew(wxCommandEvent& event) |
|
|
|
string strAddress = PubKeyToAddress(pwalletMain->GetKeyFromKeyPool()); |
|
|
|
string strAddress = PubKeyToAddress(pwalletMain->GetKeyFromKeyPool()); |
|
|
|
|
|
|
|
|
|
|
|
// Save
|
|
|
|
// Save
|
|
|
|
|
|
|
|
CRITICAL_BLOCK(pwalletMain->cs_mapAddressBook) |
|
|
|
pwalletMain->SetAddressBookName(strAddress, strName); |
|
|
|
pwalletMain->SetAddressBookName(strAddress, strName); |
|
|
|
SetDefaultReceivingAddress(strAddress); |
|
|
|
SetDefaultReceivingAddress(strAddress); |
|
|
|
} |
|
|
|
} |
|
|
@ -2444,6 +2445,7 @@ void CAddressBookDialog::OnListEndLabelEdit(wxListEvent& event) |
|
|
|
if (event.IsEditCancelled()) |
|
|
|
if (event.IsEditCancelled()) |
|
|
|
return; |
|
|
|
return; |
|
|
|
string strAddress = (string)GetItemText(m_listCtrl, event.GetIndex(), 1); |
|
|
|
string strAddress = (string)GetItemText(m_listCtrl, event.GetIndex(), 1); |
|
|
|
|
|
|
|
CRITICAL_BLOCK(pwalletMain->cs_mapAddressBook) |
|
|
|
pwalletMain->SetAddressBookName(strAddress, string(event.GetText())); |
|
|
|
pwalletMain->SetAddressBookName(strAddress, string(event.GetText())); |
|
|
|
pframeMain->RefreshListCtrl(); |
|
|
|
pframeMain->RefreshListCtrl(); |
|
|
|
} |
|
|
|
} |
|
|
@ -2479,7 +2481,8 @@ void CAddressBookDialog::OnButtonDelete(wxCommandEvent& event) |
|
|
|
if (m_listCtrl->GetItemState(nIndex, wxLIST_STATE_SELECTED)) |
|
|
|
if (m_listCtrl->GetItemState(nIndex, wxLIST_STATE_SELECTED)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
string strAddress = (string)GetItemText(m_listCtrl, nIndex, 1); |
|
|
|
string strAddress = (string)GetItemText(m_listCtrl, nIndex, 1); |
|
|
|
CWalletDB(pwalletMain->strWalletFile).EraseName(strAddress); |
|
|
|
CRITICAL_BLOCK(pwalletMain->cs_mapAddressBook) |
|
|
|
|
|
|
|
pwalletMain->DelAddressBookName(strAddress); |
|
|
|
m_listCtrl->DeleteItem(nIndex); |
|
|
|
m_listCtrl->DeleteItem(nIndex); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -2538,9 +2541,12 @@ void CAddressBookDialog::OnButtonEdit(wxCommandEvent& event) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Write back
|
|
|
|
// Write back
|
|
|
|
|
|
|
|
CRITICAL_BLOCK(pwalletMain->cs_mapAddressBook) |
|
|
|
|
|
|
|
{ |
|
|
|
if (strAddress != strAddressOrg) |
|
|
|
if (strAddress != strAddressOrg) |
|
|
|
CWalletDB(pwalletMain->strWalletFile).EraseName(strAddressOrg); |
|
|
|
pwalletMain->DelAddressBookName(strAddressOrg); |
|
|
|
pwalletMain->SetAddressBookName(strAddress, strName); |
|
|
|
pwalletMain->SetAddressBookName(strAddress, strName); |
|
|
|
|
|
|
|
} |
|
|
|
m_listCtrl->SetItem(nIndex, 1, strAddress); |
|
|
|
m_listCtrl->SetItem(nIndex, 1, strAddress); |
|
|
|
m_listCtrl->SetItemText(nIndex, strName); |
|
|
|
m_listCtrl->SetItemText(nIndex, strName); |
|
|
|
pframeMain->RefreshListCtrl(); |
|
|
|
pframeMain->RefreshListCtrl(); |
|
|
@ -2580,6 +2586,7 @@ void CAddressBookDialog::OnButtonNew(wxCommandEvent& event) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Add to list and select it
|
|
|
|
// Add to list and select it
|
|
|
|
|
|
|
|
CRITICAL_BLOCK(pwalletMain->cs_mapAddressBook) |
|
|
|
pwalletMain->SetAddressBookName(strAddress, strName); |
|
|
|
pwalletMain->SetAddressBookName(strAddress, strName); |
|
|
|
int nIndex = InsertLine(m_listCtrl, strName, strAddress); |
|
|
|
int nIndex = InsertLine(m_listCtrl, strName, strAddress); |
|
|
|
SetSelection(m_listCtrl, nIndex); |
|
|
|
SetSelection(m_listCtrl, nIndex); |
|
|
|