Changeset 290dde


Ignore:
Timestamp:
Feb 17, 2015, 11:57:35 AM (7 years ago)
Author:
rene <rene@…>
Branches:
ng_0.9
Children:
081ae7
Parents:
dcfdfa
Message:

allow in-between changes of account settings without causing trouble

Files:
5 edited

Legend:

Unmodified
Added
Removed
  • content/accountManagerOverlays/vI_am-Overlay.xul

    rdcfdfa r290dde  
    2525
    2626<overlay xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
    27     <script type="application/x-javascript" src="chrome://v_identity/content/vI_am-Overlay.js"/>
     27    <script type="application/x-javascript" src="chrome://v_identity/content/accountManagerOverlays/vI_am-Overlay.js"/>
    2828</overlay>
  • content/accountManagerOverlays/vI_am-smtpOverlay.xul

    rdcfdfa r290dde  
    2525
    2626<overlay xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
    27     <script type="application/x-javascript" src="chrome://v_identity/content/vI_am-smtpOverlay.js"/>
     27    <script type="application/x-javascript" src="chrome://v_identity/content/accountManagerOverlays/vI_am-smtpOverlay.js"/>
    2828</overlay>
  • content/bindings/v_identity.xml

    rdcfdfa r290dde  
    367367                    this._msgIdentityElem.selectedItem = MenuItems[index];
    368368                    this._msgIdentityElem.value = MenuItems[index].getAttribute("value");
     369          this._msgIdentityPopupElem.doCommand();
    369370                    break;
    370371                }
    371372            }
    372             this._msgIdentityPopupElem.doCommand();
    373373        }
    374374        this.identityData = this.selectedMenuItem.identityData.getDuplicate();
     
    378378            this.identityData.smtp.key = this._AccountManager.getIdentity(this.value).smtpServerKey;
    379379            document.getAnonymousElementByAttribute(this, "anonid", "smtpServerListHbox").smtp = this.identityData.smtp.keyNice;
    380             this.checkForVirtualIdentity();
    381         }
     380        }
     381    this.checkForVirtualIdentity();
    382382    ]]></body>
    383383    </method>   
  • content/v_identity.js

    rdcfdfa r290dde  
    3636    Components.utils.import("resource://v_identity/vI_smartIdentity.js", virtualIdentityExtension);
    3737    Components.utils.import("resource://v_identity/vI_log.js", virtualIdentityExtension);
     38    Components.utils.import("resource:///modules/mailServices.js");
    3839
    3940    var main = {
     
    418419          if (topic == "am-acceptChanges") {
    419420            Log.debug("account changes observed");
    420             document.getElementById("virtualIdentityExtension_msgIdentityClone").clean();
    421             document.getElementById("virtualIdentityExtension_msgIdentityClone").init();
     421            Log.debug("cleaning original msgIdentityPopup");
     422            var MenuItems = main.elements.Obj_MsgIdentityPopup.childNodes;
     423            while (MenuItems.length > 0) {
     424              try {MenuItems[0].clean();} catch (e) { };
     425              main.elements.Obj_MsgIdentityPopup.removeChild(MenuItems[0])
     426            }
     427            main.replacement_functions.FillIdentityList(main.elements.Obj_MsgIdentity)
     428            let virtualIdentityExtension_msgIdentityClone = document.getElementById("virtualIdentityExtension_msgIdentityClone")
     429            let tmp_identity = virtualIdentityExtension_msgIdentityClone.identityData;
     430            virtualIdentityExtension_msgIdentityClone.clean();
     431            virtualIdentityExtension_msgIdentityClone.init();
     432            Log.debug("cleaning original msgIdentityPopup done.");
     433            tmp_identity.existingID = tmp_identity.isExistingIdentity(false)
     434            if (tmp_identity.existingID) {
     435              tmp_identity.id.key = tmp_identity.existingID
     436            } else {
     437              tmp_identity.id.key = MailServices.accounts.defaultAccount.defaultIdentity.key
     438            }
     439            Log.debug("adding previous identity to msgIdentityClone");
     440            virtualIdentityExtension_msgIdentityClone.selectedMenuItem = virtualIdentityExtension_msgIdentityClone.addIdentityToCloneMenu(tmp_identity);
     441            Log.debug("adding previous identity to msgIdentityClone done.");
    422442          }
    423443        },
  • modules/vI_rdfDatasource.js

    rdcfdfa r290dde  
    6969  this._rdfFileName = rdfFileName;
    7070  if (this._rdfFileName) this.init();
    71   if (!dontRegisterObserver) this.AccountManagerObserver.register();
     71  if (!dontRegisterObserver) this.AccountManagerObserver.register(this);
    7272  try {
    7373    this._extVersion = get3PaneWindow().virtualIdentityExtension.extensionVersion;
     
    932932  //  code adapted from http://xulsolutions.blogspot.com/2006/07/creating-uninstall-script-for.html
    933933  AccountManagerObserver: {
     934    self: null,
    934935    _uninstall: false,
    935936    observe: function (subject, topic, data) {
    936937      if (topic == "am-smtpChanges" || topic == "am-acceptChanges") {
    937938        Log.debug("account/smtp changes observed");
    938         this.searchIdentityMismatch();
    939         this.searchSmtpMismatch();
    940         this.refreshAccountInfo();
     939        this.self.searchIdentityMismatch();
     940        this.self.searchSmtpMismatch();
     941        this.self.refreshAccountInfo();
    941942      }
    942943    },
    943     register: function () {
     944    register: function (self) {
     945      this.self = self;
    944946      Log.debug("register AccountManagerObserver");
    945947      var obsService = Components.classes["@mozilla.org/observer-service;1"].
Note: See TracChangeset for help on using the changeset viewer.