Merge remote-tracking branch 'origin/pr/269'

* origin/pr/269:
  Added more reasonable behavior to "should I force shutdown or wait" message
This commit is contained in:
Marek Marczykowski-Górecki 2020-10-29 03:59:15 +01:00
commit 1e3da9e68f
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -533,7 +533,14 @@ class VmShutdownMonitor(QObject):
self.tr("Wait another {0} seconds...").format( self.tr("Wait another {0} seconds...").format(
self.shutdown_time / 1000), self.shutdown_time / 1000),
QMessageBox.NoRole) QMessageBox.NoRole)
ignore_button = msgbox.addButton(self.tr("Don't ask again"),
QMessageBox.RejectRole)
msgbox.setDefaultButton(wait_button) msgbox.setDefaultButton(wait_button)
msgbox.setEscapeButton(ignore_button)
msgbox.setWindowFlags(
msgbox.windowFlags() | Qt.CustomizeWindowHint)
msgbox.setWindowFlags(
msgbox.windowFlags() & ~Qt.WindowCloseButtonHint)
msgbox.exec_() msgbox.exec_()
msgbox.deleteLater() msgbox.deleteLater()
@ -545,6 +552,8 @@ class VmShutdownMonitor(QObject):
# shutting it down # shutting it down
pass pass
self.restart_vm_if_needed() self.restart_vm_if_needed()
elif msgbox.clickedButton() is ignore_button:
return
else: else:
self.shutdown_started = datetime.now() self.shutdown_started = datetime.now()
self.check_again_later() self.check_again_later()