Changeset 6178fe


Ignore:
Timestamp:
Nov 13, 2007, 7:25:10 PM (14 years ago)
Author:
rene <rene@…>
Branches:
master
Children:
03c0d1
Parents:
24ee6c
Message:

save-in-Addressbook button was not always shown as user selected it, bugfix

Location:
chrome/content/v_identity
Files:
2 edited

Legend:

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

    r24ee6c r6178fe  
    4343    rdfService : Components.classes["@mozilla.org/rdf/rdf-service;1"]
    4444            .getService(Components.interfaces.nsIRDFService),
    45    
     45
     46    prefroot : Components.classes["@mozilla.org/preferences-service;1"]
     47            .getService(Components.interfaces.nsIPrefService)
     48            .getBranch(null),
     49
    4650    original_functions : {
    4751        awSetInputAndPopupValue : null,
     
    5660    },
    5761   
     62    observe: function() {
     63        vI_addressBook.elements.Obj_aBookSave.setAttribute("hidden",
     64            !vI.preferences.getBoolPref("aBook_show_switch") ||
     65            !vI.preferences.getBoolPref("aBook_use_non_vI") ||
     66            !vI.preferences.getBoolPref("aBook_use"));
     67        vI_addressBook.elements.Obj_aBookSave.checked = vI.preferences.getBoolPref("aBook_storedefault");
     68    },
     69   
     70    addObserver: function() {
     71        vI_addressBook.prefroot.addObserver("extensions.virtualIdentity.aBook_use", vI_addressBook, false);
     72        vI_addressBook.prefroot.addObserver("extensions.virtualIdentity.aBook_show_switch", vI_addressBook, false);
     73        vI_addressBook.prefroot.addObserver("extensions.virtualIdentity.aBook_use_non_vI", vI_addressBook, false);
     74        vI_addressBook.prefroot.addObserver("extensions.virtualIdentity.aBook_storedefault", vI_addressBook, false);   
     75    },
     76   
     77    removeObserver: function() {
     78        vI_addressBook.prefroot.removeObserver("extensions.virtualIdentity.aBook_use", vI_addressBook);
     79        vI_addressBook.prefroot.removeObserver("extensions.virtualIdentity.aBook_show_switch", vI_addressBook);
     80        vI_addressBook.prefroot.removeObserver("extensions.virtualIdentity.aBook_use_non_vI", vI_addressBook);
     81        vI_addressBook.prefroot.removeObserver("extensions.virtualIdentity.aBook_storedefault", vI_addressBook);
     82    },
    5883   
    5984    init: function() {
    6085        vI_addressBook.elements.Obj_aBookSave = document.getElementById("aBook_save");
    61         vI_addressBook.elements.Obj_aBookSave.setAttribute("hidden",
    62                     !vI.preferences.getBoolPref("aBook_use_non_vI"));
    63         vI_addressBook.elements.Obj_aBookSave.checked = vI.preferences.getBoolPref("aBook_storedefault");
     86        vI_addressBook.addObserver();
     87        vI_addressBook.observe();
    6488       
    6589        // better approach would be to use te onchange event, but this one is not fired in any change case
     
    272296        if (!vI.preferences.getBoolPref("aBook_use")) {
    273297            vI_notificationBar.dump("## vI_addressBook: usage deactivated.\n")
    274             return all_addresses;
     298            return;
    275299        }
    276300       
     
    450474
    451475}
     476window.addEventListener("unload", function(e) { vI_addressBook.removeObserver(); }, false);
  • chrome/content/v_identity/vI_msgIdentityClone.js

    r24ee6c r6178fe  
    305305                vI.elements.Obj_vILogo.setAttribute("hidden","false");
    306306                vI_addressBook.elements.Obj_aBookSave.setAttribute("hidden",
    307                     !vI.preferences.getBoolPref("aBook_show_switch"));
     307                    !vI.preferences.getBoolPref("aBook_show_switch") ||
     308                    !vI.preferences.getBoolPref("aBook_use"));
    308309            }
    309310            // code to hide the signature
     
    323324                vI.elements.Obj_vILogo.setAttribute("hidden","true");
    324325                vI_addressBook.elements.Obj_aBookSave.setAttribute("hidden",
    325                     !vI.preferences.getBoolPref("aBook_use_non_vI"));
     326                    !vI.preferences.getBoolPref("aBook_show_switch") ||
     327                    !vI.preferences.getBoolPref("aBook_use_non_vI") ||
     328                    !vI.preferences.getBoolPref("aBook_use"));
    326329                vI_msgIdentityClone.elements.Obj_MsgIdentity_clone
    327330                    .setAttribute("oldvalue",null)
Note: See TracChangeset for help on using the changeset viewer.