[Pkg-mozext-commits] [nostalgy] 91/252: *** empty log message ***

David Prévot taffit at moszumanska.debian.org
Tue Jun 14 15:24:45 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 acf4d72b878ef30a7a5a484bf75c5a886332bb1a
Author: frisch <frisch at 56b81dcf-5a2f-0410-9db0-014be2e416ff>
Date:   Tue May 29 15:33:18 2007 +0000

    *** empty log message ***
---
 CHANGES                        |   7 ++
 content/edit_prefs.js          |   2 +-
 content/nostalgy.js            | 149 +++++++++++++++++++++++++++++++++++++----
 content/nostalgy_keys.js       |   6 +-
 content/thunderbirdOverlay.xul |   2 +-
 install.rdf                    |   2 +-
 6 files changed, 152 insertions(+), 16 deletions(-)

diff --git a/CHANGES b/CHANGES
index 3c200dd..37d63d9 100644
--- a/CHANGES
+++ b/CHANGES
@@ -6,6 +6,13 @@ Since 0.2.13
   - when showing a folder, if no message is currently selected,
     select the last one
   - custom shortcuts are now working in stand-alone message windows
+  - Thunderbirds shortcuts that are hidden by Nostalgy can now
+    be used (type "Escape" before)
+  - change the behavior of the QuickSearch box: always show the
+    popup menu to select/show the current search criterion; use UP/DOWN to
+    change the criterion (the view is automatically updated);
+    ESCAPE to focus the thread pane; Control+RETURN (customizable)
+    to start the search, select all results, and focus the thread pane
 
 0.2.12
   - bug fix: use the mime-decoded version for the subject (for matching
diff --git a/content/edit_prefs.js b/content/edit_prefs.js
index e67e302..0579ef6 100644
--- a/content/edit_prefs.js
+++ b/content/edit_prefs.js
@@ -337,7 +337,7 @@ function onKeyPress(ev) {
     ev.stopPropagation();
     wait_key.value = wait_key_old;
     wait_key = null;
-  } else if (wait_key && ev.keyCode != 13) {
+  } else if (wait_key && (ev.keyCode != 13 || ev.ctrlKey || ev.altKey)) {
     Recognize(ev,wait_key);
     wait_key = null;
   } else if (ev.keyCode == KeyEvent.DOM_VK_RETURN) {
diff --git a/content/nostalgy.js b/content/nostalgy.js
index a42d14d..fc0cd87 100644
--- a/content/nostalgy.js
+++ b/content/nostalgy.js
@@ -10,6 +10,8 @@ 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;
 
 /** Rules **/
 
@@ -110,7 +112,7 @@ var NostalgyRules =
       if (timeout_regkey) return;
       timeout_regkey = 1;
       var r = this;
-      setTimeout(function() { timeout_regkey = 0; r.register_keys(); }, 1000);
+      setTimeout(function() { timeout_regkey = 0; r.register_keys(); }, 150);
     }
   },
 
@@ -181,7 +183,7 @@ var NostalgyFolderListener = {
  OnItemEvent: function(folder, event) { 
    var evt = event.toString();
    if (evt == "FolderLoaded") setTimeout(NostalgySelectLastMsg,50);
-   NostalgyDebug(event.toString()); 
+   // NostalgyDebug(event.toString()); 
  }
 }
 
@@ -193,8 +195,11 @@ function NostalgySelectMessageByNavigationType(type)
 
   gDBView.viewNavigate(type, resultId, resultIndex, threadIndex, true);
 
-  if ((resultId.value != nsMsgKey_None) && (resultIndex.value != nsMsgKey_None))
+  if ((resultId.value != nsMsgKey_None) && 
+      (resultIndex.value != nsMsgKey_None)) {
+    // gDBView.selection.currentIndex = resultIndex.value;
     gDBView.selectMsgByKey(resultId.value);
+  }
 }
 
 function NostalgyMailSession() {
@@ -245,7 +250,38 @@ function onNostalgyLoad() {
 
 
  var old_OnMsgParsed = OnMsgParsed;
- OnMsgParsed = function (url) { old_OnMsgParsed(url); NostalgyOnMsgParsed(); };
+ OnMsgParsed = function (url) { 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);
+   };
+ }
+
+ if (window.onSearchInputFocus) {
+   var old_f1 = onSearchInputFocus;
+   onSearchInputFocus = function(ev) {
+     old_f1(ev);
+     NostalgyEnterSearch();
+   };
+   onSearchInputBlur = NostalgyLeaveSearch;
+
+
+   gEBI("quick-search-menupopup").addEventListener
+     ("popupshowing",
+      function() { 
+       if (nostalgy_search_focused) setTimeout(NostalgyEnterSearch,0);
+     },
+      false);
+   gEBI("quick-search-menupopup").addEventListener
+     ("popuphiding",
+      function() { 
+       if (nostalgy_search_focused) setTimeout(NostalgyEnterSearch,0);
+     },
+      false); }
 }
 
 function NostalgyOnMsgParsed() {
@@ -590,16 +626,36 @@ function NostalgyFocusThreadPane() {
   // NostalgySelectLastMsg();
 }
 
-function NostalgyEscape(ev) {
+function NostalgySaveSelection() {
+  var o = { };
+  gDBView.getIndicesForSelection(o,{ });
+  o = o.value;
+  for (var j = 0; j < o.length; j++) o[j] = gDBView.getKeyAt(o[j]);
+  return o;
+}
+
+function NostalgyRestoreSelection(o) {
+  var s = gDBView.selection;
+  for (var j = 0; j < o.length; j++) {
+    var k = gDBView.findIndexFromKey(o[j],true);
+    if (!s.isSelected(k)) s.toggleSelect(k);
+  }
+}
+
+function NostalgyEscape() {
   NostalgyEscapePressed++;
   var i = NostalgyEscapePressed;
   setTimeout(
     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);
   }
   if (NostalgyEscapePressed == 2) NostalgyFocusThreadPane();
 }
@@ -649,7 +705,54 @@ function NostalgySearchSender() {
   }
 }
 
+function NostalgySearchSelectAll() {
+  if (!gSearchInput || gSearchInput.value == "" 
+      || gSearchInput.showingSearchCriteria) return;
+
+  initializeSearchBar();
+  nostalgy_on_search_done = function() {
+    nostalgy_on_search_done = null;
+    gDBView.selection.selectAll();
+    SetFocusThreadPane();
+  };
+  onSearchInput(true);
+}
+
+function NostalgyEnterSearch() {
+  NostalgyDebug("Enter");
+  var o = gEBI("quick-search-menupopup");
+  if (!o) return;
+  InitQuickSearchPopup();
+  nostalgy_search_focused = false;
+  o.showPopup(gEBI("searchInput"),-1,-1,"tooltip", "bottomright", "topright");
+  nostalgy_search_focused = true;
+}
+function NostalgyLeaveSearch(ev) {
+  NostalgyDebug("Leave");
+  nostalgy_search_focused = false;
+  var o = gEBI("quick-search-menupopup");
+  if (!o) return;
+  o.hidePopup();
+}
+
+function NostalgySearchMode(dir) {  
+  var input = GetSearchInput();
+  var popup = gEBI("quick-search-menupopup");
+  var oldmode = popup.getElementsByAttribute('value', input.searchMode)[0];
+  var newmode = dir > 0 ? oldmode.nextSibling : oldmode.previousSibling;
+  if (newmode && newmode.value) {
+    oldmode.removeAttribute('checked');
+    newmode.setAttribute('checked','true');
+    input.searchMode = newmode.value;
+    popup.setAttribute("value",newmode.value);
+    onEnterInSearchBar();
+  }
+}
+
 function onNostalgyKeyPress(ev) {
+  //  NostalgyDebug(RecognizeKey(ev) + "  " + nostalgy_search_focused);
+  // if (ev.keyCode == 27) NostalgyEscape();
+
   if (NostalgyEscapePressed >= 1) {
     if (!in_message_window && ev.charCode == 109) { // M
       NostalgyFocusMessagePane();
@@ -666,7 +769,8 @@ function onNostalgyKeyPress(ev) {
     return;
   } 
   if (!nostalgy_statusBar.hidden &&
-      document.commandDispatcher.focusedElement.nodeName != "html:input") {
+      document.commandDispatcher.focusedElement.nodeName != "html:input")
+    {
     // ugly hack: it takes some time for the folderBox to be focused
     if (ev.charCode) {
       nostalgy_folderBox.value =  nostalgy_folderBox.value + 
@@ -675,9 +779,28 @@ function onNostalgyKeyPress(ev) {
     ev.preventDefault();
     return;
   }
-  if (ev.originalTarget.localName == "input") return;
-  var k = nostalgy_active_keys[RecognizeKey(ev)];
-  if (k) { ParseCommand(k); ev.preventDefault(); }
+  var kn = RecognizeKey(ev);
+  if (ev.keyCode == KeyEvent.DOM_VK_DOWN && nostalgy_search_focused) {
+    NostalgySearchMode(1); 
+    ev.stopPropagation();
+    ev.preventDefault();
+    return;
+  }
+  if (ev.keyCode == KeyEvent.DOM_VK_UP && nostalgy_search_focused) {
+    NostalgySearchMode(-1);
+    ev.stopPropagation();
+    ev.preventDefault();
+    return;
+  }
+  if (kn == "ESCAPE" && nostalgy_search_focused) {
+    NostalgyFocusThreadPane();
+    ev.preventDefault();
+    return;
+  }
+  if (ev.originalTarget.localName == "input" && !ev.ctrlKey && !ev.altKey) 
+    return;
+  var k = nostalgy_active_keys[kn];
+  if (k) { ParseCommand(k); ev.preventDefault();  ev.stopPropagation();}
 }
 
 function ParseCommand(k) {
@@ -697,13 +820,15 @@ function ParseCommand(k) {
 }
 
 function NostalgyGoCommand() {
-  if (!in_message_window) NostalgyCmd('Go to folder:', NostalgyShowFolder, false);
+  if (!in_message_window) 
+    NostalgyCmd('Go to folder:', NostalgyShowFolder, false);
 }
 function NostalgyGoSuggestedCommand() {
-  if (!in_message_window) NostalgySuggested(NostalgyShowFolder);
+  if (!in_message_window) 
+    NostalgySuggested(NostalgyShowFolder);
 }
 
 window.addEventListener("load", onNostalgyLoad, false);
 window.addEventListener("resize", onNostalgyResize, false);
 window.addEventListener("unload", onNostalgyUnload, false);
-window.addEventListener("keypress", onNostalgyKeyPress, false);
+window.addEventListener("keypress", onNostalgyKeyPress, true);
diff --git a/content/nostalgy_keys.js b/content/nostalgy_keys.js
index 6ed72f1..f6da91a 100644
--- a/content/nostalgy_keys.js
+++ b/content/nostalgy_keys.js
@@ -14,6 +14,10 @@ var nostalgy_keys = [
   ["hide_folders","Hide folder pane","L",
    "JS:NostalgyCollapseFolderPane();"],
   ["search_sender","Show messages with same sender/same subject","`",
-   "JS:NostalgySearchSender();"]
+   "JS:NostalgySearchSender();"],
+  ["select_all","Search, select all messages and focus the thread pane",
+   "control RETURN",
+   "JS:NostalgySearchSelectAll();"]
 ];
 
+
diff --git a/content/thunderbirdOverlay.xul b/content/thunderbirdOverlay.xul
index 8f2e7d6..30b2742 100644
--- a/content/thunderbirdOverlay.xul
+++ b/content/thunderbirdOverlay.xul
@@ -28,7 +28,7 @@
   <key keycode="VK_RIGHT" modifiers="shift" 
        oncommand="NostalgyScrollMsg(50);"/>
 
-  <key keycode="VK_ESCAPE" oncommand="NostalgyEscape(event);"/>
+  <key keycode="VK_ESCAPE" oncommand="NostalgyEscape();"/>
  </keyset>
 
 
diff --git a/install.rdf b/install.rdf
index 3405ad8..b6ef26c 100644
--- a/install.rdf
+++ b/install.rdf
@@ -5,7 +5,7 @@
   <RDF:Description RDF:about="urn:mozilla:install-manifest"
                    em:id="nostalgy at alain.frisch"
                    em:name="Nostalgy"
-                   em:version="0.2.12"
+                   em:version="0.2.13"
                    em:creator="Alain Frisch"
                    em:description="Adds shortcuts to change folder, move message, with folder completion"
                    em:homepageURL="http://alain.frisch.fr/soft_mozilla.html"

-- 
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