fix for #141881. remove addMailListToDatabase() from nsIAbDirectory.idl, not needed.

also, so other code cleanup.  r/sr=bienvenu
This commit is contained in:
sspitzer%netscape.com 2002-05-02 23:46:59 +00:00
parent 5d7747f14f
commit cf254a36ae
5 changed files with 11 additions and 59 deletions

View File

@ -156,13 +156,6 @@ interface nsIAbDirectory : nsISupports {
attribute wstring listNickName;
attribute wstring description;
/**
* Adds a new mail list into the directory
* defined by the uri
* XXX javadoc me
*/
void addMailListToDatabase(in string uri);
/**
* Edits an existing mailing list (specified as listCard)
* into the directory specified by the uri

View File

@ -38,7 +38,6 @@
top.MAX_RECIPIENTS = 1;
var inputElementType = "";
var mailList;
var gParentURI;
var gListCard;
var gEditList;
@ -174,11 +173,13 @@ function MailListOKButton()
// -----
//Add mailing list to database
mailList = Components.classes["@mozilla.org/addressbook/directoryproperty;1"].createInstance();
var mailList = Components.classes["@mozilla.org/addressbook/directoryproperty;1"].createInstance();
mailList = mailList.QueryInterface(Components.interfaces.nsIAbDirectory);
if (GetListValue(mailList, true))
mailList.addMailListToDatabase(uri);
if (GetListValue(mailList, true)) {
var parentDirectory = GetDirectoryFromURI(uri);
parentDirectory.addMailList(mailList);
}
else
return false;
}

View File

@ -196,24 +196,6 @@ NS_IMETHODIMP nsAbDirProperty::SetAddressLists(nsISupportsArray * aAddressLists)
return NS_OK;
}
NS_IMETHODIMP nsAbDirProperty::AddMailListToDatabase(const char *uri)
{
nsresult rv = NS_OK;
nsCOMPtr<nsIRDFService> rdf(do_GetService("@mozilla.org/rdf/rdf-service;1", &rv));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIRDFResource> res;
rv = rdf->GetResource(uri, getter_AddRefs(res));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIAbDirectory> directory(do_QueryInterface(res, &rv));
NS_ENSURE_SUCCESS(rv, rv);
rv = directory->AddMailList(this);
NS_ENSURE_SUCCESS(rv, rv);
return rv;
}
NS_IMETHODIMP nsAbDirProperty::CopyMailList(nsIAbDirectory* srcList)
{
nsXPIDLString str;

View File

@ -100,30 +100,6 @@ NS_IMPL_ISUPPORTS_INHERITED4(nsAbMDBDirectory, nsRDFResource,
////////////////////////////////////////////////////////////////////////////////
// Not called
nsresult nsAbMDBDirectory::AddMailList(const char *uriName)
{
if (!uriName)
return NS_ERROR_NULL_POINTER;
nsresult rv = NS_OK;
nsCOMPtr<nsIRDFService> rdf(do_GetService("@mozilla.org/rdf/rdf-service;1", &rv));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIRDFResource> res;
rv = rdf->GetResource(uriName, getter_AddRefs(res));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIAbDirectory> directory(do_QueryInterface(res, &rv));
NS_ENSURE_SUCCESS(rv, rv);
mSubDirectories->AppendElement(directory);
return rv;
}
nsresult nsAbMDBDirectory::RemoveCardFromAddressList(nsIAbCard* card)
{
nsresult rv = NS_OK;
@ -675,8 +651,7 @@ NS_IMETHODIMP nsAbMDBDirectory::AddMailList(nsIAbDirectory *list)
nsCOMPtr<nsIAbDirectory> newlist = getter_AddRefs(NS_STATIC_CAST(nsIAbDirectory*, dblistproperty));
newlist->CopyMailList(list);
list = newlist;
dblist = do_QueryInterface(list);
rv = NS_OK;
dblist = do_QueryInterface(list, &rv);
}
mDatabase->CreateMailListAndAddToDB(list, PR_TRUE);
@ -684,10 +659,13 @@ NS_IMETHODIMP nsAbMDBDirectory::AddMailList(nsIAbDirectory *list)
PRUint32 dbRowID;
dblist->GetDbRowID(&dbRowID);
char *listUri = PR_smprintf("%s/MailList%ld", mURI, dbRowID);
nsCAutoString listUri;
listUri = nsDependentCString(mURI) + NS_LITERAL_CSTRING("/MailList");
listUri.AppendInt(dbRowID);
nsCOMPtr<nsIAbDirectory> newList;
rv = AddDirectory(listUri, getter_AddRefs(newList));
rv = AddDirectory(listUri.get(), getter_AddRefs(newList));
nsCOMPtr<nsIAbMDBDirectory> dbnewList(do_QueryInterface(newList));
if (NS_SUCCEEDED(rv) && newList)
{

View File

@ -114,8 +114,6 @@ protected:
nsresult NotifyItemChanged(nsISupports *item);
nsresult RemoveCardFromAddressList(nsIAbCard* card);
nsresult AddMailList(const char *uriName);
nsresult GetAbDatabase();
nsCOMPtr<nsIAddrDatabase> mDatabase;