From 5b07d8800aecf0e53e53a52b1971d6d0f2069b53 Mon Sep 17 00:00:00 2001 From: mailchuck Date: Thu, 19 Nov 2015 19:17:26 +0100 Subject: [PATCH] Update addressbook on changes Fixes #99 - enable/disable new/delete chan/subscription - also found and fixed a logger crash --- src/bitmessageqt/__init__.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/bitmessageqt/__init__.py b/src/bitmessageqt/__init__.py index ca0d30ef..f807b215 100644 --- a/src/bitmessageqt/__init__.py +++ b/src/bitmessageqt/__init__.py @@ -1569,7 +1569,7 @@ class MyForm(settingsmixin.SMainWindow): shared.apiAddressGeneratorReturnQueue.queue.clear() shared.addressGeneratorQueue.put(('createChan', 4, 1, self.str_chan + ' ' + str(self.newChanDialogInstance.ui.lineEditChanNameCreate.text().toUtf8()), self.newChanDialogInstance.ui.lineEditChanNameCreate.text().toUtf8())) addressGeneratorReturnValue = shared.apiAddressGeneratorReturnQueue.get() - logger.debug('addressGeneratorReturnValue ' + addressGeneratorReturnValue) + logger.debug('addressGeneratorReturnValue ' + str(addressGeneratorReturnValue)) if len(addressGeneratorReturnValue) == 0: QMessageBox.about(self, _translate("MainWindow", "Address already present"), _translate( "MainWindow", "Could not add chan because it appears to already be one of your identities.")) @@ -1594,7 +1594,7 @@ class MyForm(settingsmixin.SMainWindow): shared.apiAddressGeneratorReturnQueue.queue.clear() shared.addressGeneratorQueue.put(('joinChan', addBMIfNotPresent(self.newChanDialogInstance.ui.lineEditChanBitmessageAddress.text()), self.str_chan + ' ' + str(self.newChanDialogInstance.ui.lineEditChanNameJoin.text().toUtf8()), self.newChanDialogInstance.ui.lineEditChanNameJoin.text().toUtf8())) addressGeneratorReturnValue = shared.apiAddressGeneratorReturnQueue.get() - logger.debug('addressGeneratorReturnValue ' + addressGeneratorReturnValue) + logger.debug('addressGeneratorReturnValue ' + str(addressGeneratorReturnValue)) if addressGeneratorReturnValue == 'chan name does not match address': QMessageBox.about(self, _translate("MainWindow", "Address does not match chan name"), _translate( "MainWindow", "Although the Bitmessage address you entered was valid, it doesn\'t match the chan name.")) @@ -1607,6 +1607,7 @@ class MyForm(settingsmixin.SMainWindow): QMessageBox.about(self, _translate("MainWindow", "Success"), _translate( "MainWindow", "Successfully joined chan. ")) self.ui.tabWidget.setCurrentIndex(3) + self.rerenderAddressBook() def showConnectDialog(self): self.connectDialogInstance = connectDialog(self) @@ -2069,7 +2070,7 @@ class MyForm(settingsmixin.SMainWindow): addresses = getSortedAccounts() for address in addresses: account = accountClass(address) - if (account.type == 'chan'): + if (account.type == 'chan' and shared.safeConfigGetBoolean(address, 'enabled')): addRow(address, account.getLabel(), 'chan') # normal accounts @@ -2500,7 +2501,7 @@ class MyForm(settingsmixin.SMainWindow): sqlExecute('''INSERT INTO subscriptions VALUES (?,?,?)''',str(label),address,True) self.rerenderInboxFromLabels() shared.reloadBroadcastSendersForWhichImWatching() - + self.rerenderAddressBook() self.rerenderTabTreeSubscriptions() def click_pushButtonAddSubscription(self): @@ -3384,6 +3385,7 @@ class MyForm(settingsmixin.SMainWindow): address) self.rerenderTabTreeSubscriptions() self.rerenderInboxFromLabels() + self.rerenderAddressBook() shared.reloadBroadcastSendersForWhichImWatching() def on_action_SubscriptionsClipboard(self): @@ -3398,6 +3400,7 @@ class MyForm(settingsmixin.SMainWindow): address) account = self.getCurrentItem() account.setEnabled(True) + self.rerenderAddressBook() shared.reloadBroadcastSendersForWhichImWatching() def on_action_SubscriptionsDisable(self): @@ -3407,6 +3410,7 @@ class MyForm(settingsmixin.SMainWindow): address) account = self.getCurrentItem() account.setEnabled(False) + self.rerenderAddressBook() shared.reloadBroadcastSendersForWhichImWatching() def on_context_menuSubscriptions(self, point): @@ -3666,6 +3670,7 @@ class MyForm(settingsmixin.SMainWindow): return shared.writeKeysFile() shared.reloadMyAddressHashes() + self.rerenderAddressBook() if account.type == "normal": self.rerenderTabTreeMessages() elif account.type == "chan": @@ -3681,6 +3686,7 @@ class MyForm(settingsmixin.SMainWindow): shared.config.set(address, 'enabled', 'true') shared.writeKeysFile() shared.reloadMyAddressHashes() + self.rerenderAddressBook() def on_action_Disable(self): address = self.getCurrentAccount() @@ -3692,6 +3698,7 @@ class MyForm(settingsmixin.SMainWindow): shared.config.set(str(address), 'enabled', 'false') shared.writeKeysFile() shared.reloadMyAddressHashes() + self.rerenderAddressBook() def on_action_Clipboard(self): address = self.getCurrentAccount()