mirror of
https://github.com/onionshare/onionshare.git
synced 2025-05-06 08:25:15 -04:00
Show warning when quitting while any tabs are active
This commit is contained in:
parent
654fccc009
commit
b7a095d64d
4 changed files with 50 additions and 22 deletions
|
@ -268,8 +268,32 @@ class MainWindow(QtWidgets.QMainWindow):
|
|||
|
||||
def closeEvent(self, e):
|
||||
self.common.log("MainWindow", "closeEvent")
|
||||
|
||||
if self.tabs.are_tabs_active():
|
||||
# Open the warning dialog
|
||||
dialog = QtWidgets.QMessageBox()
|
||||
dialog.setWindowTitle(strings._("gui_quit_warning_title"))
|
||||
dialog.setText(strings._("gui_quit_warning_description"))
|
||||
dialog.setIcon(QtWidgets.QMessageBox.Critical)
|
||||
dialog.addButton(
|
||||
strings._("gui_quit_warning_quit"), QtWidgets.QMessageBox.YesRole
|
||||
)
|
||||
cancel_button = dialog.addButton(
|
||||
strings._("gui_quit_warning_cancel"), QtWidgets.QMessageBox.NoRole
|
||||
)
|
||||
dialog.setDefaultButton(cancel_button)
|
||||
reply = dialog.exec_()
|
||||
|
||||
# Close
|
||||
if reply == 0:
|
||||
self.system_tray.hide()
|
||||
e.accept()
|
||||
# Cancel
|
||||
else:
|
||||
e.ignore()
|
||||
return
|
||||
|
||||
self.system_tray.hide()
|
||||
# TODO: Run the tab's close_event
|
||||
e.accept()
|
||||
|
||||
def cleanup(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue