From 80c174e4177bd345790f39148b7db8fa6d21c097 Mon Sep 17 00:00:00 2001 From: mirrorwish Date: Fri, 12 Feb 2016 02:25:07 +0100 Subject: [PATCH] Save changes to blacklist labels Fixes mailchuck/PyBitmessage#175 Signed-off-by: Peter Surda --- src/bitmessageqt/__init__.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/bitmessageqt/__init__.py b/src/bitmessageqt/__init__.py index a635a7da..fa34890c 100644 --- a/src/bitmessageqt/__init__.py +++ b/src/bitmessageqt/__init__.py @@ -717,6 +717,10 @@ class MyForm(settingsmixin.SMainWindow): QtCore.QObject.connect(self.ui.treeWidgetChans, QtCore.SIGNAL( "itemChanged (QTreeWidgetItem *, int)"), self.treeWidgetItemChanged) + # Initialize blacklist + QtCore.QObject.connect(self.ui.tableWidgetBlacklist, QtCore.SIGNAL( + "itemChanged(QTableWidgetItem *)"), self.tableWidgetBlacklistItemChanged) + # Put the colored icon on the status bar # self.ui.pushButtonStatusIcon.setIcon(QIcon(":/newPrefix/images/yellowicon.png")) self.statusbar = self.statusBar() @@ -3969,6 +3973,16 @@ class MyForm(settingsmixin.SMainWindow): self.rerenderComboBoxSendFrom() self.rerenderComboBoxSendFromBroadcast() + def tableWidgetBlacklistItemChanged(self, item): + if item.column() == 0: + addressitem = self.ui.tableWidgetBlacklist.item(item.row(), 1) + if self.ui.radioButtonBlacklist.isChecked(): + sqlExecute('''UPDATE blacklist SET label=? WHERE address=?''', + str(item.text()), str(addressitem.text())) + else: + sqlExecute('''UPDATE whitelist SET label=? WHERE address=?''', + str(item.text()), str(addressitem.text())) + def updateStatusBar(self, data): if data != "": logger.info('Status bar: ' + data)