V0.6 #852

Merged
Atheros1 merged 399 commits from v0.6 into master 2016-05-03 01:58:38 +02:00
Showing only changes of commit 4c8223ae88 - Show all commits

View File

@ -2940,10 +2940,16 @@ class MyForm(QtGui.QMainWindow):
font = QFont() font = QFont()
font.setBold(True) font.setBold(True)
inventoryHashesToMarkUnread = [] inventoryHashesToMarkUnread = []
modified = 0
for row in tableWidget.selectedIndexes(): for row in tableWidget.selectedIndexes():
currentRow = row.row() currentRow = row.row()
inventoryHashToMarkUnread = str(tableWidget.item( inventoryHashToMarkUnread = str(tableWidget.item(
currentRow, 3).data(Qt.UserRole).toPyObject()) currentRow, 3).data(Qt.UserRole).toPyObject())
if inventoryHashToMarkUnread in inventoryHashesToMarkUnread:
# it returns columns as separate items, so we skip dupes
continue
if not tableWidget.item(currentRow, 0).font().bold():
modified += 1
inventoryHashesToMarkUnread.append(inventoryHashToMarkUnread) inventoryHashesToMarkUnread.append(inventoryHashToMarkUnread)
tableWidget.item(currentRow, 0).setFont(font) tableWidget.item(currentRow, 0).setFont(font)
tableWidget.item(currentRow, 1).setFont(font) tableWidget.item(currentRow, 1).setFont(font)
@ -2952,6 +2958,10 @@ class MyForm(QtGui.QMainWindow):
#sqlite requires the exact number of ?s to prevent injection #sqlite requires the exact number of ?s to prevent injection
sqlExecute('''UPDATE inbox SET read=0 WHERE msgid IN (%s)''' % ( sqlExecute('''UPDATE inbox SET read=0 WHERE msgid IN (%s)''' % (
"?," * len(inventoryHashesToMarkUnread))[:-1], *inventoryHashesToMarkUnread) "?," * len(inventoryHashesToMarkUnread))[:-1], *inventoryHashesToMarkUnread)
if modified == 1:
# performance optimisation
self.propagateUnreadCount(self.getCurrentAccount())
else:
self.propagateUnreadCount(self.getCurrentAccount(), "inbox", self.getCurrentTreeWidget(), 0) self.propagateUnreadCount(self.getCurrentAccount(), "inbox", self.getCurrentTreeWidget(), 0)
# tableWidget.selectRow(currentRow + 1) # tableWidget.selectRow(currentRow + 1)
# This doesn't de-select the last message if you try to mark it unread, but that doesn't interfere. Might not be necessary. # This doesn't de-select the last message if you try to mark it unread, but that doesn't interfere. Might not be necessary.