[Pkg-mozext-commits] [nostalgy] 28/235: *** empty log message ***

David Prévot taffit at alioth.debian.org
Tue Oct 8 20:41:30 UTC 2013


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository nostalgy.

commit 044efd1c41c8f8be433775c9204dccc5a66c4055
Author: frisch <frisch at 56b81dcf-5a2f-0410-9db0-014be2e416ff>
Date:   Fri Sep 1 12:49:24 2006 +0000

    *** empty log message ***
    
    
    git-svn-id: http://nostalgy.googlecode.com/svn/trunk@28 56b81dcf-5a2f-0410-9db0-014be2e416ff
---
 CHANGES                |    5 +++--
 content/about.xhtml    |   40 +++++++++++++++++++++++++++++------
 content/edit_prefs.js  |   10 +++++++++
 content/edit_prefs.xul |    2 ++
 content/folders.js     |   55 ++++++++++++++++++++++++++++++++----------------
 content/nostalgy.js    |    9 ++++++++
 6 files changed, 95 insertions(+), 26 deletions(-)

diff --git a/CHANGES b/CHANGES
index ce90e31..916f90c 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,8 +1,9 @@
 0.1.6
   - add the rule system (quick selection of a default folder for messages)
-  - add the Shift-Left/Shift-Right keys (scroll the message while the
+  - add the Ctrl-Left/Ctrl-Right keys (scroll the message while the
     thread pane is focused)
-  - change the pane-navigation commands (see about.xhtml)
+  - change pane-navigation commands (see about.xhtml)
+  - focus the thread pane when opening a folder with the G key
 
 0.1.5
   - add the commands:
diff --git a/content/about.xhtml b/content/about.xhtml
index 115d3f3..6549cba 100644
--- a/content/about.xhtml
+++ b/content/about.xhtml
@@ -54,8 +54,24 @@
 
    <p>The S and C commands also work in a standalone message window.</p>
 
+   <p>The G command also focuses the thread pane.</p>
+
    <h3>3-pane navigation</h3>
 
+   <p>
+   Because of the G command,
+   the folder pane becomes thus much less useful, and it can be
+   hidden with the L shortcut.
+   </p>
+
+   <p>
+   Nostalgy also allows to scroll the message while the thread pane
+   is focused with the Ctrl-Left/Right keys. Because of that,
+   it is a good idea to leave the thread pane always focused.
+   Nostalgy still provides shortcuts to easily focus one of the three
+   panes.
+   </p>
+
    <table border="1">
     <tr><th>Shortcut</th><th>Description</th></tr>
     <tr><td>L</td><td>Hide/show the folder pane</td></tr>
@@ -63,7 +79,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>Ctrl-Left/Right</td>
-         <td>Scroll the message from the thread pane</td>
+         <td>Scroll the message from the thread pane</td></tr>
    </table>
 
    <p>The Esc-X shortcuts means: press and release Escape, and then
@@ -74,11 +90,6 @@
    displayed message (up and down) by pressing Ctrl-Left/Ctrl-Right.
    </p>
 
-   <p>
-   The rationale behind the L command is that thanks to Nostalgy's folder
-   commands, you rarely need the folder pane.
-   </p>
-
    <h3>Rules</h3>
 
    <p>Nostalgy has a notion of rule. A rule associates a folder to a
@@ -99,6 +110,23 @@
    it is global.
    </p>
 
+   <h3>Preferences</h3>
+   
+   <p>The preference dialog for Nostalgy is the place where rules are
+   defined. In addition, two switches control the way the completion
+   box (where folder names are proposed) is populated.</p>
+   <p>The first switch restricts the lookup to folders on the same server/account
+   as the currently active folder.</p>
+
+   <p>The second switch forces Nostalgy to interpret differently what
+      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 
+      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.</p>
+
+
    <h3>About Nostalgy...</h3>
    <p>The Nostalgy extension has been written by Alain Frisch (<tt>Alain.Frisch at inria.fr</tt>). Comments ands suggestions are welcome!</p>
   </body>
diff --git a/content/edit_prefs.js b/content/edit_prefs.js
index a999018..c452858 100644
--- a/content/edit_prefs.js
+++ b/content/edit_prefs.js
@@ -2,6 +2,7 @@ function gEBI(s) { return document.getElementById(s); }
 
 var gList = null;
 var gRestrict = null;
+var gMatchFolder = null;
 
 (function () {
    var m = {
@@ -109,6 +110,8 @@ function onAcceptChanges() {
   prefs.setCharPref("extensions.nostalgy.rules", MkPrefStr());
   prefs.setBoolPref("extensions.nostalgy.restrict_to_current_server", 
 	gRestrict.checked);
+  prefs.setBoolPref("extensions.nostalgy.match_only_folder_name", 
+	gMatchFolder.checked);
   window.close();
 }
 
@@ -128,6 +131,7 @@ function DoDelete() {
 function onNostalgyLoad() {
   gList = gEBI("rules");
   gRestrict = gEBI("restrict_to_current_server");
+  gMatchFolder = gEBI("match_only_folder_name");
 
   var prefs = Components.classes["@mozilla.org/preferences-service;1"].
                          getService(Components.interfaces.nsIPrefBranch);
@@ -143,6 +147,12 @@ function onNostalgyLoad() {
   b=prefs.getBoolPref("extensions.nostalgy.restrict_to_current_server"); }
  catch (ex) { }
  gRestrict.checked = b;
+
+ var b = false;
+ try { 
+  b=prefs.getBoolPref("extensions.nostalgy.match_only_folder_name"); }
+ catch (ex) { }
+ gMatchFolder.checked = b;
 }
 
 function onKeyPress(ev) {
diff --git a/content/edit_prefs.xul b/content/edit_prefs.xul
index 0d9c9c2..05b9945 100644
--- a/content/edit_prefs.xul
+++ b/content/edit_prefs.xul
@@ -51,6 +51,8 @@ shortcuts to move/copy the message to this folder.</label>
  <groupbox>
    <checkbox label="Restrict folder completion to the current server"
              id="restrict_to_current_server" accesskey="R"/>
+   <checkbox label="Match only on folder name, not on the full path"
+             id="match_only_folder_name" accesskey="P"/>
  </groupbox>
 
 </vbox>
diff --git a/content/folders.js b/content/folders.js
index e93cd5c..b632a95 100644
--- a/content/folders.js
+++ b/content/folders.js
@@ -1,4 +1,5 @@
 var restrict_to_current_server = false;
+var match_only_folder_name = false;
 
 function NostalgyCrop(s) {
   var len = 120;
@@ -33,6 +34,15 @@ function LongestCommonPrefix(s1,s2) {
 
 /** Autocompletion of folders **/
 
+function NostalgyFolderMatch(f,reg) {
+  if (match_only_folder_name) {
+    return (f.prettyName.toLowerCase().match(reg) ||
+            folder_name(f).toLowerCase().search(reg) == 0);
+  } else {
+    return (folder_name(f).toLowerCase().match(reg));
+  }
+}
+
 function NostalgyAutocomplete() {
  this.xresults = 
   Components.classes[
@@ -44,20 +54,16 @@ NostalgyAutocomplete.prototype.onStartLookup =
 function(text, results, listener) {
  var items = this.xresults.items;
  items.Clear();
- var ltext = NostalgyMakeRegexp(text.toLowerCase());
 
- var addItem = function (folder) {
-  var fname = folder_name(folder);
-  if (! fname.toLowerCase().match(ltext)) { return; }
+ IterateMatches(text, function (folder) {
   var newitem = 
    Components.classes[
     "@mozilla.org/autocomplete/item;1"
    ].createInstance(Components.interfaces.nsIAutoCompleteItem);
-  newitem.value = NostalgyCrop(fname);
+  newitem.value = NostalgyCrop(folder_name(folder));
 
   items.AppendElement(newitem);
- };
- IterateFolders(addItem);
+ });
  this.xresults.searchString = text;
  this.xresults.defaultItemIndex = 0;
  listener.onAutoComplete(this.xresults, 1);
@@ -92,7 +98,14 @@ function NostalgyCompleteUnique(s) {
      if (nb == 1) { ret = n; } else { ret = LongestCommonPrefix(ret,n); }
    }
   });
-  if (ret) { return ret; } else { return s; }
+  if (ret) { 
+    var f = FindFolderExact(ret);
+    if (f) {
+     if (f.hasSubFolders) { return (folder_name(f) + "/"); }
+     else return (folder_name(f)); 
+    }
+    else { return(ret); }
+  } else { return s;  }
 }
 
 // Resolve a string coming from a completion box
@@ -107,22 +120,16 @@ function NostalgyResolveFolder(uri) {
 
 function FirstCompletion(uri) {
   var ret = null;
-  var rexp = NostalgyMakeRegexp(uri.toLowerCase());
-
-  try {
-   IterateFolders(function (f) {
-    if (folder_name(f).toLowerCase().match(rexp)) { ret = f; throw(0); }
-   });
-  } catch (ex) { }
-
+  IterateMatches(uri, function(f) { ret = f; throw(0); });
   return ret;
 }
 
 function FindFolderExact(uri) {
  var ret = null;
+ var u = uri.toLowerCase();
  try {
   IterateFoldersAllServers(function (folder) {
-   if (folder_name(folder) == uri) { ret = folder; throw(0); }
+   if (folder_name(folder).toLowerCase() == u) { ret = folder; throw(0); }
   });
  } catch (ex) { }
  return ret;
@@ -186,4 +193,16 @@ function IterateFoldersCurrentServer(f) {
 function IterateFolders(f) {
  if (restrict_to_current_server) { IterateFoldersCurrentServer(f); }
  else { IterateFoldersAllServers(f); }
-}
\ No newline at end of file
+}
+
+function IterateMatches(uri,f) {
+  var ret = null;
+  var rexp = NostalgyMakeRegexp(uri.toLowerCase());
+
+  try {
+   IterateFolders(function (folder) {
+    if (NostalgyFolderMatch(folder,rexp)) { f(folder); }
+   });
+  } catch (ex) { }
+}
+
diff --git a/content/nostalgy.js b/content/nostalgy.js
index c8ffb70..0d92f80 100644
--- a/content/nostalgy.js
+++ b/content/nostalgy.js
@@ -26,6 +26,10 @@ var NostalgyRules =
      restrict_to_current_server = 
          this._branch.getBoolPref("restrict_to_current_server");
     } catch (ex) { }
+    try {
+     match_only_folder_name = 
+         this._branch.getBoolPref("match_only_folder_name");
+    } catch (ex) { }
   },
 
   unregister: function()
@@ -59,6 +63,10 @@ var NostalgyRules =
            this._branch.getBoolPref("restrict_to_current_server");
         if (!in_message_window) { NostalgyDefLabel(); }
         break;
+      case "match_only_folder_name":
+        match_only_folder_name = 
+           this._branch.getBoolPref("match_only_folder_name");
+        break;
     }
   },
 
@@ -256,6 +264,7 @@ function ShowFolder(folder) {
   var folderTree = GetFolderTree();
   var idx = NostalgyEnsureFolderIndex(folderTree.builderView, folder);
   ChangeSelection(folderTree, idx);
+  setTimeout(function() { SetFocusThreadPane(); }, 0);
 }
 
 function MoveToFolder(folder) {

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