Make Esc (or clicking X on Windows) cancel Rebuild/Clear Index

Previously the secondary actions were being triggered, with no way to
fix that due to https://bugzilla.mozilla.org/show_bug.cgi?id=345067
This commit is contained in:
Dan Stillman 2013-11-19 15:53:19 -05:00
parent a75192d744
commit 860ebdb3fd

View File

@ -447,8 +447,8 @@ Zotero_Preferences.Search = {
var ps = Components.classes["@mozilla.org/embedcomp/prompt-service;1"].
createInstance(Components.interfaces.nsIPromptService);
var buttonFlags = (ps.BUTTON_POS_0) * (ps.BUTTON_TITLE_IS_STRING)
+ (ps.BUTTON_POS_1) * (ps.BUTTON_TITLE_IS_STRING)
+ (ps.BUTTON_POS_2) * (ps.BUTTON_TITLE_CANCEL);
+ (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.preferences.search.rebuildIndex'),
@ -456,13 +456,15 @@ Zotero_Preferences.Search = {
Zotero.getString('zotero.preferences.search.indexUnindexed')),
buttonFlags,
Zotero.getString('zotero.preferences.search.rebuildIndex'),
null,
// Position 2 because of https://bugzilla.mozilla.org/show_bug.cgi?id=345067
Zotero.getString('zotero.preferences.search.indexUnindexed'),
null, null, {});
null, {});
if (index == 0) {
Zotero.Fulltext.rebuildIndex();
}
else if (index == 1) {
else if (index == 2) {
Zotero.Fulltext.rebuildIndex(true)
}
@ -474,8 +476,8 @@ Zotero_Preferences.Search = {
var ps = Components.classes["@mozilla.org/embedcomp/prompt-service;1"].
createInstance(Components.interfaces.nsIPromptService);
var buttonFlags = (ps.BUTTON_POS_0) * (ps.BUTTON_TITLE_IS_STRING)
+ (ps.BUTTON_POS_1) * (ps.BUTTON_TITLE_IS_STRING)
+ (ps.BUTTON_POS_2) * (ps.BUTTON_TITLE_CANCEL);
+ (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.preferences.search.clearIndex'),
@ -483,13 +485,14 @@ Zotero_Preferences.Search = {
Zotero.getString('zotero.preferences.search.clearNonLinkedURLs')),
buttonFlags,
Zotero.getString('zotero.preferences.search.clearIndex'),
Zotero.getString('zotero.preferences.search.clearNonLinkedURLs'),
null, null, {});
null,
// Position 2 because of https://bugzilla.mozilla.org/show_bug.cgi?id=345067
Zotero.getString('zotero.preferences.search.clearNonLinkedURLs'), null, {});
if (index == 0) {
Zotero.Fulltext.clearIndex();
}
else if (index == 1) {
else if (index == 2) {
Zotero.Fulltext.clearIndex(true);
}