From ab2880471eb4cc3c48f301e576976dc20db5ad8b Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Wed, 19 Mar 2025 00:59:57 -0400 Subject: [PATCH] =?UTF-8?q?Add=20Troubleshooting=20Mode=20checkbox=20to=20?= =?UTF-8?q?"Restart=20with=20Logging=20Enabled=E2=80=A6"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add "Restart in Troubleshooting Mode" checkbox, checked by default, and remove "Restart Later" option, since it's not possible to restart later in Troubleshooting Mode. I doubt anyone used that, and if they really need it, they can use -ZoteroDebug at the command line or toggle the `debug.store` pref manually. Closes #4580 --- .../content/zotero/standalone/standalone.js | 35 ++++++++++--------- chrome/locale/en-US/zotero/zotero.ftl | 6 +++- 2 files changed, 24 insertions(+), 17 deletions(-) diff --git a/chrome/content/zotero/standalone/standalone.js b/chrome/content/zotero/standalone/standalone.js index 43b6a40383..8585db8f20 100644 --- a/chrome/content/zotero/standalone/standalone.js +++ b/chrome/content/zotero/standalone/standalone.js @@ -942,23 +942,26 @@ ZoteroStandalone.DebugOutput = { restartEnabled: function () { - var ps = Services.prompt; - var buttonFlags = ps.BUTTON_POS_0 * ps.BUTTON_TITLE_IS_STRING - + ps.BUTTON_POS_1 * ps.BUTTON_TITLE_CANCEL - + ps.BUTTON_POS_2 * ps.BUTTON_TITLE_IS_STRING; - var index = ps.confirmEx( - null, - Zotero.getString('zotero.debugOutputLogging'), - Zotero.getString('zotero.debugOutputLogging.enabledAfterRestart', [Zotero.clientName]), - buttonFlags, - Zotero.getString('general.restartNow'), - null, Zotero.getString('general.restartLater'), null, {} - ); - if (index != 1) { - Zotero.Prefs.set('debug.store', true); - } + var checkbox = { value: true }; + var index = Zotero.Prompt.confirm({ + title: Zotero.getString('zotero.debugOutputLogging'), + text: Zotero.getString('zotero.debugOutputLogging.enabledAfterRestart', [Zotero.clientName]), + button0: Zotero.getString('general-restartApp'), + button1: Services.prompt.BUTTON_TITLE_CANCEL, + checkLabel: Zotero.getString('debug-output-logging-restart-in-troubleshooting-mode-checkbox'), + checkbox, + }); if (index == 0) { - Zotero.Utilities.Internal.quit(true); + Zotero.Prefs.set('debug.store', true); + + // Restart in Troubleshooting Mode + if (checkbox.value) { + Services.startup.restartInSafeMode(Ci.nsIAppStartup.eAttemptQuit); + } + // Restart in normal mode + else { + Zotero.Utilities.Internal.quit(true); + } } }, diff --git a/chrome/locale/en-US/zotero/zotero.ftl b/chrome/locale/en-US/zotero/zotero.ftl index 08c39de8ed..3e6f2f7cff 100644 --- a/chrome/locale/en-US/zotero/zotero.ftl +++ b/chrome/locale/en-US/zotero/zotero.ftl @@ -39,6 +39,8 @@ general-go-back = Go Back general-accept = Accept general-cancel = Cancel general-show-in-library = Show in Library +general-restartApp = Restart { -app-name } +general-restartInTroubleshootingMode = Restart in Troubleshooting Mode citation-style-label = Citation Style: language-label = Language: @@ -412,10 +414,12 @@ licenses-cc-by-nc-sa = Creative Commons Attribution-NonCommercial-ShareAlike 4.0 licenses-cc-more-info = Be sure you have read the Creative Commons Considerations for licensors before placing your work under a CC license. Note that the license you apply cannot be revoked, even if you later choose different terms or cease publishing the work. licenses-cc0-more-info = Be sure you have read the Creative Commons CC0 FAQ before applying CC0 to your work. Please note that dedicating your work to the public domain is irreversible, even if you later choose different terms or cease publishing the work. +debug-output-logging-restart-in-troubleshooting-mode-checkbox = { general-restartInTroubleshootingMode } + restart-in-troubleshooting-mode-menuitem = .label = Restart in Troubleshooting Mode… .accesskey = T -restart-in-troubleshooting-mode-dialog-title = Restart in Troubleshooting Mode +restart-in-troubleshooting-mode-dialog-title = { general-restartInTroubleshootingMode } restart-in-troubleshooting-mode-dialog-description = { -app-name } will restart with all plugins disabled. Some features may not function correctly while Troubleshooting Mode is enabled. menu-ui-density =