parent
dfe66ae756
commit
33064601ac
|
@ -985,23 +985,9 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
acct.parseMessage(toAddress, fromAddress, subject, "")
|
acct.parseMessage(toAddress, fromAddress, subject, "")
|
||||||
|
|
||||||
items = []
|
items = []
|
||||||
toAddressItem = QtGui.QTableWidgetItem(unicode(acct.toLabel, 'utf-8'))
|
MessageList_AddressWidget(items, str(acct.toAddress), unicode(acct.toLabel, 'utf-8'))
|
||||||
toAddressItem.setToolTip(unicode(acct.toLabel, 'utf-8') + " (" + str(acct.toAddress) + ")")
|
|
||||||
toAddressItem.setIcon(avatarize(toAddress))
|
|
||||||
toAddressItem.setData(Qt.UserRole, str(toAddress))
|
|
||||||
toAddressItem.setTextColor(AccountColor(toAddress).accountColor())
|
|
||||||
toAddressItem.setFlags(
|
|
||||||
QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
|
|
||||||
items.append(toAddressItem)
|
|
||||||
|
|
||||||
fromAddressItem = QtGui.QTableWidgetItem(unicode(acct.fromLabel, 'utf-8'))
|
MessageList_AddressWidget(items, str(acct.fromAddress), unicode(acct.fromLabel, 'utf-8'))
|
||||||
fromAddressItem.setToolTip(unicode(acct.fromLabel, 'utf-8') + " (" + str(acct.fromAddress) + ")")
|
|
||||||
fromAddressItem.setIcon(avatarize(fromAddress))
|
|
||||||
fromAddressItem.setData(Qt.UserRole, str(fromAddress))
|
|
||||||
fromAddressItem.setTextColor(AccountColor(fromAddress).accountColor())
|
|
||||||
fromAddressItem.setFlags(
|
|
||||||
QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
|
|
||||||
items.append(fromAddressItem)
|
|
||||||
|
|
||||||
subjectItem = QtGui.QTableWidgetItem(unicode(acct.subject, 'utf-8'))
|
subjectItem = QtGui.QTableWidgetItem(unicode(acct.subject, 'utf-8'))
|
||||||
subjectItem.setToolTip(unicode(acct.subject, 'utf-8'))
|
subjectItem.setToolTip(unicode(acct.subject, 'utf-8'))
|
||||||
|
@ -1075,27 +1061,9 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
|
|
||||||
items = []
|
items = []
|
||||||
#to
|
#to
|
||||||
to_item = QtGui.QTableWidgetItem(unicode(acct.toLabel, 'utf-8'))
|
MessageList_AddressWidget(items, str(acct.toAddress), unicode(acct.toLabel, 'utf-8'), not read)
|
||||||
to_item.setToolTip(unicode(acct.toLabel, 'utf-8') + " (" + str(acct.toAddress) + ")")
|
|
||||||
to_item.setFlags(
|
|
||||||
QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
|
|
||||||
if not read:
|
|
||||||
to_item.setFont(font)
|
|
||||||
to_item.setData(Qt.UserRole, str(toAddress))
|
|
||||||
to_item.setTextColor(AccountColor(toAddress).accountColor())
|
|
||||||
to_item.setIcon(avatarize(toAddress))
|
|
||||||
items.append(to_item)
|
|
||||||
# from
|
# from
|
||||||
from_item = QtGui.QTableWidgetItem(unicode(acct.fromLabel, 'utf-8'))
|
MessageList_AddressWidget(items, str(acct.fromAddress), unicode(acct.fromLabel, 'utf-8'), not read)
|
||||||
from_item.setToolTip(unicode(acct.fromLabel, 'utf-8') + " (" + str(fromAddress) + ")")
|
|
||||||
from_item.setFlags(
|
|
||||||
QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
|
|
||||||
if not read:
|
|
||||||
from_item.setFont(font)
|
|
||||||
from_item.setData(Qt.UserRole, str(fromAddress))
|
|
||||||
from_item.setTextColor(AccountColor(fromAddress).accountColor())
|
|
||||||
from_item.setIcon(avatarize(fromAddress))
|
|
||||||
items.append(from_item)
|
|
||||||
# subject
|
# subject
|
||||||
subject_item = QtGui.QTableWidgetItem(unicode(acct.subject, 'utf-8'))
|
subject_item = QtGui.QTableWidgetItem(unicode(acct.subject, 'utf-8'))
|
||||||
subject_item.setToolTip(unicode(acct.subject, 'utf-8'))
|
subject_item.setToolTip(unicode(acct.subject, 'utf-8'))
|
||||||
|
|
|
@ -261,8 +261,69 @@ class Ui_SubscriptionWidget(Ui_AddressWidget, AccountMixin):
|
||||||
if not self.initialised:
|
if not self.initialised:
|
||||||
return
|
return
|
||||||
self.emitDataChanged()
|
self.emitDataChanged()
|
||||||
|
|
||||||
|
|
||||||
|
class MessageList_AddressWidget(QtGui.QTableWidgetItem, AccountMixin, SettingsMixin):
|
||||||
|
def __init__(self, parent, address = None, label = None, unread = False):
|
||||||
|
super(QtGui.QTableWidgetItem, self).__init__()
|
||||||
|
#parent.insertTopLevelItem(pos, self)
|
||||||
|
# only set default when creating
|
||||||
|
#super(QtGui.QTreeWidgetItem, self).setExpanded(shared.config.getboolean(self.address, 'enabled'))
|
||||||
|
self.initialised = False
|
||||||
|
self.isEnabled = True
|
||||||
|
self.setAddress(address)
|
||||||
|
self.setLabel(label)
|
||||||
|
self.setUnread(unread)
|
||||||
|
self.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
|
||||||
|
self.initialised = True
|
||||||
|
self.setType() # does updateText
|
||||||
|
parent.append(self)
|
||||||
|
|
||||||
|
def setLabel(self, label = None):
|
||||||
|
if label is None:
|
||||||
|
label = unicode(shared.config.get(self.address, 'label'), 'utf-8)')
|
||||||
|
else:
|
||||||
|
self.label = label
|
||||||
|
|
||||||
|
def setUnread(self, unread):
|
||||||
|
self.unread = unread
|
||||||
|
|
||||||
|
def data(self, role):
|
||||||
|
if role == QtCore.Qt.DisplayRole:
|
||||||
|
return self.label
|
||||||
|
elif role == QtCore.Qt.EditRole:
|
||||||
|
return self.label
|
||||||
|
elif role == QtCore.Qt.ToolTipRole:
|
||||||
|
return self.label + " (" + self.address + ")"
|
||||||
|
elif role == QtCore.Qt.DecorationRole:
|
||||||
|
if shared.safeConfigGetBoolean('bitmessagesettings', 'useidenticons'):
|
||||||
|
if self.address is None:
|
||||||
|
return avatarize(self.label)
|
||||||
|
else:
|
||||||
|
return avatarize(self.address)
|
||||||
|
elif role == QtCore.Qt.FontRole:
|
||||||
|
font = QtGui.QFont()
|
||||||
|
font.setBold(self.unread)
|
||||||
|
return font
|
||||||
|
elif role == QtCore.Qt.ForegroundRole:
|
||||||
|
return self.accountBrush()
|
||||||
|
elif role == QtCore.Qt.UserRole:
|
||||||
|
return self.address
|
||||||
|
return super(MessageList_AddressWidget, self).data(role)
|
||||||
|
|
||||||
|
def setData(self, role, value):
|
||||||
|
if role == QtCore.Qt.EditRole:
|
||||||
|
self.setLabel()
|
||||||
|
return
|
||||||
|
return super(MessageList_AddressWidget, self).setData(role, value)
|
||||||
|
|
||||||
|
# label (or address) alphabetically, disabled at the end
|
||||||
|
def __lt__(self, other):
|
||||||
|
if (isinstance(other, MessageList_AddressWidget)):
|
||||||
|
return self.label.lower() < other.label.lower()
|
||||||
|
return super(QtGui.QTableWidgetItem, self).__lt__(other)
|
||||||
|
|
||||||
|
|
||||||
class Ui_AddressBookWidgetItem(QtGui.QTableWidgetItem, AccountMixin):
|
class Ui_AddressBookWidgetItem(QtGui.QTableWidgetItem, AccountMixin):
|
||||||
def __init__ (self, text, type = AccountMixin.NORMAL):
|
def __init__ (self, text, type = AccountMixin.NORMAL):
|
||||||
super(QtGui.QTableWidgetItem, self).__init__(text)
|
super(QtGui.QTableWidgetItem, self).__init__(text)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user