Changeset 75af75


Ignore:
Timestamp:
Oct 2, 2009, 1:19:00 PM (10 years ago)
Author:
rene <rene@…>
Branches:
lite_0.1, multiEdit, ng_0.6, ng_0.6_help, ng_0.8, ng_0.9
Children:
ec0f59
Parents:
ea80f9
Message:

reimplemented autoReplyTo

Location:
chrome
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • chrome/content/v_identity/vI_msgIdentityCloneTools.js

    rea80f9 r75af75  
    5353        }
    5454    },
    55 
    56     replyToInputElem : null,    // it is important to store the Elements and not the row
    57     replyToPopupElem : null,    // cause row might change if one above gets removed
    58     replyToInitValue : null,
    59     replyToStoredLastValue : null,
    60     replyToSynchronize : true,
    6155   
    62     cleanReplyToFields : function() {
    63         vI_notificationBar.dump("## vI_msgIdentityCloneTools: cleanReplyToFields\n");
    64         vI_msgIdentityCloneTools.replyToInputElem = null;
    65         vI_msgIdentityCloneTools.replyToPopupElem = null;
    66         vI_msgIdentityCloneTools.replyToInitValue = null;
    67         vI_msgIdentityCloneTools.replyToStoredLastValue = null;
    68         vI_msgIdentityCloneTools.replyToSynchronize = true;
    69         vI_msgIdentityCloneTools.blurEventBlocked = true;
     56    initReplyTo : function() {
     57        if (vI_statusmenu.prefroot.getBoolPref("extensions.virtualIdentity.autoReplyToSelf")) {
     58            document.getElementById("autoReplyToSelfLabel").removeAttribute("hidden");
     59            vI_msgIdentityCloneTools.removeAllReplyTos();
     60        }
     61        else document.getElementById("autoReplyToSelfLabel").setAttribute("hidden", "true");
    7062    },
    7163   
    72     // called directly after a change of the Identity with the dropdown menu
    73     // searches the first reply-to row and assumes that this is the one we like to adapt
    74     initReplyToFields : function(id) {
    75 //      vI_notificationBar.dump("## vI_msgIdentityCloneTools: initReplyToFields id=" + id + "\n");
    76         var replyTo = gAccountManager.getIdentity(id).replyTo
    77         if (replyTo == "") return
    78        
    79         vI_msgIdentityCloneTools.replyToInitValue = replyTo;
    80         for (var row = 1; row <= top.MAX_RECIPIENTS; row ++) {
    81             var awType = awGetPopupElement(row).selectedItem.getAttribute("value");
    82             var awValue = awGetInputElement(row).value
    83             if (awType == "addr_reply" && awValue == replyTo) {
    84                 vI_notificationBar.dump("## vI_msgIdentityCloneTools: initReplyToFields identity.replyTo: " + replyTo + " found in row " + row + "\n");
    85                 vI_msgIdentityCloneTools.replyToPopupElem = awGetPopupElement(row)
    86                 vI_msgIdentityCloneTools.replyToInputElem = awGetInputElement(row)
    87                 break;
     64    removeAllReplyTos : function() {
     65        if (!document.getElementById("autoReplyToSelfLabel").hasAttribute("hidden")) {
     66            for (var row = 1; row <= top.MAX_RECIPIENTS; row ++) {
     67                var awType = awGetPopupElement(row).selectedItem.getAttribute("value");
     68                if (awType == "addr_reply") {
     69                    vI_notificationBar.dump("## vI_msgIdentityCloneTools: removed ReplyTo found in row " + row + "\n");
     70                    awDeleteRow(row--); // removed one line therefore decrease row-value
     71                }
    8872            }
    8973        }
    9074    },
    91    
    92     cleanupReplyTo : function() {
    93         if (!vI_msgIdentityCloneTools.replyToSynchronize) return
    94         vI_notificationBar.dump("## vI_msgIdentityCloneTools: cleanupReplyTo\n");
    95        
    96         // check if sychronizing should still be done (will be stopped if value was modified by hand)
    97         // if still in synchronizing mode reset the fields
    98         if ( vI_msgIdentityCloneTools.replyToInputElem && vI_msgIdentityCloneTools.synchroneReplyTo() ) {
    99             if (vI_msgIdentityCloneTools.replyToInitValue) {
    100                 var replyTo = vI_msgIdentityCloneTools.replyToInitValue;
    101                 vI_notificationBar.dump("## vI_msgIdentityCloneTools: cleanupReplyTo restore ReplyTo: " + replyTo + "\n");
    102                 vI_msgIdentityCloneTools.replyToInputElem.value = replyTo;
    103                 vI_msgIdentityCloneTools.replyToInputElem.setAttribute("value",replyTo)
    104             }
    105             else {
    106                 awDeleteHit(vI_msgIdentityCloneTools.replyToInputElem);
    107                 window.setTimeout("document.getElementById('msgIdentity_clone').textBoxElem.focus();", 0)
    108             }
     75
     76    addReplyToSelf : function() {
     77        if (!document.getElementById("autoReplyToSelfLabel").hasAttribute("hidden")) {
     78            awAddRecipient("addr_reply",document.getElementById("msgIdentity_clone").label);
     79            vI_notificationBar.dump("## vI_msgIdentityCloneTools: added ReplyToSelf");
     80            document.getElementById("autoReplyToSelfLabel").setAttribute("hidden","true");
    10981        }
    110         vI_msgIdentityCloneTools.replyToInputElem = null;
    111         vI_msgIdentityCloneTools.replyToPopupElem = null;
    112         vI_msgIdentityCloneTools.replyToInitValue = null;
    113         vI_msgIdentityCloneTools.replyToStoredLastValue = null;
    114     },
    115    
    116     synchroneReplyTo : function() {
    117         vI_notificationBar.dump("## vI_msgIdentityCloneTools: synchroneReplyTo\n");
    118         if ( (vI_msgIdentityCloneTools.replyToPopupElem.selectedItem) && // might be destroyed...
    119             (vI_msgIdentityCloneTools.replyToPopupElem.selectedItem.value != "addr_reply" ||
    120             (vI_msgIdentityCloneTools.replyToStoredLastValue &&
    121             vI_msgIdentityCloneTools.replyToInputElem.value != vI_msgIdentityCloneTools.replyToStoredLastValue) ) ) {
    122             vI_msgIdentityCloneTools.replyToSynchronize = false;
    123             vI_notificationBar.dump("## vI_msgIdentityCloneTools: (former) Reply-To entry changed, stop synchronizing\n");
    124         }
    125         return vI_msgIdentityCloneTools.replyToSynchronize
    126     },
    127    
    128     // updateReplyTo is called on every change in the From: field, if its a virtual Identity
    129     updateReplyTo : function() {
    130         if (!vI.preferences.getBoolPref("autoReplyToSelf")) return
    131         if (!vI_msgIdentityCloneTools.replyToSynchronize) {
    132             vI_notificationBar.dump("## vI_msgIdentityCloneTools: updateReplyTo stopped Synchronizing\n")
    133             return
    134         }
    135         vI_notificationBar.dump("## vI_msgIdentityCloneTools: updateReplyTo replyToStoredLastValue="
    136                 + vI_msgIdentityCloneTools.replyToStoredLastValue + "\n");
    137 
    138         // if replyToInputElem not set (so no initial Reply-To row was found) add a row now
    139         if (!vI_msgIdentityCloneTools.replyToInputElem) {
    140             vI_msgIdentityCloneTools.blurEventBlocked = true;
    141             awAddRecipient("addr_reply",document.getElementById("msgIdentity_clone").label)
    142             window.setTimeout("document.getElementById('msgIdentity_clone').textBoxElem.focus();vI_msgIdentityCloneTools.blurEventBlocked = false;", 0)
    143             vI_msgIdentityCloneTools.replyToPopupElem = awGetPopupElement(top.MAX_RECIPIENTS - 1)
    144             vI_msgIdentityCloneTools.replyToInputElem = awGetInputElement(top.MAX_RECIPIENTS - 1)
    145         }
    146        
    147         // check if sychronizing should still be done (will be stopped if value was modified by hand)
    148         if (vI_msgIdentityCloneTools.synchroneReplyTo()) {
    149             vI_msgIdentityCloneTools.replyToInputElem.value =
    150                 document.getElementById("msgIdentity_clone").label;
    151             vI_msgIdentityCloneTools.replyToStoredLastValue = vI_msgIdentityCloneTools.replyToInputElem.value
    152         }       
    15382    }
    15483}
  • chrome/content/v_identity/vI_storage.js

    rea80f9 r75af75  
    7070    awPopupOnCommand : function (element) {
    7171        vI_notificationBar.dump("\n## vI_storage: awPopupOnCommand'" + element.id +"'\n");
    72         vI_storage.updateVIdentityFromStorage(document.getElementById(element.id.replace(/^addressCol1/,"addressCol2")))
     72        vI_storage.updateVIdentityFromStorage(document.getElementById(element.id.replace(/^addressCol1/,"addressCol2")));
     73        if (element.selectedItem.getAttribute("value") == "addr_reply") // if reply-to is manually entered disable AutoReplyToSelf
     74            document.getElementById("autoReplyToSelfLabel").setAttribute("hidden", "true");
     75
    7376    },
    7477   
  • chrome/content/v_identity/v_identity.js

    rea80f9 r75af75  
    173173                    return;
    174174                }
     175                vI_msgIdentityCloneTools.addReplyToSelf();
    175176            }
    176177            if (vid) vI.prepareAccount();
     
    178179//          vI_notificationBar.dump("## v_identity: original_functions.GenericSendMessage\n");
    179180            vI.original_functions.GenericSendMessage(msgType);
     181
    180182//          vI_notificationBar.dump("## v_identity: original_functions.GenericSendMessage done\n");
    181183        },
     
    230232    initSystemStage2 : function() {
    231233        vI_notificationBar.dump("## v_identity: initSystemStage2.\n")
     234        vI_msgIdentityCloneTools.initReplyTo();
    232235        vI_storage.init();
    233236        vI_smartIdentity.init();
     
    248251        var parent_hbox = vI.elements.Obj_MsgIdentity.parentNode;
    249252        var storage_box = document.getElementById("addresses-box");
    250        
     253        var autoReplyToSelfLabel = document.getElementById("autoReplyToSelfLabel");
     254       
     255        storage_box.removeChild(autoReplyToSelfLabel);
     256        parent_hbox.appendChild(autoReplyToSelfLabel);
     257        storage_box.removeChild(vI.elements.Area_MsgIdentityHbox);
     258        parent_hbox.appendChild(vI.elements.Area_MsgIdentityHbox);
     259
    251260        vI.elements.Obj_MsgIdentity.setAttribute("hidden", "true");
    252261        vI.elements.Obj_MsgIdentity.previousSibling.setAttribute("control", "msgIdentity_clone");
    253 
    254         storage_box.removeChild(vI.elements.Area_MsgIdentityHbox);
    255         parent_hbox.appendChild(vI.elements.Area_MsgIdentityHbox);
    256262       
    257263        // initialize the pointers to extension elements (initialize those earlier might brake the interface)
     
    273279        // clean all elements
    274280        document.getElementById("msgIdentity_clone").clean();
    275         vI_msgIdentityCloneTools.cleanReplyToFields();
    276281        vI_smartIdentity.clean();
    277282        vI_notificationBar.dump("## v_identity: everything cleaned.\n")
  • chrome/content/v_identity/v_identity.xml

    rea80f9 r75af75  
    294294        vI_notificationBar.dump("\n** v_identity.xml msgIdentityCloneElem.doCommand() \n")
    295295        this.identityData = this.selectedMenuItem.identityData.getDuplicate();
    296         // clean reply-to fields before reinit
    297         vI_msgIdentityCloneTools.cleanupReplyTo();
    298         // set orignal Identity-Menu to the selected Identity
    299         vI_msgIdentityCloneTools.copySelectedIdentity(this.value);
    300         // recognize reply-to fields for auto-reply
    301         vI_msgIdentityCloneTools.initReplyToFields(this.value);
    302296        ]]></body>
    303297    </method>   
     
    321315        }
    322316        this._popupMenu_separator = true;
    323        
    324         vI_msgIdentityCloneTools.initReplyToFields(this.value);
    325317        ]]></body>
    326318    </method>
     
    445437        var existingIdentity = this.checkForVirtualIdentity();
    446438        if (existingIdentity) this.selectedMenuItem = existingIdentity;
    447        
    448         vI_msgIdentityCloneTools.updateReplyTo();
    449439        ]]></body>
    450440    </method>
     
    452442        <body><![CDATA[
    453443        var existingIdentity = this.identityData.isExistingIdentity(false);
    454         if (!existingIdentity) { this.vid = true; vI_msgIdentityCloneTools.updateReplyTo(); }
    455         else this.vid = false;
     444       
     445        this.vid = (!existingIdentity);
    456446       
    457447        vI_msgIdentityCloneTools.signatureSwitch(existingIdentity);
  • chrome/content/v_identity/v_identity.xul

    rea80f9 r75af75  
    6666
    6767<vbox flex="1" id="addresses-box"> <!-- this is used as a strorage, elements will be rearranged by v_identity_init -->
     68
     69<label id="autoReplyToSelfLabel" context="vI_autoReplyToSelfMenu" value="&vident.composeDialog.autoReplyToSelf.label;" hidden="true" />
    6870   
    6971<hbox id="msgIdentityHbox" flex="1">
     
    8587  <popupset>
    8688      <popup id="vI_statusMenu">
    87           <menuitem type="checkbox" id="vI_statusMenu_storage_save" label="&vident.vI_Menu.storageSave.label;"              oncommand="vI_statusmenu.menuConstraint(this);"/>
    88           <menuitem type="checkbox" id="vI_statusMenu_storage_saveBaseID" label="&vident.vI_Menu.saveBaseID.label;"             oncommand="vI_statusmenu.menuConstraint(vI_statusmenu.objStorageSaveMenuItem);"/>
    89           <menuseparator id="vI_statusMenu_separator" />       
     89          <menuitem type="checkbox" id="vI_statusMenu_storage_save" label="&vident.vI_Menu.storageSave.label;"
     90            oncommand="vI_statusmenu.menuConstraint(this);"/>
     91          <menuitem type="checkbox" id="vI_statusMenu_storage_saveBaseID" label="&vident.vI_Menu.saveBaseID.label;"
     92            oncommand="vI_statusmenu.menuConstraint(vI_statusmenu.objStorageSaveMenuItem);"/>
     93          <menuseparator id="vI_statusMenu_separator" />
    9094          <menuitem class="menuitem-iconic" label="&vident.vI_Menu.Settings.label;"
    9195            oncommand="window.openDialog('chrome://v_identity/content/vI_prefDialogOpener.xul', '', 'chrome');" />
     
    9498      </popup>
    9599  </popupset>
    96  
     100  <popupset>
     101      <popup id="vI_autoReplyToSelfMenu">
     102          <menuitem type="menuitem-iconic" label="&vident.composeDialog.autoReplyToSelf.menuLabel;"
     103            oncommand="document.getElementById('autoReplyToSelfLabel').setAttribute('hidden', 'true');"/>
     104      </popup>
     105  </popupset>
    97106  <popupset>
    98107      <tooltip id="vI_statusMenuTooltip" orient="vertical" >
  • chrome/locale/en-US/v_identity/v_identity.dtd

    rea80f9 r75af75  
    55<!ENTITY vident.composeDialog.fcc_switch.label "Fcc">
    66<!ENTITY vident.composeDialog.fcc_switch.tooltiptext "save copy of sent mail">
     7<!ENTITY vident.composeDialog.autoReplyToSelf.label "(=Reply-To)">
     8<!ENTITY vident.composeDialog.autoReplyToSelf.menuLabel "disable Reply-To synchronization">
    79<!ENTITY vident.replySelector.dialogheader.title "Virtual Identity">
    810<!ENTITY vident.replySelector.caption.label "Choose a Virtual Identity">
Note: See TracChangeset for help on using the changeset viewer.