dont freeze UI when mass-marking unread
This commit is contained in:
parent
12b4015457
commit
88efb92c15
|
@ -2663,15 +2663,19 @@ class MyForm(QtGui.QMainWindow):
|
||||||
def on_action_InboxMarkUnread(self):
|
def on_action_InboxMarkUnread(self):
|
||||||
font = QFont()
|
font = QFont()
|
||||||
font.setBold(True)
|
font.setBold(True)
|
||||||
|
inventoryHashesToMarkUnread = []
|
||||||
for row in self.ui.tableWidgetInbox.selectedIndexes():
|
for row in self.ui.tableWidgetInbox.selectedIndexes():
|
||||||
currentRow = row.row()
|
currentRow = row.row()
|
||||||
inventoryHashToMarkUnread = str(self.ui.tableWidgetInbox.item(
|
inventoryHashToMarkUnread = str(self.ui.tableWidgetInbox.item(
|
||||||
currentRow, 3).data(Qt.UserRole).toPyObject())
|
currentRow, 3).data(Qt.UserRole).toPyObject())
|
||||||
sqlExecute('''UPDATE inbox SET read=0 WHERE msgid=?''', inventoryHashToMarkUnread)
|
inventoryHashesToMarkUnread.append(inventoryHashToMarkUnread)
|
||||||
self.ui.tableWidgetInbox.item(currentRow, 0).setFont(font)
|
self.ui.tableWidgetInbox.item(currentRow, 0).setFont(font)
|
||||||
self.ui.tableWidgetInbox.item(currentRow, 1).setFont(font)
|
self.ui.tableWidgetInbox.item(currentRow, 1).setFont(font)
|
||||||
self.ui.tableWidgetInbox.item(currentRow, 2).setFont(font)
|
self.ui.tableWidgetInbox.item(currentRow, 2).setFont(font)
|
||||||
self.ui.tableWidgetInbox.item(currentRow, 3).setFont(font)
|
self.ui.tableWidgetInbox.item(currentRow, 3).setFont(font)
|
||||||
|
#sqlite requires the exact number of ?s to prevent injection
|
||||||
|
sqlExecute('''UPDATE inbox SET read=0 WHERE msgid IN (%s)''' % (
|
||||||
|
"?," * len(inventoryHashesToMarkUnread))[:-1], *inventoryHashesToMarkUnread)
|
||||||
self.changedInboxUnread()
|
self.changedInboxUnread()
|
||||||
# self.ui.tableWidgetInbox.selectRow(currentRow + 1)
|
# self.ui.tableWidgetInbox.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.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user