MCPcopy Create free account
hub / github.com/Bitmessage/PyBitmessage / on_action_TrashUndelete

Method on_action_TrashUndelete

src/bitmessageqt/__init__.py:3148–3176  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

3146 "MainWindow", "Moved items to trash."))
3147
3148 def on_action_TrashUndelete(self):
3149 tableWidget = self.getCurrentMessagelist()
3150 if not tableWidget:
3151 return
3152 currentRow = 0
3153 tableWidget.setUpdatesEnabled(False)
3154 inventoryHashesToTrash = []
3155 # ranges in reversed order
3156 for r in sorted(tableWidget.selectedRanges(), key=lambda r: r.topRow())[::-1]:
3157 for i in range(r.bottomRow()-r.topRow()+1):
3158 inventoryHashToTrash = str(tableWidget.item(
3159 r.topRow()+i, 3).data(QtCore.Qt.UserRole).toPyObject())
3160 if inventoryHashToTrash in inventoryHashesToTrash:
3161 continue
3162 inventoryHashesToTrash.append(inventoryHashToTrash)
3163 currentRow = r.topRow()
3164 self.getCurrentMessageTextedit().setText("")
3165 tableWidget.model().removeRows(r.topRow(), r.bottomRow()-r.topRow()+1)
3166 if currentRow == 0:
3167 tableWidget.selectRow(currentRow)
3168 else:
3169 tableWidget.selectRow(currentRow - 1)
3170 idCount = len(inventoryHashesToTrash)
3171 sqlExecuteChunked('''UPDATE inbox SET folder='inbox' WHERE msgid IN({0})''',
3172 idCount, *inventoryHashesToTrash)
3173 tableWidget.selectRow(0 if currentRow == 0 else currentRow - 1)
3174 tableWidget.setUpdatesEnabled(True)
3175 self.propagateUnreadCount(self.getCurrentAccount)
3176 self.updateStatusBar(_translate("MainWindow", "Undeleted item."))
3177
3178 def on_action_InboxSaveMessageAs(self):
3179 tableWidget = self.getCurrentMessagelist()

Callers

nothing calls this directly

Calls 7

getCurrentMessagelistMethod · 0.95
propagateUnreadCountMethod · 0.95
updateStatusBarMethod · 0.95
sqlExecuteChunkedFunction · 0.90
_translateFunction · 0.90
dataMethod · 0.45

Tested by

no test coverage detected