feat: avoid accidental press of the "reset preferences" button (#2093)
closes #2093
This commit is contained in:
1 parent
d4f11542f9
commit
f6fcac5856
2 files changed
+18
-3
No files matched your search
@@ -247,6 +247,9 @@
|
||||
/* No comment provided by engineer. */
|
||||
"Reset preferences and restart" = "Reset preferences and restart";
|
||||
|
||||
/* No comment provided by engineer. */
|
||||
"Reset preferences and restart…" = "Reset preferences and restart…";
|
||||
|
||||
/* No comment provided by engineer. */
|
||||
"Rows of thumbnails:" = "Rows of thumbnails:";
|
||||
|
||||
@@ -394,5 +397,8 @@
|
||||
/* No comment provided by engineer. */
|
||||
"Window title truncation:" = "Window title truncation:";
|
||||
|
||||
/* No comment provided by engineer. */
|
||||
"You can’t undo this action." = "You can’t undo this action.";
|
||||
|
||||
/* No comment provided by engineer. */
|
||||
"You didn’t write your email, thus can’t receive any response." = "You didn’t write your email, thus can’t receive any response.";
|
||||
@@ -4,7 +4,7 @@ class GeneralTab {
|
||||
static func initTab() -> NSView {
|
||||
let startAtLogin = LabelAndControl.makeLabelWithCheckbox(NSLocalizedString("Start at login:", comment: ""), "startAtLogin", extraAction: startAtLoginCallback)
|
||||
let menubarIcon = LabelAndControl.makeLabelWithDropdown(NSLocalizedString("Menubar icon:", comment: ""), "menubarIcon", MenubarIconPreference.allCases, extraAction: Menubar.menubarIconCallback)
|
||||
let resetPreferences = Button(NSLocalizedString("Reset preferences and restart", comment: "")) { _ in GeneralTab.resetPreferences() }
|
||||
let resetPreferences = Button(NSLocalizedString("Reset preferences and restart…", comment: "")) { _ in GeneralTab.resetPreferences() }
|
||||
if #available(OSX 11, *) { resetPreferences.hasDestructiveAction = true }
|
||||
let menubarIconDropdown = menubarIcon[1] as! NSPopUpButton
|
||||
for i in 0...2 {
|
||||
@@ -31,8 +31,17 @@ class GeneralTab {
|
||||
}
|
||||
|
||||
static func resetPreferences() {
|
||||
Preferences.resetAll()
|
||||
App.app.restart()
|
||||
let alert = NSAlert()
|
||||
alert.alertStyle = .critical
|
||||
alert.messageText = ""
|
||||
alert.informativeText = NSLocalizedString("You can’t undo this action.", comment: "")
|
||||
alert.addButton(withTitle: NSLocalizedString("Cancel", comment: ""))
|
||||
let resetButton = alert.addButton(withTitle: NSLocalizedString("Reset preferences and restart", comment: ""))
|
||||
if #available(OSX 11, *) { resetButton.hasDestructiveAction = true }
|
||||
if alert.runModal() == .alertSecondButtonReturn {
|
||||
Preferences.resetAll()
|
||||
App.app.restart()
|
||||
}
|
||||
}
|
||||
|
||||
/// add/remove plist file in ~/Library/LaunchAgents/ depending on the checkbox state
|
||||
|
||||
Reference in new issue
Block a user