Save changes to blacklist labels

Fixes mailchuck/PyBitmessage#175

Signed-off-by: Peter Surda <surda@economicsofbitcoin.com>
This commit is contained in:
mirrorwish 2016-02-12 02:25:07 +01:00 committed by Peter Surda
parent 1690597b0b
commit 0db41adfd7
Signed by untrusted user: PeterSurda
GPG Key ID: 0C5F50C0B5F37D87

View File

@ -718,6 +718,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()
@ -3970,6 +3974,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)