[Pkg-mozext-commits] [nostalgy] 95/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 671e28123626603559cc19cddfd38b3b850343d6
Author: frisch <frisch at 56b81dcf-5a2f-0410-9db0-014be2e416ff>
Date:   Wed May 30 12:43:04 2007 +0000

    *** empty log message ***
---
 CHANGES                  |  3 ++
 content/edit_prefs.js    | 53 +++++++++++++++++---------------
 content/edit_prefs.xul   |  5 +--
 content/nostalgy.js      | 80 +++++++++++++++++++++++++++++++++++++++---------
 content/nostalgy_keys.js |  6 ++++
 5 files changed, 105 insertions(+), 42 deletions(-)

diff --git a/CHANGES b/CHANGES
index 6d63d55..b796e66 100644
--- a/CHANGES
+++ b/CHANGES
@@ -9,10 +9,13 @@ Since 0.2.13
       focus thread pane
     * CTRL-RETURN (customizable): same, but select all results
     * ESCAPE: cancel search, focus thread pane
+  - new "Save and Go" feature
 
   - make Nostalgy work with TB 3.0 (tested with 3.0a1pre)
   - Thunderbirds shortcuts that are hidden by Nostalgy can now
     be used (type "Escape" before)
+  - ask for a confirmation when cancelling changes (with Escape)
+    in the preference dialog
   - bug fix: custom shortcuts are now working in stand-alone message windows
   - bug fix: custom shortcuts with no modifier are not recognized when typing
     in a text box (QuickSearch or Nostalgy's completion box)
diff --git a/content/edit_prefs.js b/content/edit_prefs.js
index 33baaec..be16589 100644
--- a/content/edit_prefs.js
+++ b/content/edit_prefs.js
@@ -10,29 +10,29 @@ var kKeysPrefs = "extensions.nostalgy.keys.";
 var kCustomActionsPrefs = "extensions.nostalgy.actions.";
 var max_custom = (-1);
 
-(function () {
-   var m = {
-            '\b': '\\b',
-            '\t': '\\t',
-            '\n': '\\n',
-            '\f': '\\f',
-            '\r': '\\r',
-            '"' : '\\"',
-            '\\': '\\\\'
-        };
-   String.prototype.quote = function () {
-     var x = this;
-     if (/["\\\x00-\x1f]/.test(this)) {
-      x = this.replace(/([\x00-\x1f\\"])/g, function(a, b) {
-      var c = m[b];
+var nost_js_quote = {
+  '\b': '\\b',
+  '\t': '\\t',
+  '\n': '\\n',
+  '\f': '\\f',
+  '\r': '\\r',
+  '"' : '\\"',
+  '\\': '\\\\'
+};
+
+String.prototype.quote = function () {
+  var x = this;
+  if (/["\\\x00-\x1f"]/.test(this)) {
+    x = this.replace(/(["\x00-\x1f\\"])/g, function(a, b) {
+      var c = nost_js_quote[b];
       if (c) { return c; }
       c = b.charCodeAt();
-      return '\\u00' + Math.floor(c / 16).toString(16) + (c % 16).toString(16);
-      });
-     }
-     return '"' + x + '"';
-   };
-})();
+      return '\\u00' + 
+	Math.floor(c / 16).toString(16) + (c % 16).toString(16);
+    });
+  }
+  return '"' + x + '"';
+};
 
 function NostalgySendRules() {
   var sAccountManager = 
@@ -340,10 +340,13 @@ function onKeyPress(ev) {
   } 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) {
-    ev.preventDefault();
-    ev.stopPropagation();
-    } */
+  } else if (ev.keyCode == KeyEvent.DOM_VK_ESCAPE) {
+    if 
+      (!confirm("Do you really want to cancel all your changes to the preferences?")) {
+      ev.preventDefault();
+      ev.stopPropagation();
+    }
+  }
 }
 
 
diff --git a/content/edit_prefs.xul b/content/edit_prefs.xul
index e85d601..9f3c32b 100644
--- a/content/edit_prefs.xul
+++ b/content/edit_prefs.xul
@@ -32,7 +32,7 @@ is selected for a given message, Nostalgy informs you in the status line.
 You can then use the Shift-S/Shift-C
 shortcuts to move/copy the message to this folder.</label>
  <hbox flex="0">
- <listbox id="rules" flex="0">
+ <listbox id="rules" flex="0" style="width:400px">
   <listhead>
    <listheader label="Field"/>
    <listheader label="Contains"/>
@@ -41,7 +41,7 @@ shortcuts to move/copy the message to this folder.</label>
   </listhead>
   <listcols>
    <listcol width="80" maxwidth="80"/>
-   <listcol/>
+   <listcol width="150" maxwidth="150"/>
    <listcol width="150" maxwidth="150"/>
    <listcol width="450" maxwidth="450"/>
   </listcols>
@@ -92,6 +92,7 @@ shortcuts to move/copy the message to this folder.</label>
   <radio value="Go" label="Go" selected="true"/>
   <radio value="Save" label="Save"/>
   <radio value="Copy" label="Copy"/>
+  <radio value="SaveGo" label="Save+Go"/>
   </radiogroup>
   <textbox style="width:600px" type="autocomplete" id="folderselect" 
            nostalgyfolderbox="SelectFolder();"/>
diff --git a/content/nostalgy.js b/content/nostalgy.js
index 618b6ae..f68730e 100644
--- a/content/nostalgy.js
+++ b/content/nostalgy.js
@@ -12,6 +12,8 @@ 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;
 
 /** Rules **/
 
@@ -182,8 +184,12 @@ var NostalgyFolderListener = {
  OnItemPropertyFlagChanged: function(item, property, oldFlag, newFlag) { },
  OnItemEvent: function(folder, event) { 
    var evt = event.toString();
+   NostalgyDebug(evt + " folder:" + folder.prettyName);
    if (evt == "FolderLoaded") setTimeout(NostalgySelectLastMsg,50);
-   // NostalgyDebug(event.toString()); 
+   if (evt == "DeleteOrMoveMsgCompleted" && nostalgy_on_move_completed) {
+     nostalgy_on_move_completed();
+     nostalgy_on_move_completed = null;
+   }
  }
 }
 
@@ -537,6 +543,10 @@ function NostalgyEnsureFolderIndex(builder, msgFolder)
 
 function NostalgySelectLastMsg() {
   if (!gDBView) return;
+  if (nostalgy_selection_saved) {
+    NostalgyRestoreSelection(nostalgy_selection_saved);
+    nostalgy_selection_saved = null;
+  } else
   try { gDBView.viewIndexForFirstSelectedMsg; } catch (ex) {
     NostalgySelectMessageByNavigationType(nsMsgNavigationType.lastMessage);
   }
@@ -545,7 +555,7 @@ function NostalgySelectLastMsg() {
 function NostalgyShowFolder(folder) {
   if (folder.tag) {
     ViewChange(kViewTagMarker + folder.key, folder.tag);
-    return;
+    return true;
   }
 
   var folderTree = GetFolderTree();
@@ -575,6 +585,7 @@ function NostalgyShowFolder(folder) {
     input.value = search;
     setTimeout(function(){onEnterInSearchBar(true);}, 200);
   }
+  return true;
 }
 
 function NostalgyToggleMessageTag(tag) {
@@ -593,12 +604,28 @@ function NostalgyMoveToFolder(folder) {
  if (folder.tag) NostalgyToggleMessageTag(folder);
  else gDBView.doCommandWithFolder(nsMsgViewCommandType.moveMessages,folder);
  SetNextMessageAfterDelete();
+ return true;
+}
+
+function NostalgyMoveToFolderAndGo(folder) {
+ register_folder(folder);
+ var sel = NostalgySaveSelection();
+ if (folder.tag) NostalgyToggleMessageTag(folder);
+ else 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;
 }
 
 function NostalgyCopyToFolder(folder) {
  register_folder(folder);
  if (folder.tag) NostalgyToggleMessageTag(folder);
  else gDBView.doCommandWithFolder(nsMsgViewCommandType.copyMessages,folder);
+ return true;
 }
 
 function NostalgySuggested(cmd) {
@@ -633,15 +660,25 @@ 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);
+  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 = gDBView.msgFolder.getMessages(msgWindow);
+  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);
+    }
   }
 }
 
@@ -823,10 +860,11 @@ function ParseCommand(k) {
   var folder = FindFolderExact(spl[2]);
   if (!folder) { alert("Cannot find folder " + spl[2]); return; }
   switch (spl[1]) {
-   case "Go": NostalgyShowFolder(folder); break;
-   case "Save": NostalgyMoveToFolder(folder); break;
-   case "Copy": NostalgyCopyToFolder(folder); break;
-   default: alert("Unknown command " + spl[1]); return;
+  case "Go": return NostalgyShowFolder(folder);
+  case "Save": return NostalgyMoveToFolder(folder);
+  case "Copy": return NostalgyCopyToFolder(folder);
+  case "SaveGo": return NostalgyMoveToFolderAndGo(folder);
+  default: alert("Unknown command " + spl[1]); return;
   }
 }
 
@@ -843,6 +881,18 @@ function NostalgyGoSuggestedCommand() {
   } else return false;
 }
 
+function NostalgySaveAndGo() {
+  if (in_message_window) return false;
+  NostalgyCmd('Move messages and go to:', NostalgyMoveToFolderAndGo, true);
+  return true;
+}
+
+function NostalgySaveAndGoSuggested() {
+  if (in_message_window) return false;
+  NostalgySuggested(NostalgyMoveToFolderAndGo);
+  return true;
+}
+
 window.addEventListener("load", onNostalgyLoad, false);
 window.addEventListener("resize", onNostalgyResize, false);
 window.addEventListener("unload", onNostalgyUnload, false);
diff --git a/content/nostalgy_keys.js b/content/nostalgy_keys.js
index e1d6886..30ae3a0 100644
--- a/content/nostalgy_keys.js
+++ b/content/nostalgy_keys.js
@@ -11,6 +11,12 @@ var nostalgy_keys = [
    "JS:NostalgyGoCommand();"],
   ["go_suggest","Go as suggested","shift G",
    "JS:NostalgyGoSuggestedCommand();"],
+  ["save_go","Save message and go there","control S",
+   "JS:NostalgySaveAndGo();"],
+  ["save_go_suggest","Save message as suggested and go there",
+   "control shift S",
+   "JS:NostalgySaveAndGoSuggested();"],
+
   ["hide_folders","Hide folder pane","L",
    "JS:NostalgyCollapseFolderPane();"],
   ["search_sender","Show messages with same sender/same subject","`",

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