Changeset fe3a63


Ignore:
Timestamp:
Feb 18, 2008, 9:03:44 PM (12 years ago)
Author:
rene <rene@…>
Branches:
master
Children:
374555
Parents:
3caa82
Message:

fixed order of reinit, init

Location:
chrome/content/v_identity
Files:
5 edited

Legend:

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

    r3caa82 rfe3a63  
    3838   
    3939    init : function() {
    40         vI_msgIdentityClone.elements.Obj_MsgIdentity = document.getElementById("msgIdentity");
    41         vI_msgIdentityClone.elements.Obj_MsgIdentityPopup = document.getElementById("msgIdentityPopup");
    42         vI_msgIdentityClone.elements.Obj_MsgIdentity_clone = document.getElementById("msgIdentity_clone");
    43         vI_msgIdentityClone.elements.Obj_MsgIdentityPopup_clone = document.getElementById("msgIdentityPopup_clone");
     40        var reopen = vI_msgIdentityClone.elements.Obj_MsgIdentity
     41        if (!reopen) {
     42            vI_msgIdentityClone.elements.Obj_MsgIdentity = document.getElementById("msgIdentity");
     43            vI_msgIdentityClone.elements.Obj_MsgIdentityPopup = document.getElementById("msgIdentityPopup");
     44            vI_msgIdentityClone.elements.Obj_MsgIdentity_clone = document.getElementById("msgIdentity_clone");
     45            vI_msgIdentityClone.elements.Obj_MsgIdentityPopup_clone = document.getElementById("msgIdentityPopup_clone");
     46        }
    4447        vI_msgIdentityClone.clone_Obj_MsgIdentity();
    45         vI_msgIdentityClone.elements.Obj_MsgIdentity.setAttribute("hidden", "true");
    46         vI_msgIdentityClone.elements.Obj_MsgIdentity_clone.setAttribute("hidden", "false");
    47         vI_msgIdentityClone.elements.Obj_MsgIdentity.previousSibling.setAttribute("control", "msgIdentity_clone");
    48     },
    49    
    50     reinit : function() {
    51         vI_notificationBar.dump("## vI_msgIdentityClone: reinit\n");
     48        if (!reopen) {
     49            vI_msgIdentityClone.elements.Obj_MsgIdentity.setAttribute("hidden", "true");
     50            vI_msgIdentityClone.elements.Obj_MsgIdentity_clone.setAttribute("hidden", "false");
     51            vI_msgIdentityClone.elements.Obj_MsgIdentity.previousSibling.setAttribute("control", "msgIdentity_clone");
     52        }
     53        else vI_msgIdentityClone.elements.Obj_MsgIdentityPopup_clone.doCommand();
     54    },
     55   
     56    clean : function() {
    5257        MenuItems = vI_msgIdentityClone.elements.Obj_MsgIdentityPopup_clone.childNodes
    5358        while (MenuItems.length > 0) vI_msgIdentityClone.elements.Obj_MsgIdentityPopup_clone.removeChild(MenuItems[0])
    54         vI_msgIdentityClone.clone_Obj_MsgIdentity();
    55         vI_msgIdentityClone.elements.Obj_MsgIdentityPopup_clone.doCommand();
    5659    },
    5760   
     
    204207    replyToSynchronize : true,
    205208   
    206     reinitReplyToFields : function() {
     209    cleanReplyToFields : function() {
    207210        replyToInputElem = null;
    208211        replyToPopupElem = null;
     
    210213        replyToStoredLastValue = null;
    211214        replyToSynchronize = true;
    212         vI_msgIdentityClone.initReplyToFields();
    213215    },
    214216   
  • chrome/content/v_identity/vI_smartIdentity.js

    r3caa82 rfe3a63  
    2929    smartIdentity_BaseIdentity : null,
    3030
    31     reinit : function() {
     31    clean : function() {
    3232        vI_smartIdentity.smartIdentity_BaseIdentity = null;
    33         vI_smartIdentity.init();
    3433    },
    3534   
  • chrome/content/v_identity/vI_smtpSelector.js

    r3caa82 rfe3a63  
    3434   
    3535    init : function() {
    36         vI_smtpSelector.elements.Area_SMTPServerList = document.getElementById("smtpServerListHbox");
    37         vI_smtpSelector.elements.Obj_SMTPServerList = document.getElementById("smtp_server_list");
    38         vI_smtpSelector.elements.Obj_SMTPServerListPopup = document.getElementById("smtp_server_list_popup");
     36        // only do this once
     37        if (!vI_smtpSelector.elements.Area_SMTPServerList) {
     38            vI_smtpSelector.elements.Area_SMTPServerList = document.getElementById("smtpServerListHbox");
     39            vI_smtpSelector.elements.Obj_SMTPServerList = document.getElementById("smtp_server_list");
     40            vI_smtpSelector.elements.Obj_SMTPServerListPopup = document.getElementById("smtp_server_list_popup");
     41            vI_smtpSelector.addObserver();
     42        }
    3943        vI_smtpSelector.__loadSMTP_server_list();
    4044        vI_smtpSelector.__selectUsedSMTPServer();
    41         vI_smtpSelector.addObserver();
    4245        vI_smtpSelector.observe(); // just do it once to initialize the status
    4346    },
    4447   
    45     reinit : function() {
    46         vI_notificationBar.dump("## v_smtpSelector: reinit\n")
     48    clean : function() {
     49        vI_notificationBar.dump("## v_smtpSelector: clean\n")
    4750        MenuItems = vI_smtpSelector.elements.Obj_SMTPServerListPopup.childNodes
    4851        while (MenuItems.length > 0) vI_smtpSelector.elements.Obj_SMTPServerListPopup.removeChild(MenuItems[0])
    49         vI_smtpSelector.__loadSMTP_server_list();
    50         vI_smtpSelector.__selectUsedSMTPServer();
    51         vI_smtpSelector.observe(); // just do it once to initialize the status
    5252    },
    5353
  • chrome/content/v_identity/vI_storage.js

    r3caa82 rfe3a63  
    4646            .getBranch(null),
    4747   
    48     reinit: function() {
     48    clean: function() {
    4949        vI_storage.multipleRecipients = null;
    5050        vI_storage.lastCheckedEmail = {};
     
    5252        vI_storage.firstUsedInputElement = null;
    5353        vI_storage.firstUsedStorageData = null;
     54        awSetInputAndPopupValue = vI_storage.original_functions.awSetInputAndPopupValue;
    5455    },
    5556   
     
    9697   
    9798    init: function() {
    98         vI_storage.elements.Obj_storageSave = document.getElementById("storage_save");
    99         vI_storage.addObserver();
    100         vI_storage.observe();
    101        
    102         // better approach would be to use te onchange event, but this one is not fired in any change case
    103         // see https://bugzilla.mozilla.org/show_bug.cgi?id=355367
    104         // same seems to happen with the ondragdrop event
    105         awGetInputElement(1).setAttribute("onblur",
    106             "window.setTimeout(vI_storage.awOnBlur, 250, this.parentNode.parentNode.parentNode);")
    107         awGetPopupElement(1).setAttribute("oncommand",
    108             "window.setTimeout(vI_storage.awPopupOnCommand, 250, this);")
     99        if (!vI_storage.elements.Obj_storageSave) {
     100            vI_storage.elements.Obj_storageSave = document.getElementById("storage_save");
     101            vI_storage.addObserver();
     102            vI_storage.observe();
     103           
     104            // better approach would be to use te onchange event, but this one is not fired in any change case
     105            // see https://bugzilla.mozilla.org/show_bug.cgi?id=355367
     106            // same seems to happen with the ondragdrop event
     107            awGetInputElement(1).setAttribute("onblur",
     108                "window.setTimeout(vI_storage.awOnBlur, 250, this.parentNode.parentNode.parentNode);")
     109            awGetPopupElement(1).setAttribute("oncommand",
     110                "window.setTimeout(vI_storage.awPopupOnCommand, 250, this);")
     111        }
    109112        vI_storage.original_functions.awSetInputAndPopupValue = awSetInputAndPopupValue;
    110113        awSetInputAndPopupValue = function (inputElem, inputValue, popupElem, popupValue, rowNumber) {
  • chrome/content/v_identity/v_identity.js

    r3caa82 rfe3a63  
    121121        NotifyComposeFieldsReady: function() {
    122122            vI_notificationBar.dump("## v_identity: NotifyComposeFieldsReady\n");
    123             vI.open();
     123            vI.initSystemStage2();
    124124        },
    125125        ComposeProcessDone: function(aResult) {
     
    209209        vI.Cleanup_Account();
    210210    },
    211    
     211
    212212    // initialization //
    213213    init: function() {
    214214        vI.unicodeConverter.charset="UTF-8";
     215        vI.adapt_interface();
     216        vI.adapt_genericSendMessage();
    215217        gMsgCompose.RegisterStateListener(vI.ComposeStateListener);
    216218        window.addEventListener('compose-window-reopen', vI.reopen, true);
    217219        window.addEventListener('compose-window-close', vI.close, true);
     220        vI.initSystemStage1();
     221    },
     222   
     223    initSystemStage1 : function() {
     224        vI_smtpSelector.init();
     225        vI_msgIdentityClone.init();
     226        vI_msgIdentityClone.initReplyToFields();
     227    },
     228   
     229    initSystemStage2 : function() {
     230        vI_storage.init();
     231        vI_smartIdentity.init();   
    218232    },
    219233   
     
    232246        var storage_box = document.getElementById("addresses-box");
    233247       
    234         storage_box.removeChild(vI.elements.Area_MsgIdentityHbox)
     248        storage_box.removeChild(vI.elements.Area_MsgIdentityHbox);
    235249        parent_hbox.appendChild(vI.elements.Area_MsgIdentityHbox);
    236250       
     
    251265    },
    252266   
    253     open : function() {
    254         vI_notificationBar.dump("## v_identity: composeDialog opened.\n")
    255         vI.adapt_interface();
    256         vI.adapt_genericSendMessage();
    257         vI_smtpSelector.init();
    258         vI_msgIdentityClone.init();
    259         vI_msgIdentityClone.initReplyToFields();
    260         vI_storage.init();
    261         vI_smartIdentity.init();
    262     },
    263    
    264267    reopen: function() {
    265268        vI_notificationBar.clear_dump()
    266         vI_notificationBar.dump("## v_identity: composeDialog reopened.\n")
    267         vI.adapt_interface();
    268         vI.adapt_genericSendMessage();
    269         vI_storage.reinit();
    270         vI_smtpSelector.reinit();
    271         vI_msgIdentityClone.reinit();
    272         vI_msgIdentityClone.reinitReplyToFields();
    273         vI_storage.reinit();
    274         vI_smartIdentity.reinit();
     269        vI_notificationBar.dump("## v_identity: composeDialog reopened. " + gMsgCompose.type + "\n")
     270        // clean all elements
     271        vI_smtpSelector.clean();
     272        vI_msgIdentityClone.clean();
     273        vI_msgIdentityClone.cleanReplyToFields();
     274        vI_storage.clean();
     275        vI_smartIdentity.clean();
     276        // now (re)init the elements
     277        vI.initSystemStage1();
     278       
     279        // stateLsitener only works with reply etc., so check MsgType to activate stage2
     280        var msgComposeType = Components.interfaces.nsIMsgCompType;
     281        switch (gMsgCompose.type) {
     282            case msgComposeType.New:
     283            case msgComposeType.NewsPost:
     284            case msgComposeType.MailToUrl:
     285                vI.initSystemStage2();
     286                break;
     287            default:
     288                gMsgCompose.RegisterStateListener(vI.ComposeStateListener);
     289        }
    275290    },
    276291   
Note: See TracChangeset for help on using the changeset viewer.