V0.6 #852
|
@ -2431,17 +2431,8 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
def addEntryToAddressBook(self,address,label):
|
def addEntryToAddressBook(self,address,label):
|
||||||
queryreturn = sqlQuery('''select * from addressbook where address=?''', address)
|
queryreturn = sqlQuery('''select * from addressbook where address=?''', address)
|
||||||
if queryreturn == []:
|
if queryreturn == []:
|
||||||
self.ui.tableWidgetAddressBook.setSortingEnabled(False)
|
|
||||||
self.ui.tableWidgetAddressBook.insertRow(0)
|
|
||||||
newItem = QtGui.QTableWidgetItem(unicode(label, 'utf-8'))
|
|
||||||
newItem.setIcon(avatarize(address))
|
|
||||||
self.ui.tableWidgetAddressBook.setItem(0, 0, newItem)
|
|
||||||
newItem = QtGui.QTableWidgetItem(address)
|
|
||||||
newItem.setFlags(
|
|
||||||
QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
|
|
||||||
self.ui.tableWidgetAddressBook.setItem(0, 1, newItem)
|
|
||||||
self.ui.tableWidgetAddressBook.setSortingEnabled(True)
|
|
||||||
sqlExecute('''INSERT INTO addressbook VALUES (?,?)''', str(label), address)
|
sqlExecute('''INSERT INTO addressbook VALUES (?,?)''', str(label), address)
|
||||||
|
self.rerenderAddressBook()
|
||||||
self.rerenderInboxFromLabels()
|
self.rerenderInboxFromLabels()
|
||||||
self.rerenderSentToLabels()
|
self.rerenderSentToLabels()
|
||||||
else:
|
else:
|
||||||
|
@ -3073,20 +3064,10 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
queryreturn = sqlQuery('''select * from addressbook where address=?''',
|
queryreturn = sqlQuery('''select * from addressbook where address=?''',
|
||||||
addressAtCurrentInboxRow)
|
addressAtCurrentInboxRow)
|
||||||
if queryreturn == []:
|
if queryreturn == []:
|
||||||
self.ui.tableWidgetAddressBook.insertRow(0)
|
|
||||||
newItem = QtGui.QTableWidgetItem(
|
|
||||||
'--New entry. Change label in Address Book.--')
|
|
||||||
self.ui.tableWidgetAddressBook.setItem(0, 0, newItem)
|
|
||||||
newItem.setIcon(avatarize(addressAtCurrentInboxRow))
|
|
||||||
newItem = QtGui.QTableWidgetItem(addressAtCurrentInboxRow)
|
|
||||||
newItem.setFlags(
|
|
||||||
QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
|
|
||||||
self.ui.tableWidgetAddressBook.setItem(0, 1, newItem)
|
|
||||||
sqlExecute('''INSERT INTO addressbook VALUES (?,?)''',
|
sqlExecute('''INSERT INTO addressbook VALUES (?,?)''',
|
||||||
'--New entry. Change label in Address Book.--',
|
'--New entry. Change label in Address Book.--',
|
||||||
addressAtCurrentInboxRow)
|
addressAtCurrentInboxRow)
|
||||||
self.ui.tabWidget.setCurrentIndex(1)
|
self.rerenderAddressBook()
|
||||||
self.ui.tableWidgetAddressBook.setCurrentCell(0, 0)
|
|
||||||
self.statusBar().showMessage(_translate(
|
self.statusBar().showMessage(_translate(
|
||||||
"MainWindow", "Entry added to the Address Book. Edit the label to your liking."))
|
"MainWindow", "Entry added to the Address Book. Edit the label to your liking."))
|
||||||
else:
|
else:
|
||||||
|
@ -3928,6 +3909,7 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
sqlExecute('''UPDATE addressbook set label=? WHERE address=?''',
|
sqlExecute('''UPDATE addressbook set label=? WHERE address=?''',
|
||||||
str(self.ui.tableWidgetAddressBook.item(currentRow, 0).text().toUtf8()),
|
str(self.ui.tableWidgetAddressBook.item(currentRow, 0).text().toUtf8()),
|
||||||
str(addressAtCurrentRow))
|
str(addressAtCurrentRow))
|
||||||
|
self.ui.tableWidgetAddressBook.item(currentRow, 0).setLabel(str(self.ui.tableWidgetAddressBook.item(currentRow, 0).text().toUtf8()))
|
||||||
self.rerenderInboxFromLabels()
|
self.rerenderInboxFromLabels()
|
||||||
self.rerenderSentToLabels()
|
self.rerenderSentToLabels()
|
||||||
|
|
||||||
|
|
|
@ -287,9 +287,15 @@ class Ui_AddressBookWidgetItem(QtGui.QTableWidgetItem, AccountMixin):
|
||||||
class Ui_AddressBookWidgetItemLabel(Ui_AddressBookWidgetItem):
|
class Ui_AddressBookWidgetItemLabel(Ui_AddressBookWidgetItem):
|
||||||
def __init__ (self, address, label, type):
|
def __init__ (self, address, label, type):
|
||||||
Ui_AddressBookWidgetItem.__init__(self, label, type)
|
Ui_AddressBookWidgetItem.__init__(self, label, type)
|
||||||
|
self.address = address
|
||||||
|
self.label = label
|
||||||
self.setIcon(avatarize(address))
|
self.setIcon(avatarize(address))
|
||||||
self.setToolTip(label + " (" + address + ")")
|
self.setToolTip(label + " (" + address + ")")
|
||||||
|
|
||||||
|
def setLabel(self, label):
|
||||||
|
self.label = label
|
||||||
|
self.setToolTip(self.label + " (" + self.address + ")")
|
||||||
|
|
||||||
|
|
||||||
class Ui_AddressBookWidgetItemAddress(Ui_AddressBookWidgetItem):
|
class Ui_AddressBookWidgetItemAddress(Ui_AddressBookWidgetItem):
|
||||||
def __init__ (self, address, label, type):
|
def __init__ (self, address, label, type):
|
||||||
|
|
Reference in New Issue
Block a user