Changeset b91264


Ignore:
Timestamp:
Dec 2, 2014, 8:54:19 PM (5 years ago)
Author:
rene <rene@…>
Branches:
ng_0.9
Children:
71a07e
Parents:
48333d
Message:

seperated mixed storage-objects for different windows

Location:
content
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • content/vI_storage.js

    r48333d rb91264  
    3838
    3939    var storage = {
     40      initTime: null, // used to trace different objects of same type
    4041      focusedElement: null,
    41 
     42     
    4243      lastCheckedEmail: {}, // array of last checked emails per row,
    4344      // to prevent ugly double dialogs and time-consuming double-checks
     
    5051
    5152      clean: function () {
    52         Log.debug("clean.");
     53        Log.debug("clean. storageElem-time " + storage.initTime);
    5354        storage.multipleRecipients = null;
    5455        storage.lastCheckedEmail = {};
    5556        storage.firstUsedInputElement = null;
    56         awSetInputAndPopupValue = storage.original_functions.awSetInputAndPopupValue;
     57        if (storage.original_functions.awSetInputAndPopupValue) {
     58          awSetInputAndPopupValue = storage.original_functions.awSetInputAndPopupValue;
     59          storage.original_functions.awSetInputAndPopupValue = null;
     60        }
    5761        if (storage._rdfDatasourceAccess) storage._rdfDatasourceAccess.clean();
    5862      },
     
    6468      replacement_functions: {
    6569        awSetInputAndPopupValue: function (inputElem, inputValue, popupElem, popupValue, rowNumber) {
    66           Log.debug("awSetInputAndPopupValue '" + inputElem.id + "'");
     70          Log.debug("awSetInputAndPopupValue '" + inputElem.id + "'" + " storageElem-time " + storage.initTime);
    6771          storage.original_functions.awSetInputAndPopupValue(inputElem, inputValue, popupElem, popupValue, rowNumber);
    6872          storage.__updateVIdentityFromStorage(inputElem, storage.currentWindow);
     
    99103      currentWindow: null,
    100104      init: function () {
     105        if (!this.initTime)
     106          this.initTime = (new Date()).toLocaleTimeString();
    101107        if (!storage.initialized) {
     108          Log.debug("initializing storage request environment storageElem-time " + storage.initTime);
    102109          storage._rdfDatasourceAccess = new vI.rdfDatasourceAccess();
    103110
     
    111118              var oldBlur = input.getAttribute("onblur")
    112119              input.setAttribute("onblur", (oldBlur ? oldBlur + "; " : "") +
    113                 "window.setTimeout(virtualIdentityExtension.storage.awOnBlur, 250, this, window);")
     120                "window.setTimeout(virtualIdentityExtension.main.storage.awOnBlur, 250, this, window);")
    114121              var oldFocus = input.getAttribute("onfocus")
    115122              input.setAttribute("onfocus", (oldFocus ? oldFocus + "; " : "") +
    116                 "window.setTimeout(virtualIdentityExtension.storage.awOnFocus, 250, this, window);")
     123                "window.setTimeout(virtualIdentityExtension.main.storage.awOnFocus, 250, this, window);")
    117124            }
    118125            var popup = window.awGetPopupElement(row);
     
    120127              var oldCommand = popup.getAttribute("oncommand")
    121128              popup.setAttribute("oncommand", (oldCommand ? oldCommand + "; " : "") +
    122                 "window.setTimeout(virtualIdentityExtension.storage.awPopupOnCommand, 250, this, window);")
     129                "window.setTimeout(virtualIdentityExtension.main.storage.awPopupOnCommand, 250, this, window);")
    123130            }
    124131          }
    125132          storage.currentWindow = window;
     133          Log.debug("initializing storage request environment - done.");
    126134          storage.initialized = true;
    127135        }
     136        else {
     137          Log.debug("storage request environment already initialized storageElem-time " + storage.initTime);
     138        }
    128139
    129140        if (typeof awSetInputAndPopupValue == 'function' && storage.original_functions.awSetInputAndPopupValue == null) {
     141          Log.debug("replacing awSetInputAndPopupValue");
    130142          storage.original_functions.awSetInputAndPopupValue = awSetInputAndPopupValue;
    131143          awSetInputAndPopupValue = function (inputElem, inputValue, popupElem, popupValue, rowNumber) {
     
    133145          }
    134146        }
     147       
    135148        // reset unavailable storageExtras preferences
    136149        AddonManager.getAddonByID("{847b3a00-7ab1-11d4-8f02-006008948af5}", function (addon) {
     
    145158      firstUsedInputElement: null, // this stores the first Element for which a Lookup in the Storage was successfull
    146159      __updateVIdentityFromStorage: function (inputElement, currentWindow) {
     160        Log.debug("__updateVIdentityFromStorage storageElem-time " + storage.initTime);
    147161        if (!vI.vIprefs.get("storage")) {
    148162          Log.debug("Storage deactivated");
     
    219233      }
    220234    }
    221     vI.storage = storage;
     235    vI.main.storage = storage;
    222236  }
    223237});
  • content/v_identity.js

    r48333d rb91264  
    3333    Components.utils.import("resource://v_identity/vI_accountUtils.js", virtualIdentityExtension);
    3434    Components.utils.import("resource://v_identity/plugins/signatureSwitch.js", virtualIdentityExtension);
     35    Components.utils.import("resource://v_identity/vI_identityData.js", virtualIdentityExtension);
    3536    Components.utils.import("resource://v_identity/vI_smartIdentity.js", virtualIdentityExtension);
    3637
    3738    var main = {
     39      initTime: null,
    3840      _smartIdentity: null,
    3941     
     
    7880          Log.debug("StateListener reports ComposeProcessDone");
    7981          vI.vIaccount_removeUsedVIAccount();
    80           vI.storage.clean();
     82          main.storage.clean();
    8183        },
    8284        SaveInFolderDone: function (folderURI) {
    8385          Log.debug("SaveInFolderDone");
    8486          vI.vIaccount_removeUsedVIAccount();
    85           vI.storage.clean();
     87          main.storage.clean();
    8688        }
    8789      },
     
    126128
    127129          // if addressCol2 is focused while sending check storage for the entered address before continuing
    128           vI.storage.awOnBlur(vI.storage.focusedElement, window);
     130          main.storage.awOnBlur(main.storage.focusedElement, window);
    129131
    130132          Log.debug("VIdentity_GenericSendMessage");
     
    180182        window.removeEventListener('compose-window-close', main.close, true);
    181183        Log.debug("end. remove Account if there.")
    182         vI.storage.clean();
     184        main.storage.clean();
    183185      },
    184186
     
    215217      // initialization //
    216218      init: function () {
     219        if (!main.initTime)
     220          main.initTime = (new Date()).toLocaleTimeString();
     221        Log.debug("init set main-time " + main.initTime);
    217222        window.removeEventListener('load', main.init, false);
    218223        window.removeEventListener('compose-window-init', main.init, true);
     
    242247
    243248      initSystemStage1: function () {
    244         Log.debug("initSystemStage1.")
     249        Log.debug("initSystemStage1. main-time " + main.initTime);
    245250        document.getElementById("virtualIdentityExtension_msgIdentityClone").init();
    246251        vI.statusmenu.init();
     
    249254
    250255      initSystemStage2: function () {
    251         Log.debug("initSystemStage2.")
     256        Log.debug("initSystemStage2. main-time " + main.initTime);
    252257        Log.debug("document.title=" + document.title + " gMsgCompose=" + gMsgCompose + " msgIdentityClone=" + document.getElementById("virtualIdentityExtension_msgIdentityClone"))
    253258        vI.initReplyTo(window);
    254         vI.storage.init();
    255         this._smartIdentity = new vI.smartIdentity(window, gMsgCompose, vI.storage);
     259        main.storage.init();
     260        new vI.smartIdentity(window, gMsgCompose, main.storage);
    256261        Log.debug("initSystemStage2 done.")
    257262      },
    258263
    259264      close: function () {
    260         vI.storage.clean();
     265        main.storage.clean();
    261266      },
    262267
     
    302307        // clean all elements
    303308        document.getElementById("virtualIdentityExtension_msgIdentityClone").clean();
    304         vI.storage.clean(); // just to be sure!
     309        main.storage.clean(); // just to be sure!
    305310        Log.debug("everything cleaned.")
    306311
Note: See TracChangeset for help on using the changeset viewer.