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
overlay chrome://messenger/content/messenger.xul chrome://cardbook/content/ovl_cardbook.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
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
# support for importing attachments
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
overlay chrome://messenger/content/messenger.xul chrome://cardbook/content/ovl_cardbookTab.xul
# support for Contacts sidebar
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
overlay chrome://messenger/content/messageWindow.xul chrome://cardbook/content/ovl_cardbookContexts.xul
......@@ -39,7 +39,8 @@
windowtype="CardBook:contactEditionWindow"
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/cardbookClipboard.js"/>
<script src="chrome://cardbook/content/cardbookUtils.js"/>
......
......@@ -2208,6 +2208,7 @@ if ("undefined" == typeof(cardbookSynchronization)) {
cardbookSynchronization.loadAccount(result[i], initialSync, true, myMode);
}
cardbookSynchronization.setPeriodicSyncs();
cardbookUtils.notifyObservers("cardbook.accountsLoaded");
},
loadAccount: function (aDirPrefId, aSync, aAddAccount, aMode) {
......
......@@ -1881,6 +1881,11 @@ if ("undefined" == typeof(wdw_cardbookConfiguration)) {
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 () {
wdw_cardbookConfiguration.loadTitle();
wdw_cardbookConfiguration.addAcceptButton();
......@@ -1931,6 +1936,7 @@ if ("undefined" == typeof(wdw_cardbookConfiguration)) {
wdw_cardbookConfiguration.validateEventEntryTitle();
wdw_cardbookConfiguration.validateAdrFormula();
wdw_cardbookConfiguration.validateAutocompleteRestrictSearchFields();
wdw_cardbookConfiguration.validateDisplaySettings();
if (!(wdw_cardbookConfiguration.validateCustomValues())) {
// don't work
// return false;
......
......@@ -564,7 +564,6 @@ if ("undefined" == typeof(wdw_cardbookContactsSidebar)) {
editCard: function () {
var listOfUid = wdw_cardbookContactsSidebar.getSelectedCards();
var AB = MailServices.ab.getDirectoryFromId(listOfUid[0][2]);
if (listOfUid[0][0] === "CARDCARDBOOK" || listOfUid[0][0] === "LISTCARDBOOK") {
var myCard = listOfUid[0][1];
var myOutCard = new cardbookCardParser();
......@@ -580,6 +579,7 @@ if ("undefined" == typeof(wdw_cardbookContactsSidebar)) {
cardbookUtils.openEditionWindow(myOutCard, "Edit" + myType, "cardbook.cardModifiedIndirect");
}
} else if (listOfUid[0][0] === "CARDCORE") {
var AB = MailServices.ab.getDirectoryFromId(listOfUid[0][2]);
var myCard = listOfUid[0][1];
goEditCardDialog(AB.URI, myCard);
} else if (listOfUid[0][0] === "LISTCORE") {
......@@ -596,6 +596,19 @@ if ("undefined" == typeof(wdw_cardbookContactsSidebar)) {
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 () {
var myTree = document.getElementById('abResultsTree');
myTree.view.selection.selectAll();
......@@ -659,20 +672,30 @@ if ("undefined" == typeof(wdw_cardbookContactsSidebar)) {
},
loadPanel: function () {
myCardBookSideBarObserver.register();
myCardBookSideBarPrefObserver.register();
if (Services.vc.compare(Services.appinfo.version, "60") >= 0) {
document.getElementById("abContextMenuButton").hidden=false;
} else {
document.getElementById("abContextMenuButton").hidden=true;
}
cardBookSideBarObserver.register();
cardBookSideBarPrefObserver.register();
document.title = parent.document.getElementById("sidebar-title").value;
wdw_cardbookContactsSidebar.waitForMsgIdentityFinished();
},
unloadPanel: function () {
myCardBookSideBarObserver.unregister();
myCardBookSideBarPrefObserver.unregister();
cardBookSideBarObserver.unregister();
cardBookSideBarPrefObserver.unregister();
},
loadRestrictions: function () {
// Mail Redirect has no content
if (content) {
var outerID = content.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIDOMWindowUtils).outerWindowID;
var msgIdentity = cardbookRepository.composeMsgIdentity[outerID];
} else {
var msgIdentity = "";
}
var result = [];
result = cardbookPreferences.getAllRestrictions();
wdw_cardbookContactsSidebar.ABInclRestrictions = {};
......@@ -788,11 +811,17 @@ if ("undefined" == typeof(wdw_cardbookContactsSidebar)) {
waitForMsgIdentityFinished: function () {
var lTimerMsgIdentity = Components.classes["@mozilla.org/timer;1"].createInstance(Components.interfaces.nsITimer);
lTimerMsgIdentity.initWithCallback({ notify: function(lTimerMsgIdentity) {
// Mail Redirect has no content
if (content) {
var outerID = content.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIDOMWindowUtils).outerWindowID;
if (cardbookRepository.composeMsgIdentity[outerID]) {
wdw_cardbookContactsSidebar.loadAB();
lTimerMsgIdentity.cancel();
}
} else {
wdw_cardbookContactsSidebar.loadAB();
lTimerMsgIdentity.cancel();
}
}
}, 500, Components.interfaces.nsITimer.TYPE_REPEATING_SLACK);
},
......
......@@ -30,7 +30,8 @@
<script src="chrome://cardbook/content/cardbookUtils.js"/>
<script src="chrome://cardbook/content/cardbookElementTools.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/cardbookSynchronization.js"/>
<script src="chrome://cardbook/content/preferences/cardbookPreferences.js"/>
......@@ -43,6 +44,15 @@
<key id="selectAllKey" modifiers="control" key="a" oncommand="wdw_cardbookContactsSidebar.selectAllKey();"/>
</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();">
<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');"/>
......@@ -57,8 +67,13 @@
<vbox id="results_box" flex="1">
<separator class="thin"/>
<hbox id="AbPickerHeader" class="toolbar">
<label id="addressbookPickerLabel" value="&addressbookPicker.label;" accesskey="&addressbookPicker.accesskey;" control="CardBookABMenulist"/>
<hbox class="toolbar" align="center">
<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">
<menupopup id="CardBookABMenupopup"/>
</menulist>
......
if ("undefined" == typeof(ovl_lightningAttendees)) {
var ovl_lightningAttendees = {
onLoad: function() {
myCardBookLightningObserver.register();
cardBookLightningObserver.register();
cardbookAutocomplete.setLightningCompletion();
cardbookAutocomplete.loadCssRules();
window.removeEventListener('load', arguments.callee, true);
......
......@@ -6,7 +6,8 @@
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<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/autocomplete/cardbookAutocomplete.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 {
ChromeUtils.import("resource://gre/modules/Services.jsm");
}
......@@ -19,73 +19,15 @@ if ("undefined" == typeof(cardBookObserver)) {
aPrefObserver.branch.removeObserver("", aPrefObserver);
}
};
};
var cardBookPrefObserver = {
register: function() {
cardBookPrefObserverRepository.registerAll(this);
},
unregister: function() {
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;
if ("undefined" == typeof(cardBookObserverRepository)) {
try {
ChromeUtils.import("resource://gre/modules/Services.jsm");
}
catch(e) {
Components.utils.import("resource://gre/modules/Services.jsm");
}
};
var cardBookObserverRepository = {
registerAll: function(aObserver) {
......@@ -115,6 +57,7 @@ if ("undefined" == typeof(cardBookObserver)) {
Services.obs.addObserver(aObserver, "cardbook.DBOpen", false);
Services.obs.addObserver(aObserver, "cardbook.complexSearchInitLoaded", false);
Services.obs.addObserver(aObserver, "cardbook.complexSearchLoaded", false);
Services.obs.addObserver(aObserver, "cardbook.accountsLoaded", false);
Services.obs.addObserver(aObserver, "cardbook.preferencesChanged", false);
......@@ -148,190 +91,11 @@ if ("undefined" == typeof(cardBookObserver)) {
Services.obs.removeObserver(aObserver, "cardbook.DBOpen");
Services.obs.removeObserver(aObserver, "cardbook.complexSearchInitLoaded");
Services.obs.removeObserver(aObserver, "cardbook.complexSearchLoaded");
Services.obs.removeObserver(aObserver, "cardbook.accountsLoaded");
Services.obs.removeObserver(aObserver, "cardbook.preferencesChanged");
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;
}
}
};
var cardBookWindowObserver = {
register: function() {
cardBookObserverRepository.registerAll(this);
},
unregister: function() {
cardBookObserverRepository.unregisterAll(this);
},
observe: function(aSubject, aTopic, aData) {
switch (aTopic) {
case "cardbook.catAddedIndirect":
break;
case "cardbook.syncRunning":
wdw_cardbook.refreshWindow(aData);
break;
case "cardbook.cardRemovedDirect":
wdw_cardbook.clearCard();
case "cardbook.cardAddedIndirect":
case "cardbook.cardRemovedIndirect":
case "cardbook.cardModifiedIndirect":
case "cardbook.cardPasted":
case "cardbook.cardDragged":
case "cardbook.cardImportedFromFile":
wdw_cardbook.refreshWindow();
break;
case "cardbook.preferencesChanged":
cardbookRepository.loadCustoms();
wdw_cardbook.loadCssRules();
var myColumns = cardbookUtils.getColumnsState().split(',');
wdw_cardbook.addTreeColumns();
cardbookUtils.setColumnsState(myColumns);
wdw_cardbook.refreshWindow();
break;
case "cardbook.ABAddedDirect":
case "cardbook.ABRemovedDirect":
case "cardbook.catRemovedDirect":
wdw_cardbook.clearCard();
case "cardbook.catAddedDirect":
case "cardbook.catRemovedIndirect":
case "cardbook.catModifiedIndirect":
case "cardbook.catModifiedDirect":
case "cardbook.ABModifiedDirect":
case "cardbook.cardAddedDirect":
case "cardbook.cardModifiedDirect":
case "cardbook.complexSearchLoaded":
wdw_cardbook.loadCssRules();
wdw_cardbook.refreshWindow(aData);
break;
}
}
};
var cardBookWindowMutationObserver = {
register: function() {
var observer = new MutationObserver(function handleMutations(mutations) {
if (cardbookRepository.cardbookReorderMode == "NOREORDER") {
cardbookUtils.saveColumnsState();
}
});
observer.observe(document.getElementById("cardsTreecols"), {
attributes: true,
subtree: true,
attributeFilter: ["hidden", "ordinal", "width"]
});
}
};
};
if ("undefined" == typeof(cardBookSideBarPrefObserver)) {
try {
ChromeUtils.import("resource://gre/modules/Services.jsm");
}
catch(e) {
Components.utils.import("resource://gre/modules/Services.jsm");
}
var cardBookSideBarPrefObserver = {
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;
}
}
};
};
if ("undefined" == typeof(cardBookSideBarObserver)) {
try {
ChromeUtils.import("resource://gre/modules/Services.jsm");
}
catch(e) {
Components.utils.import("resource://gre/modules/Services.jsm");
}
var cardBookSideBarObserver = {
register: function() {
cardBookObserverRepository.registerAll(this);
},
unregister: function() {
cardBookObserverRepository.unregisterAll(this);