Changeset 4e1f8f


Ignore:
Timestamp:
Sep 11, 2012, 9:17:57 PM (8 years ago)
Author:
rene <rene@…>
Branches:
ng_0.9
Children:
f9dc3c
Parents:
422911
Message:

use ReplyToSelf? with window parameter

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • content/v_identity.js

    r422911 r4e1f8f  
    143143           
    144144            if (msgType == Components.interfaces.nsIMsgCompDeliverMode.Now)
    145               vI.addReplyToSelf();
     145              vI.addReplyToSelf(window);
    146146
    147147            var vid = document.getElementById("virtualIdentityExtension_msgIdentityClone").vid
     
    253253    initSystemStage2 : function() {
    254254        Log.debug("initSystemStage2.")
    255         vI.initReplyTo();
     255        vI.initReplyTo(window);
    256256        vI.storage.init();
    257257        vI.smartIdentity.init();
  • modules/vI_replyToSelf.js

    r422911 r4e1f8f  
    3030let Log = setupLogging("virtualIdentity.replyToSelf");
    3131
    32 function initReplyTo() {
     32function initReplyTo(vIcomposeWindow) {
     33  let replyToSelfObj = vIcomposeWindow.document.getElementById("virtualIdentityExtension_autoReplyToSelfLabel");
    3334  if (vIprefs.get("autoReplyToSelf")) {
    3435    replyToSelfObj.removeAttribute("hidden");
    35     removeAllReplyTos();
     36    removeAllReplyTos(vIcomposeWindow, replyToSelfObj);
    3637  }
    3738  else
     
    3940};
    4041
    41 function removeAllReplyTos() {
     42function removeAllReplyTos(vIcomposeWindow, replyToSelfObj) {
    4243  if (!replyToSelfObj.hasAttribute("hidden")) {
    4344    for (var row = 1; row <= vIcomposeWindow.top.MAX_RECIPIENTS; row ++) {
     
    5152};
    5253
    53 function addReplyToSelf() {
     54function addReplyToSelf(vIcomposeWindow) {
     55  let replyToSelfObj = vIcomposeWindow.document.getElementById("virtualIdentityExtension_autoReplyToSelfLabel");
    5456  if (!replyToSelfObj.hasAttribute("hidden")) {
    55     try {
    56       vIcomposeWindow.awAddRecipient("addr_reply",vIcomposeWindow.document.getElementById("virtualIdentityExtension_msgIdentityClone").label);
    57       Log.debug("added ReplyToSelf");
    58       replyToSelfObj.setAttribute("hidden","true");
    59     } catch (e) { Log.debug("ReplyToSelf failed"); dumpCallStack(e); };
     57    vIcomposeWindow.awAddRecipient("addr_reply",vIcomposeWindow.document.getElementById("virtualIdentityExtension_msgIdentityClone").label);
     58    Log.debug("added ReplyToSelf");
     59    replyToSelfObj.setAttribute("hidden","true");
    6060  }
    61 }
    62 
    63 let replyToSelfObj = null;
    64 let vIcomposeWindow = Cc["@mozilla.org/appshell/window-mediator;1"]
    65   .getService(Ci.nsIWindowMediator)
    66   .getMostRecentWindow(null);
    67 vIcomposeWindow.addEventListener("load", function () {
    68   replyToSelfObj = vIcomposeWindow.document.getElementById("virtualIdentityExtension_autoReplyToSelfLabel");
    69   }, false);
     61};
Note: See TracChangeset for help on using the changeset viewer.