Skip to content

Commit 601a7c9

Browse files
committed
fix: quit dialog — Cancel is Return-key default, Quit Anyway marked destructive
1 parent f039f69 commit 601a7c9

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

TablePro/AppDelegate.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,10 +204,12 @@ class AppDelegate: NSObject, NSApplicationDelegate {
204204
alert.messageText = String(localized: "You have unsaved changes")
205205
alert.informativeText = String(localized: "Some tabs have unsaved edits. Quitting will discard these changes.")
206206
alert.alertStyle = .warning
207-
alert.addButton(withTitle: String(localized: "Cancel"))
208207
alert.addButton(withTitle: String(localized: "Quit Anyway"))
208+
alert.addButton(withTitle: String(localized: "Cancel"))
209+
alert.buttons[0].hasDestructiveAction = true
210+
alert.buttons[1].keyEquivalent = "\r"
209211
let response = alert.runModal()
210-
return response == .alertSecondButtonReturn ? .terminateNow : .terminateCancel
212+
return response == .alertFirstButtonReturn ? .terminateNow : .terminateCancel
211213
}
212214

213215
func applicationWillTerminate(_ notification: Notification) {

0 commit comments

Comments
 (0)