Protect from accidental quitting with alert

This commit is contained in:
Ivan Grachyov 2021-06-19 15:08:41 +03:00
parent 8430084163
commit c754187819

View File

@ -92,8 +92,16 @@ class Agent: NSObject {
}()
@objc private func didSelectQuitMenuItem() {
// TODO: show alert
NSApp.terminate(nil)
Window.activateWindow(nil)
let alert = NSAlert()
alert.messageText = "Quit Encrypted Ink?"
alert.informativeText = "It will not be able to show sign requests."
alert.alertStyle = .warning
alert.addButton(withTitle: "OK")
alert.addButton(withTitle: "Cancel")
if alert.runModal() == .alertFirstButtonReturn {
NSApp.terminate(nil)
}
}
func setupStatusBarItem() {