Browse Source

wallet.add_contact method

283
ecdsa 12 years ago
parent
commit
8104a47a3e
  1. 3
      gui/gui_android.py
  2. 4
      gui/gui_classic.py
  3. 4
      gui/gui_gtk.py
  4. 8
      lib/wallet.py

3
gui/gui_android.py

@ -491,8 +491,7 @@ def make_new_contact():
address = None
if address:
if modal_question('Add to contacts?', address):
wallet.addressbook.append(address)
wallet.save()
wallet.add_contact(address)
else:
modal_dialog('Invalid address', data)

4
gui/gui_classic.py

@ -929,7 +929,6 @@ class ElectrumWindow(QMainWindow):
self.save_column_widths()
self.expert_mode = (i == 1)
self.config.set_key('classic_expert_mode', self.expert_mode, True)
self.wallet.save()
self.update_receive_tab()
@ -1233,8 +1232,7 @@ class ElectrumWindow(QMainWindow):
address = unicode(text)
if ok:
if is_valid(address):
self.wallet.addressbook.append(address)
self.wallet.save()
self.wallet.add_contact(address)
self.update_contacts_tab()
self.update_history_tab()
self.update_completions()

4
gui/gui_gtk.py

@ -1260,9 +1260,7 @@ class ElectrumWindow:
if result == 1:
if is_valid(address):
self.wallet.addressbook.append(address)
if label: self.wallet.labels[address] = label
self.wallet.save()
self.wallet.add_contact(address,label)
self.update_sending_tab()
else:
errorDialog = gtk.MessageDialog(

8
lib/wallet.py

@ -412,6 +412,14 @@ class Wallet:
return self.history.values() != [[]] * len(self.history)
def add_contact(self, address, label=None):
self.addressbook.append(address)
self.config.set_key('addressbook', self.addressbook, True)
if label:
self.labels[address] = label
self.config.set_key('labels',self.labels)
def fill_addressbook(self):
for tx_hash, tx in self.transactions.items():
is_relevant, is_send, _, _ = self.get_tx_value(tx)

Loading…
Cancel
Save