ask for confirmation when deleting multiple messages

This commit is contained in:
dries.k
2022-03-29 22:43:52 +02:00
parent e50890e4ab
commit 08d4d60559

View File

@@ -108,6 +108,20 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
self.application_selection_changed.emit(item) self.application_selection_changed.emit(item)
def delete_all_callback(self): def delete_all_callback(self):
if (
self.messages_model.rowCount() == 0
or QtWidgets.QMessageBox.warning(
self,
"Are you sure?",
"Delete all messages?",
QtWidgets.QMessageBox.StandardButton.Ok
| QtWidgets.QMessageBox.StandardButton.Cancel,
defaultButton=QtWidgets.QMessageBox.StandardButton.Cancel,
)
!= QtWidgets.QMessageBox.StandardButton.Ok
):
return
index = self.currentApplicationIndex() index = self.currentApplicationIndex()
if item := self.application_model.itemFromIndex(index): if item := self.application_model.itemFromIndex(index):
self.delete_all.emit(item) self.delete_all.emit(item)