Browse Source

Remove mailnews and friends

custom-2020
Matt A. Tobin 3 years ago committed by Roy Tam
parent
commit
3a8b5b26c8
  1. 7
      communicator/communicator.mozbuild
  2. 72
      mailnews/addrbook/content/abAddressBookNameDialog.js
  3. 26
      mailnews/addrbook/content/abAddressBookNameDialog.xul
  4. 424
      mailnews/addrbook/content/abDragDrop.js
  5. 17
      mailnews/addrbook/content/abEditCardDialog.xul
  6. 613
      mailnews/addrbook/content/abMailListDialog.js
  7. 33
      mailnews/addrbook/content/abNewCardDialog.xul
  8. 502
      mailnews/addrbook/content/abResultsPane.js
  9. 90
      mailnews/addrbook/content/abResultsPaneOverlay.xul
  10. 439
      mailnews/addrbook/content/addrbookWidgets.xml
  11. 94
      mailnews/addrbook/content/print.css
  12. 10
      mailnews/addrbook/moz.build
  13. 394
      mailnews/addrbook/prefs/content/pref-directory-add.js
  14. 152
      mailnews/addrbook/prefs/content/pref-directory-add.xul
  15. 142
      mailnews/addrbook/prefs/content/pref-editdirectories.js
  16. 43
      mailnews/addrbook/prefs/content/pref-editdirectories.xul
  17. 47
      mailnews/addrbook/public/moz.build
  18. 445
      mailnews/addrbook/public/nsAbBaseCID.h
  19. 58
      mailnews/addrbook/public/nsIAbAddressCollector.idl
  20. 36
      mailnews/addrbook/public/nsIAbAutoCompleteResult.idl
  21. 122
      mailnews/addrbook/public/nsIAbBooleanExpression.idl
  22. 358
      mailnews/addrbook/public/nsIAbCard.idl
  23. 92
      mailnews/addrbook/public/nsIAbCollection.idl
  24. 35
      mailnews/addrbook/public/nsIAbDirFactory.idl
  25. 28
      mailnews/addrbook/public/nsIAbDirFactoryService.idl
  26. 15
      mailnews/addrbook/public/nsIAbDirSearchListener.idl
  27. 296
      mailnews/addrbook/public/nsIAbDirectory.idl
  28. 164
      mailnews/addrbook/public/nsIAbDirectoryQuery.idl
  29. 14
      mailnews/addrbook/public/nsIAbDirectoryQueryProxy.idl
  30. 53
      mailnews/addrbook/public/nsIAbDirectorySearch.idl
  31. 90
      mailnews/addrbook/public/nsIAbItem.idl
  32. 194
      mailnews/addrbook/public/nsIAbLDAPAttributeMap.idl
  33. 56
      mailnews/addrbook/public/nsIAbLDAPCard.idl
  34. 112
      mailnews/addrbook/public/nsIAbLDAPDirectory.idl
  35. 68
      mailnews/addrbook/public/nsIAbLDAPReplicationData.idl
  36. 67
      mailnews/addrbook/public/nsIAbLDAPReplicationQuery.idl
  37. 32
      mailnews/addrbook/public/nsIAbLDAPReplicationService.idl
  38. 40
      mailnews/addrbook/public/nsIAbLDIFService.idl
  39. 90
      mailnews/addrbook/public/nsIAbListener.idl
  40. 71
      mailnews/addrbook/public/nsIAbMDBDirectory.idl
  41. 190
      mailnews/addrbook/public/nsIAbManager.idl
  42. 109
      mailnews/addrbook/public/nsIAbView.idl
  43. 19
      mailnews/addrbook/public/nsIAddbookUrl.idl
  44. 35
      mailnews/addrbook/public/nsIAddrDBAnnouncer.idl
  45. 36
      mailnews/addrbook/public/nsIAddrDBListener.idl
  46. 311
      mailnews/addrbook/public/nsIAddrDatabase.idl
  47. 29
      mailnews/addrbook/public/nsIMsgVCardService.idl
  48. 93
      mailnews/addrbook/src/moz.build
  49. 331
      mailnews/addrbook/src/nsAbAddressCollector.cpp
  50. 44
      mailnews/addrbook/src/nsAbAddressCollector.h
  51. 58
      mailnews/addrbook/src/nsAbAutoCompleteMyDomain.js
  52. 466
      mailnews/addrbook/src/nsAbAutoCompleteSearch.js
  53. 323
      mailnews/addrbook/src/nsAbBSDirectory.cpp
  54. 50
      mailnews/addrbook/src/nsAbBSDirectory.h
  55. 246
      mailnews/addrbook/src/nsAbBoolExprToLDAPFilter.cpp
  56. 45
      mailnews/addrbook/src/nsAbBoolExprToLDAPFilter.h
  57. 132
      mailnews/addrbook/src/nsAbBooleanExpression.cpp
  58. 43
      mailnews/addrbook/src/nsAbBooleanExpression.h
  59. 1193
      mailnews/addrbook/src/nsAbCardProperty.cpp
  60. 59
      mailnews/addrbook/src/nsAbCardProperty.h
  61. 184
      mailnews/addrbook/src/nsAbContentHandler.cpp
  62. 26
      mailnews/addrbook/src/nsAbContentHandler.h
  63. 54
      mailnews/addrbook/src/nsAbDirFactoryService.cpp
  64. 23
      mailnews/addrbook/src/nsAbDirFactoryService.h
  65. 593
      mailnews/addrbook/src/nsAbDirProperty.cpp
  66. 72
      mailnews/addrbook/src/nsAbDirProperty.h
  67. 528
      mailnews/addrbook/src/nsAbDirectoryQuery.cpp
  68. 113
      mailnews/addrbook/src/nsAbDirectoryQuery.h
  69. 33
      mailnews/addrbook/src/nsAbDirectoryQueryProxy.cpp
  70. 27
      mailnews/addrbook/src/nsAbDirectoryQueryProxy.h
  71. 247
      mailnews/addrbook/src/nsAbLDAPAttributeMap.js
  72. 325
      mailnews/addrbook/src/nsAbLDAPAutoCompleteSearch.js
  73. 297
      mailnews/addrbook/src/nsAbLDAPCard.cpp
  74. 30
      mailnews/addrbook/src/nsAbLDAPCard.h
  75. 542
      mailnews/addrbook/src/nsAbLDAPChangeLogData.cpp
  76. 57
      mailnews/addrbook/src/nsAbLDAPChangeLogData.h
  77. 180
      mailnews/addrbook/src/nsAbLDAPChangeLogQuery.cpp
  78. 28
      mailnews/addrbook/src/nsAbLDAPChangeLogQuery.h
  79. 79
      mailnews/addrbook/src/nsAbLDAPDirFactory.cpp
  80. 23
      mailnews/addrbook/src/nsAbLDAPDirFactory.h
  81. 948
      mailnews/addrbook/src/nsAbLDAPDirectory.cpp
  82. 75
      mailnews/addrbook/src/nsAbLDAPDirectory.h
  83. 372
      mailnews/addrbook/src/nsAbLDAPDirectoryModify.cpp
  84. 31
      mailnews/addrbook/src/nsAbLDAPDirectoryModify.h
  85. 610
      mailnews/addrbook/src/nsAbLDAPDirectoryQuery.cpp
  86. 44
      mailnews/addrbook/src/nsAbLDAPDirectoryQuery.h
  87. 358
      mailnews/addrbook/src/nsAbLDAPListenerBase.cpp
  88. 54
      mailnews/addrbook/src/nsAbLDAPListenerBase.h
  89. 489
      mailnews/addrbook/src/nsAbLDAPReplicationData.cpp
  90. 66
      mailnews/addrbook/src/nsAbLDAPReplicationData.h
  91. 153
      mailnews/addrbook/src/nsAbLDAPReplicationQuery.cpp
  92. 44
      mailnews/addrbook/src/nsAbLDAPReplicationQuery.h
  93. 136
      mailnews/addrbook/src/nsAbLDAPReplicationService.cpp
  94. 33
      mailnews/addrbook/src/nsAbLDAPReplicationService.h
  95. 868
      mailnews/addrbook/src/nsAbLDIFService.cpp
  96. 37
      mailnews/addrbook/src/nsAbLDIFService.h
  97. 55
      mailnews/addrbook/src/nsAbMDBCard.cpp
  98. 26
      mailnews/addrbook/src/nsAbMDBCard.h
  99. 118
      mailnews/addrbook/src/nsAbMDBDirFactory.cpp
  100. 24
      mailnews/addrbook/src/nsAbMDBDirFactory.h
  101. Some files were not shown because too many files have changed in this diff Show More

7
communicator/communicator.mozbuild

@ -6,13 +6,6 @@
if CONFIG['MOZ_COMPOSER']:
DIRS += ['/editor/ui']
if CONFIG['MOZ_MAILNEWS']:
DIRS += [
'/modules/ldap',
'/modules/mork',
'/mailnews',
]
if CONFIG['MOZ_CALENDAR']:
DIRS += [
'/modules/libical',

72
mailnews/addrbook/content/abAddressBookNameDialog.js

@ -1,72 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
Components.utils.import("resource:///modules/mailServices.js");
var gOkButton;
var gNameInput;
var gDirectory = null;
var kPersonalAddressbookURI = "moz-abmdbdirectory://abook.mab";
var kCollectedAddressbookURI = "moz-abmdbdirectory://history.mab";
var kAllDirectoryRoot = "moz-abdirectory://";
var kPABDirectory = 2; // defined in nsDirPrefs.h
function abNameOnLoad()
{
// Get the document elements.
gOkButton = document.documentElement.getButton('accept');
gNameInput = document.getElementById('name');
// look in arguments[0] for parameters to see if we have a directory or not
if ("arguments" in window && window.arguments[0] &&
"selectedDirectory" in window.arguments[0]) {
gDirectory = window.arguments[0].selectedDirectory;
gNameInput.value = gDirectory.dirName;
}
// Work out the window title (if we have a directory specified, then it's a
// rename).
var bundle = document.getElementById("bundle_addressBook");
if (gDirectory) {
let oldListName = gDirectory.dirName;
document.title = bundle.getFormattedString("addressBookTitleEdit", [oldListName]);
} else {
document.title = bundle.getString("addressBookTitleNew");
}
if (gDirectory &&
(gDirectory.URI == kCollectedAddressbookURI ||
gDirectory.URI == kPersonalAddressbookURI ||
gDirectory.URI == kAllDirectoryRoot + "?")) {
// Address book name is not editable, therefore disable the field and
// only have an ok button that doesn't do anything.
gNameInput.readOnly = true;
document.documentElement.buttons = "accept";
document.documentElement.removeAttribute("ondialogaccept");
} else {
gNameInput.focus();
abNameDoOkEnabling();
}
}
function abNameOKButton()
{
var newName = gNameInput.value.trim();
// Either create a new directory or update an existing one depending on what
// we were given when we started.
if (gDirectory)
gDirectory.dirName = newName;
else
MailServices.ab.newAddressBook(newName, "", kPABDirectory);
return true;
}
function abNameDoOkEnabling()
{
gOkButton.disabled = gNameInput.value.trim() == "";
}

26
mailnews/addrbook/content/abAddressBookNameDialog.xul

@ -1,26 +0,0 @@
<?xml version="1.0"?>
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<?xml-stylesheet href="chrome://messenger/skin/dialogs.css" type="text/css"?>
<!DOCTYPE dialog SYSTEM "chrome://messenger/locale/addressbook/abAddressBookNameDialog.dtd">
<dialog xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
style="width: 36em;"
onload="abNameOnLoad();"
ondialogaccept="return abNameOKButton();">
<stringbundleset id="stringbundleset">
<stringbundle id="bundle_addressBook"
src="chrome://messenger/locale/addressbook/addressBook.properties"/>
</stringbundleset>
<script type="application/javascript" src="chrome://messenger/content/addressbook/abAddressBookNameDialog.js"/>
<hbox align="center">
<label control="name" value="&name.label;" accesskey="&name.accesskey;"/>
<textbox id="name" oninput="abNameDoOkEnabling();" flex="1"/>
</hbox>
</dialog>

424
mailnews/addrbook/content/abDragDrop.js

@ -1,424 +0,0 @@
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
Components.utils.import("resource://gre/modules/PluralForm.jsm");
// Returns the load context for the current window
function getLoadContext() {
return window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIWebNavigation)
.QueryInterface(Components.interfaces.nsILoadContext);
}
var abFlavorDataProvider = {
QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsIFlavorDataProvider]),
getFlavorData: function(aTransferable, aFlavor, aData, aDataLen)
{
if (aFlavor == "application/x-moz-file-promise")
{
var primitive = {};
aTransferable.getTransferData("text/vcard", primitive, {});
var vCard = primitive.value.QueryInterface(Components.interfaces.nsISupportsString).data;
aTransferable.getTransferData("application/x-moz-file-promise-dest-filename", primitive, {});
var leafName = primitive.value.QueryInterface(Components.interfaces.nsISupportsString).data;
aTransferable.getTransferData("application/x-moz-file-promise-dir", primitive, {});
var localFile = primitive.value.QueryInterface(Components.interfaces.nsIFile).clone();
localFile.append(leafName);
var ofStream = Components.classes["@mozilla.org/network/file-output-stream;1"].createInstance(Components.interfaces.nsIFileOutputStream);
ofStream.init(localFile, -1, -1, 0);
var converter = Components.classes["@mozilla.org/intl/converter-output-stream;1"].createInstance(Components.interfaces.nsIConverterOutputStream);
converter.init(ofStream, null, 0, 0);
converter.writeString(vCard);
converter.close();
aData.value = localFile;
}
}
};
var abResultsPaneObserver = {
onDragStart: function (aEvent, aXferData, aDragAction)
{
var selectedRows = GetSelectedRows();
if (!selectedRows)
return;
var selectedAddresses = GetSelectedAddresses();
aXferData.data = new TransferData();
aXferData.data.addDataForFlavour("moz/abcard", selectedRows);
aXferData.data.addDataForFlavour("text/x-moz-address", selectedAddresses);
aXferData.data.addDataForFlavour("text/unicode", selectedAddresses);
let srcDirectory = getSelectedDirectory();
// The default allowable actions are copy, move and link, so we need
// to restrict them here.
if (!srcDirectory.readOnly)
// Only allow copy & move from read-write directories.
aDragAction.action = Components.interfaces.
nsIDragService.DRAGDROP_ACTION_COPY |
Components.interfaces.
nsIDragService.DRAGDROP_ACTION_MOVE;
else
// Only allow copy from read-only directories.
aDragAction.action = Components.interfaces.
nsIDragService.DRAGDROP_ACTION_COPY;
var card = GetSelectedCard();
if (card && card.displayName) {
let vCard = card.translateTo("vcard");
aXferData.data.addDataForFlavour("text/vcard", decodeURIComponent(vCard));
aXferData.data.addDataForFlavour("application/x-moz-file-promise-dest-filename", card.displayName + ".vcf");
aXferData.data.addDataForFlavour("application/x-moz-file-promise-url", "data:text/vcard," + vCard);
aXferData.data.addDataForFlavour("application/x-moz-file-promise", abFlavorDataProvider);
}
},
onDrop: function (aEvent, aXferData, aDragSession)
{
},
onDragExit: function (aEvent, aDragSession)
{
},
onDragOver: function (aEvent, aFlavour, aDragSession)
{
},
getSupportedFlavours: function ()
{
return null;
}
};
var dragService = Components.classes["@mozilla.org/widget/dragservice;1"]
.getService(Components.interfaces.nsIDragService);
var abDirTreeObserver = {
/**
* canDrop - determine if the tree will accept the dropping of a item
* onto it.
*
* Note 1: We don't allow duplicate mailing list names, therefore copy
* is not allowed for mailing lists.
* Note 2: Mailing lists currently really need a card in the parent
* address book, therefore only moving to an address book is allowed.
*
* The possibilities:
*
* anything -> same place = Not allowed
* anything -> read only directory = Not allowed
* mailing list -> mailing list = Not allowed
* (we currently do not support recursive lists)
* address book card -> different address book = MOVE or COPY
* address book card -> mailing list = COPY only
* (cards currently have to exist outside list for list to work correctly)
* mailing list -> different address book = MOVE only
* (lists currently need to have unique names)
* card in mailing list -> parent mailing list = Not allowed
* card in mailing list -> other mailing list = MOVE or COPY
* card in mailing list -> other address book = MOVE or COPY
* read only directory item -> anywhere = COPY only
*/
canDrop: function(index, orientation, dataTransfer)
{
if (orientation != Components.interfaces.nsITreeView.DROP_ON)
return false;
if (!dataTransfer.types.includes("moz/abcard")) {
return false;
}
let targetURI = gDirectoryTreeView.getDirectoryAtIndex(index).URI;
let srcURI = getSelectedDirectoryURI();
// We cannot allow copy/move to "All Address Books".
if (targetURI == kAllDirectoryRoot + "?")
return false;
// The same place case
if (targetURI == srcURI)
return false;
// determine if we dragging from a mailing list on a directory x to the parent (directory x).
// if so, don't allow the drop
if (srcURI.startsWith(targetURI))
return false;
// check if we can write to the target directory
// e.g. LDAP is readonly currently
var targetDirectory = GetDirectoryFromURI(targetURI);
if (targetDirectory.readOnly)
return false;
var dragSession = dragService.getCurrentSession();
if (!dragSession)
return false;
// XXX Due to bug 373125/bug 349044 we can't specify a default action,
// so we default to move and this means that the user would have to press
// ctrl to copy which most users don't realise.
//
// If target directory is a mailing list, then only allow copies.
// if (targetDirectory.isMailList &&
// dragSession.dragAction != Components.interfaces.
// nsIDragService.DRAGDROP_ACTION_COPY)
//return false;
var srcDirectory = GetDirectoryFromURI(srcURI);
// Only allow copy from read-only directories.
if (srcDirectory.readOnly &&
dragSession.dragAction != Components.interfaces.
nsIDragService.DRAGDROP_ACTION_COPY)
return false;
// Go through the cards checking to see if one of them is a mailing list
// (if we are attempting a copy) - we can't copy mailing lists as
// that would give us duplicate names which isn't allowed at the
// moment.
var draggingMailList = false;
// The data contains the a string of "selected rows", eg.: "1,2".
var rows = dataTransfer.getData("moz/abcard").split(",").map(j => parseInt(j, 10));
for (var j = 0; j < rows.length; j++)
{
if (gAbView.getCardFromRow(rows[j]).isMailList)
{
draggingMailList = true;
break;
}
}
// The rest of the cases - allow cards for copy or move, but only allow
// move of mailing lists if we're not going into another mailing list.
if (draggingMailList &&
(targetDirectory.isMailList ||
dragSession.dragAction == Components.interfaces.
nsIDragService.DRAGDROP_ACTION_COPY))
{
return false;
}
dragSession.canDrop = true;
return true;
},
/**
* onDrop - we don't need to check again for correctness as the
* tree view calls canDrop just before calling onDrop.
*
*/
onDrop: function(index, orientation, dataTransfer)
{
var dragSession = dragService.getCurrentSession();
if (!dragSession)
return;
if (!dataTransfer.types.includes("moz/abcard")) {
return;
}
let targetURI = gDirectoryTreeView.getDirectoryAtIndex(index).URI;
let srcURI = getSelectedDirectoryURI();
// The data contains the a string of "selected rows", eg.: "1,2".
var rows = dataTransfer.getData("moz/abcard").split(",").map(j => parseInt(j, 10));
var numrows = rows.length;
var result;
// needToCopyCard is used for whether or not we should be creating
// copies of the cards in a mailing list in a different address book
// - it's not for if we are moving or not.
var needToCopyCard = true;
if (srcURI.length > targetURI.length) {
result = srcURI.split(targetURI);
if (result[0] != srcURI) {
// src directory is a mailing list on target directory, no need to copy card
needToCopyCard = false;
}
}
else {
result = targetURI.split(srcURI);
if (result[0] != targetURI) {
// target directory is a mailing list on src directory, no need to copy card
needToCopyCard = false;
}
}
// if we still think we have to copy the card,
// check if srcURI and targetURI are mailing lists on same directory
// if so, we don't have to copy the card
if (needToCopyCard) {
var targetParentURI = GetParentDirectoryFromMailingListURI(targetURI);
if (targetParentURI && (targetParentURI == GetParentDirectoryFromMailingListURI(srcURI)))
needToCopyCard = false;
}
var directory = GetDirectoryFromURI(targetURI);
// Only move if we are not transferring to a mail list
var actionIsMoving = (dragSession.dragAction & dragSession.DRAGDROP_ACTION_MOVE) && !directory.isMailList;
let cardsToCopy = [];
for (let j = 0; j < numrows; j++) {
cardsToCopy.push(gAbView.getCardFromRow(rows[j]));
}
for (let card of cardsToCopy) {
if (card.isMailList) {
// This check ensures we haven't slipped through by mistake
if (needToCopyCard && actionIsMoving) {
directory.addMailList(GetDirectoryFromURI(card.mailListURI));
}
} else {
let srcDirectory = null;
if (srcURI == (kAllDirectoryRoot + "?") && actionIsMoving) {
let dirId = card.directoryId.substring(0, card.directoryId.indexOf("&"));
srcDirectory = MailServices.ab.getDirectoryFromId(dirId);
}
directory.dropCard(card, needToCopyCard);
// This is true only if srcURI is "All ABs" and action is moving.
if (srcDirectory) {
let cardArray =
Components.classes["@mozilla.org/array;1"]
.createInstance(Components.interfaces.nsIMutableArray);
cardArray.appendElement(card, false);
srcDirectory.deleteCards(cardArray);
}
}
}
var cardsTransferredText;
// If we are moving, but not moving to a directory, then delete the
// selected cards and display the appropriate text
if (actionIsMoving && srcURI != (kAllDirectoryRoot + "?")) {
// If we have moved the cards, then delete them as well.
gAbView.deleteSelectedCards();
}
if (actionIsMoving) {
cardsTransferredText = PluralForm.get(numrows,
gAddressBookBundle.getFormattedString("contactsMoved", [numrows]));
} else {
cardsTransferredText = PluralForm.get(numrows,
gAddressBookBundle.getFormattedString("contactsCopied", [numrows]));
}
if (srcURI == kAllDirectoryRoot + "?") {
SetAbView(srcURI);
}
document.getElementById("statusText").label = cardsTransferredText;
},
onToggleOpenState: function()
{
},
onCycleHeader: function(colID, elt)
{
},
onCycleCell: function(row, colID)
{
},
onSelectionChanged: function()
{
},
onPerformAction: function(action)
{
},
onPerformActionOnRow: function(action, row)
{
},
onPerformActionOnCell: function(action, row, colID)
{
}
}
function DragAddressOverTargetControl(event)
{
var dragSession = gDragService.getCurrentSession();
if (!dragSession.isDataFlavorSupported("text/x-moz-address"))
return;
var trans = Components.classes["@mozilla.org/widget/transferable;1"]
.createInstance(Components.interfaces.nsITransferable);
trans.init(getLoadContext());
trans.addDataFlavor("text/x-moz-address");
var canDrop = true;
for ( var i = 0; i < dragSession.numDropItems; ++i )
{
dragSession.getData ( trans, i );
var dataObj = new Object();
var bestFlavor = new Object();
var len = new Object();
try
{
trans.getAnyTransferData ( bestFlavor, dataObj, len );
}
catch (ex)
{
canDrop = false;
break;
}
}
dragSession.canDrop = canDrop;
}
function DropAddressOverTargetControl(event)
{
var dragSession = gDragService.getCurrentSession();
var trans = Components.classes["@mozilla.org/widget/transferable;1"].createInstance(Components.interfaces.nsITransferable);
trans.addDataFlavor("text/x-moz-address");
for ( var i = 0; i < dragSession.numDropItems; ++i )
{
dragSession.getData ( trans, i );
var dataObj = new Object();
var bestFlavor = new Object();
var len = new Object();
// Ensure we catch any empty data that may have slipped through
try
{
trans.getAnyTransferData ( bestFlavor, dataObj, len);
}
catch (ex)
{
continue;
}
if ( dataObj )
dataObj = dataObj.value.QueryInterface(Components.interfaces.nsISupportsString);
if ( !dataObj )
continue;
// pull the address out of the data object
var address = dataObj.data.substring(0, len.value);
if (!address)
continue;
DropRecipient(address);
}
}

17
mailnews/addrbook/content/abEditCardDialog.xul

@ -1,17 +0,0 @@
<?xml version="1.0"?>
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?>
<?xul-overlay href="chrome://messenger/content/addressbook/abCardOverlay.xul"?>
<dialog xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
id="abcardWindow"
onload="OnLoadEditCard()"
ondialogaccept="return EditCardOKButton();">
<stringbundleset id="stringbundleset"/>
<vbox id="editcard"/>
</dialog>

613
mailnews/addrbook/content/abMailListDialog.js

@ -1,613 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
top.MAX_RECIPIENTS = 1;
var inputElementType = "";
var gListCard;
var gEditList;
var oldListName = "";
var gLoadListeners = [];
var gSaveListeners = [];
try
{
var gDragService = Components.classes["@mozilla.org/widget/dragservice;1"]
.getService(Components.interfaces.nsIDragService);
}
catch (e)
{
}
// Returns the load context for the current window
function getLoadContext() {
return window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIWebNavigation)
.QueryInterface(Components.interfaces.nsILoadContext);
}
function awHandleKeyPress(element, event)
{
// allow dialog to close on enter if focused textbox has no value
if (element.value != "" && event.keyCode == KeyEvent.DOM_VK_RETURN) {
event.stopPropagation();
event.preventDefault();
}
}
function mailingListExists(listname)
{
if (MailServices.ab.mailListNameExists(listname))
{
Services.prompt.alert(window,
gAddressBookBundle.getString("mailListNameExistsTitle"),
gAddressBookBundle.getString("mailListNameExistsMessage"));
return true;
}
return false;
}
function GetListValue(mailList, doAdd)
{
var listname = document.getElementById("ListName").value.trim();
if (listname.length == 0)
{
var alertText = gAddressBookBundle.getString("emptyListName");
alert(alertText);
return false;
}
else
{
var canonicalNewListName = listname.toLowerCase();
var canonicalOldListName = oldListName.toLowerCase();
if (doAdd)
{
if (mailingListExists(canonicalNewListName))
return false;
}
else if (canonicalOldListName != canonicalNewListName)
{
if (mailingListExists(canonicalNewListName))
return false;
}
}
mailList.isMailList = true;
mailList.dirName = listname;
mailList.listNickName = document.getElementById('ListNickName').value;
mailList.description = document.getElementById('ListDescription').value;
var oldTotal = mailList.addressLists.length;
var i = 1;
var pos = 0;
var inputField, fieldValue, cardproperty;
while ((inputField = awGetInputElement(i)))
{
fieldValue = inputField.value;
if (doAdd || (!doAdd && pos >= oldTotal))
cardproperty = Components.classes["@mozilla.org/addressbook/cardproperty;1"].createInstance();
else
cardproperty = mailList.addressLists.queryElementAt(pos, Components.interfaces.nsIAbCard);
if (fieldValue == "")
{
if (!doAdd && cardproperty)
try
{
mailList.addressLists.removeElementAt(pos);
--oldTotal;
}
catch(ex)
{
// Ignore attempting to remove an item
// at a position greater than the number
// of elements in the addressLists attribute
}
}
else if (cardproperty)
{
cardproperty = cardproperty.QueryInterface(Components.interfaces.nsIAbCard);
if (cardproperty)
{
let addrObjects = MailServices.headerParser
.makeFromDisplayAddress(fieldValue, {});
for (let j = 0; j < addrObjects.length; j++)
{
if (j > 0)
{
cardproperty = Components.classes["@mozilla.org/addressbook/cardproperty;1"].createInstance();
cardproperty = cardproperty.QueryInterface(Components.interfaces.nsIAbCard);
}
cardproperty.primaryEmail = addrObjects[j].email;
cardproperty.displayName = addrObjects[j].name || addrObjects[j].email;
if (doAdd || (doAdd == false && pos >= oldTotal))
mailList.addressLists.appendElement(cardproperty, false);
}
pos++;
}
}
i++;
}
--i;
if (doAdd == false && i < oldTotal)
{
for (var j = i; j < oldTotal; j++)
mailList.addressLists.removeElementAt(j);
}
return true;
}
function MailListOKButton()
{
var popup = document.getElementById('abPopup');
if (popup)
{
var uri = popup.getAttribute('value');
// FIX ME - hack to avoid crashing if no ab selected because of blank option bug from template
// should be able to just remove this if we are not seeing blank lines in the ab popup
if (!uri)
return false; // don't close window
// -----
//Add mailing list to database
var mailList = Components.classes["@mozilla.org/addressbook/directoryproperty;1"].createInstance();
mailList = mailList.QueryInterface(Components.interfaces.nsIAbDirectory);
if (GetListValue(mailList, true))
{
var parentDirectory = GetDirectoryFromURI(uri);
mailList = parentDirectory.addMailList(mailList);
NotifySaveListeners(mailList);
}
else
return false;
}
return true; // close the window
}
function OnLoadNewMailList()
{
var selectedAB = null;
InitCommonJS();
if ("arguments" in window && window.arguments[0])
{
var abURI = window.arguments[0].selectedAB;
if (abURI && abURI != kAllDirectoryRoot + "?") {
var directory = GetDirectoryFromURI(abURI);
if (directory.isMailList) {
var parentURI = GetParentDirectoryFromMailingListURI(abURI);
if (parentURI) {
selectedAB = parentURI;
}
}
else if (directory.readOnly) {
selectedAB = kPersonalAddressbookURI;
}
else {
selectedAB = abURI;
}
}
}
if (!selectedAB)
selectedAB = kPersonalAddressbookURI;
// set popup with address book names
var abPopup = document.getElementById('abPopup');
abPopup.value = selectedAB;
AppendNewRowAndSetFocus();
awFitDummyRows(1);
document.addEventListener("keypress", awDocumentKeyPress, true);
// focus on first name
var listName = document.getElementById('ListName');
if (listName)
setTimeout( function(firstTextBox) { firstTextBox.focus(); }, 0, listName );
NotifyLoadListeners(directory);
}
function EditListOKButton()
{
//edit mailing list in database
if (GetListValue(gEditList, false))
{
if (gListCard) {
// modify the list card (for the results pane) from the mailing list
gListCard.displayName = gEditList.dirName;
gListCard.lastName = gEditList.dirName;
gListCard.setProperty("NickName", gEditList.listNickName);
gListCard.setProperty("Notes", gEditList.description);
}
NotifySaveListeners(gEditList);
gEditList.editMailListToDatabase(gListCard);
window.arguments[0].refresh = true;
return true; // close the window
}
return false;
}
function OnLoadEditList()
{
InitCommonJS();
gListCard = window.arguments[0].abCard;
var listUri = window.arguments[0].listURI;
gEditList = GetDirectoryFromURI(listUri);
document.getElementById('ListName').value = gEditList.dirName;
document.getElementById('ListNickName').value = gEditList.listNickName;
document.getElementById('ListDescription').value = gEditList.description;
oldListName = gEditList.dirName;
document.title = gAddressBookBundle.getFormattedString("mailingListTitleEdit", [oldListName]);
if (gEditList.addressLists)
{
let total = gEditList.addressLists.length;
if (total)
{
let listbox = document.getElementById('addressingWidget');
let newListBoxNode = listbox.cloneNode(false);
let templateNode = listbox.querySelector("listitem");
top.MAX_RECIPIENTS = 0;
for (let i = 0; i < total; i++)
{
let card = gEditList.addressLists.queryElementAt(i, Components.interfaces.nsIAbCard);
let address = MailServices.headerParser.makeMailboxObject(
card.displayName, card.primaryEmail).toString();
SetInputValue(address, newListBoxNode, templateNode);
}
listbox.parentNode.replaceChild(newListBoxNode, listbox);
}
}
// Is this directory read-only? If so, we now need to set all the fields to
// read-only.
if (gEditList.readOnly) {
const kMailListFields = [ 'ListName', 'ListNickName', 'ListDescription' ];
for (let i = 0; i < kMailListFields.length; ++i)
document.getElementById(kMailListFields[i]).readOnly = true;
document.documentElement.buttons = "accept";
document.documentElement.removeAttribute("ondialogaccept");
// Getting a sane read-only implementation for the addressing widget would
// basically need a separate dialog. Given I'm not sure about the future of
// the mailing list dialog in its current state, let's just disable it
// completely.
document.getElementById("addressingWidget").disabled = true;
}
document.addEventListener("keypress", awDocumentKeyPress, true);
// workaround for bug 118337 - for mailing lists that have more rows than fits inside
// the display, the value of the textbox inside the new row isn't inherited into the input -
// the first row then appears to be duplicated at the end although it is actually empty.
// see awAppendNewRow which copies first row and clears it
setTimeout(AppendLastRow, 0);
NotifyLoadListeners(gEditList);
}
function AppendLastRow()
{
AppendNewRowAndSetFocus();
awFitDummyRows(1);
// focus on first name
var listName = document.getElementById('ListName');
if (listName)
listName.focus();
}
function AppendNewRowAndSetFocus()
{
var lastInput = awGetInputElement(top.MAX_RECIPIENTS);
if (lastInput && lastInput.value)
awAppendNewRow(true);
else
awSetFocus(top.MAX_RECIPIENTS, lastInput);
}
function SetInputValue(inputValue, parentNode, templateNode)
{
top.MAX_RECIPIENTS++;
var newNode = templateNode.cloneNode(true);
parentNode.appendChild(newNode); // we need to insert the new node before we set the value of the select element!
var input = newNode.getElementsByTagName(awInputElementName());
if (input && input.length == 1)
{
//We need to set the value using both setAttribute and .value else we will
// lose the content when the field is not visible. See bug 37435
input[0].setAttribute("value", inputValue);
input[0].value = inputValue;
input[0].setAttribute("id", "addressCol1#" + top.MAX_RECIPIENTS);
}
}
function awNotAnEmptyArea(event)
{
//This is temporary until i figure out how to ensure to always having an empty space after the last row
var lastInput = awGetInputElement(top.MAX_RECIPIENTS);
if (lastInput && lastInput.value)
awAppendNewRow(false);
event.stopPropagation();
}
function awClickEmptySpace(target, setFocus)
{
if (target == null ||
(target.localName != "listboxbody" &&
target.localName != "listcell" &&
target.localName != "listitem"))
return;
var lastInput = awGetInputElement(top.MAX_RECIPIENTS);
if (lastInput && lastInput.value)
awAppendNewRow(setFocus);
else
if (setFocus)
awSetFocus(top.MAX_RECIPIENTS, lastInput);
}
function awReturnHit(inputElement)
{
var row = awGetRowByInputElement(inputElement);
if (inputElement.value)
{
var nextInput = awGetInputElement(row+1);
if (!nextInput)
awAppendNewRow(true);
else
awSetFocus(row+1, nextInput);
}
}
function awDeleteRow(rowToDelete)
{
/* When we delete a row, we must reset the id of others row in order to not break the sequence */
var maxRecipients = top.MAX_RECIPIENTS;
awRemoveRow(rowToDelete);
var numberOfCols = awGetNumberOfCols();
for (var row = rowToDelete + 1; row <= maxRecipients; row ++)
for (var col = 1; col <= numberOfCols; col++)
awGetElementByCol(row, col).setAttribute("id", "addressCol" + (col) + "#" + (row-1));
awTestRowSequence();
}
function awInputChanged(inputElement)
{
// AutoCompleteAddress(inputElement);
//Do we need to add a new row?
var lastInput = awGetInputElement(top.MAX_RECIPIENTS);
if (lastInput && lastInput.value && !top.doNotCreateANewRow)
awAppendNewRow(false);
top.doNotCreateANewRow = false;
}
function awInputElementName()
{
if (inputElementType == "")
inputElementType = document.getElementById("addressCol1#1").localName;
return inputElementType;
}
function awAppendNewRow(setFocus)
{
var body = document.getElementById("addressingWidget");
var listitem1 = awGetListItem(1);
if (body && listitem1)
{
var nextDummy = awGetNextDummyRow();
var newNode = listitem1.cloneNode(true);
if (nextDummy)
body.replaceChild(newNode, nextDummy);
else
body.appendChild(newNode);
top.MAX_RECIPIENTS++;
var input = newNode.getElementsByTagName(awInputElementName());
if (input && input.length == 1)
{
input[0].setAttribute("value", "");
input[0].setAttribute("id", "addressCol1#" + top.MAX_RECIPIENTS);
if (input[0].getAttribute('focused') != '')
input[0].removeAttribute('focused');
}
// focus on new input widget
if (setFocus && input )
awSetFocus(top.MAX_RECIPIENTS, input[0]);
}
}
// functions for accessing the elements in the addressing widget
function awGetInputElement(row)
{
return document.getElementById("addressCol1#" + row);
}
function _awSetFocus()
{
var listbox = document.getElementById('addressingWidget');
try
{
var theNewRow = awGetListItem(top.awRow);
listbox.ensureElementIsVisible(theNewRow);
top.awInputElement.focus();
}
catch(ex)
{
top.awFocusRetry ++;
if (top.awFocusRetry < 8)
{
dump("_awSetFocus failed, try it again...\n");
setTimeout(_awSetFocus, 0);
}
else
dump("_awSetFocus failed, forget about it!\n");
}
}
function awTabFromRecipient(element, event)
{
//If we are the last element in the listbox, we don't want to create a new row.
if (element == awGetInputElement(top.MAX_RECIPIENTS))
top.doNotCreateANewRow = true;
}
function DragOverAddressListTree(event)
{
var validFlavor = false;
var dragSession = gDragService.getCurrentSession();
// XXX add support for other flavors here
if (dragSession.isDataFlavorSupported("text/x-moz-address")) {
dragSession.canDrop = true;
}
}
function DropOnAddressListTree(event)
{
let dragSession = gDragService.getCurrentSession();
let trans;
try {
trans = Components.classes["@mozilla.org/widget/transferable;1"].createInstance(Components.interfaces.nsITransferable);
trans.init(getLoadContext());
trans.addDataFlavor("text/x-moz-address");
}
catch (ex) {
return;
}
for (let i = 0; i < dragSession.numDropItems; ++i)
{
dragSession.getData(trans, i);
let dataObj = new Object();
let bestFlavor = new Object();
let len = new Object();
trans.getAnyTransferData(bestFlavor, dataObj, len);
if (dataObj)
dataObj = dataObj.value.QueryInterface(Components.interfaces.nsISupportsString);
if (!dataObj)
continue;
// pull the URL out of the data object
let address = dataObj.data.substring(0, len.value);
if (!address)
continue;
DropListAddress(event.target, address);
}
}
function DropListAddress(target, address)
{
// Set focus on a new available, visible row.
awClickEmptySpace(target, true);
if (top.MAX_RECIPIENTS == 0)
top.MAX_RECIPIENTS = 1;
// Break apart the MIME-ready header address into individual addressees to
// add to the dialog.
let addresses = {}, names = {}, fullNames = {};
MailServices.headerParser.parseHeadersWithArray(address, addresses, names,
fullNames);
for (let full of fullNames.value)
{
let lastInput = awGetInputElement(top.MAX_RECIPIENTS);
lastInput.value = full;
awAppendNewRow(true);
}
}
/* Allows extensions to register a listener function for
* when a mailing list is loaded. The listener function
* should take two parameters - the first being the
* mailing list being loaded, the second one being the
* current window document.
*/
function RegisterLoadListener(aListener)
{
gLoadListeners.push(aListener);
}
/* Allows extensions to unload a load listener function.
*/
function UnregisterLoadListener(aListener)
{
var fIndex = gLoadListeners.indexOf(aListener);
if (fIndex != -1)
gLoadListeners.splice(fIndex, 1);
}
/* Allows extensions to register a listener function for
* when a mailing list is saved. Like a load listener,
* the save listener should take two parameters: the first
* being a copy of the mailing list that is being saved,
* and the second being the current window document.
*/
function RegisterSaveListener(aListener)
{
gSaveListeners.push(aListener);
}
/* Allows extensions to unload a save listener function.
*/
function UnregisterSaveListener(aListener)
{
var fIndex = gSaveListeners.indexOf(aListener);
if (fIndex != -1)
gSaveListeners.splice(fIndex, 1);
}
/* Notifies all load listeners.
*/
function NotifyLoadListeners(aMailingList)
{
for (let i = 0; i < gLoadListeners.length; i++)
gLoadListeners[i](aMailingList, document);
}
/* Notifies all save listeners.
*/
function NotifySaveListeners(aMailingList)
{
for (let i = 0; i < gSaveListeners.length; i++)
gSaveListeners[i](aMailingList, document);
}

33
mailnews/addrbook/content/abNewCardDialog.xul

@ -1,33 +0,0 @@
<?xml version="1.0"?>
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?>
<?xul-overlay href="chrome://messenger/content/addressbook/abCardOverlay.xul"?>
<!DOCTYPE dialog SYSTEM "chrome://messenger/locale/addressbook/abNewCardDialog.dtd">
<dialog xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
id="abcardWindow"
onload="OnLoadNewCard()"
ondialogaccept="return NewCardOKButton();">
<stringbundleset id="stringbundleset"/>
<hbox align="center">
<label id="abPopupLabel" control="abPopup" value="&chooseAddressBook.label;" accesskey="&chooseAddressBook.accesskey;"/>
<menulist id="abPopup">
<menupopup id="abPopup-menupopup" class="addrbooksPopup" writable="true"/>
</menulist>
</hbox>
<spacer style="height:1em"/>
<vbox id="editcard"/>
</dialog>

502
mailnews/addrbook/content/abResultsPane.js

@ -1,502 +0,0 @@
/* -*- Mode: javascript; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 ; js-indent-level: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/**
* Use of items in this file require:
*
* getSelectedDirectoryURI()
* returns the URI of the selected directory
* AbResultsPaneDoubleClick(card)
* Is called when the results pane is double-clicked, with the clicked card.
* AbEditCard(card)
* Is called when a card is to be edited, with the card as the parameter.
*
* The following function is only required if ResultsPaneController is used:
*
* goSetMenuValue()
* Core function in globalOverlay.js
*/
// List/card selections in the results pane.
var kNothingSelected = 0;
var kListsAndCards = 1;
var kMultipleListsOnly = 2;
var kSingleListOnly = 3;
var kCardsOnly = 4;
// Global Variables
// gAbView holds an object with an nsIAbView interface
var gAbView = null;
// Holds a reference to the "abResultsTree" document element. Initially
// set up by SetAbView.
var gAbResultsTree = null;
function SetAbView(aURI)
{
// If we don't have a URI, just clear the view and leave everything else
// alone.
if (!aURI) {
gAbView.clearView();
return;
}
// If we do have a URI, we want to allow updating the review even if the
// URI is the same, as the search results may be different.
var sortColumn = kDefaultSortColumn;
var sortDirection = kDefaultAscending;
if (!gAbResultsTree) {
gAbResultsTree = document.getElementById("abResultsTree");
gAbResultsTree.controllers.appendController(ResultsPaneController);
}
if (gAbView) {
sortColumn = gAbView.sortColumn;
sortDirection = gAbView.sortDirection;
}
else {
if (gAbResultsTree.hasAttribute("sortCol"))
sortColumn = gAbResultsTree.getAttribute("sortCol");
var sortColumnNode = document.getElementById(sortColumn);
if (sortColumnNode && sortColumnNode.hasAttribute("sortDirection"))
sortDirection = sortColumnNode.getAttribute("sortDirection");
}
var directory = GetDirectoryFromURI(aURI);
if (!gAbView)
gAbView = Components.classes["@mozilla.org/addressbook/abview;1"]
.createInstance(Components.interfaces.nsIAbView);
var actualSortColumn = gAbView.setView(directory, GetAbViewListener(),
sortColumn, sortDirection);
gAbResultsTree.treeBoxObject.view =
gAbView.QueryInterface(Components.interfaces.nsITreeView);
UpdateSortIndicators(actualSortColumn, sortDirection);
// If the selected address book is LDAP and the search box is empty,
// inform the user of the empty results pane.
let abResultsTree = document.getElementById("abResultsTree");
let cardViewOuterBox = document.getElementById("CardViewOuterBox");
let blankResultsPaneMessageBox = document.getElementById("blankResultsPaneMessageBox");
if (aURI.startsWith("moz-abldapdirectory://") && !aURI.includes("?")) {
if (abResultsTree)
abResultsTree.hidden = true;
if (cardViewOuterBox)
cardViewOuterBox.hidden = true;
if (blankResultsPaneMessageBox)
blankResultsPaneMessageBox.hidden = false;
} else {
if (abResultsTree)
abResultsTree.hidden = false;
if (cardViewOuterBox)
cardViewOuterBox.hidden = false;
if (blankResultsPaneMessageBox)
blankResultsPaneMessageBox.hidden = true;
}
}
function CloseAbView()
{
if (gAbView)
gAbView.clearView();
}
function GetOneOrMoreCardsSelected()
{
return (gAbView && (gAbView.selection.getRangeCount() > 0));
}
function GetSelectedAddresses()
{
return GetAddressesForCards(GetSelectedAbCards());
}
function GetNumSelectedCards()
{
try {
return gAbView.selection.count;
}
catch (ex) {
}
// if something went wrong, return 0 for the count.
return 0;
}
function GetSelectedCardTypes()
{
var cards = GetSelectedAbCards();
if (!cards) {
Components.utils.reportError("ERROR: GetSelectedCardTypes: |cards| is null.");
return kNothingSelected; // no view
}
var count = cards.length;
if (count == 0)