[Pkg-mozext-commits] [nostalgy] 185/252: Remove quick-search features.
David Prévot
taffit at moszumanska.debian.org
Tue Jun 14 15:24:56 UTC 2016
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository nostalgy.
commit 81bcf7064792382a97c88797b3deff047cab087e
Author: frisch <frisch at 56b81dcf-5a2f-0410-9db0-014be2e416ff>
Date: Wed Dec 23 14:25:48 2009 +0000
Remove quick-search features.
---
CHANGES | 4 +
content/about.xhtml | 74 ++++---------
content/nostalgy.js | 281 +++--------------------------------------------
content/nostalgy_keys.js | 6 -
4 files changed, 39 insertions(+), 326 deletions(-)
diff --git a/CHANGES b/CHANGES
index 692cd33..04e3bad 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,7 @@
+Since 0.2.23
+ - Remove special support for the QuickSearch box
+ - general code cleanup
+
0.2.23
- Add explicit size for the preference dialog.
diff --git a/content/about.xhtml b/content/about.xhtml
index 0c986c6..02b64b5 100644
--- a/content/about.xhtml
+++ b/content/about.xhtml
@@ -8,7 +8,7 @@
<style>
html {
background-color: white;
- }
+ }
a {
color: blue;
text-decoration: underline;
@@ -35,7 +35,7 @@
<p>
<b>Notes about shortcuts:</b>
<ul>
- <li>We give here the default values for shortcuts.
+ <li>We give here the default values for shortcuts.
Most of them can be changed from the preference dialog.</li>
<li>Even if the key shortcuts above are written in
uppercase, you must not press Shift.</li>
@@ -69,7 +69,7 @@
Regular expressions are accepted as well (and .. is a
short-hand for .* meaning: any sequence of characters). You can
choose the first suggested completion with RETURN, or select
- another one in the popup with the UP/DOWN keys and then RETURN.
+ another one in the popup with the UP/DOWN keys and then RETURN.
You can cancel the command with ESCAPE.
</p>
@@ -148,9 +148,7 @@
<tr><td>ESC-M</td><td>Focus the message pane</td></tr>
<tr><td>ESC-ESC</td><td>Focus the thread pane</td></tr>
<tr><td>ESC-ESC-ESC</td><td>Focus the thread pane, clear quick search box, select the "All" view</td></tr>
- <tr><td>ESC-I</td><td>Focus the quick search box (same as Ctrl-K)</td></tr>
- <tr><td>Ctrl-Left/Right</td>
- <td>Scroll the message from the thread pane</td></tr>
+ <tr><td>Ctrl-Left/Right</td><td>Scroll the message from the thread pane</td></tr>
</table>
@@ -207,49 +205,20 @@
<b>IMPORTANT:</b> importing rules from an e-email will destroy
your current rules. Use this feature with caution.
</p>
-
- <h3>QuickSearch</h3>
+
+ <h3>Looking for messages with same sender / subject</h3>
<p>
- Nostalgy changes the behavior of Thunderbird's QuickSearch
- features.
+ The key "`" (backquote) launches a QuickSearch for messages
+ from the same sender as the currently selected message.
+ If you press the same key again, messages with the same
+ subject are searched. And if you press again,
+ the QuickSearch is cancelled.
+ In the Sent folder, the search is done on the first recipient (To:
+ header) instead of the sender.
</p>
- <ul>
- <li>
- When the QuickSearch box is focused, you can use the UP/DOWN keys
- to change the search criterion (the view is automatically updated).
- If you hold ALT or CONTROL, the menu with the list of criterion
- pops up, so that you can see the current search criterion (and
- change it with UP/DOWN). An option in the preference dialog changes
- this behavior so that this menu is always displayed when the
- QuickSearch box is focused. </li>
-
- <li>
- In the QuickSearch box, you can press RETURN (customizable) to
- perform to search and put the focus on the thread pane. CONTROL
- RETURN does the same but also selects all the results. ESCAPE
- cancels the search and also put the focus on the thread pane.
- </li>
-
- <li>The G command (change current folder) does not destroy the
- current search terms.</li>
-
- <li>You can focus the QuickSearch input box with
- ESC-I. (Thunderbird recently introduced another shortcut with
- the same effect: Ctrl-K.)
- </li>
- <li>The combination ESC-ESC-ESC clears the QuickSearch input box.</li>
- <li>The key "`" (backquote) launches a QuickSearch for messages
- from the same sender as the currently selected message.
- If you press the same key again, messages with the same
- subject are searched. And if you press again,
- the QuickSearch is cancelled.
- In the Sent folder, the search is done on the first recipient (To:
- header) instead of the sender.</li>
- </ul>
-
<h3>Tags</h3>
@@ -296,20 +265,19 @@ without the quotes).</p>
opens the file attachment dialog.</p>
<h3>Preferences</h3>
-
+
<p>The preference dialog for Nostalgy has several tabs.
The first tab is the place where rules are
- defined. The second tab has several switches to control
+ defined. The second tab has several switches to control
the way the completion
box (where folder names are proposed) is populated (see below).
- The third pane controls some behavior of Thunderbird's user interface.
- The fourthd pane allows you to configure Nostalgy's shortcuts
+ The third pane allows you to configure Nostalgy's shortcuts
(click on the key to change it), to disable some of them,
or to manage custom shortcuts.
</p>
<p>Here is a description of the completion options:</p>
-
+
<ul>
<li><b>Restrict folder completion to the current server:</b>
limit lookup to folders on the same
@@ -319,15 +287,15 @@ opens the file attachment dialog.</p>
<li><b>Match only on folder name, not on the full path:</b>
force Nostalgy to interpret differently what
- is typed in the text. Normally, when the option is disabled,
+ is typed in the text. Normally, when the option is disabled,
it is interpreted as a regexp which can match an arbitrary substring
- of the complete folder name (including the account name and
+ of the complete folder name (including the account name and
the name of parent folders). When the option is enabled,
the regexp must match either a substring of the local folder name
(not the full name) or a prefix of the full folder name.</li>
<li><b>Sort folders alphabetically</b>.</li>
-
+
<li><b>Match folder names in a case sensitive way</b>.</li>
@@ -344,7 +312,7 @@ the input box starts with a colon character, or if no folder matches.
<p>The Nostalgy extension has been written by Alain Frisch (<a
href="mailto:alain at frisch.fr">alain at frisch.fr</a>). Comments and
suggestions are welcome! You can join the <a href="http://frisch.fr/cgi-bin/mailman/listinfo/nostalgy">Nostalgy mailing list.</a>
- Donations can be sent to the Paypal
+ Donations can be sent to the Paypal
account <tt>alain at frisch.fr</tt>.</p>
</body>
</html>
diff --git a/content/nostalgy.js b/content/nostalgy.js
index 9f7e2fe..b23d907 100644
--- a/content/nostalgy.js
+++ b/content/nostalgy.js
@@ -8,8 +8,6 @@ var nostalgy_cmdLabel = null;
var nostalgy_extracted_rules = "";
var nostalgy_active_keys = { };
var timeout_regkey = 0;
-var nostalgy_on_search_done = null;
-var nostalgy_search_focused = false;
var nostalgy_on_move_completed = null;
var nostalgy_selection_saved = null;
@@ -17,24 +15,12 @@ function NostalgyIsDefined(s) {
return (typeof(window[s]) != "undefined");
}
-function NostalgySearch() {
- if (window.onEnterInSearchBar) {
- onEnterInSearchBar();
- return;
- }
- var search = gEBI("searchInput");
- search.doSearch();
-}
-
function NostalgyDoSearch(str) {
var search = gEBI("searchInput");
- search.value = str;
- search.doSearch();
-}
-
-function NostalgyCurrentSearchMode() {
- var input = gEBI("searchInput");
- return input.searchMode;
+ if (search.value != str) {
+ search.value = str;
+ search.doSearch();
+ }
}
/** Rules **/
@@ -210,7 +196,6 @@ var NostalgyFolderListener = {
OnItemEvent: function(folder, event) {
var evt = event.toString();
// NostalgyDebug(evt + " folder:" + folder.prettyName);
- if (evt == "FolderLoaded") setTimeout(NostalgySelectLastMsg,50);
if (evt == "DeleteOrMoveMsgCompleted" && nostalgy_on_move_completed) {
nostalgy_on_move_completed();
nostalgy_on_move_completed = null;
@@ -218,26 +203,6 @@ var NostalgyFolderListener = {
}
}
-function NostalgySelectMessageByNavigationType(type)
-{
- var resultId = new Object;
- var resultIndex = new Object;
- var threadIndex = new Object;
-
- gDBView.viewNavigate(type, resultId, resultIndex, threadIndex, true);
-
- if ((resultId.value != nsMsgKey_None) &&
- (resultIndex.value != nsMsgKey_None)) {
-
- gEBI("threadTree").treeBoxObject.ensureRowIsVisible(resultIndex.value);
- gDBView.selection.currentIndex = resultIndex.value;
- //gDBView.selection.timedSelect(resultIndex.value, 500);
- //gDBView.selectMsgByKey(resultId.value);
- return true;
- }
- return false;
-}
-
function NostalgyMailSession() {
var mSession = Components.classes["@mozilla.org/messenger/services/session;1"].getService();
if (!mSession) return mSessions;
@@ -259,7 +224,6 @@ function onNostalgyLoad() {
if (!in_message_window) {
gEBI("threadTree").addEventListener("select", NostalgyDefLabel, false);
- onSearchKeyPress = function() { };
} else {
// find a better way to be notified when the displayed message changes
var old = UpdateStandAloneMessageCounts;
@@ -281,50 +245,6 @@ function onNostalgyLoad() {
Components.classes["@mozilla.org/observer-service;1"].
getService(Components.interfaces.nsIObserverService).
addObserver(NostalgyObserver, "MsgMsgDisplayed", false);
-
- /*
- var old_OnMsgParsed = OnMsgParsed;
- OnMsgParsed = function (url) {
- NostalgyDebug("OnMsgParsed");
- old_OnMsgParsed(url);
- setTimeout(NostalgyOnMsgParsed,100);
- };
- */
-
- if (window.gSearchNotificationListener) {
- var old_f0 = gSearchNotificationListener.onSearchDone;
- gSearchNotificationListener.onSearchDone = function(status) {
- if (nostalgy_on_search_done) nostalgy_on_search_done();
- old_f0(status);
- };
- }
-
- var search_input = gEBI("searchInput");
- search_input.addEventListener("focus",
- function() {
- NostalgyEnterSearch();
- },
- false);
- search_input.addEventListener("blur",
- function() {
- NostalgyLeaveSearch();
- },
- false);
-
-
- NostalgyDebug("window.onSearchInputFocus " + window.onSearchInputFocus);
- if (window.onSearchInputFocus) {
- var old_f1 = onSearchInputFocus;
- onSearchInputFocus = function(ev) {
- old_f1(ev);
- NostalgyEnterSearch();
- };
- var old_f2 = onSearchInputBlur;
- onSearchInputBlur = function(ev) {
- old_f2(ev);
- NostalgyLeaveSearch();
- };
- }
}
function NostalgyOnMsgParsed() {
@@ -617,21 +537,6 @@ function NostalgyEnsureFolderIndex(builder, msgFolder)
return index;
}
-function NostalgySelectLastMsg() {
- if (!gDBView) return;
- if (nostalgy_selection_saved) {
- NostalgyRestoreSelection(nostalgy_selection_saved);
- nostalgy_selection_saved = null;
- } else
- try { gDBView.viewIndexForFirstSelectedMsg; } catch (ex) {
-/*
- if (!NostalgySelectMessageByNavigationType(nsMsgNavigationType.firstUnreadMessage)) {
- NostalgySelectMessageByNavigationType(nsMsgNavigationType.lastMessage);
- }
-*/
- }
-}
-
function NostalgyShowFolder(folder) {
if (folder.tag) {
ViewChange(kViewTagMarker + folder.key, folder.tag);
@@ -656,9 +561,6 @@ function NostalgyShowFolder(folder) {
ChangeSelection(folderTree, EnsureFolderIndex(folder));
return;
}
- var search = "";
- var input = gEBI("searchInput");
- if (input && !input.showingSearchCriteria) search = input.value;
if (window.gFolderTreeView) {
var saved_mode = window.gFolderTreeView.mode;
try {
@@ -684,12 +586,8 @@ function NostalgyShowFolder(folder) {
}
setTimeout(function() {
SetFocusThreadPane();
+ NostalgyDoSearch("");
}, 400);
- if (search != "") {
- input.focus();
- input.value = search;
- setTimeout(function(){onEnterInSearchBar(true);}, 200);
- }
return true;
}
@@ -718,18 +616,12 @@ function NostalgyMoveToFolder(folder) {
function NostalgyMoveToFolderAndGo(folder) {
register_folder(folder);
- var sel = NostalgySaveSelection();
if (folder.tag) NostalgyToggleMessageTag(folder);
else {
NostalgyPredict.update_folder(folder);
gDBView.doCommandWithFolder(nsMsgViewCommandType.moveMessages,folder);
}
NostalgyShowFolder(folder);
- nostalgy_selection_saved = null;
- nostalgy_on_move_completed = function() { nostalgy_selection_saved = sel; };
- setTimeout(function () {
- if (!nostalgy_selection_saved) nostalgy_on_move_completed = null;
- }, 1000);
return true;
}
@@ -768,38 +660,6 @@ var NostalgyEscapePressed = 0;
function NostalgyFocusThreadPane() {
SetFocusThreadPane();
- NostalgySelectLastMsg();
-}
-
-function NostalgySaveSelection() {
- var o = { };
- gDBView.getIndicesForSelection(o,{ });
- o = o.value;
- var folder = gDBView.msgFolder;
- var msgids = { };
- for (var i = 0; i < o.length; i++) {
- var id = folder.GetMessageHeader(gDBView.getKeyAt(o[i])).messageId;
- msgids[id] = true;
- }
- return msgids;
-}
-
-function NostalgyRestoreSelection(msgids) {
- var msgs;
- if (gDBView.msgFolder.getMessages)
- msgs = gDBView.msgFolder.getMessages(msgWindow);
- else if (gDBView.msgFolder.msgDatabase)
- msgs = gDBView.msgFolder.msgDatabase.EnumerateMessages();
-
- var selection = gDBView.selection;
- selection.clearSelection();
- while (msgs.hasMoreElements()) {
- var m = msgs.getNext().QueryInterface(Components.interfaces.nsIMsgDBHdr);
- if (msgids[m.messageId]) {
- var idx = gDBView.findIndexFromKey(m.messageKey,true);
- if (!selection.isSelected(idx)) selection.toggleSelect(idx);
- }
- }
}
function NostalgyEscape() {
@@ -809,13 +669,9 @@ function NostalgyEscape() {
function(){ if (NostalgyEscapePressed==i) NostalgyEscapePressed = 0; },
300);
if (NostalgyEscapePressed == 3) {
- // var o = NostalgySaveSelection();
-
- onClearSearch();
- ViewChange(kViewItemAll, "All"); // TODO: localized string
- setTimeout(NostalgyFocusThreadPane,100);
-
- // setTimeout(function(){ NostalgyRestoreSelection(o); }, 0);
+ NostalgyDoSearch("");
+ ViewChange(kViewItemAll, "All"); // TODO: localized string
+ setTimeout(NostalgyFocusThreadPane,100);
}
if (NostalgyEscapePressed == 2) NostalgyFocusThreadPane();
}
@@ -849,9 +705,10 @@ function NostalgySearchSender() {
var subj = MailSubject();
if (input.value != last_cycle_restrict_value) last_cycle_restrict = 0;
last_cycle_restrict++;
+ var to_search = "";
if (last_cycle_restrict == 1) {
last_cycle_saved_searchMode = input.searchMode;
- input.value = name;
+ to_search = name;
if (recips && window.kQuickSearchRecipient)
input.searchMode = kQuickSearchRecipient;
else if (window.kQuickSearchSender)
@@ -864,7 +721,7 @@ function NostalgySearchSender() {
alert("Nostalgy error: don't know which QuickSearch criterion to use");
}
else if (last_cycle_restrict == 2) {
- input.value = subj;
+ to_search = subj;
if (NostalgyIsDefined("kQuickSearchSubject"))
input.searchMode = kQuickSearchSubject;
else if (window.QuickSearchConstants)
@@ -873,11 +730,11 @@ function NostalgySearchSender() {
alert("Nostalgy error: don't know which QuickSearch criterion to use");
}
else
- { last_cycle_restrict = 0; input.value = "";
+ { last_cycle_restrict = 0; to_search = "";
input.searchMode = last_cycle_saved_searchMode;
}
- last_cycle_restrict_value = input.value;
- NostalgySearch();
+ last_cycle_restrict_value = to_search;
+ NostalgyDoSearch(to_search);
SetFocusThreadPane();
gDBView.selectMsgByKey(key);
} catch (ex) {
@@ -889,72 +746,6 @@ function NostalgySearchSender() {
return true;
}
-function NostalgySearchSelectAll(select) {
- if (!nostalgy_search_focused) return false;
-
- if (!gEBI("searchInput") || gEBI("searchInput").value == ""
- || gEBI("searchInput").showingSearchCriteria) {
- SetFocusThreadPane();
- return true;
- }
-
- initializeSearchBar();
- nostalgy_on_search_done = function() {
- nostalgy_on_search_done = null;
- if (select) setTimeout(function(){ gDBView.selection.selectAll(); },0);
- else NostalgySelectLastMsg();
- SetFocusThreadPane();
- };
- if (gSearchTimer) {
- clearTimeout(gSearchTimer);
- gSearchTimer = null;
- }
- gSearchTimer = setTimeout("NostalgySearch();", 0);
- return true;
-}
-
-function NostalgyShowSearchMode() {
- var o = NostalgyQuickSearch();
- o.showPopup(gEBI("quick-search-button"),-1,-1,"tooltip",
- "bottomleft", "topleft");
-}
-
-function NostalgyQuickSearch() {
- var o = gEBI("quick-search-menupopup");
- if (!o)
- o = document.getAnonymousElementByAttribute(gEBI("searchInput"), "anonid", "quick-search-menupopup");
- return o;
-}
-
-function NostalgyEnterSearch() {
- if (window.InitQuickSearchPopup)
- InitQuickSearchPopup();
- nostalgy_search_focused = true;
-}
-function NostalgyLeaveSearch() {
- nostalgy_search_focused = false;
- var o = NostalgyQuickSearch();
- if (!o) return;
- o.hidePopup();
-}
-
-function NostalgySearchMode(current,dir) {
- var input = gEBI("searchInput");
- var popup = NostalgyQuickSearch();
- if (!popup) return;
- var oldmode = popup.getElementsByAttribute('value', current)[0];
- if (!oldmode) oldmode = popup.firstChild;
- var newmode = dir > 0 ? oldmode.nextSibling : oldmode.previousSibling;
- if (!newmode || !newmode.value) newmode = oldmode;
- oldmode.setAttribute('checked','false');
- newmode.setAttribute('checked','true');
- input.searchMode = newmode.value;
- popup.setAttribute("value",newmode.value);
- if (window.InitQuickSearchPopup)
- InitQuickSearchPopup();
- NostalgySearch();
-}
-
function onNostalgyKeyPressCapture(ev) {
if (ev.keyCode == KeyEvent.DOM_VK_ESCAPE)
NostalgyEscape();
@@ -972,27 +763,6 @@ function onNostalgyKeyPressCapture(ev) {
NostalgyStopEvent(ev);
return;
}
- //NostalgyDebug("nostalgy_search_focused " + nostalgy_search_focused);
- if (nostalgy_search_focused) {
- if (ev.keyCode == KeyEvent.DOM_VK_DOWN) {
- var i = NostalgyCurrentSearchMode();
- setTimeout(function(){NostalgySearchMode(i,1);},0);
- NostalgyStopEvent(ev);
- return;
- }
- if (ev.keyCode == KeyEvent.DOM_VK_UP) {
- var i = NostalgyCurrentSearchMode();
- setTimeout(function(){NostalgySearchMode(i,-1);},0);
- NostalgyStopEvent(ev);
- return;
- }
- if (ev.keyCode == KeyEvent.DOM_VK_ESCAPE) {
- NostalgyDoSearch("");
- setTimeout(SetFocusThreadPane,0);
- NostalgyStopEvent(ev);
- return;
- }
- }
}
@@ -1007,11 +777,6 @@ function onNostalgyKeyPress(ev) {
if (!in_message_window && ev.charCode == 102) { // F
document.getElementById("folderTree").focus();
NostalgyStopEvent(ev);
- } else
- if (!in_message_window && ev.charCode == 105) { // I
- var search = GetSearchInput();
- if (search) search.focus();
- NostalgyStopEvent(ev);
}
return;
}
@@ -1065,26 +830,8 @@ function NostalgySaveAndGoSuggested() {
return true;
}
-function onNostalgyKeyDown(ev) {
- if (nostalgy_search_focused && gEBI("searchInput").showingSearchCriteria)
- gEBI("searchInput").showingSearchCriteria = false;
- if ((ev.keyCode == KeyEvent.DOM_VK_ALT ||
- ev.keyCode == KeyEvent.DOM_VK_CONTROL)
- && nostalgy_search_focused) NostalgyShowSearchMode();
-}
-function onNostalgyKeyUp(ev) {
- if ((ev.keyCode == KeyEvent.DOM_VK_ALT ||
- ev.keyCode == KeyEvent.DOM_VK_CONTROL)
- && nostalgy_search_focused) {
- var o = NostalgyQuickSearch();
- o.hidePopup();
- }
-}
-
window.addEventListener("load", onNostalgyLoad, false);
window.addEventListener("resize", onNostalgyResize, false);
window.addEventListener("unload", onNostalgyUnload, false);
window.addEventListener("keypress", onNostalgyKeyPress, false);
window.addEventListener("keypress", onNostalgyKeyPressCapture, true);
-window.addEventListener("keydown", onNostalgyKeyDown, true);
-window.addEventListener("keyup", onNostalgyKeyUp, true);
diff --git a/content/nostalgy_keys.js b/content/nostalgy_keys.js
index 35567ce..2ec0fc9 100644
--- a/content/nostalgy_keys.js
+++ b/content/nostalgy_keys.js
@@ -21,12 +21,6 @@ var nostalgy_keys = [
"JS:NostalgyCollapseFolderPane();"],
["search_sender","Show messages with same sender/same subject","`",
"JS:NostalgySearchSender();"],
- ["select_all","Search, select all messages and focus the thread pane",
- "control RETURN",
- "JS:NostalgySearchSelectAll(true);"],
- ["select_search","Search, select last result and focus the thread pane",
- "RETURN",
- "JS:NostalgySearchSelectAll(false);"]
];
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/nostalgy.git
More information about the Pkg-mozext-commits
mailing list