Add Help -> Restart in Safe Mode... and a toolbar indicator (#3209)
This commit is contained in:
parent
5536f8d2bd
commit
c9b4daf152
4 changed files with 44 additions and 2 deletions
|
@ -645,6 +645,29 @@ const ZoteroStandalone = new function() {
|
|||
};
|
||||
|
||||
|
||||
this.promptForRestartInSafeMode = async function () {
|
||||
let ps = Services.prompt;
|
||||
let [title, description] = await document.l10n.formatValues([
|
||||
'restart-in-safe-mode-dialog-title',
|
||||
'restart-in-safe-mode-dialog-description'
|
||||
]);
|
||||
let buttonFlags = ps.BUTTON_POS_0 * ps.BUTTON_TITLE_IS_STRING
|
||||
+ ps.BUTTON_POS_1 * ps.BUTTON_TITLE_CANCEL;
|
||||
let index = ps.confirmEx(
|
||||
null,
|
||||
title,
|
||||
description,
|
||||
buttonFlags,
|
||||
Zotero.getString('general.restartNow'),
|
||||
null, null, null, {}
|
||||
);
|
||||
|
||||
if (index == 0) {
|
||||
Services.startup.restartInSafeMode(Ci.nsIAppStartup.eAttemptQuit);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
this.updateAddonsPane = function (doc) {
|
||||
//var rootWindow = doc.ownerGlobal.windowRoot.ownerGlobal;
|
||||
|
||||
|
|
|
@ -415,7 +415,7 @@ var ZoteroPane = new function()
|
|||
Zotero.hiDPI = window.devicePixelRatio > 1;
|
||||
Zotero.hiDPISuffix = Zotero.hiDPI ? "@2x" : "";
|
||||
|
||||
// Show warning in toolbar for 'dev' channel builds
|
||||
// Show warning in toolbar for 'dev' channel builds and safe mode
|
||||
try {
|
||||
let isDevBuild = Zotero.version.includes('-dev');
|
||||
// Uncomment to test
|
||||
|
@ -430,6 +430,16 @@ var ZoteroPane = new function()
|
|||
let syncStop = document.getElementById('zotero-tb-sync-stop');
|
||||
syncStop.parentNode.insertBefore(label, syncStop);
|
||||
}
|
||||
else if (Services.appinfo.inSafeMode) {
|
||||
let label = document.createElement('span');
|
||||
label.setAttribute('style', 'font-weight: bold; color: darkblue; cursor: pointer; margin-right: .5em');
|
||||
label.onclick = function () {
|
||||
Zotero.Utilities.Internal.quit(true);
|
||||
};
|
||||
label.textContent = 'Safe Mode';
|
||||
let syncStop = document.getElementById('zotero-tb-sync-stop');
|
||||
syncStop.parentNode.insertBefore(label, syncStop);
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
Zotero.logError(e);
|
||||
|
|
|
@ -673,6 +673,9 @@
|
|||
oncommand="ZoteroStandalone.DebugOutput.restartEnabled()"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
<menuitem id="menuitem-restart-in-safe-mode"
|
||||
data-l10n-id="restart-in-safe-mode-menuitem"
|
||||
oncommand="ZoteroStandalone.promptForRestartInSafeMode();"/>
|
||||
<menuseparator/>
|
||||
<menuitem id="checkForUpdates"
|
||||
accesskey="&helpCheckForUpdates.accesskey;"
|
||||
|
|
|
@ -185,4 +185,10 @@ licenses-cc-by-nc = Creative Commons Attribution-NonCommercial 4.0 International
|
|||
licenses-cc-by-nc-nd = Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License
|
||||
licenses-cc-by-nc-sa = Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License
|
||||
licenses-cc-more-info = Be sure you have read the Creative Commons <a data-l10n-name="license-considerations">Considerations for licensors</a> 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 <a data-l10n-name="license-considerations">CC0 FAQ</a> 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.
|
||||
licenses-cc0-more-info = Be sure you have read the Creative Commons <a data-l10n-name="license-considerations">CC0 FAQ</a> 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.
|
||||
|
||||
restart-in-safe-mode-menuitem =
|
||||
.label = Restart in Safe Mode…
|
||||
.accesskey = S
|
||||
restart-in-safe-mode-dialog-title = Restart in Safe Mode
|
||||
restart-in-safe-mode-dialog-description = { -app-name } will restart with all plugins disabled. Some features may not function correctly while Safe Mode is enabled.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue