Change PDF reader beta pref to a general beta pref

The PDF reader pref is now "Use Zotero PDF reader and new note editor
(beta, My Library only)". Toggling the pref prompts to restart, and
Zotero.isPDFBuild -- which currently controls the PDF reader, new note
editor, and tabs UI -- is set based on that pref at startup.
This commit is contained in:
Dan Stillman 2021-02-25 02:33:35 -05:00
parent 557a75c90f
commit 7cd861a9e1
6 changed files with 26 additions and 17 deletions

View file

@ -41,10 +41,6 @@ Zotero_Preferences.General = {
var menuitem = document.getElementById('fileHandler-internal');
menuitem.setAttribute('label', Zotero.appName);
if (Zotero.isPDFBuild) {
document.getElementById('useInternalPDFReader-checkbox').hidden = false;
}
this.updateAutoRenameFilesUI();
this._updateFileHandlerUI();
},
@ -143,5 +139,20 @@ Zotero_Preferences.General = {
throw new Error(`Unknown file type ${type}`);
}
return 'fileHandler.pdf';
},
handleZotero6BetaChange: function () {
var ps = Services.prompt;
var buttonFlags = ps.BUTTON_POS_0 * ps.BUTTON_TITLE_IS_STRING;
ps.confirmEx(
window,
Zotero.getString('general.restartRequired'),
Zotero.getString('general.restartRequiredForChange', Zotero.appName),
buttonFlags,
Zotero.getString('general.restartApp', Zotero.appName),
null, null, null, {}
);
Zotero.Utilities.Internal.quitZotero(true);
}
}

View file

@ -45,7 +45,7 @@
<preference id="pref-groups-copyChildLinks" name="extensions.zotero.groups.copyChildLinks" type="bool"/>
<preference id="pref-groups-copyTags" name="extensions.zotero.groups.copyTags" type="bool"/>
<preference id="pref-useInternalPDFReader" name="extensions.zotero.beta.useInternalPDFReader" type="bool"/>
<preference id="pref-zotero6" name="extensions.zotero.beta.zotero6" type="bool"/>
</preferences>
<groupbox id="zotero-prefpane-file-handling-groupbox">
@ -80,10 +80,10 @@
</menulist>
</hbox>
<checkbox
id="useInternalPDFReader-checkbox"
label="Use Zotero PDF reader for My Library (beta)"
preference="pref-useInternalPDFReader"
hidden="true"/>
id="zotero6-checkbox"
label="Use Zotero PDF reader and new note editor (beta, My Library only)"
preference="pref-zotero6"
onsynctopreference="Zotero_Preferences.General.handleZotero6BetaChange()"/>
</groupbox>
<groupbox id="zotero-prefpane-miscellaneous-groupbox">

View file

@ -36,9 +36,8 @@ Zotero.OpenPDF = {
else {
let item = pathOrItem;
let library = Zotero.Libraries.get(item.libraryID);
if (Zotero.isPDFBuild
&& library.libraryType == 'user'
&& Zotero.Prefs.get('beta.useInternalPDFReader')) {
// TEMP
if (Zotero.isPDFBuild && library.libraryType == 'user') {
let location = {
pageIndex: page - 1
};

View file

@ -231,7 +231,6 @@ Services.scriptloader.loadSubScript("resource://zotero/polyfill.js");
Zotero.isDevBuild = Zotero.version.includes('beta')
|| Zotero.version.includes('dev')
|| Zotero.version.includes('SOURCE');
Zotero.isPDFBuild = true;
// OS platform
var win = Components.classes["@mozilla.org/appshell/appShellService;1"]
@ -260,6 +259,8 @@ Services.scriptloader.loadSubScript("resource://zotero/polyfill.js");
return;
}
Zotero.isPDFBuild = Zotero.Prefs.get('beta.zotero6');
try {
yield Zotero.DataDirectory.init();
if (this.restarting) {

View file

@ -4132,9 +4132,7 @@ var ZoteroPane = new function()
let item = await Zotero.Items.getAsync(itemID);
let library = Zotero.Libraries.get(item.libraryID);
// TEMP
if (Zotero.isPDFBuild
&& library.libraryType == 'user'
&& Zotero.Prefs.get('beta.useInternalPDFReader')) {
if (Zotero.isPDFBuild && library.libraryType == 'user') {
this.viewPDF(itemID, event && event.shiftKey);
return;
}

View file

@ -179,7 +179,7 @@ pref("extensions.zotero.pane.persist", "");
// Custom file handlers
pref("extensions.zotero.fileHandler.pdf", "");
pref("extensions.zotero.beta.useInternalPDFReader", true);
pref("extensions.zotero.beta.zotero6", false);
// File/URL opening executable if launch() fails
pref("extensions.zotero.fallbackLauncher.unix", "/usr/bin/xdg-open");