From 860ebdb3fdc7e099487d65db4049db5be12005d4 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Tue, 19 Nov 2013 15:53:19 -0500 Subject: [PATCH] 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 --- .../zotero/preferences/preferences_search.js | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/chrome/content/zotero/preferences/preferences_search.js b/chrome/content/zotero/preferences/preferences_search.js index 711a06568..6b3b56631 100644 --- a/chrome/content/zotero/preferences/preferences_search.js +++ b/chrome/content/zotero/preferences/preferences_search.js @@ -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); }