Bring Check for Updates to front if re-triggered, unify functions (#3861)

This commit is contained in:
Abe Jellinek 2024-04-02 06:42:35 -04:00 committed by GitHub
parent 0b04a518e7
commit 009f2a5607
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 18 additions and 7 deletions

View file

@ -739,7 +739,8 @@ const ZoteroStandalone = new function() {
* Checks for updates
*/
this.checkForUpdates = function() {
window.open('chrome://zotero/content/update/updates.xhtml', 'updateChecker', 'chrome,centerscreen');
Zotero.debug('ZoteroStandalone.checkForUpdates is deprecated -- use Zotero.openCheckForUpdatesWindow() instead');
Zotero.openCheckForUpdatesWindow();
}
/**

View file

@ -1337,7 +1337,7 @@ Zotero.Sync.Runner_Module = function (options = {}) {
e.errorType = 'warning';
e.dialogButtonText = Zotero.getString('general.checkForUpdates');
e.dialogButtonCallback = () => {
Zotero.openCheckForUpdatesWindow();
Zotero.openCheckForUpdatesWindow({ modal: true });
};
e.dialogButton2Text = Zotero.getString('general.moreInformation');
e.dialogButton2Callback = () => {

View file

@ -649,7 +649,7 @@ Services.scriptloader.loadSubScript("resource://zotero/polyfill.js");
// "Check for Update" button
if (index === 0) {
Zotero.openCheckForUpdatesWindow();
Zotero.openCheckForUpdatesWindow({ modal: true });
}
// Load More Info page
else if (index == 2) {
@ -973,9 +973,19 @@ Services.scriptloader.loadSubScript("resource://zotero/polyfill.js");
}
this.openCheckForUpdatesWindow = function () {
Services.ww.openWindow(null, 'chrome://zotero/content/update/updates.xhtml',
'updateChecker', 'chrome,centerscreen,modal', null);
this.openCheckForUpdatesWindow = function ({ modal } = {}) {
let win = Services.wm.getMostRecentWindow('Update:Wizard');
if (win) {
win.focus();
}
else {
let flags = 'chrome,centerscreen';
if (modal) {
flags += ',modal';
}
Services.ww.openWindow(null, 'chrome://zotero/content/update/updates.xhtml',
'updateChecker', flags, null);
}
};

View file

@ -772,7 +772,7 @@
<menuitem id="checkForUpdates"
accesskey="&helpCheckForUpdates.accesskey;"
label="&helpCheckForUpdates.label;"
oncommand="ZoteroStandalone.checkForUpdates();"/>
oncommand="Zotero.openCheckForUpdatesWindow();"/>
<menuitem id="aboutName"
accesskey="&aboutProduct.accesskey;"
label="&aboutProduct.label;"