parent
37b79bc446
commit
98372bd6ba
|
@ -876,7 +876,7 @@ class MyForm(QtGui.QMainWindow):
|
||||||
self.ui.tabWidget.setCurrentIndex(3)
|
self.ui.tabWidget.setCurrentIndex(3)
|
||||||
|
|
||||||
def propagateUnreadCount(self, address = None, folder = "inbox", widget = None, type = 1):
|
def propagateUnreadCount(self, address = None, folder = "inbox", widget = None, type = 1):
|
||||||
def updateUnreadCount(item, type = 1):
|
def updateUnreadCount(item):
|
||||||
if type == 1:
|
if type == 1:
|
||||||
item.setUnreadCount(item.unreadCount + 1)
|
item.setUnreadCount(item.unreadCount + 1)
|
||||||
if isinstance(item, Ui_AddressWidget):
|
if isinstance(item, Ui_AddressWidget):
|
||||||
|
@ -886,10 +886,14 @@ class MyForm(QtGui.QMainWindow):
|
||||||
if isinstance(item, Ui_AddressWidget):
|
if isinstance(item, Ui_AddressWidget):
|
||||||
self.drawTrayIcon(self.currentTrayIconFileName, self.findInboxUnreadCount(self.unreadCount -1))
|
self.drawTrayIcon(self.currentTrayIconFileName, self.findInboxUnreadCount(self.unreadCount -1))
|
||||||
else:
|
else:
|
||||||
|
if addressItem.type == 'subscription' or addressItem.type == 'mailinglist':
|
||||||
|
xAddress = "fromaddress"
|
||||||
|
else:
|
||||||
|
xAddress = "toaddress"
|
||||||
if address and folder:
|
if address and folder:
|
||||||
queryreturn = sqlQuery("SELECT COUNT(*) FROM inbox WHERE toaddress = ? AND folder = ? AND read = 0", address, folder)
|
queryreturn = sqlQuery("SELECT COUNT(*) FROM inbox WHERE " + xAddress + " = ? AND folder = ? AND read = 0", address, folder)
|
||||||
elif address:
|
elif address:
|
||||||
queryreturn = sqlQuery("SELECT COUNT(*) FROM inbox WHERE toaddress = ? AND read = 0", address)
|
queryreturn = sqlQuery("SELECT COUNT(*) FROM inbox WHERE " + xAddress + " = ? AND read = 0", address)
|
||||||
elif folder:
|
elif folder:
|
||||||
queryreturn = sqlQuery("SELECT COUNT(*) FROM inbox WHERE folder = ? AND read = 0", folder)
|
queryreturn = sqlQuery("SELECT COUNT(*) FROM inbox WHERE folder = ? AND read = 0", folder)
|
||||||
else:
|
else:
|
||||||
|
@ -909,14 +913,14 @@ class MyForm(QtGui.QMainWindow):
|
||||||
addressItem = root.child(i)
|
addressItem = root.child(i)
|
||||||
if address is not None and addressItem.data(0, QtCore.Qt.UserRole) != address:
|
if address is not None and addressItem.data(0, QtCore.Qt.UserRole) != address:
|
||||||
continue
|
continue
|
||||||
updateUnreadCount(addressItem, type)
|
updateUnreadCount(addressItem)
|
||||||
if addressItem.childCount == 0:
|
if addressItem.childCount == 0:
|
||||||
continue
|
continue
|
||||||
for j in range(addressItem.childCount()):
|
for j in range(addressItem.childCount()):
|
||||||
folderItem = addressItem.child(j)
|
folderItem = addressItem.child(j)
|
||||||
if folder is not None and folderItem.data(0, QtCore.Qt.UserRole) != folder:
|
if folder is not None and folderItem.data(0, QtCore.Qt.UserRole) != folder:
|
||||||
continue
|
continue
|
||||||
updateUnreadCount(folderItem, type)
|
updateUnreadCount(folderItem)
|
||||||
|
|
||||||
# Load Sent items from database
|
# Load Sent items from database
|
||||||
def loadSent(self, tableWidget, account, where="", what=""):
|
def loadSent(self, tableWidget, account, where="", what=""):
|
||||||
|
@ -2368,12 +2372,15 @@ class MyForm(QtGui.QMainWindow):
|
||||||
|
|
||||||
def displayNewInboxMessage(self, inventoryHash, toAddress, fromAddress, subject, message):
|
def displayNewInboxMessage(self, inventoryHash, toAddress, fromAddress, subject, message):
|
||||||
subject = shared.fixPotentiallyInvalidUTF8Data(subject)
|
subject = shared.fixPotentiallyInvalidUTF8Data(subject)
|
||||||
|
if toAddress == str_broadcast_subscribers:
|
||||||
|
acct = accountClass(fromAddress)
|
||||||
|
else:
|
||||||
acct = accountClass(toAddress)
|
acct = accountClass(toAddress)
|
||||||
acct.parseMessage(toAddress, fromAddress, subject, message)
|
acct.parseMessage(toAddress, fromAddress, subject, message)
|
||||||
inbox = self.getAccountMessagelist(acct)
|
inbox = self.getAccountMessagelist(acct)
|
||||||
treeWidget = self.getAccountTreeWidget(acct)
|
treeWidget = self.getAccountTreeWidget(acct)
|
||||||
self.propagateUnreadCount(toAddress)
|
self.propagateUnreadCount(acct.address)
|
||||||
if (self.getCurrentFolder(treeWidget) != "inbox" and self.getCurrentFolder(treeWidget) != False) or self.getCurrentAccount(treeWidget) != toAddress:
|
if (self.getCurrentFolder(treeWidget) != "inbox" and self.getCurrentFolder(treeWidget) != False) or self.getCurrentAccount(treeWidget) != acct.address:
|
||||||
# Ubuntu should notify of new message irespective of whether it's in current message list or not
|
# Ubuntu should notify of new message irespective of whether it's in current message list or not
|
||||||
self.ubuntuMessagingMenuUpdate(True, None, acct.toLabel)
|
self.ubuntuMessagingMenuUpdate(True, None, acct.toLabel)
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue
Block a user