fx115: nsIPromptService → Services.prompt

This commit is contained in:
Dan Stillman 2023-12-04 05:19:57 -05:00
parent ef75f59037
commit b6a597a7f9
25 changed files with 53 additions and 110 deletions

View file

@ -145,8 +145,7 @@ var ZoteroAdvancedSearch = new function() {
this.save = Zotero.Promise.coroutine(function* () { this.save = Zotero.Promise.coroutine(function* () {
_searchBox.updateSearch(); _searchBox.updateSearch();
var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] var promptService = Services.prompt;
.getService(Components.interfaces.nsIPromptService);
var libraryID = _searchBox.search.libraryID; var libraryID = _searchBox.search.libraryID;

View file

@ -688,8 +688,7 @@ Zotero.TagSelector = class TagSelectorContainer extends React.PureComponent {
var tagColors = this.state.tagColors; var tagColors = this.state.tagColors;
if (tagColors.size >= Zotero.Tags.MAX_COLORED_TAGS && !tagColors.has(io.name)) { if (tagColors.size >= Zotero.Tags.MAX_COLORED_TAGS && !tagColors.has(io.name)) {
var ps = Cc['@mozilla.org/embedcomp/prompt-service;1'] var ps = Services.prompt;
.getService(Ci.nsIPromptService);
ps.alert(null, '', Zotero.getString('pane.tagSelector.maxColoredTags', Zotero.Tags.MAX_COLORED_TAGS)); ps.alert(null, '', Zotero.getString('pane.tagSelector.maxColoredTags', Zotero.Tags.MAX_COLORED_TAGS));
return; return;
} }
@ -751,8 +750,7 @@ Zotero.TagSelector = class TagSelectorContainer extends React.PureComponent {
} }
async openRenamePrompt() { async openRenamePrompt() {
var promptService = Cc['@mozilla.org/embedcomp/prompt-service;1'] var promptService = Services.prompt;
.getService(Ci.nsIPromptService);
var newName = { value: this.contextTag.name }; var newName = { value: this.contextTag.name };
var result = promptService.prompt(window, var result = promptService.prompt(window,
@ -786,8 +784,7 @@ Zotero.TagSelector = class TagSelectorContainer extends React.PureComponent {
} }
async openDeletePrompt() { async openDeletePrompt() {
var promptService = Cc['@mozilla.org/embedcomp/prompt-service;1'] var promptService = Services.prompt;
.getService(Ci.nsIPromptService);
var confirmed = promptService.confirm(window, var confirmed = promptService.confirm(window,
Zotero.getString('pane.tagSelector.delete.title'), Zotero.getString('pane.tagSelector.delete.title'),
@ -834,8 +831,7 @@ Zotero.TagSelector = class TagSelectorContainer extends React.PureComponent {
return; return;
} }
var ps = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] var ps = Services.prompt;
.getService(Components.interfaces.nsIPromptService);
var confirmed = ps.confirm( var confirmed = ps.confirm(
window, window,
Zotero.getString('pane.tagSelector.deleteAutomatic.title'), Zotero.getString('pane.tagSelector.deleteAutomatic.title'),

View file

@ -1406,8 +1406,7 @@
+ Zotero.ItemFields.getLocalizedString(fieldsToDelete[i]); + Zotero.ItemFields.getLocalizedString(fieldsToDelete[i]);
} }
var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] var promptService = Services.prompt;
.getService(Components.interfaces.nsIPromptService);
} }
if (!fieldsToDelete || fieldsToDelete.length == 0 if (!fieldsToDelete || fieldsToDelete.length == 0

View file

@ -108,8 +108,7 @@
return; return;
} }
var ps = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] var ps = Services.prompt;
.getService(Components.interfaces.nsIPromptService);
if (!xmlhttp.responseXML){ if (!xmlhttp.responseXML){
try { try {

View file

@ -504,8 +504,7 @@ var Zotero_File_Interface = new function() {
this.importFromClipboard = Zotero.Promise.coroutine(function* () { this.importFromClipboard = Zotero.Promise.coroutine(function* () {
var str = Zotero.Utilities.Internal.getClipboard("text/unicode"); var str = Zotero.Utilities.Internal.getClipboard("text/unicode");
if(!str) { if(!str) {
var ps = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] var ps = Services.prompt;
.getService(Components.interfaces.nsIPromptService);
ps.alert( ps.alert(
null, null,
Zotero.getString('general.error'), Zotero.getString('general.error'),
@ -563,8 +562,7 @@ var Zotero_File_Interface = new function() {
yield onBeforeImport(false); yield onBeforeImport(false);
} }
let ps = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] let ps = Services.prompt;
.getService(Components.interfaces.nsIPromptService);
let buttonFlags = ps.BUTTON_POS_0 * ps.BUTTON_TITLE_OK let buttonFlags = ps.BUTTON_POS_0 * ps.BUTTON_TITLE_OK
+ ps.BUTTON_POS_1 * ps.BUTTON_TITLE_IS_STRING; + ps.BUTTON_POS_1 * ps.BUTTON_TITLE_IS_STRING;
let index = ps.confirmEx( let index = ps.confirmEx(

View file

@ -540,8 +540,7 @@ var Zotero_Citation_Dialog = new function () {
if(_autoRegeneratePref == -1) { if(_autoRegeneratePref == -1) {
if(focusShifted) { // only ask after onchange event; oninput is too if(focusShifted) { // only ask after onchange event; oninput is too
// frequent for this to be worthwhile // frequent for this to be worthwhile
var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] var promptService = Services.prompt;
.getService(Components.interfaces.nsIPromptService);
var saveBehavior = { value: false }; var saveBehavior = { value: false };
var regenerate = promptService.confirmEx( var regenerate = promptService.confirmEx(
@ -613,8 +612,7 @@ var Zotero_Citation_Dialog = new function () {
if(isCustom) { if(isCustom) {
var citation = _editor.getContent(true); var citation = _editor.getContent(true);
if(Zotero.Utilities.trim(citation) == "") { if(Zotero.Utilities.trim(citation) == "") {
var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] var promptService = Services.prompt;
.getService(Components.interfaces.nsIPromptService);
var insert = promptService.confirm(window, var insert = promptService.confirm(window,
Zotero.getString("integration.emptyCitationWarning.title"), Zotero.getString("integration.emptyCitationWarning.title"),
Zotero.getString("integration.emptyCitationWarning.body")); Zotero.getString("integration.emptyCitationWarning.body"));

View file

@ -157,8 +157,7 @@ var Zotero_Bibliography_Dialog = new function () {
* Clears all customizations * Clears all customizations
*/ */
this.revertAll = function() { this.revertAll = function() {
var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] var promptService = Services.prompt;
.getService(Components.interfaces.nsIPromptService);
var out = {}; var out = {};
var regenerate = promptService.confirmEx( var regenerate = promptService.confirmEx(
@ -181,8 +180,7 @@ var Zotero_Bibliography_Dialog = new function () {
* Clears customizations to selected entry * Clears customizations to selected entry
*/ */
this.revert = function() { this.revert = function() {
var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] var promptService = Services.prompt;
.getService(Components.interfaces.nsIPromptService);
var out = {}; var out = {};
var regenerate = promptService.confirmEx( var regenerate = promptService.confirmEx(
@ -214,8 +212,7 @@ var Zotero_Bibliography_Dialog = new function () {
isCited |= bibEditInterface.isCited(itemID); isCited |= bibEditInterface.isCited(itemID);
} }
if(isCited) { if(isCited) {
var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] var promptService = Services.prompt;
.getService(Components.interfaces.nsIPromptService);
var out = {}; var out = {};
var regenerate = promptService.confirmEx( var regenerate = promptService.confirmEx(

View file

@ -106,8 +106,7 @@ Zotero_Preferences.Advanced = {
} }
Components.utils.import("resource://zotero/config.js") Components.utils.import("resource://zotero/config.js")
var ps = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] var ps = Services.prompt;
.getService(Components.interfaces.nsIPromptService);
// If there's a migration marker, point data directory back to the current location and remove // If there's a migration marker, point data directory back to the current location and remove
// it to trigger the migration again // it to trigger the migration again
@ -269,8 +268,7 @@ Zotero_Preferences.Advanced = {
resetTranslatorsAndStyles: function () { resetTranslatorsAndStyles: function () {
var ps = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] var ps = Services.prompt;
.getService(Components.interfaces.nsIPromptService);
var buttonFlags = (ps.BUTTON_POS_0) * (ps.BUTTON_TITLE_IS_STRING) var buttonFlags = (ps.BUTTON_POS_0) * (ps.BUTTON_TITLE_IS_STRING)
+ (ps.BUTTON_POS_1) * (ps.BUTTON_TITLE_CANCEL); + (ps.BUTTON_POS_1) * (ps.BUTTON_TITLE_CANCEL);
@ -294,8 +292,7 @@ Zotero_Preferences.Advanced = {
resetTranslators: async function () { resetTranslators: async function () {
var ps = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] var ps = Services.prompt;
.getService(Components.interfaces.nsIPromptService);
var buttonFlags = (ps.BUTTON_POS_0) * (ps.BUTTON_TITLE_IS_STRING) var buttonFlags = (ps.BUTTON_POS_0) * (ps.BUTTON_TITLE_IS_STRING)
+ (ps.BUTTON_POS_1) * (ps.BUTTON_TITLE_CANCEL); + (ps.BUTTON_POS_1) * (ps.BUTTON_TITLE_CANCEL);
@ -324,8 +321,7 @@ Zotero_Preferences.Advanced = {
resetStyles: async function () { resetStyles: async function () {
var ps = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] var ps = Services.prompt;
.getService(Components.interfaces.nsIPromptService);
var buttonFlags = (ps.BUTTON_POS_0) * (ps.BUTTON_TITLE_IS_STRING) var buttonFlags = (ps.BUTTON_POS_0) * (ps.BUTTON_TITLE_IS_STRING)
+ (ps.BUTTON_POS_1) * (ps.BUTTON_TITLE_CANCEL); + (ps.BUTTON_POS_1) * (ps.BUTTON_TITLE_CANCEL);
@ -665,8 +661,7 @@ Zotero_Preferences.Attachment_Base_Directory = {
} }
//Confirm change of the base path //Confirm change of the base path
var ps = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] var ps = Services.prompt;
.getService(Components.interfaces.nsIPromptService);
var chooseStrPrefix = 'attachmentBasePath.chooseNewPath.'; var chooseStrPrefix = 'attachmentBasePath.chooseNewPath.';
var clearStrPrefix = 'attachmentBasePath.clearBasePath.'; var clearStrPrefix = 'attachmentBasePath.clearBasePath.';
@ -756,8 +751,7 @@ Zotero_Preferences.Attachment_Base_Directory = {
var relativeAttachmentIDs = yield Zotero.DB.columnQueryAsync(sql, params); var relativeAttachmentIDs = yield Zotero.DB.columnQueryAsync(sql, params);
// Prompt for confirmation // Prompt for confirmation
var ps = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] var ps = Services.prompt;
.getService(Components.interfaces.nsIPromptService);
var strPrefix = 'attachmentBasePath.clearBasePath.'; var strPrefix = 'attachmentBasePath.clearBasePath.';
var title = Zotero.getString(strPrefix + 'title'); var title = Zotero.getString(strPrefix + 'title');

View file

@ -210,8 +210,7 @@ Zotero_Preferences.Cite = {
var text = Zotero.getString('styles.deleteStyles'); var text = Zotero.getString('styles.deleteStyles');
} }
var ps = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] var ps = Services.prompt;
.getService(Components.interfaces.nsIPromptService);
if(ps.confirm(null, '', text)) { if(ps.confirm(null, '', text)) {
// delete if requested // delete if requested
if(cslIDs.length == 1) { if(cslIDs.length == 1) {

View file

@ -489,8 +489,7 @@ Zotero_Preferences.Sync = {
var sql = "SELECT COUNT(*) FROM settings " var sql = "SELECT COUNT(*) FROM settings "
+ "WHERE setting='storage' AND key='zfsPurge' AND value='user'"; + "WHERE setting='storage' AND key='zfsPurge' AND value='user'";
if (!Zotero.DB.valueQueryAsync(sql)) { if (!Zotero.DB.valueQueryAsync(sql)) {
var ps = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] let ps = Services.prompt;
.getService(Components.interfaces.nsIPromptService);
var buttonFlags = (ps.BUTTON_POS_0) * (ps.BUTTON_TITLE_IS_STRING) var buttonFlags = (ps.BUTTON_POS_0) * (ps.BUTTON_TITLE_IS_STRING)
+ (ps.BUTTON_POS_1) * (ps.BUTTON_TITLE_IS_STRING) + (ps.BUTTON_POS_1) * (ps.BUTTON_TITLE_IS_STRING)
+ ps.BUTTON_DELAY_ENABLE; + ps.BUTTON_DELAY_ENABLE;

View file

@ -361,8 +361,7 @@ Zotero.DataDirectory = {
|| ('winLastError' in e && e.winLastError == OS.Constants.Win.ERROR_ACCESS_DENIED))) { || ('winLastError' in e && e.winLastError == OS.Constants.Win.ERROR_ACCESS_DENIED))) {
Zotero.restarting = true; Zotero.restarting = true;
let isDefaultDir = dataDir == Zotero.DataDirectory.defaultDir; let isDefaultDir = dataDir == Zotero.DataDirectory.defaultDir;
let ps = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] let ps = Services.prompt;
.createInstance(Components.interfaces.nsIPromptService);
let buttonFlags = ps.BUTTON_POS_0 * ps.BUTTON_TITLE_IS_STRING let buttonFlags = ps.BUTTON_POS_0 * ps.BUTTON_TITLE_IS_STRING
+ ps.BUTTON_POS_1 * ps.BUTTON_TITLE_IS_STRING; + ps.BUTTON_POS_1 * ps.BUTTON_TITLE_IS_STRING;
if (!isDefaultDir) { if (!isDefaultDir) {

View file

@ -210,8 +210,7 @@ Zotero.FileDragDataProvider.prototype = {
} }
if (notFoundNames.length || existingItems.length) { if (notFoundNames.length || existingItems.length) {
var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] var promptService = Services.prompt;
.getService(Components.interfaces.nsIPromptService);
} }
// Display alert if files were not found // Display alert if files were not found

View file

@ -147,8 +147,7 @@ Zotero.Integration = new function() {
// can attempt to delete on OS X // can attempt to delete on OS X
try { try {
var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] let promptService = Services.prompt;
.getService(Components.interfaces.nsIPromptService);
var deletePipe = promptService.confirm(null, Zotero.getString("integration.error.title"), Zotero.getString("integration.error.deletePipe")); var deletePipe = promptService.confirm(null, Zotero.getString("integration.error.title"), Zotero.getString("integration.error.deletePipe"));
if(!deletePipe) return false; if(!deletePipe) return false;
let escapedFifoFile = pipe.path.replace("'", "'\\''"); let escapedFifoFile = pipe.path.replace("'", "'\\''");

View file

@ -710,8 +710,7 @@ Zotero.Schema = new function(){
// This is mostly temporary // This is mostly temporary
// TEMP - NSF // TEMP - NSF
this.importSchema = Zotero.Promise.coroutine(function* (str, uri) { this.importSchema = Zotero.Promise.coroutine(function* (str, uri) {
var ps = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] var ps = Services.prompt;
.getService(Components.interfaces.nsIPromptService);
if (!uri.match(/https?:\/\/([^\.]+\.)?zotero.org\//)) { if (!uri.match(/https?:\/\/([^\.]+\.)?zotero.org\//)) {
Zotero.debug("Ignoring schema file from non-zotero.org domain"); Zotero.debug("Ignoring schema file from non-zotero.org domain");
@ -2188,8 +2187,7 @@ Zotero.Schema = new function(){
catch (e) { catch (e) {
Zotero.debug(e, 1); Zotero.debug(e, 1);
Components.utils.reportError(e); Components.utils.reportError(e);
let ps = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] let ps = Services.prompt;
.getService(Components.interfaces.nsIPromptService);
ps.alert( ps.alert(
null, null,
Zotero.getString('general.error'), Zotero.getString('general.error'),

View file

@ -115,8 +115,7 @@ Zotero.Sync.Storage = new function () {
setTimeout(function () { setTimeout(function () {
var group = Zotero.Groups.get(e.data.groupID); var group = Zotero.Groups.get(e.data.groupID);
var ps = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] var ps = Services.prompt;
.getService(Components.interfaces.nsIPromptService);
var buttonFlags = (ps.BUTTON_POS_0) * (ps.BUTTON_TITLE_IS_STRING) var buttonFlags = (ps.BUTTON_POS_0) * (ps.BUTTON_TITLE_IS_STRING)
+ (ps.BUTTON_POS_1) * (ps.BUTTON_TITLE_CANCEL) + (ps.BUTTON_POS_1) * (ps.BUTTON_TITLE_CANCEL)
+ ps.BUTTON_DELAY_ENABLE; + ps.BUTTON_DELAY_ENABLE;

View file

@ -91,8 +91,7 @@ Zotero.Sync.Storage.Utilities = {
throw new Error("Unsupported library type " + libraryType); throw new Error("Unsupported library type " + libraryType);
} }
var ps = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] var ps = Services.prompt;
.getService(Components.interfaces.nsIPromptService);
var buttonFlags = (ps.BUTTON_POS_0) * (ps.BUTTON_TITLE_IS_STRING) var buttonFlags = (ps.BUTTON_POS_0) * (ps.BUTTON_TITLE_IS_STRING)
+ (ps.BUTTON_POS_1) * (ps.BUTTON_TITLE_IS_STRING) + (ps.BUTTON_POS_1) * (ps.BUTTON_TITLE_IS_STRING)
+ ps.BUTTON_DELAY_ENABLE; + ps.BUTTON_DELAY_ENABLE;

View file

@ -769,9 +769,7 @@ Zotero.Sync.Storage.Mode.WebDAV.prototype = {
* @return bool True if the verification eventually succeeded, false otherwise * @return bool True if the verification eventually succeeded, false otherwise
*/ */
handleVerificationError: Zotero.Promise.coroutine(function* (err, window, skipSuccessMessage) { handleVerificationError: Zotero.Promise.coroutine(function* (err, window, skipSuccessMessage) {
var promptService = var promptService = Services.prompt;
Components.classes["@mozilla.org/embedcomp/prompt-service;1"].
createInstance(Components.interfaces.nsIPromptService);
var errorTitle, errorMsg; var errorTitle, errorMsg;

View file

@ -260,8 +260,7 @@ Zotero.Sync.Server = new function () {
} }
} }
var ps = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] var ps = Services.prompt;
.getService(Components.interfaces.nsIPromptService);
var buttonFlags = (ps.BUTTON_POS_0) * (ps.BUTTON_TITLE_IS_STRING) var buttonFlags = (ps.BUTTON_POS_0) * (ps.BUTTON_TITLE_IS_STRING)
+ (ps.BUTTON_POS_1) * (ps.BUTTON_TITLE_CANCEL) + (ps.BUTTON_POS_1) * (ps.BUTTON_TITLE_CANCEL)
+ ps.BUTTON_DELAY_ENABLE; + ps.BUTTON_DELAY_ENABLE;

View file

@ -544,8 +544,7 @@ Zotero.Sync.Runner_Module = function (options = {}) {
let removedGroups = []; let removedGroups = [];
let keptGroups = []; let keptGroups = [];
let ps = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] let ps = Services.prompt;
.getService(Components.interfaces.nsIPromptService);
let buttonFlags = (ps.BUTTON_POS_0) * (ps.BUTTON_TITLE_IS_STRING) let buttonFlags = (ps.BUTTON_POS_0) * (ps.BUTTON_TITLE_IS_STRING)
+ (ps.BUTTON_POS_1) * (ps.BUTTON_TITLE_IS_STRING) + (ps.BUTTON_POS_1) * (ps.BUTTON_TITLE_IS_STRING)
+ (ps.BUTTON_POS_2) * (ps.BUTTON_TITLE_IS_STRING) + (ps.BUTTON_POS_2) * (ps.BUTTON_TITLE_IS_STRING)
@ -1158,8 +1157,7 @@ Zotero.Sync.Runner_Module = function (options = {}) {
.getService(Components.interfaces.nsIWindowMediator); .getService(Components.interfaces.nsIWindowMediator);
var win = wm.getMostRecentWindow("navigator:browser"); var win = wm.getMostRecentWindow("navigator:browser");
var ps = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] var ps = Services.prompt;
.getService(Components.interfaces.nsIPromptService);
var buttonFlags = (ps.BUTTON_POS_0) * (ps.BUTTON_TITLE_IS_STRING) var buttonFlags = (ps.BUTTON_POS_0) * (ps.BUTTON_TITLE_IS_STRING)
+ (ps.BUTTON_POS_1) * (ps.BUTTON_TITLE_CANCEL); + (ps.BUTTON_POS_1) * (ps.BUTTON_TITLE_CANCEL);
if (e.error == Zotero.Error.ERROR_API_KEY_NOT_SET) { if (e.error == Zotero.Error.ERROR_API_KEY_NOT_SET) {

View file

@ -72,8 +72,7 @@ Zotero.Sync.Data.Utilities = {
throw new Error("Unsupported library type " + libraryType); throw new Error("Unsupported library type " + libraryType);
} }
var ps = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] var ps = Services.prompt;
.getService(Components.interfaces.nsIPromptService);
var buttonFlags = (ps.BUTTON_POS_0) * (ps.BUTTON_TITLE_IS_STRING) var buttonFlags = (ps.BUTTON_POS_0) * (ps.BUTTON_TITLE_IS_STRING)
+ (ps.BUTTON_POS_1) * (ps.BUTTON_TITLE_IS_STRING) + (ps.BUTTON_POS_1) * (ps.BUTTON_TITLE_IS_STRING)
+ ps.BUTTON_DELAY_ENABLE; + ps.BUTTON_DELAY_ENABLE;

View file

@ -399,8 +399,7 @@ Zotero.Utilities.Internal = {
* Display a prompt from an error with custom buttons and a callback * Display a prompt from an error with custom buttons and a callback
*/ */
errorPrompt: function (title, e) { errorPrompt: function (title, e) {
var ps = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] var ps = Services.prompt;
.getService(Components.interfaces.nsIPromptService);
var message, buttonText, buttonCallback; var message, buttonText, buttonCallback;
if (e.dialogButtonText !== undefined) { if (e.dialogButtonText !== undefined) {

View file

@ -305,8 +305,7 @@ Services.scriptloader.loadSubScript("resource://zotero/polyfill.js");
) )
: Zotero.getString('dataDir.notFound', Zotero.clientName); : Zotero.getString('dataDir.notFound', Zotero.clientName);
_startupErrorHandler = async function() { _startupErrorHandler = async function() {
var ps = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]. var ps = Services.prompt;
createInstance(Components.interfaces.nsIPromptService);
var buttonFlags = ps.BUTTON_POS_0 * ps.BUTTON_TITLE_IS_STRING var buttonFlags = ps.BUTTON_POS_0 * ps.BUTTON_TITLE_IS_STRING
+ ps.BUTTON_POS_1 * ps.BUTTON_TITLE_IS_STRING + ps.BUTTON_POS_1 * ps.BUTTON_TITLE_IS_STRING
+ ps.BUTTON_POS_2 * ps.BUTTON_TITLE_IS_STRING; + ps.BUTTON_POS_2 * ps.BUTTON_TITLE_IS_STRING;
@ -552,8 +551,7 @@ Services.scriptloader.loadSubScript("resource://zotero/polyfill.js");
// Require >=2.1b3 database to ensure proper locking // Require >=2.1b3 database to ensure proper locking
let dbSystemVersion = yield Zotero.Schema.getDBVersion('system'); let dbSystemVersion = yield Zotero.Schema.getDBVersion('system');
if (dbSystemVersion > 0 && dbSystemVersion < 31) { if (dbSystemVersion > 0 && dbSystemVersion < 31) {
var ps = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] let ps = Services.prompt;
.createInstance(Components.interfaces.nsIPromptService);
var buttonFlags = (ps.BUTTON_POS_0) * (ps.BUTTON_TITLE_IS_STRING) var buttonFlags = (ps.BUTTON_POS_0) * (ps.BUTTON_TITLE_IS_STRING)
+ (ps.BUTTON_POS_1) * (ps.BUTTON_TITLE_IS_STRING) + (ps.BUTTON_POS_1) * (ps.BUTTON_TITLE_IS_STRING)
+ (ps.BUTTON_POS_2) * (ps.BUTTON_TITLE_IS_STRING) + (ps.BUTTON_POS_2) * (ps.BUTTON_TITLE_IS_STRING)
@ -629,8 +627,7 @@ Services.scriptloader.loadSubScript("resource://zotero/polyfill.js");
ZOTERO_CONFIG.DOMAIN_NAME); ZOTERO_CONFIG.DOMAIN_NAME);
Zotero.startupError = msg; Zotero.startupError = msg;
_startupErrorHandler = function() { _startupErrorHandler = function() {
var ps = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] var ps = Services.prompt;
.getService(Components.interfaces.nsIPromptService);
var buttonFlags = (ps.BUTTON_POS_0) * (ps.BUTTON_TITLE_IS_STRING) var buttonFlags = (ps.BUTTON_POS_0) * (ps.BUTTON_TITLE_IS_STRING)
+ (ps.BUTTON_POS_1) * (ps.BUTTON_TITLE_CANCEL) + (ps.BUTTON_POS_1) * (ps.BUTTON_TITLE_CANCEL)
+ (ps.BUTTON_POS_2) * (ps.BUTTON_TITLE_IS_STRING) + (ps.BUTTON_POS_2) * (ps.BUTTON_TITLE_IS_STRING)
@ -1249,9 +1246,7 @@ Services.scriptloader.loadSubScript("resource://zotero/polyfill.js");
*/ */
this.alert = function (window, title, msg) { this.alert = function (window, title, msg) {
this.debug(`Alert:\n\n${msg}`); this.debug(`Alert:\n\n${msg}`);
var ps = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] Services.prompt.alert(window, title, msg);
.getService(Components.interfaces.nsIPromptService);
ps.alert(window, title, msg);
} }

View file

@ -545,8 +545,7 @@ var ZoteroPane = new function()
Zotero.restoreFromServer = false; Zotero.restoreFromServer = false;
setTimeout(function () { setTimeout(function () {
var ps = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] var ps = Services.prompt;
.getService(Components.interfaces.nsIPromptService);
var buttonFlags = (ps.BUTTON_POS_0) * (ps.BUTTON_TITLE_IS_STRING) var buttonFlags = (ps.BUTTON_POS_0) * (ps.BUTTON_TITLE_IS_STRING)
+ (ps.BUTTON_POS_1) * (ps.BUTTON_TITLE_CANCEL); + (ps.BUTTON_POS_1) * (ps.BUTTON_TITLE_CANCEL);
var index = ps.confirmEx( var index = ps.confirmEx(
@ -2425,9 +2424,7 @@ var ZoteroPane = new function()
var prompt = toDelete; var prompt = toDelete;
} }
var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] if (!prompt || Services.prompt.confirm(window, prompt.title, prompt.text)) {
.getService(Components.interfaces.nsIPromptService);
if (!prompt || promptService.confirm(window, prompt.title, prompt.text)) {
this.itemsView.deleteSelection(force); this.itemsView.deleteSelection(force);
} }
} }
@ -2484,8 +2481,7 @@ var ZoteroPane = new function()
} }
var ps = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] var ps = Services.prompt;
.getService(Components.interfaces.nsIPromptService);
buttonFlags = ps.BUTTON_POS_0 * ps.BUTTON_TITLE_IS_STRING buttonFlags = ps.BUTTON_POS_0 * ps.BUTTON_TITLE_IS_STRING
+ ps.BUTTON_POS_1 * ps.BUTTON_TITLE_CANCEL; + ps.BUTTON_POS_1 * ps.BUTTON_TITLE_CANCEL;
if (this.getCollectionTreeRow()) { if (this.getCollectionTreeRow()) {
@ -2619,10 +2615,7 @@ var ZoteroPane = new function()
this.emptyTrash = Zotero.Promise.coroutine(function* () { this.emptyTrash = Zotero.Promise.coroutine(function* () {
var libraryID = this.getSelectedLibraryID(); var libraryID = this.getSelectedLibraryID();
var ps = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] var result = Services.prompt.confirm(
.getService(Components.interfaces.nsIPromptService);
var result = ps.confirm(
null, null,
"", "",
Zotero.getString('pane.collections.emptyTrash') + "\n\n" Zotero.getString('pane.collections.emptyTrash') + "\n\n"
@ -2799,9 +2792,7 @@ var ZoteroPane = new function()
// This isn't currently shown, because the commands are disabled when not relevant, so this // This isn't currently shown, because the commands are disabled when not relevant, so this
// function isn't called // function isn't called
if (!items.length) { if (!items.length) {
let ps = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] Services.prompt.alert(null, "", Zotero.getString("fileInterface.noReferencesError"));
.getService(Components.interfaces.nsIPromptService);
ps.alert(null, "", Zotero.getString("fileInterface.noReferencesError"));
return; return;
} }
@ -5241,23 +5232,17 @@ var ZoteroPane = new function()
this.displayCannotEditLibraryMessage = function () { this.displayCannotEditLibraryMessage = function () {
var ps = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] Services.prompt.alert(null, "", Zotero.getString('save.error.cannotMakeChangesToCollection'));
.getService(Components.interfaces.nsIPromptService);
ps.alert(null, "", Zotero.getString('save.error.cannotMakeChangesToCollection'));
} }
this.displayCannotEditLibraryFilesMessage = function () { this.displayCannotEditLibraryFilesMessage = function () {
var ps = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] Services.prompt.alert(null, "", Zotero.getString('save.error.cannotAddFilesToCollection'));
.getService(Components.interfaces.nsIPromptService);
ps.alert(null, "", Zotero.getString('save.error.cannotAddFilesToCollection'));
} }
this.displayCannotAddToMyPublicationsMessage = function () { this.displayCannotAddToMyPublicationsMessage = function () {
var ps = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] Services.prompt.alert(null, "", Zotero.getString('save.error.cannotAddToMyPublications'));
.getService(Components.interfaces.nsIPromptService);
ps.alert(null, "", Zotero.getString('save.error.cannotAddToMyPublications'));
} }

View file

@ -108,9 +108,7 @@ ZoteroCommandLineHandler.prototype = {
var checkState = { var checkState = {
value: Zotero.Prefs.get('import.createNewCollection.fromFileOpenHandler') value: Zotero.Prefs.get('import.createNewCollection.fromFileOpenHandler')
}; };
if (Components.classes["@mozilla.org/embedcomp/prompt-service;1"] if (Services.prompt.confirmCheck(null, Zotero.getString('ingester.importFile.title'),
.getService(Components.interfaces.nsIPromptService)
.confirmCheck(null, Zotero.getString('ingester.importFile.title'),
Zotero.getString('ingester.importFile.text', [file.leafName]), Zotero.getString('ingester.importFile.text', [file.leafName]),
Zotero.getString('ingester.importFile.intoNewCollection'), Zotero.getString('ingester.importFile.intoNewCollection'),
checkState)) { checkState)) {

View file

@ -124,10 +124,11 @@ ZoteroPluginInstaller.prototype = {
if(this.force && !this._addon.DISABLE_PROGRESS_WINDOW) { if(this.force && !this._addon.DISABLE_PROGRESS_WINDOW) {
var addon = this._addon; var addon = this._addon;
setTimeout(function() { setTimeout(function() {
Components.classes["@mozilla.org/embedcomp/prompt-service;1"] Services.prompt.alert(
.getService(Components.interfaces.nsIPromptService) null,
.alert(null, addon.EXTENSION_STRING, addon.EXTENSION_STRING,
Zotero.getString("zotero.preferences.wordProcessors.installationSuccess")); Zotero.getString("zotero.preferences.wordProcessors.installationSuccess")
);
}, 0); }, 0);
} }
}, },