Commit b5ef9574 authored by CardBook's avatar CardBook

version 33.1

parent 114a6de7
...@@ -71,15 +71,6 @@ style chrome://messenger/content/customizeToolbar.xul chrome://cardbook-toolb ...@@ -71,15 +71,6 @@ style chrome://messenger/content/customizeToolbar.xul chrome://cardbook-toolb
overlay chrome://messenger/content/messenger.xul chrome://cardbook/content/ovl_cardbook.xul overlay chrome://messenger/content/messenger.xul chrome://cardbook/content/ovl_cardbook.xul
overlay chrome://messenger/content/messenger.xul chrome://cardbook/content/ovl_cardbookContexts.xul overlay chrome://messenger/content/messenger.xul chrome://cardbook/content/ovl_cardbookContexts.xul
# support for CardBook menu in composition window
overlay chrome://messenger/content/messengercompose/messengercompose.xul chrome://cardbook/content/ovl_cardbookComposeMsg.xul
# support for collected mail
overlay chrome://messenger/content/messengercompose/messengercompose.xul chrome://cardbook/content/collected/ovl_collected.xul
# support for expanding list
overlay chrome://messenger/content/messengercompose/messengercompose.xul chrome://cardbook/content/lists/ovl_list.xul
# support for search engines # support for search engines
overlay chrome://messenger/content/messenger.xul chrome://cardbook/content/filters/ovl_filters.xul overlay chrome://messenger/content/messenger.xul chrome://cardbook/content/filters/ovl_filters.xul
...@@ -99,14 +90,23 @@ overlay chrome://messenger/content/messenger.xul chrome://cardbook/content/birt ...@@ -99,14 +90,23 @@ overlay chrome://messenger/content/messenger.xul chrome://cardbook/content/birt
# support for importing attachments # support for importing attachments
overlay chrome://messenger/content/messenger.xul chrome://cardbook/content/attachments/ovl_attachments.xul overlay chrome://messenger/content/messenger.xul chrome://cardbook/content/attachments/ovl_attachments.xul
# support for attaching a vCard
overlay chrome://messenger/content/messengercompose/messengercompose.xul chrome://cardbook/content/attachvCard/ovl_attachvCard.xul
# support for CardBook Tab # support for CardBook Tab
overlay chrome://messenger/content/messenger.xul chrome://cardbook/content/ovl_cardbookTab.xul overlay chrome://messenger/content/messenger.xul chrome://cardbook/content/ovl_cardbookTab.xul
# support for Contacts sidebar # support for Contacts sidebar
overlay chrome://messenger/content/messengercompose/messengercompose.xul chrome://cardbook/content/contactsSidebar/ovl_cardbookContactsSidebarMain.xul overlay chrome://messenger/content/messengercompose/messengercompose.xul chrome://cardbook/content/contactsSidebar/ovl_cardbookContactsSidebarMain.xul
# support for attaching a vCard
overlay chrome://messenger/content/messengercompose/messengercompose.xul chrome://cardbook/content/attachvCard/ovl_attachvCard.xul
# support for CardBook menu in composition window
overlay chrome://messenger/content/messengercompose/messengercompose.xul chrome://cardbook/content/ovl_cardbookComposeMsg.xul
# support for collected mail
overlay chrome://messenger/content/messengercompose/messengercompose.xul chrome://cardbook/content/collected/ovl_collected.xul
# support for expanding list
overlay chrome://messenger/content/messengercompose/messengercompose.xul chrome://cardbook/content/lists/ovl_list.xul
# support for the message window # support for the message window
overlay chrome://messenger/content/messageWindow.xul chrome://cardbook/content/ovl_cardbookContexts.xul overlay chrome://messenger/content/messageWindow.xul chrome://cardbook/content/ovl_cardbookContexts.xul
...@@ -39,7 +39,8 @@ ...@@ -39,7 +39,8 @@
windowtype="CardBook:contactEditionWindow" windowtype="CardBook:contactEditionWindow"
style="min-width:500px;min-height:600px;"> style="min-width:500px;min-height:600px;">
<script src="chrome://cardbook/content/cardbookObserver.js"/> <script src="chrome://cardbook/content/observers/cardBookObserverRepository.js"/>
<script src="chrome://cardbook/content/observers/cardBookEditionPrefObserver.js"/>
<script src="chrome://cardbook/content/preferences/cardbookPreferences.js"/> <script src="chrome://cardbook/content/preferences/cardbookPreferences.js"/>
<script src="chrome://cardbook/content/cardbookClipboard.js"/> <script src="chrome://cardbook/content/cardbookClipboard.js"/>
<script src="chrome://cardbook/content/cardbookUtils.js"/> <script src="chrome://cardbook/content/cardbookUtils.js"/>
......
...@@ -2208,6 +2208,7 @@ if ("undefined" == typeof(cardbookSynchronization)) { ...@@ -2208,6 +2208,7 @@ if ("undefined" == typeof(cardbookSynchronization)) {
cardbookSynchronization.loadAccount(result[i], initialSync, true, myMode); cardbookSynchronization.loadAccount(result[i], initialSync, true, myMode);
} }
cardbookSynchronization.setPeriodicSyncs(); cardbookSynchronization.setPeriodicSyncs();
cardbookUtils.notifyObservers("cardbook.accountsLoaded");
}, },
loadAccount: function (aDirPrefId, aSync, aAddAccount, aMode) { loadAccount: function (aDirPrefId, aSync, aAddAccount, aMode) {
......
...@@ -1881,6 +1881,11 @@ if ("undefined" == typeof(wdw_cardbookConfiguration)) { ...@@ -1881,6 +1881,11 @@ if ("undefined" == typeof(wdw_cardbookConfiguration)) {
cardbookElementTools.loadCountries(countryPopup, countryList, country, true, true); cardbookElementTools.loadCountries(countryPopup, countryList, country, true, true);
}, },
validateDisplaySettings: function () {
cardbookRepository.showNameAs = document.getElementById('showNameAsRadiogroup').selectedItem.value
cardbookRepository.dateDisplayedFormat = document.getElementById('dateDisplayedFormatMenulist').selectedItem.value;
},
load: function () { load: function () {
wdw_cardbookConfiguration.loadTitle(); wdw_cardbookConfiguration.loadTitle();
wdw_cardbookConfiguration.addAcceptButton(); wdw_cardbookConfiguration.addAcceptButton();
...@@ -1931,6 +1936,7 @@ if ("undefined" == typeof(wdw_cardbookConfiguration)) { ...@@ -1931,6 +1936,7 @@ if ("undefined" == typeof(wdw_cardbookConfiguration)) {
wdw_cardbookConfiguration.validateEventEntryTitle(); wdw_cardbookConfiguration.validateEventEntryTitle();
wdw_cardbookConfiguration.validateAdrFormula(); wdw_cardbookConfiguration.validateAdrFormula();
wdw_cardbookConfiguration.validateAutocompleteRestrictSearchFields(); wdw_cardbookConfiguration.validateAutocompleteRestrictSearchFields();
wdw_cardbookConfiguration.validateDisplaySettings();
if (!(wdw_cardbookConfiguration.validateCustomValues())) { if (!(wdw_cardbookConfiguration.validateCustomValues())) {
// don't work // don't work
// return false; // return false;
......
...@@ -564,7 +564,6 @@ if ("undefined" == typeof(wdw_cardbookContactsSidebar)) { ...@@ -564,7 +564,6 @@ if ("undefined" == typeof(wdw_cardbookContactsSidebar)) {
editCard: function () { editCard: function () {
var listOfUid = wdw_cardbookContactsSidebar.getSelectedCards(); var listOfUid = wdw_cardbookContactsSidebar.getSelectedCards();
var AB = MailServices.ab.getDirectoryFromId(listOfUid[0][2]);
if (listOfUid[0][0] === "CARDCARDBOOK" || listOfUid[0][0] === "LISTCARDBOOK") { if (listOfUid[0][0] === "CARDCARDBOOK" || listOfUid[0][0] === "LISTCARDBOOK") {
var myCard = listOfUid[0][1]; var myCard = listOfUid[0][1];
var myOutCard = new cardbookCardParser(); var myOutCard = new cardbookCardParser();
...@@ -580,6 +579,7 @@ if ("undefined" == typeof(wdw_cardbookContactsSidebar)) { ...@@ -580,6 +579,7 @@ if ("undefined" == typeof(wdw_cardbookContactsSidebar)) {
cardbookUtils.openEditionWindow(myOutCard, "Edit" + myType, "cardbook.cardModifiedIndirect"); cardbookUtils.openEditionWindow(myOutCard, "Edit" + myType, "cardbook.cardModifiedIndirect");
} }
} else if (listOfUid[0][0] === "CARDCORE") { } else if (listOfUid[0][0] === "CARDCORE") {
var AB = MailServices.ab.getDirectoryFromId(listOfUid[0][2]);
var myCard = listOfUid[0][1]; var myCard = listOfUid[0][1];
goEditCardDialog(AB.URI, myCard); goEditCardDialog(AB.URI, myCard);
} else if (listOfUid[0][0] === "LISTCORE") { } else if (listOfUid[0][0] === "LISTCORE") {
...@@ -596,6 +596,19 @@ if ("undefined" == typeof(wdw_cardbookContactsSidebar)) { ...@@ -596,6 +596,19 @@ if ("undefined" == typeof(wdw_cardbookContactsSidebar)) {
wdw_cardbookContactsSidebar.search(); wdw_cardbookContactsSidebar.search();
}, },
newCard: function () {
var myNewCard = new cardbookCardParser();
myNewCard.dirPrefId = document.getElementById('CardBookABMenulist').selectedItem.value
cardbookUtils.openEditionWindow(myNewCard, "CreateContact", "cardbook.cardAddedDirect");
},
newList: function () {
var myNewCard = new cardbookCardParser();
myNewCard.isAList = true;
myNewCard.dirPrefId = document.getElementById('CardBookABMenulist').selectedItem.value
cardbookUtils.openEditionWindow(myNewCard, "CreateList", "cardbook.cardAddedDirect");
},
selectAllKey: function () { selectAllKey: function () {
var myTree = document.getElementById('abResultsTree'); var myTree = document.getElementById('abResultsTree');
myTree.view.selection.selectAll(); myTree.view.selection.selectAll();
...@@ -659,20 +672,30 @@ if ("undefined" == typeof(wdw_cardbookContactsSidebar)) { ...@@ -659,20 +672,30 @@ if ("undefined" == typeof(wdw_cardbookContactsSidebar)) {
}, },
loadPanel: function () { loadPanel: function () {
myCardBookSideBarObserver.register(); if (Services.vc.compare(Services.appinfo.version, "60") >= 0) {
myCardBookSideBarPrefObserver.register(); document.getElementById("abContextMenuButton").hidden=false;
} else {
document.getElementById("abContextMenuButton").hidden=true;
}
cardBookSideBarObserver.register();
cardBookSideBarPrefObserver.register();
document.title = parent.document.getElementById("sidebar-title").value; document.title = parent.document.getElementById("sidebar-title").value;
wdw_cardbookContactsSidebar.waitForMsgIdentityFinished(); wdw_cardbookContactsSidebar.waitForMsgIdentityFinished();
}, },
unloadPanel: function () { unloadPanel: function () {
myCardBookSideBarObserver.unregister(); cardBookSideBarObserver.unregister();
myCardBookSideBarPrefObserver.unregister(); cardBookSideBarPrefObserver.unregister();
}, },
loadRestrictions: function () { loadRestrictions: function () {
var outerID = content.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIDOMWindowUtils).outerWindowID; // Mail Redirect has no content
var msgIdentity = cardbookRepository.composeMsgIdentity[outerID]; if (content) {
var outerID = content.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIDOMWindowUtils).outerWindowID;
var msgIdentity = cardbookRepository.composeMsgIdentity[outerID];
} else {
var msgIdentity = "";
}
var result = []; var result = [];
result = cardbookPreferences.getAllRestrictions(); result = cardbookPreferences.getAllRestrictions();
wdw_cardbookContactsSidebar.ABInclRestrictions = {}; wdw_cardbookContactsSidebar.ABInclRestrictions = {};
...@@ -788,12 +811,18 @@ if ("undefined" == typeof(wdw_cardbookContactsSidebar)) { ...@@ -788,12 +811,18 @@ if ("undefined" == typeof(wdw_cardbookContactsSidebar)) {
waitForMsgIdentityFinished: function () { waitForMsgIdentityFinished: function () {
var lTimerMsgIdentity = Components.classes["@mozilla.org/timer;1"].createInstance(Components.interfaces.nsITimer); var lTimerMsgIdentity = Components.classes["@mozilla.org/timer;1"].createInstance(Components.interfaces.nsITimer);
lTimerMsgIdentity.initWithCallback({ notify: function(lTimerMsgIdentity) { lTimerMsgIdentity.initWithCallback({ notify: function(lTimerMsgIdentity) {
var outerID = content.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIDOMWindowUtils).outerWindowID; // Mail Redirect has no content
if (cardbookRepository.composeMsgIdentity[outerID]) { if (content) {
var outerID = content.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIDOMWindowUtils).outerWindowID;
if (cardbookRepository.composeMsgIdentity[outerID]) {
wdw_cardbookContactsSidebar.loadAB(); wdw_cardbookContactsSidebar.loadAB();
lTimerMsgIdentity.cancel(); lTimerMsgIdentity.cancel();
} }
} else {
wdw_cardbookContactsSidebar.loadAB();
lTimerMsgIdentity.cancel();
} }
}
}, 500, Components.interfaces.nsITimer.TYPE_REPEATING_SLACK); }, 500, Components.interfaces.nsITimer.TYPE_REPEATING_SLACK);
}, },
......
...@@ -30,7 +30,8 @@ ...@@ -30,7 +30,8 @@
<script src="chrome://cardbook/content/cardbookUtils.js"/> <script src="chrome://cardbook/content/cardbookUtils.js"/>
<script src="chrome://cardbook/content/cardbookElementTools.js"/> <script src="chrome://cardbook/content/cardbookElementTools.js"/>
<script src="chrome://cardbook/content/cardbookCardParser.js"/> <script src="chrome://cardbook/content/cardbookCardParser.js"/>
<script src="chrome://cardbook/content/cardbookObserver.js"/> <script src="chrome://cardbook/content/observers/cardBookObserverRepository.js"/>
<script src="chrome://cardbook/content/observers/cardBookSideBarObserver.js"/>
<script src="chrome://cardbook/content/wdw_cardbook.js"/> <script src="chrome://cardbook/content/wdw_cardbook.js"/>
<script src="chrome://cardbook/content/cardbookSynchronization.js"/> <script src="chrome://cardbook/content/cardbookSynchronization.js"/>
<script src="chrome://cardbook/content/preferences/cardbookPreferences.js"/> <script src="chrome://cardbook/content/preferences/cardbookPreferences.js"/>
...@@ -43,6 +44,15 @@ ...@@ -43,6 +44,15 @@
<key id="selectAllKey" modifiers="control" key="a" oncommand="wdw_cardbookContactsSidebar.selectAllKey();"/> <key id="selectAllKey" modifiers="control" key="a" oncommand="wdw_cardbookContactsSidebar.selectAllKey();"/>
</keyset> </keyset>
<menupopup id="sidebarAbContextMenu">
<menuitem label="&newContactAbContext.label;"
accesskey="&newContactAbContext.accesskey;"
oncommand="wdw_cardbookContactsSidebar.newCard();"/>
<menuitem label="&newListAbContext.label;"
accesskey="&newListAbContext.accesskey;"
oncommand="wdw_cardbookContactsSidebar.newList();"/>
</menupopup>
<menupopup id="cardProperties" onpopupshowing="return wdw_cardbookContactsSidebar.cardPropertiesMenuContextShowing();"> <menupopup id="cardProperties" onpopupshowing="return wdw_cardbookContactsSidebar.cardPropertiesMenuContextShowing();">
<menuitem id="toEmail" label="&addtoToFieldMenu.label;" accesskey="&addtoToFieldMenu.accesskey;" oncommand="wdw_cardbookContactsSidebar.addEmails('addr_to');"/> <menuitem id="toEmail" label="&addtoToFieldMenu.label;" accesskey="&addtoToFieldMenu.accesskey;" oncommand="wdw_cardbookContactsSidebar.addEmails('addr_to');"/>
<menuitem id="ccEmail" label="&addtoCcFieldMenu.label;" accesskey="&addtoCcFieldMenu.accesskey;" oncommand="wdw_cardbookContactsSidebar.addEmails('addr_cc');"/> <menuitem id="ccEmail" label="&addtoCcFieldMenu.label;" accesskey="&addtoCcFieldMenu.accesskey;" oncommand="wdw_cardbookContactsSidebar.addEmails('addr_cc');"/>
...@@ -57,8 +67,13 @@ ...@@ -57,8 +67,13 @@
<vbox id="results_box" flex="1"> <vbox id="results_box" flex="1">
<separator class="thin"/> <separator class="thin"/>
<label id="addressbookPickerLabel" value="&addressbookPicker.label;" accesskey="&addressbookPicker.accesskey;" control="CardBookABMenulist"/> <hbox id="AbPickerHeader" class="toolbar">
<hbox class="toolbar" align="center"> <label id="addressbookPickerLabel" value="&addressbookPicker.label;" accesskey="&addressbookPicker.accesskey;" control="CardBookABMenulist"/>
<spacer flex="1"/>
<toolbarbutton id="abContextMenuButton"
onclick="document.getElementById('sidebarAbContextMenu').openPopup(event.target, 'after_end');"/>
</hbox>
<hbox id="panel-bar" class="toolbar" align="center">
<menulist id="CardBookABMenulist" oncommand="wdw_cardbookContactsSidebar.onABChange();" flex="1" persist="value"> <menulist id="CardBookABMenulist" oncommand="wdw_cardbookContactsSidebar.onABChange();" flex="1" persist="value">
<menupopup id="CardBookABMenupopup"/> <menupopup id="CardBookABMenupopup"/>
</menulist> </menulist>
......
if ("undefined" == typeof(ovl_lightningAttendees)) { if ("undefined" == typeof(ovl_lightningAttendees)) {
var ovl_lightningAttendees = { var ovl_lightningAttendees = {
onLoad: function() { onLoad: function() {
myCardBookLightningObserver.register(); cardBookLightningObserver.register();
cardbookAutocomplete.setLightningCompletion(); cardbookAutocomplete.setLightningCompletion();
cardbookAutocomplete.loadCssRules(); cardbookAutocomplete.loadCssRules();
window.removeEventListener('load', arguments.callee, true); window.removeEventListener('load', arguments.callee, true);
......
...@@ -6,7 +6,8 @@ ...@@ -6,7 +6,8 @@
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script src="chrome://cardbook/content/wdw_log.js"/> <script src="chrome://cardbook/content/wdw_log.js"/>
<script src="chrome://cardbook/content/cardbookObserver.js"/> <script src="chrome://cardbook/content/observers/cardBookObserverRepository.js"/>
<script src="chrome://cardbook/content/observers/cardBookLightningObserver.js"/>
<script src="chrome://cardbook/content/preferences/cardbookPreferences.js"/> <script src="chrome://cardbook/content/preferences/cardbookPreferences.js"/>
<script src="chrome://cardbook/content/autocomplete/cardbookAutocomplete.js"/> <script src="chrome://cardbook/content/autocomplete/cardbookAutocomplete.js"/>
<script src="chrome://cardbook/content/lightning/ovl_lightningAttendees.js"/> <script src="chrome://cardbook/content/lightning/ovl_lightningAttendees.js"/>
......
if ("undefined" == typeof(cardBookComposeMsgObserver)) {
try {
ChromeUtils.import("resource://gre/modules/Services.jsm");
}
catch(e) {
Components.utils.import("resource://gre/modules/Services.jsm");
}
var cardBookComposeMsgObserver = {
register: function() {
cardBookObserverRepository.registerAll(this);
},
unregister: function() {
cardBookObserverRepository.unregisterAll(this);
},
observe: function(aSubject, aTopic, aData) {
switch (aTopic) {
case "cardbook.ABAddedDirect":
case "cardbook.ABRemovedDirect":
case "cardbook.ABModifiedDirect":
case "cardbook.preferencesChanged":
cardbookAutocomplete.loadCssRules();
break;
}
}
};
};
if ("undefined" == typeof(cardBookEditionPrefObserver)) {
try {
ChromeUtils.import("resource://gre/modules/Services.jsm");
}
catch(e) {
Components.utils.import("resource://gre/modules/Services.jsm");
}
var cardBookEditionPrefObserver = {
register: function() {
cardBookPrefObserverRepository.registerAll(this);
},
unregister: function() {
cardBookPrefObserverRepository.unregisterAll(this);
},
observe: function(aSubject, aTopic, aData) {
switch (aData) {
case "mailPopularityTabView":
case "advancedTabView":
wdw_cardEdition.showCorrectTabs();
break;
}
}
};
};
if ("undefined" == typeof(cardBookLightningObserver)) {
try {
ChromeUtils.import("resource://gre/modules/Services.jsm");
}
catch(e) {
Components.utils.import("resource://gre/modules/Services.jsm");
}
var cardBookLightningObserver = {
register: function() {
cardBookObserverRepository.registerAll(this);
},
unregister: function() {
cardBookObserverRepository.unregisterAll(this);
},
observe: function(aSubject, aTopic, aData) {
switch (aTopic) {
case "cardbook.ABAddedDirect":
case "cardbook.ABRemovedDirect":
case "cardbook.ABModifiedDirect":
case "cardbook.preferencesChanged":
cardbookAutocomplete.loadCssRules();
break;
}
}
};
};
if ("undefined" == typeof(cardBookObserver)) {
try {
ChromeUtils.import("resource://gre/modules/Services.jsm");
}
catch(e) {
Components.utils.import("resource://gre/modules/Services.jsm");
}
var cardBookObserver = {
register: function() {
cardBookObserverRepository.registerAll(this);
},
unregister: function() {
cardBookObserverRepository.unregisterAll(this);
},
observe: function(aSubject, aTopic, aData) {
switch (aTopic) {
case "cardbook.DBOpen":
cardbookSynchronization.loadComplexSearchAccounts();
break;
case "cardbook.complexSearchInitLoaded":
cardbookSynchronization.loadAccounts();
break;
}
}
};
};
if ("undefined" == typeof(cardBookObserver)) { if ("undefined" == typeof(cardBookPrefObserverRepository)) {
try { try {
ChromeUtils.import("resource://gre/modules/Services.jsm"); ChromeUtils.import("resource://gre/modules/Services.jsm");
} }
...@@ -19,73 +19,15 @@ if ("undefined" == typeof(cardBookObserver)) { ...@@ -19,73 +19,15 @@ if ("undefined" == typeof(cardBookObserver)) {
aPrefObserver.branch.removeObserver("", aPrefObserver); aPrefObserver.branch.removeObserver("", aPrefObserver);
} }
}; };
};
var cardBookPrefObserver = { if ("undefined" == typeof(cardBookObserverRepository)) {
register: function() { try {
cardBookPrefObserverRepository.registerAll(this); ChromeUtils.import("resource://gre/modules/Services.jsm");
}, }
catch(e) {
unregister: function() { Components.utils.import("resource://gre/modules/Services.jsm");
cardBookPrefObserverRepository.unregisterAll(this); }
},
observe: function(aSubject, aTopic, aData) {
switch (aData) {
case "panesView":
ovl_cardbookLayout.orientPanes();
break;
case "viewABPane":
case "viewABContact":
ovl_cardbookLayout.resizePanes();
break;
case "mailPopularityTabView":
case "technicalTabView":
case "vcardTabView":
wdw_cardbook.showCorrectTabs();
break;
}
}
};
var cardBookEditionPrefObserver = {
register: function() {
cardBookPrefObserverRepository.registerAll(this);
},
unregister: function() {
cardBookPrefObserverRepository.unregisterAll(this);
},
observe: function(aSubject, aTopic, aData) {
switch (aData) {
case "mailPopularityTabView":
case "advancedTabView":
wdw_cardEdition.showCorrectTabs();
break;
}
}
};
var myCardBookSideBarPrefObserver = {
register: function() {
cardBookPrefObserverRepository.registerAll(this);
},
unregister: function() {
cardBookPrefObserverRepository.unregisterAll(this);
},
observe: function(aSubject, aTopic, aData) {
switch (aData) {
case "exclusive":
wdw_cardbookContactsSidebar.loadAB();
break;
case "preferEmailPref":
wdw_cardbookContactsSidebar.onABChange();
break;
}
}
};
var cardBookObserverRepository = { var cardBookObserverRepository = {
registerAll: function(aObserver) { registerAll: function(aObserver) {
...@@ -115,6 +57,7 @@ if ("undefined" == typeof(cardBookObserver)) { ...@@ -115,6 +57,7 @@ if ("undefined" == typeof(cardBookObserver)) {
Services.obs.addObserver(aObserver, "cardbook.DBOpen", false); Services.obs.addObserver(aObserver, "cardbook.DBOpen", false);
Services.obs.addObserver(aObserver, "cardbook.complexSearchInitLoaded", false); Services.obs.addObserver(aObserver, "cardbook.complexSearchInitLoaded", false);
Services.obs.addObserver(aObserver, "cardbook.complexSearchLoaded", false); Services.obs.addObserver(aObserver, "cardbook.complexSearchLoaded", false);
Services.obs.addObserver(aObserver, "cardbook.accountsLoaded", false);
Services.obs.addObserver(aObserver, "cardbook.preferencesChanged", false); Services.obs.addObserver(aObserver, "cardbook.preferencesChanged", false);
...@@ -148,190 +91,11 @@ if ("undefined" == typeof(cardBookObserver)) { ...@@ -148,190 +91,11 @@ if ("undefined" == typeof(cardBookObserver)) {
Services.obs.removeObserver(aObserver, "cardbook.DBOpen"); Services.obs.removeObserver(aObserver, "cardbook.DBOpen");
Services.obs.removeObserver(aObserver, "cardbook.complexSearchInitLoaded"); Services.obs.removeObserver(aObserver, "cardbook.complexSearchInitLoaded");
Services.obs.removeObserver(aObserver, "cardbook.complexSearchLoaded"); Services.obs.removeObserver(aObserver, "cardbook.complexSearchLoaded");
Services.obs.removeObserver(aObserver, "cardbook.accountsLoaded");
Services.obs.removeObserver(aObserver, "cardbook.preferencesChanged"); Services.obs.removeObserver(aObserver, "cardbook.preferencesChanged");
Services.obs.removeObserver(aObserver, "cardbook.identityChanged"); Services.obs.removeObserver(aObserver, "cardbook.identityChanged");
} }
}; };
var myCardBookLightningObserver = {
register: function() {
cardBookObserverRepository.registerAll(this);
},
unregister: function() {
cardBookObserverRepository.unregisterAll(this);
},
observe: function(aSubject, aTopic, aData) {
switch (aTopic) {
case "cardbook.ABAddedDirect":
case "cardbook.ABRemovedDirect":
case "cardbook.ABModifiedDirect":
case "cardbook.preferencesChanged":
cardbookAutocomplete.loadCssRules();
break;
}
}
};
var myCardBookSideBarObserver = {
register: function() {
cardBookObserverRepository.registerAll(this);
},
unregister: function() {
cardBookObserverRepository.unregisterAll(this);
},
observe: function(aSubject, aTopic, aData) {
switch (aTopic) {
case "cardbook.ABAddedDirect":
case "cardbook.ABRemovedDirect":
case "cardbook.ABModifiedDirect":
wdw_cardbookContactsSidebar.loadAB();
break;
case "cardbook.syncRunning":
wdw_cardbookContactsSidebar.onABChange(aData);
break;
case "cardbook.catAddedIndirect":
case "cardbook.cardAddedIndirect":
case "cardbook.cardRemovedIndirect":
case "cardbook.cardRemovedDirect":
case "cardbook.cardModifiedIndirect":
case "cardbook.cardPasted":
case "cardbook.cardDragged":
case "cardbook.cardImportedFromFile":
case "cardbook.catAddedDirect":
case "cardbook.catRemovedIndirect":
case "cardbook.catRemovedDirect":
case "cardbook.catModifiedIndirect":
case "cardbook.catModifiedDirect":
case "cardbook.cardAddedDirect":
case "cardbook.cardModifiedDirect":
wdw_cardbookContactsSidebar.onABChange();
break;
case "cardbook.preferencesChanged":
wdw_cardbookContactsSidebar.onRestrictionsChanged();
break;
case "cardbook.identityChanged":
wdw_cardbookContactsSidebar.onIdentityChanged(aData);
break;
}
}
};
var myCardBookComposeMsgObserver = {
register: function() {
cardBookObserverRepository.registerAll(this);
},
unregister: function() {
cardBookObserverRepository.unregisterAll(this);
},
observe: function(aSubject, aTopic, aData) {
switch (aTopic) {
case "cardbook.ABAddedDirect":
case "cardbook.ABRemovedDirect":
case "cardbook.ABModifiedDirect":
case "cardbook.preferencesChanged":
cardbookAutocomplete.loadCssRules();
break;
}
}
};
var cardBookObserver = {
register: function() {
cardBookObserverRepository.registerAll(this);
},
unregister: function() {
cardBookObserverRepository.unregisterAll(this);
},
observe: function(aSubject, aTopic, aData) {
switch (aTopic) {
case "cardbook.DBOpen":
cardbookSynchronization.loadComplexSearchAccounts();
break;
case "cardbook.complexSearchInitLoaded":
cardbookSynchronization.loadAccounts();
if (wdw_cardbook) {
wdw_cardbook.loadFirstWindow();
}
break;
}
}