Delete from addressbook by pressing DEL

This commit is contained in:
Dmitri Bogomolov 2019-09-23 18:15:31 +03:00
parent 7d0e23e31a
commit 42a89ad367
Signed by untrusted user: g1itch
GPG Key ID: 720A756F18DEED13

View File

@ -781,6 +781,9 @@ class MyForm(settingsmixin.SMainWindow):
self.ui.treeWidgetSubscriptions.keyPressEvent = self.treeWidgetKeyPressEvent
self.ui.treeWidgetChans.keyPressEvent = self.treeWidgetKeyPressEvent
# Key press in addressbook
self.ui.tableWidgetAddressBook.keyPressEvent = self.addressbookKeyPressEvent
# Key press in messagelist
self.ui.tableWidgetInbox.keyPressEvent = self.tableWidgetKeyPressEvent
self.ui.tableWidgetInboxSubscriptions.keyPressEvent = self.tableWidgetKeyPressEvent
@ -1450,6 +1453,15 @@ class MyForm(settingsmixin.SMainWindow):
def treeWidgetKeyPressEvent(self, event):
return self.handleKeyPress(event, self.getCurrentTreeWidget())
# addressbook
def addressbookKeyPressEvent(self, event):
"""Handle keypress event in addressbook widget"""
if event.key() == QtCore.Qt.Key_Delete:
self.on_action_AddressBookDelete()
else:
return QtGui.QTableWidget.keyPressEvent(
self.ui.tableWidgetAddressBook, event)
# inbox / sent
def tableWidgetKeyPressEvent(self, event):
return self.handleKeyPress(event, self.getCurrentMessagelist())
@ -1459,6 +1471,7 @@ class MyForm(settingsmixin.SMainWindow):
return self.handleKeyPress(event, self.getCurrentMessageTextedit())
def handleKeyPress(self, event, focus=None):
"""This method handles keypress events for all widgets on MyForm"""
messagelist = self.getCurrentMessagelist()
folder = self.getCurrentFolder()
if event.key() == QtCore.Qt.Key_Delete: