Delete from addressbook by pressing DEL
This commit is contained in:
parent
7d0e23e31a
commit
42a89ad367
|
@ -781,6 +781,9 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
self.ui.treeWidgetSubscriptions.keyPressEvent = self.treeWidgetKeyPressEvent
|
self.ui.treeWidgetSubscriptions.keyPressEvent = self.treeWidgetKeyPressEvent
|
||||||
self.ui.treeWidgetChans.keyPressEvent = self.treeWidgetKeyPressEvent
|
self.ui.treeWidgetChans.keyPressEvent = self.treeWidgetKeyPressEvent
|
||||||
|
|
||||||
|
# Key press in addressbook
|
||||||
|
self.ui.tableWidgetAddressBook.keyPressEvent = self.addressbookKeyPressEvent
|
||||||
|
|
||||||
# Key press in messagelist
|
# Key press in messagelist
|
||||||
self.ui.tableWidgetInbox.keyPressEvent = self.tableWidgetKeyPressEvent
|
self.ui.tableWidgetInbox.keyPressEvent = self.tableWidgetKeyPressEvent
|
||||||
self.ui.tableWidgetInboxSubscriptions.keyPressEvent = self.tableWidgetKeyPressEvent
|
self.ui.tableWidgetInboxSubscriptions.keyPressEvent = self.tableWidgetKeyPressEvent
|
||||||
|
@ -1450,6 +1453,15 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
def treeWidgetKeyPressEvent(self, event):
|
def treeWidgetKeyPressEvent(self, event):
|
||||||
return self.handleKeyPress(event, self.getCurrentTreeWidget())
|
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
|
# inbox / sent
|
||||||
def tableWidgetKeyPressEvent(self, event):
|
def tableWidgetKeyPressEvent(self, event):
|
||||||
return self.handleKeyPress(event, self.getCurrentMessagelist())
|
return self.handleKeyPress(event, self.getCurrentMessagelist())
|
||||||
|
@ -1458,11 +1470,12 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
def textEditKeyPressEvent(self, event):
|
def textEditKeyPressEvent(self, event):
|
||||||
return self.handleKeyPress(event, self.getCurrentMessageTextedit())
|
return self.handleKeyPress(event, self.getCurrentMessageTextedit())
|
||||||
|
|
||||||
def handleKeyPress(self, event, focus = None):
|
def handleKeyPress(self, event, focus=None):
|
||||||
|
"""This method handles keypress events for all widgets on MyForm"""
|
||||||
messagelist = self.getCurrentMessagelist()
|
messagelist = self.getCurrentMessagelist()
|
||||||
folder = self.getCurrentFolder()
|
folder = self.getCurrentFolder()
|
||||||
if event.key() == QtCore.Qt.Key_Delete:
|
if event.key() == QtCore.Qt.Key_Delete:
|
||||||
if isinstance (focus, MessageView) or isinstance(focus, QtGui.QTableWidget):
|
if isinstance(focus, MessageView) or isinstance(focus, QtGui.QTableWidget):
|
||||||
if folder == "sent":
|
if folder == "sent":
|
||||||
self.on_action_SentTrash()
|
self.on_action_SentTrash()
|
||||||
else:
|
else:
|
||||||
|
@ -1498,17 +1511,17 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
self.ui.lineEditTo.setFocus()
|
self.ui.lineEditTo.setFocus()
|
||||||
event.ignore()
|
event.ignore()
|
||||||
elif event.key() == QtCore.Qt.Key_F:
|
elif event.key() == QtCore.Qt.Key_F:
|
||||||
searchline = self.getCurrentSearchLine(retObj = True)
|
searchline = self.getCurrentSearchLine(retObj=True)
|
||||||
if searchline:
|
if searchline:
|
||||||
searchline.setFocus()
|
searchline.setFocus()
|
||||||
event.ignore()
|
event.ignore()
|
||||||
if not event.isAccepted():
|
if not event.isAccepted():
|
||||||
return
|
return
|
||||||
if isinstance (focus, MessageView):
|
if isinstance(focus, MessageView):
|
||||||
return MessageView.keyPressEvent(focus, event)
|
return MessageView.keyPressEvent(focus, event)
|
||||||
elif isinstance (focus, QtGui.QTableWidget):
|
elif isinstance(focus, QtGui.QTableWidget):
|
||||||
return QtGui.QTableWidget.keyPressEvent(focus, event)
|
return QtGui.QTableWidget.keyPressEvent(focus, event)
|
||||||
elif isinstance (focus, QtGui.QTreeWidget):
|
elif isinstance(focus, QtGui.QTreeWidget):
|
||||||
return QtGui.QTreeWidget.keyPressEvent(focus, event)
|
return QtGui.QTreeWidget.keyPressEvent(focus, event)
|
||||||
|
|
||||||
# menu button 'manage keys'
|
# menu button 'manage keys'
|
||||||
|
|
Loading…
Reference in New Issue
Block a user