mirror of
https://github.com/onionshare/onionshare.git
synced 2025-02-05 01:15:29 -05:00
Confirm when user tries to close the GUI window (fixes #264)
This commit is contained in:
parent
7b8e9e1e6f
commit
cb3d39fb4f
@ -45,5 +45,6 @@
|
|||||||
"gui_download_progress_complete": "%p%, Time Elapsed: {0:s}",
|
"gui_download_progress_complete": "%p%, Time Elapsed: {0:s}",
|
||||||
"gui_download_progress_starting": "{0:s}, %p% (Computing ETA)",
|
"gui_download_progress_starting": "{0:s}, %p% (Computing ETA)",
|
||||||
"gui_download_progress_eta": "{0:s}, ETA: {1:s}, %p%",
|
"gui_download_progress_eta": "{0:s}, ETA: {1:s}, %p%",
|
||||||
"version_string": "Onionshare {0:s} | https://onionshare.org/"
|
"version_string": "Onionshare {0:s} | https://onionshare.org/",
|
||||||
|
"gui_quit_warning": "Are you sure you want to quit?\nThe URL you are sharing won't exist anymore."
|
||||||
}
|
}
|
||||||
|
@ -244,7 +244,23 @@ class OnionShareGui(QtWidgets.QMainWindow):
|
|||||||
self.status_bar.clearMessage()
|
self.status_bar.clearMessage()
|
||||||
|
|
||||||
def closeEvent(self, e):
|
def closeEvent(self, e):
|
||||||
|
if self.server_status.status != self.server_status.STATUS_STOPPED:
|
||||||
|
dialog = QtWidgets.QMessageBox()
|
||||||
|
dialog.setText(strings._('gui_quit_warning', True))
|
||||||
|
quit_button = dialog.addButton("Quit", QtWidgets.QMessageBox.YesRole)
|
||||||
|
dont_quit_button = dialog.addButton("Don't Quit", QtWidgets.QMessageBox.NoRole)
|
||||||
|
#dialog.setStandardButtons(QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No)
|
||||||
|
dialog.setDefaultButton(dont_quit_button)
|
||||||
|
reply = dialog.exec_()
|
||||||
|
print("reply: {}".format(reply))
|
||||||
|
|
||||||
|
# Quit
|
||||||
|
if reply == 0:
|
||||||
self.stop_server()
|
self.stop_server()
|
||||||
|
e.accept()
|
||||||
|
# Don't Quit
|
||||||
|
else:
|
||||||
|
e.ignore()
|
||||||
|
|
||||||
|
|
||||||
def alert(msg, icon=QtWidgets.QMessageBox.NoIcon):
|
def alert(msg, icon=QtWidgets.QMessageBox.NoIcon):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user