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

David Prévot taffit at alioth.debian.org
Tue Oct 8 20:41:44 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 92dd455b1dafceb2d7b7ed7988e08500ecf23829
Author: frisch <frisch at 56b81dcf-5a2f-0410-9db0-014be2e416ff>
Date:   Wed May 9 16:01:05 2007 +0000

    *** empty log message ***
    
    
    git-svn-id: http://nostalgy.googlecode.com/svn/trunk@74 56b81dcf-5a2f-0410-9db0-014be2e416ff
---
 CHANGES                |    5 ++++
 content/about.xhtml    |   64 +++++++++++++++++++++++++-----------------------
 content/edit_prefs.js  |   16 ++----------
 content/edit_prefs.xul |    5 +++-
 content/folders.js     |   61 ++++++++++++++++++++++++++++++---------------
 content/nostalgy.js    |   58 ++++++++++++-------------------------------
 6 files changed, 102 insertions(+), 107 deletions(-)

diff --git a/CHANGES b/CHANGES
index f132767..b549b20 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,8 @@
+Since 0.2.8
+  - new option "always include tags"; when disabled, tags are added to the
+    completion box only if the input box starts with ":" or if
+    there is no matching folder
+
 0.2.8
   - make it work again with TB 1.5
   - bug fix: prefix tags with ":" even in "Restrict to current server mode"
diff --git a/content/about.xhtml b/content/about.xhtml
index 2a0a722..27c9267 100644
--- a/content/about.xhtml
+++ b/content/about.xhtml
@@ -152,30 +152,29 @@ uppercase, you don't need to press Shift.</p>
 	header)	instead.</li>
    </ul>
 
-   <h3>Tags</h3>
+<h3>Tags</h3>
 
-   <p>
-   Starting from version 2.0, Thunderbird supports so-called tags, which
-   are a generalization of former labels. Tags can be defined by the
-   user and several tags can be attached to a message.
-   </p>
 
-   <p>
-   Nostalgy helps you use tags. In the completion box for Go/Save/Copy 
-   commands, existing tags will appear prefixed with a semi-colon.
-   A "Go" command applied to a tag will restrict the current folder view
-   to show only the messages that have this tag. A "Save" or a "Copy"
-   command applied to a tag will toggle this tag for the selected
-   messages (the first selected message is used to determine if the
-   tag has to be added or removed). Note that Save and Copy have the same
-   behavior when a tag is selected.
-   </p>
+<p> Starting from version 2.0, Thunderbird supports tags, along
+with traditional folders, as a way to organize your
+messages. Thunderbird's tagging feature replaces its former labeling
+feature, and allows users to define an unlimited number of tags, more
+than one of which can be attached to a single message. </p>
 
-   <p>
-   It is possible to use a tag instead of a folder as a target for
-   Nostalgy's rules.
-   </p>
+<p>Nostalgy helps you use tags in much the same way it helps you use folders:
+The completion box for the Go/Save/Copy commands has always listed your
+email folders, but for Thunderbird 2.0, it also lists your existing tags,
+prefixed with a semi-colon.</p>
+
+<p>A "Go" command applied to a tag restricts the current folder view to show
+only the messages that have this tag (Esc-Esc-Esc restores the "All
+messages" view). A "Save" or a "Copy" command applied to a tag toggles the
+tag on or off for the selected messages (the first selected message is used
+to determine if the tag has to be added or removed). Note that Save and Copy
+have the same behavior when applied to tags.</p>
 
+<p>You may also use tags rather than folders as targets for Nostalgy's
+rules.</p>
 
    <h3>In the Composer</h3>
 
@@ -204,12 +203,14 @@ opens the file attachment dialog.</p>
    <p>Here is a description of the completion options:</p>
  
    <ul>
-   <li>The first switch restricts the lookup to folders on the same
+   <li><b>Restrict folder completion to the current server:</b>
+   limit lookup to folders on the same
    server/account as the currently active folder. In this mode,
    the server name is not displayed (and must not be typed) in
    the input line and the completion box.</li>
 
-   <li>The second switch forces Nostalgy to interpret differently what
+   <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, 
       it is interpreted as a regexp which can match an arbitrary substring
       of the complete folder name (including the account name and 
@@ -217,20 +218,23 @@ opens the file attachment dialog.</p>
       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>The third switch sorts folder in the completion box in alphabetical
-   order.</li>
+   <li><b>Sort folders alphabetically</b>.</li>
   
-   <li>The fourth switch controls whether folder names are matched
-   in a case sensitive or insensitive way.</li>
+   <li><b>Match folder names in a case sensitive way</b>.</li>
+
+
+   <li><b>Tab triggers shell-like completion (otherwise, cycle through suggestions)</b>.</li>
 
-   <li>The fifth switch controls whether the Tab key triggers shell-like
-      completion. If it is unchecked, Tab simply cycles through suggestions,
-      like the down arrow key.</li>
+   <li><b>Always include tags</b>: if set, tags are always included
+in the completion box; otherwise, tags are included only if
+the input box starts with a colon character, or if no folder matches.
+</li>
    </ul>
 
    <hr/>
 
-   <p>The Nostalgy extension has been written by Alain Frisch (<tt>Alain.Frisch at inria.fr</tt>). Comments ands suggestions are welcome!</p>
+   <p>The Nostalgy extension has been written by Alain Frisch (<tt>Alain.Frisch at inria.fr</tt>). Comments and suggestions are welcome!  Donations
+can be sent to the Paypal account <tt>alain at frisch.fr</tt>.</p>
   </body>
 </html>
 
diff --git a/content/edit_prefs.js b/content/edit_prefs.js
index a43ddd4..634a598 100644
--- a/content/edit_prefs.js
+++ b/content/edit_prefs.js
@@ -5,14 +5,6 @@ var gList = null;
 var wait_key = null;
 var wait_key_old = "";
 
-var boolPrefs = [ 
- "restrict_to_current_server",
- "match_only_folder_name",
- "sort_folders",
- "match_case_sensitive",
- "tab_shell_completion"
-];
-
 var keys = [
  ["save","Save message","S"],
  ["save_suggest","Save as suggested","shift S"],
@@ -164,10 +156,8 @@ function onAcceptChanges() {
                          getService(Components.interfaces.nsIPrefBranch);
   prefs.setCharPref("extensions.nostalgy.rules", MkPrefStr());
 
-  for (var i in boolPrefs) {
-    var n = boolPrefs[i];
+  for (var n in nostalgy_completion_options)
     prefs.setBoolPref("extensions.nostalgy."+n,	gEBI(n).checked);
-  }
  
   if (wait_key) { wait_key.value = wait_key_old; wait_key = null; }
   for (var i in keys)
@@ -230,10 +220,8 @@ function onNostalgyLoad() {
    for (i = 0; i < r.length; i++) { CreateItem(r[i]); }
   } catch (ex) { }
 
- for (var i in boolPrefs) {
-   var n = boolPrefs[i];
+ for (var n in nostalgy_completion_options)
    gEBI(n).checked = getBoolPref(prefs, n);
- }
 
  for (var i in keys) {
   var v = keys[i][2];
diff --git a/content/edit_prefs.xul b/content/edit_prefs.xul
index 5d74cef..fb59266 100644
--- a/content/edit_prefs.xul
+++ b/content/edit_prefs.xul
@@ -69,8 +69,11 @@ shortcuts to move/copy the message to this folder.</label>
    <checkbox label="Sort folders alphabetically"
              id="sort_folders" accesskey="S"/>
    <checkbox label="Match folder names in a case sensitive way"
-             id="match_case_sensitive" accesskey="C"/>   <checkbox label="Tab triggers shell-like completion (otherwise, cycle through suggestions)"
+             id="match_case_sensitive" accesskey="C"/>   
+   <checkbox label="Tab triggers shell-like completion (otherwise, cycle through suggestions)"
              id="tab_shell_completion" accesskey="T"/>
+   <checkbox label="Always include tags"
+             id="always_include_tags"/> 
  </groupbox>
  </tabpanel>
 
diff --git a/content/folders.js b/content/folders.js
index 69c20c5..a731857 100644
--- a/content/folders.js
+++ b/content/folders.js
@@ -1,8 +1,11 @@
-var restrict_to_current_server = false;
-var match_only_folder_name = false;
-var sort_folders = false;
-var match_case_sensitive = false;
-var tab_shell_completion = false;
+var nostalgy_completion_options = {
+  restrict_to_current_server : false,
+  match_only_folder_name : false,
+  sort_folders : false,
+  match_case_sensitive : false,
+  tab_shell_completion : false,
+  always_include_tags  : false
+};
 
 function NostalgyDebug(aText)
 {
@@ -24,7 +27,10 @@ function NostalgyMakeRegexp(s) {
 }
 
 function mayLowerCase(s) {
-  if (!match_case_sensitive) { return (s.toLowerCase()); } else { return s; }
+  if (!nostalgy_completion_options.match_case_sensitive) 
+    return (s.toLowerCase());
+  else 
+    return s;
 }
 
 function full_folder_name(folder) {
@@ -55,7 +61,7 @@ function nostalgy_prettyName(folder) {
 }
 
 function folder_name(folder) {
-  if (restrict_to_current_server) {
+  if (nostalgy_completion_options.restrict_to_current_server) {
     return(short_folder_name(folder));
   } else {
     return(full_folder_name(folder));
@@ -75,7 +81,7 @@ function LongestCommonPrefix(s1,s2) {
 /** Autocompletion of folders **/
 
 function NostalgyFolderMatch(f,reg) {
-  if (match_only_folder_name) {
+  if (nostalgy_completion_options.match_only_folder_name) {
     return (mayLowerCase(nostalgy_prettyName(f)).match(reg) ||
             mayLowerCase(folder_name(f)).search(reg) == 0);
   } else {
@@ -94,9 +100,10 @@ function NostalgyAutocomplete(box) {
 NostalgyAutocomplete.prototype.onStartLookup = 
 function(text, results, listener) {
  var items = this.xresults.items;
+ var nb = 0;
  items.Clear();
 
- IterateMatches(text, this.box.shell_completion, function (folder) {
+ var f = function (folder) {
   var newitem = 
    Components.classes[
     "@mozilla.org/autocomplete/item;1"
@@ -104,7 +111,18 @@ function(text, results, listener) {
   newitem.value = NostalgyCrop(folder_name(folder));
 
   items.AppendElement(newitem);
- });
+  nb++;
+ }; 
+
+ nostalgy_search_folder_options.do_tags = 
+   nostalgy_completion_options.always_include_tags || 
+   (text.substr(0,1) == ":");
+ IterateMatches(text, this.box.shell_completion, f);
+ if (nb == 0 && !nostalgy_search_folder_options.do_tags) {
+  nostalgy_search_folder_options.do_tags = true;
+  IterateMatches(text, this.box.shell_completion, f);
+ }
+
  this.xresults.searchString = text;
  this.xresults.defaultItemIndex = 0;
  listener.onAutoComplete(this.xresults, 1);
@@ -151,7 +169,7 @@ function NostalgyProcessKeyPress(aEvent) {
   var killEvent = false;
   switch (aEvent.keyCode) {
    case KeyEvent.DOM_VK_TAB:
-     if (tab_shell_completion) {
+     if (nostalgy_completion_options.tab_shell_completion) {
        this.shell_completion = true;
        this.value = NostalgyCompleteUnique(this.value); 
        this.processInput();
@@ -309,9 +327,9 @@ var sorted_subfolders = new Array();
 
 // ugly: should be passed as argument to IterateFolders-like functions
 var nostalgy_search_folder_options = {
-   require_file: true  // do we want only folder to which we can copy/move
-                       // messages to? (excludes saved search folder)
-     
+   require_file: true,  // do we want only folder to which we can copy/move
+                        // messages to? (excludes saved search folder)
+   do_tags: false
 };
 
 function ClearNostalgyCache() {
@@ -319,7 +337,8 @@ function ClearNostalgyCache() {
 }
 
 function IterateSubfolders(folder,f) {
- if ((!folder.isServer || !restrict_to_current_server)
+ if ((!folder.isServer || 
+      !nostalgy_completion_options.restrict_to_current_server)
      && (folder.canFileMessages || 
          !nostalgy_search_folder_options.require_file))
  { 
@@ -328,7 +347,7 @@ function IterateSubfolders(folder,f) {
  }
  var arr;
  if (folder.hasSubFolders) {
-  if (sort_folders) {
+  if (nostalgy_completion_options.sort_folders) {
     arr = sorted_subfolders[full_folder_name(folder)];
     if (arr) { for (var n in arr) { IterateSubfolders(arr[n],f); }
                 return; }
@@ -340,12 +359,12 @@ function IterateSubfolders(folder,f) {
   while (!done) {
    var subfolder = subfolders.currentItem().
                    QueryInterface(Components.interfaces.nsIMsgFolder);
-   if (sort_folders) { arr.push(subfolder); } 
+   if (nostalgy_completion_options.sort_folders) { arr.push(subfolder); } 
    else { IterateSubfolders(subfolder,f); }
    try {subfolders.next();}
    catch(e) {done = true;}
   }
-  if (sort_folders) {
+  if (nostalgy_completion_options.sort_folders) {
     arr.sort(CompareFolderNames);
     sorted_subfolders[full_folder_name(folder)] = arr;
     for (var n in arr) { IterateSubfolders(arr[n],f); }
@@ -360,6 +379,7 @@ function IterateFoldersCurrentServer(f) {
 }
 
 function IterateTags(f) {
+ if (!nostalgy_search_folder_options.do_tags) return;
  try {
  var tagService = 
   Components.classes["@mozilla.org/messenger/tagservice;1"]
@@ -370,8 +390,9 @@ function IterateTags(f) {
 }
 
 function IterateFolders(f) {
- if (restrict_to_current_server) { IterateFoldersCurrentServer(f); }
- else { IterateFoldersAllServers(f); }
+ if (nostalgy_completion_options.restrict_to_current_server) 
+   IterateFoldersCurrentServer(f);
+ else IterateFoldersAllServers(f);
 }
 
 function IterateMatches(uri,shell,f) {
diff --git a/content/nostalgy.js b/content/nostalgy.js
index e60b887..b41373a 100644
--- a/content/nostalgy.js
+++ b/content/nostalgy.js
@@ -52,26 +52,12 @@ var NostalgyRules =
         this._branch.QueryInterface(Components.interfaces.nsIPrefBranch2);
     this._branch2.addObserver("", this, false);
     this.get_rules();
-    try {
-     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) { }
-    try {
-     sort_folders = 
-         this._branch.getBoolPref("sort_folders");
-    } catch (ex) { }
-    try {
-     match_case_sensitive =
-         this._branch.getBoolPref("match_case_sensitive");
-    } catch (ex) { }
-    try {
-     tab_shell_completion =
-         this._branch.getBoolPref("tab_shell_completion");
-    } catch (ex) { }
+
+    for (var n in nostalgy_completion_options) {
+      try {
+        nostalgy_completion_options[n] = this._branch.getBoolPref(n);
+      } catch (ex) { }
+    }
   },
 
   register_keys: function() {
@@ -119,27 +105,15 @@ var NostalgyRules =
   observe: function(aSubject, aTopic, aData)
   {
     if(aTopic != "nsPref:changed") return;
-    switch (aData) {
-      case "rules":
-        this.get_rules();
-        if (!in_message_window) { NostalgyDefLabel(); }
-        break;
-      case "restrict_to_current_server":
-        restrict_to_current_server = this._branch.getBoolPref(aData);
-        if (!in_message_window) { NostalgyDefLabel(); }
-        break;
-      case "match_only_folder_name":
-        match_only_folder_name = this._branch.getBoolPref(aData);
-        break;
-      case "sort_folders":
-        sort_folders = this._branch.getBoolPref(aData);
-        break;
-      case "match_case_sensitive":
-        match_case_sensitive = this._branch.getBoolPref(aData);
-        break;
-      case "tab_shell_completion":
-        tab_shell_completion = this._branch.getBoolPref(aData);
-        break;
+    if (aData == "rules") {
+      this.get_rules();
+      if (!in_message_window) NostalgyDefLabel();
+      return;
+    }
+    if (nostalgy_completion_options[aData] != undefined) {
+     nostalgy_completion_options[aData] = this._branch.getBoolPref(aData);
+     if (!in_message_window) NostalgyDefLabel();
+     return;
     }
     if (aData.match("keys.")) this.register_keys();
   },
@@ -359,7 +333,7 @@ function NostalgySuggest() {
 // r = last_folder_subject[MailSubject()];
 // if (r) { return(r); }
 
- if (restrict_to_current_server) { 
+ if (nostalgy_completion_options.restrict_to_current_server) { 
    return(last_folder_server[gDBView.msgFolder.server.key]); 
  } else { 
    return(last_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