Changeset 28c1a0


Ignore:
Timestamp:
Jul 19, 2008, 7:06:08 PM (12 years ago)
Author:
rene <rene@…>
Branches:
master
Children:
ff647c
Parents:
1c4459
Message:

virtual identites with base_id set are now used differently: first base_id is set, than vid is set. This repairs broken ReplyTo? if vid was selcted from menu.

File:
1 edited

Legend:

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

    r1c4459 r28c1a0  
    2828    text_usualId_class : "plain menulist_clone-textbox",
    2929    text_virtualId_class : "plain menulist_clone-textbox vIactiv",
    30    
     30
    3131    localIdentityData : null,
    3232   
     
    189189    },
    190190   
     191    __setIdentity : function (id) {
     192            // set orignal Identity-Menu to the selected Identity
     193            vI_msgIdentityClone.copySelectedIdentity(id);
     194            // set smtp-selector to the smtp of the selcted Identity
     195            vI_smtpSelector.resetMenuToMsgIdentity(id);
     196            // recognize reply-to fields for auto-reply
     197            vI_msgIdentityClone.initReplyToFields(id);
     198    },
     199
    191200    // this LoadIdentity - oncommand is used by our clone MsgIdentity Menu
    192201    // remove the Virtual Account if a different (usual) Account is choosen in the cloned dropdown-menu
    193     LoadIdentity : function()
    194     {
     202    LoadIdentity : function() {
    195203        vI_notificationBar.dump("## vI_msgIdentityClone: LoadIdentity\n");
    196         vI_msgIdentityClone.cleanupReplyTo();
    197204        vI_msgIdentityClone.initMsgIdentityTextbox_clone();
    198205       
     
    202209        if (vI_msgIdentityClone.elements.Obj_MsgIdentity_clone.selectedItem.value != "vid" &&
    203210            vI_msgIdentityClone.elements.Obj_MsgIdentity_clone.selectedItem.getAttribute("value") != "vid") {
     211
     212            // clean reply-to fields before reinit
     213            vI_msgIdentityClone.cleanupReplyTo();
     214            // remove possibly stored base_id_key
    204215            vI_msgIdentityClone.elements.Obj_MsgIdentity_clone.base_id_key = null;
    205             vI_msgIdentityClone.copySelectedIdentity(
    206                 vI_msgIdentityClone.elements.Obj_MsgIdentity_clone.selectedItem.value);
    207             vI_smtpSelector.resetMenuToMsgIdentity(
    208                 vI_msgIdentityClone.elements.Obj_MsgIdentity_clone.selectedItem.value);
     216           
     217            vI_msgIdentityClone.__setIdentity(vI_msgIdentityClone.elements.Obj_MsgIdentity_clone.selectedItem.value);
     218           
    209219            // Identitys might have IdentityName set differently to 'name <email>',
    210220            // so retrieve name and email directly from Identity
     
    214224        else {
    215225            vI_notificationBar.dump("## vI_msgIdentityClone: LoadIdentity virtual Identity\n");
    216             vI_msgIdentityClone.elements.Obj_MsgIdentity_clone.base_id_key =
    217                 vI_msgIdentityClone.elements.Obj_MsgIdentity_clone.selectedItem.base_id_key
    218             vI_msgIdentityClone.copySelectedIdentity(
    219                 vI_msgIdentityClone.elements.Obj_MsgIdentity_clone.base_id_key);
     226           
     227            var base_id_key = vI_msgIdentityClone.elements.Obj_MsgIdentity_clone.selectedItem.base_id_key
     228            // if MenuItem has a base_id_key set,first set Identity to base_id
     229            if (base_id_key) {
     230                vI_notificationBar.dump("## vI_msgIdentityClone: base_id found, set menu temporarily to base_id\n");
     231                vI_msgIdentityClone.__setIdentity(base_id_key);
     232                // store base_id_key if available
     233                vI_msgIdentityClone.elements.Obj_MsgIdentity_clone.base_id_key = base_id_key
     234            }
     235           
     236            // set smtp-selector to the smtp of the selected Identity
    220237            vI_smtpSelector.setMenuToKey(
    221238                vI_msgIdentityClone.elements.Obj_MsgIdentity_clone.selectedItem.smtp_key);
     239
    222240            if (vI_msgIdentityClone.elements.Obj_MsgIdentity_clone.selectedItem.extras)
    223241                vI_msgIdentityClone.elements.Obj_MsgIdentity_clone.selectedItem.extras.setValues();
     
    235253            vI_helper.getAccountname(vI_msgIdentityClone.elements.Obj_MsgIdentity_clone.selectedItem));
    236254        vI_msgIdentityClone.markAsNewAccount(vI_msgIdentityClone.isExistingIdentity());
    237         vI_msgIdentityClone.initReplyToFields();
     255
     256
    238257    },
    239258   
    240259    setIdentity : function(newName, timeStamp) {
    241         vI_notificationBar.dump("## initReplyToFields setIdentity " + newName + "\n");
     260        vI_notificationBar.dump("## vI_msgIdentityClone: setIdentity " + newName + "\n");
    242261        vI_msgIdentityClone.initMsgIdentityTextbox_clone();
    243262        vI_msgIdentityClone.elements.Obj_MsgIdentityTextbox_clone.value = newName;
     
    280299   
    281300    cleanReplyToFields : function() {
     301        vI_notificationBar.dump("## vI_msgIdentityClone: cleanReplyToFields\n");
    282302        vI_msgIdentityClone.replyToInputElem = null;
    283303        vI_msgIdentityClone.replyToPopupElem = null;
     
    290310    // called directly after a change of the Identity with the dropdown menu
    291311    // searches the first reply-to row and assumes that this is the one we like to adapt
    292     initReplyToFields : function() {
    293         // TB 1.x doesn'T accept the value without the getAttribute
    294         var id = (vI_msgIdentityClone.elements.Obj_MsgIdentity_clone.selectedItem.value ||
    295             vI_msgIdentityClone.elements.Obj_MsgIdentity_clone.selectedItem.getAttribute("value"))
    296         if (id == "vid") return;
     312    initReplyToFields : function(id) {
     313        // v_identity calls initReplyToFields in stage2 without id
     314        if (!id) id = vI_msgIdentityClone.elements.Obj_MsgIdentity_clone.selectedItem.value;
     315
     316        vI_notificationBar.dump("## vI_msgIdentityClone: initReplyToFields id=" + id + "\n");
    297317        var replyTo = gAccountManager.getIdentity(id).replyTo
    298         vI_notificationBar.dump("## initReplyToFields identity.replyTo: " + replyTo + "\n");
     318        vI_notificationBar.dump("## vI_msgIdentityClone: initReplyToFields identity.replyTo: " + replyTo + "\n");
    299319        if (replyTo == "") return
    300320       
     
    304324            var awValue = awGetInputElement(row).value
    305325            if (awType == "addr_reply" && awValue == replyTo) {
    306                 vI_notificationBar.dump("## vI_msgIdentityClone: Reply-To found in row " + row + "\n");
     326                vI_notificationBar.dump("## vI_msgIdentityClone: initReplyToFields Reply-To found in row " + row + "\n");
    307327                vI_msgIdentityClone.replyToPopupElem = awGetPopupElement(row)
    308328                vI_msgIdentityClone.replyToInputElem = awGetInputElement(row)
     
    310330                }
    311331        }
    312         if (!vI_msgIdentityClone.replyToInputElem) vI_notificationBar.dump("## vI_msgIdentityClone: no Reply-To row found\n");
     332        if (!vI_msgIdentityClone.replyToInputElem) vI_notificationBar.dump("## vI_msgIdentityClone: initReplyToFields no Reply-To row found\n");
    313333    },
    314334   
    315335    cleanupReplyTo : function() {
    316336        if (!vI_msgIdentityClone.replyToSynchronize) return
    317         vI_notificationBar.dump("## cleanupReplyTo\n");
     337        vI_notificationBar.dump("## vI_msgIdentityClone: cleanupReplyTo\n");
    318338       
    319339        // check if sychronizing should still be done (will be stopped if value was modified by hand)
     
    322342            if (vI_msgIdentityClone.replyToInitValue) {
    323343                var replyTo = vI_msgIdentityClone.replyToInitValue;
    324                 vI_notificationBar.dump("## restore ReplyTo: " + replyTo + "\n");
     344                vI_notificationBar.dump("## vI_msgIdentityClone: cleanupReplyTo restore ReplyTo: " + replyTo + "\n");
    325345                vI_msgIdentityClone.replyToInputElem.value = replyTo;
    326346                vI_msgIdentityClone.replyToInputElem.setAttribute("value",replyTo)
     
    338358   
    339359    synchroneReplyTo : function() {
    340         vI_notificationBar.dump("## synchroneReplyTo\n");
     360        vI_notificationBar.dump("## vI_msgIdentityClone: synchroneReplyTo\n");
    341361        if ( (vI_msgIdentityClone.replyToPopupElem.selectedItem.value != "addr_reply") ||
    342362            (vI_msgIdentityClone.replyToStoredLastValue &&
     
    352372        if (!vI.preferences.getBoolPref("autoReplyToSelf")) return
    353373        if (!vI_msgIdentityClone.replyToSynchronize) {
    354             vI_notificationBar.dump("## updateReplyTo stopped Synchronizing\n")
     374            vI_notificationBar.dump("## vI_msgIdentityClone: updateReplyTo stopped Synchronizing\n")
    355375            return
    356376        }
    357         vI_notificationBar.dump("## updateReplyTo replyToStoredLastValue="
     377        vI_notificationBar.dump("## vI_msgIdentityClone: updateReplyTo replyToStoredLastValue="
    358378                + vI_msgIdentityClone.replyToStoredLastValue + "\n");
    359379
Note: See TracChangeset for help on using the changeset viewer.