Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Member Functions | Static Private Member Functions | Private Attributes
nsAbOSXDirectory Class Reference

#include <nsAbOSXDirectory.h>

Inheritance diagram for nsAbOSXDirectory:
Inheritance graph
[legend]
Collaboration diagram for nsAbOSXDirectory:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 ~nsAbOSXDirectory ()
NS_DECL_ISUPPORTS_INHERITED
NS_IMETHOD 
Init (const char *aUri)
NS_IMETHOD GetOperations (PRInt32 *aOperations)
NS_IMETHOD GetChildCards (nsIEnumerator **aCards)
NS_IMETHOD GetChildNodes (nsISimpleEnumerator **aNodes)
NS_IMETHOD HasCard (nsIAbCard *aCard, PRBool *aHasCard)
NS_IMETHOD HasDirectory (nsIAbDirectory *aDirectory, PRBool *aHasDirectory)
nsresult OnSearchFinished (PRInt32 aResult)
nsresult OnSearchFoundCard (nsIAbCard *aCard)
nsresult AssertChildNodes ()
nsresult AssertDirectory (nsIAddrBookSession *aSession, nsIAbDirectory *aDirectory)
nsresult AssertCard (nsIAddrBookSession *aSession, nsIAbCard *aCard)
nsresult UnassertDirectory (nsIAddrBookSession *aSession, nsIAbDirectory *aDirectory)
nsresult UnassertCard (nsIAddrBookSession *aSession, nsIAbCard *aCard)
nsresult Update ()
void GetURI (nsACString &aURI)
void Init (in string uri)
 This method is called by the nsIRDFService after constructing a resource object to initialize it's URI.
NS_DECL_ISUPPORTS NS_IMETHOD EqualsNode (nsIRDFNode *aNode, PRBool *aResult)
boolean EqualsNode (in nsIRDFNode aNode)
NS_IMETHOD GetValue (char **aURI)
NS_IMETHOD GetValueUTF8 (nsACString &aResult)
NS_IMETHOD GetValueConst (const char **aURI)
void GetValueConst ([shared] out string aConstValue)
 An unscriptable version used to avoid a string copy.
NS_IMETHOD EqualsString (const char *aURI, PRBool *aResult)
boolean EqualsString (in string aURI)
 Determine if the resource has the given URI.
NS_IMETHOD GetDelegate (const char *aKey, REFNSIID aIID, void **aResult)
void GetDelegate (in string aKey, in nsIIDRef aIID,[iid_is(aIID), retval] out nsQIResult aResult)
 Retrieve the "delegate" object for this resource.
NS_IMETHOD ReleaseDelegate (const char *aKey)
void ReleaseDelegate (in string aKey)
 Force a delegate to be "unbound" from the resource.
void modifyDirectory (in nsIAbDirectory directory, in nsIAbDirectoryProperties aProperties)
void deleteDirectory (in nsIAbDirectory dierctory)
void deleteCards (in nsISupportsArray cards)
boolean hasCard (in nsIAbCard cards)
boolean hasDirectory (in nsIAbDirectory dir)
nsIAbCard addCard (in nsIAbCard card)
 return value is the card that got added we need to do this, as the card we pass in might be an abstract nsIAbCard, and the caller might need the "real" card (the mdbcard) to get / set non-standard card values
void dropCard (in nsIAbCard card, in boolean needToCopyCard)
void addMailList (in nsIAbDirectory list)
void addMailListWithKey (in nsIAbDirectory list, out PRUint32 key)
void editMailListToDatabase (in string uri, in nsIAbCard listCard)
 Edits an existing mailing list (specified as listCard) into the directory specified by the uri XXX javadoc me.
void copyMailList (in nsIAbDirectory srcList)
void createNewDirectory (in nsIAbDirectoryProperties aProperties)
void createDirectoryByURI (in wstring displayName, in string uri, in boolean migrating)
wstring getValueForCard (in nsIAbCard card, in string name)
void setValueForCard (in nsIAbCard card, in string name, in wstring value)

Public Attributes

readonly attribute string Value
 The single-byte string value of the resource.
readonly attribute AUTF8String ValueUTF8
 The UTF-8 URI of the resource.
const long opRead = 0x1
const long opWrite = 0x2
const long opSearch = 0x4
readonly attribute long operations
attribute wstring dirName
attribute unsigned long lastModifiedDate
attribute PRBool isMailList
readonly attribute
nsIAbDirectoryProperties 
directoryProperties
readonly attribute
nsISimpleEnumerator 
childNodes
readonly attribute nsIEnumerator childCards
readonly attribute boolean isRemote
 directory is local (example, mork based) or remote (example, LDAP)
readonly attribute boolean isSecure
 directory is secure (as in LDAP over SSL)
readonly attribute boolean searchDuringLocalAutocomplete
 directory should be searched when doing local autocomplete
readonly attribute boolean supportsMailingLists
attribute nsISupportsArray addressLists
attribute wstring listNickName
attribute wstring description
attribute ACString dirPrefId

Protected Member Functions

nsresult GetAttributeName (PRUnichar **aName, nsString &value)
nsresult SetAttributeName (const PRUnichar *aName, nsString &arrtibute)

Protected Attributes

PRBool mIsValidURI
PRBool mIsQueryURI
nsCString mPath
nsCString mQueryString
nsCString mURINoQuery
nsCString mURI
DelegateEntrymDelegates
nsString m_DirName
PRUint32 m_LastModifiedDate
nsString m_ListName
nsString m_ListNickName
nsString m_Description
PRBool m_IsMailList
nsCString m_DirPrefId
nsCOMPtr< nsISupportsArraym_AddressList

Static Protected Attributes

static nsIRDFServicegRDFService = nsnull
static nsrefcnt gRDFServiceRefCnt = 0

Private Member Functions

nsresult FallbackSearch (nsIAbBooleanExpression *aExpression, nsIEnumerator **aCards)

Static Private Member Functions

static nsresult GetEnumerator (nsISupportsArray *aArray, nsIEnumerator **aEnumerator)

Private Attributes

nsTHashtable< nsIAbCardHashKeymCardList

Detailed Description

Definition at line 123 of file nsAbOSXDirectory.h.


Constructor & Destructor Documentation

Definition at line 439 of file nsAbOSXDirectory.mm.

{
    if (--sObserverCount == 0) {
        [[NSNotificationCenter defaultCenter] removeObserver:sObserver];
        [sObserver release];
    }
}

Member Function Documentation

return value is the card that got added we need to do this, as the card we pass in might be an abstract nsIAbCard, and the caller might need the "real" card (the mdbcard) to get / set non-standard card values

nsresult nsAbOSXDirectory::AssertCard ( nsIAddrBookSession aSession,
nsIAbCard aCard 
) [virtual]

Implements nsIAbOSXDirectory.

Definition at line 676 of file nsAbOSXDirectory.mm.

{
    NS_ASSERTION(!mCardList.IsInitialized() || !mCardList.GetEntry(aCard),
                 "Replacing?");

    if (!mCardList.IsInitialized() && !mCardList.Init()) {
        return NS_ERROR_OUT_OF_MEMORY;
    }

    mCardList.PutEntry(aCard);
    return aSession->NotifyDirectoryItemAdded(this, aCard);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Implements nsIAbOSXDirectory.

Definition at line 622 of file nsAbOSXDirectory.mm.

{
    // Queries and mailing lists can't have childnodes.
    if (mIsQueryURI || m_IsMailList) {
        return NS_OK;
    }

    nsresult rv;
    nsCOMPtr<nsIAddrBookSession> abSession =
        do_GetService(NS_ADDRBOOKSESSION_CONTRACTID, &rv);
    NS_ENSURE_SUCCESS(rv, rv);

    NSArray *groups = [[ABAddressBook sharedAddressBook] groups];

    unsigned int i, count = [groups count];

    if (count > 0 && !m_AddressList) {
        rv = NS_NewISupportsArray(getter_AddRefs(m_AddressList));
        NS_ENSURE_SUCCESS(rv, rv);
    }

    nsCOMPtr<nsIAbDirectory> directory;
    for (i = 0; i < count; ++i) {
        rv = ConvertToGroupResource(gRDFService, [[groups objectAtIndex:i] uniqueId],
                                    getter_AddRefs(directory));
        NS_ENSURE_SUCCESS(rv, rv);

        rv = AssertDirectory(abSession, directory);
        NS_ENSURE_SUCCESS(rv, rv);
    }

    return NS_OK;
}

Here is the call graph for this function:

nsresult nsAbOSXDirectory::AssertDirectory ( nsIAddrBookSession aSession,
nsIAbDirectory aDirectory 
) [virtual]

Implements nsIAbOSXDirectory.

Definition at line 657 of file nsAbOSXDirectory.mm.

{
    NS_ASSERTION(!m_AddressList || m_AddressList->IndexOf(aDirectory) < 0,
                 "Replacing?");

    nsresult rv;
    if (!m_AddressList) {
        rv = NS_NewISupportsArray(getter_AddRefs(m_AddressList));
        NS_ENSURE_SUCCESS(rv, rv);
    }

    rv = m_AddressList->AppendElement(aDirectory);
    NS_ENSURE_SUCCESS(rv, rv);

    return aSession->NotifyDirectoryItemAdded(this, aDirectory);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIAbDirectory::createDirectoryByURI ( in wstring  displayName,
in string  uri,
in boolean  migrating 
) [inherited]
void nsIAbDirectory::dropCard ( in nsIAbCard  card,
in boolean  needToCopyCard 
) [inherited]
void nsIAbDirectory::editMailListToDatabase ( in string  uri,
in nsIAbCard  listCard 
) [inherited]

Edits an existing mailing list (specified as listCard) into the directory specified by the uri XXX javadoc me.

boolean nsIRDFNode::EqualsNode ( in nsIRDFNode  aNode) [inherited]
NS_IMETHODIMP nsRDFResource::EqualsNode ( nsIRDFNode aNode,
PRBool aResult 
) [inherited]

Definition at line 84 of file nsRDFResource.cpp.

{
    NS_PRECONDITION(aNode != nsnull, "null ptr");
    if (! aNode)
        return NS_ERROR_NULL_POINTER;

    nsresult rv;
    nsIRDFResource* resource;
    rv = aNode->QueryInterface(NS_GET_IID(nsIRDFResource), (void**)&resource);
    if (NS_SUCCEEDED(rv)) {
        *aResult = (NS_STATIC_CAST(nsIRDFResource*, this) == resource);
        NS_RELEASE(resource);
        return NS_OK;
    }
    else if (rv == NS_NOINTERFACE) {
        *aResult = PR_FALSE;
        return NS_OK;
    }
    else {
        return rv;
    }
}
NS_IMETHODIMP nsRDFResource::EqualsString ( const char *  aURI,
PRBool aResult 
) [inherited]

Definition at line 156 of file nsRDFResource.cpp.

{
    NS_PRECONDITION(aURI != nsnull, "null ptr");
    if (! aURI)
        return NS_ERROR_NULL_POINTER;

    NS_PRECONDITION(aResult, "null ptr");

    *aResult = mURI.Equals(aURI);
    return NS_OK;
}

Determine if the resource has the given URI.

nsresult nsAbOSXDirectory::FallbackSearch ( nsIAbBooleanExpression aExpression,
nsIEnumerator **  aCards 
) [private]

Definition at line 838 of file nsAbOSXDirectory.mm.

{
    nsresult rv;

    if (mCardList.IsInitialized()) {
        mCardList.Clear();
    }
    else if (!mCardList.Init()) {
        return NS_ERROR_OUT_OF_MEMORY;
    }

    if (m_AddressList) {
        m_AddressList->Clear();
    }
    else {
        rv = NS_NewISupportsArray(getter_AddRefs(m_AddressList));
        NS_ENSURE_SUCCESS(rv, rv);
    }

    nsCOMPtr<nsIAbDirectoryQueryArguments> arguments =
        do_CreateInstance(NS_ABDIRECTORYQUERYARGUMENTS_CONTRACTID, &rv);
    NS_ENSURE_SUCCESS(rv, rv);

    rv = arguments->SetExpression(aExpression);
    NS_ENSURE_SUCCESS(rv, rv);

    // Set the return properties to
    // return nsIAbCard interfaces
    const char* property = "card:nsIAbCard";
    rv = arguments->SetReturnProperties(1, &property);
    NS_ENSURE_SUCCESS(rv, rv);

    // Don't search the subdirectories. If the current directory is a mailing
    // list, it won't have any subdirectories. If the current directory is an
    // addressbook, searching both it and the subdirectories (the mailing
    // lists), will yield duplicate results because every entry in a mailing
    // list will be an entry in the parent addressbook.
    rv = arguments->SetQuerySubDirectories(PR_FALSE);
    NS_ENSURE_SUCCESS(rv, rv);

    // Set the the query listener
    nsCOMPtr<nsIAbDirectoryQueryResultListener> queryListener =
        new nsAbDirSearchListener(this);
    if (!queryListener) {
        return NS_ERROR_OUT_OF_MEMORY;
    }

    // Get the directory without the query
    nsCOMPtr<nsIRDFResource> resource;
    rv = gRDFService->GetResource(mURINoQuery, getter_AddRefs(resource));
    NS_ENSURE_SUCCESS(rv, rv);

    nsCOMPtr<nsIAbDirectory> directory = do_QueryInterface(resource, &rv);
    NS_ENSURE_SUCCESS(rv, rv);

    // Initiate the proxy query with the no query directory
    nsCOMPtr<nsIAbDirectoryQueryProxy> queryProxy = 
        do_CreateInstance(NS_ABDIRECTORYQUERYPROXY_CONTRACTID, &rv);
    NS_ENSURE_SUCCESS(rv, rv);

    rv = queryProxy->Initiate(directory);
    NS_ENSURE_SUCCESS(rv, rv);

    PRInt32 context = 0;
    rv = queryProxy->DoQuery(arguments, queryListener, -1, 0, &context);
    NS_ENSURE_SUCCESS(rv, rv);

    return GetEnumerator(m_AddressList, aCards);
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsAbDirProperty::GetAttributeName ( PRUnichar **  aName,
nsString value 
) [protected, inherited]

Definition at line 135 of file nsAbDirProperty.cpp.

{
       if (aName)
       {
              *aName = ToNewUnicode(value);
              if (!(*aName)) 
                     return NS_ERROR_OUT_OF_MEMORY;
              else
                     return NS_OK;
       }
       else
              return NS_ERROR_NULL_POINTER;

}

Here is the call graph for this function:

Definition at line 726 of file nsAbOSXDirectory.mm.

{
    NS_ENSURE_ARG_POINTER(aCards);

    ABAddressBook *addressBook = [ABAddressBook sharedAddressBook];

    nsresult rv;
    NSArray *cards;
    if (mIsQueryURI) {
        nsCOMPtr<nsIAbBooleanExpression> expression;
        rv = nsAbQueryStringToExpression::Convert(mQueryString.get(),
                                                  getter_AddRefs(expression));
        NS_ENSURE_SUCCESS(rv, rv);

        PRBool canHandle = !m_IsMailList && Search(expression, &cards);
        if (!canHandle) {
            return FallbackSearch(expression, aCards);
        }
    }
    else {
        if (m_IsMailList) {
            ABGroup *group = (ABGroup*)[addressBook recordForUniqueId:[NSString stringWithUTF8String:nsCAutoString(Substring(mURINoQuery, 21)).get()]];
            cards = [[group members] arrayByAddingObjectsFromArray:[group subgroups]];
        }
        else {
            cards = [[addressBook people] arrayByAddingObjectsFromArray:[addressBook groups]];
        }
    }

    // Fill the results array and update the card list
    // Also update the address list and notify any changes.
    unsigned int nbCards = [cards count];
    if (nbCards > 0) {
        if (mCardList.IsInitialized()) {
            mCardList.Clear();
        }
        else if (!mCardList.Init()) {
            return NS_ERROR_OUT_OF_MEMORY;
        }
    }

    nsCOMPtr<nsISupportsArray> cardList;
    rv = NS_NewISupportsArray(getter_AddRefs(cardList));
    NS_ENSURE_SUCCESS(rv, rv);

    unsigned int i;
    nsCOMPtr<nsIAbCard> card;
    for (i = 0; i < nbCards; ++i) {
        rv = ConvertToCard(gRDFService, [cards objectAtIndex:i],
                           getter_AddRefs(card));
        NS_ENSURE_SUCCESS(rv, rv);

        rv = cardList->AppendElement(card);
        NS_ENSURE_SUCCESS(rv, rv);

        mCardList.PutEntry(card);
    }

    return GetEnumerator(cardList, aCards);
}

Here is the call graph for this function:

Definition at line 713 of file nsAbOSXDirectory.mm.

{
    NS_ENSURE_ARG_POINTER(aNodes);

    // Queries don't have childnodes.
    if (mIsQueryURI || !m_AddressList) {
        return NS_NewEmptyEnumerator(aNodes);
    }

    return NS_NewArrayEnumerator(aNodes, m_AddressList);
}

Here is the call graph for this function:

NS_IMETHODIMP nsRDFResource::GetDelegate ( const char *  aKey,
REFNSIID  aIID,
void **  aResult 
) [inherited]

Definition at line 169 of file nsRDFResource.cpp.

{
    NS_PRECONDITION(aKey != nsnull, "null ptr");
    if (! aKey)
        return NS_ERROR_NULL_POINTER;

    nsresult rv;
    *aResult = nsnull;

    DelegateEntry* entry = mDelegates;
    while (entry) {
        if (entry->mKey.Equals(aKey)) {
            rv = entry->mDelegate->QueryInterface(aIID, aResult);
            return rv;
        }

        entry = entry->mNext;
    }

    // Construct a ContractID of the form "@mozilla.org/rdf/delegate/[key]/[scheme];1
    nsCAutoString contractID(NS_RDF_DELEGATEFACTORY_CONTRACTID_PREFIX);
    contractID.Append(aKey);
    contractID.Append("&scheme=");

    PRInt32 i = mURI.FindChar(':');
    contractID += StringHead(mURI, i);

    nsCOMPtr<nsIRDFDelegateFactory> delegateFactory =
             do_CreateInstance(contractID.get(), &rv);
    if (NS_FAILED(rv)) return rv;

    rv = delegateFactory->CreateDelegate(this, aKey, aIID, aResult);
    if (NS_FAILED(rv)) return rv;

    // Okay, we've successfully created a delegate. Let's remember it.
    entry = new DelegateEntry;
    if (! entry) {
        NS_RELEASE(*NS_REINTERPRET_CAST(nsISupports**, aResult));
        return NS_ERROR_OUT_OF_MEMORY;
    }
    
    entry->mKey      = aKey;
    entry->mDelegate = do_QueryInterface(*NS_REINTERPRET_CAST(nsISupports**, aResult), &rv);
    if (NS_FAILED(rv)) {
        NS_ERROR("nsRDFResource::GetDelegate(): can't QI to nsISupports!");

        delete entry;
        NS_RELEASE(*NS_REINTERPRET_CAST(nsISupports**, aResult));
        return NS_ERROR_FAILURE;
    }

    entry->mNext     = mDelegates;

    mDelegates = entry;

    return NS_OK;
}

Here is the call graph for this function:

void nsIRDFResource::GetDelegate ( in string  aKey,
in nsIIDRef  aIID,
[iid_is(aIID), retval] out nsQIResult  aResult 
) [inherited]

Retrieve the "delegate" object for this resource.

A resource may have several delegate objects, each of whose lifetimes is bound to the life of the resource object.

This method will return the delegate for the given key after QueryInterface()-ing it to the requested IID.

If no delegate exists for the specified key, this method will attempt to create one using the component manager. Specifically, it will combine aKey with the resource's URI scheme to produce a ContractID as follows:

component:/rdf/delegate-factory/[key]/[scheme]

This ContractID will be used to locate a factory using the FindFactory() method of nsIComponentManager. If the nsIFactory exists, it will be used to create a "delegate factory"; that is, an object that supports nsIRDFDelegateFactory. The delegate factory will be used to construct the delegate object.

Here is the caller graph for this function:

static nsresult nsAbOSXDirectory::GetEnumerator ( nsISupportsArray aArray,
nsIEnumerator **  aEnumerator 
) [inline, static, private]

Definition at line 165 of file nsAbOSXDirectory.h.

    {
        nsIBidirectionalEnumerator *enumerator;
        nsresult rv = NS_NewISupportsArrayEnumerator(aArray,
                                                     &enumerator);
        NS_ENSURE_SUCCESS(rv, rv);

        *aEnumerator = enumerator;

        return NS_OK;
    }

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 481 of file nsAbOSXDirectory.mm.

void nsAbOSXDirectory::GetURI ( nsACString &  aURI) [inline, virtual]

Implements nsIAbOSXDirectory.

Definition at line 159 of file nsAbOSXDirectory.h.

    {
        aURI = mURI;
    }
NS_IMETHODIMP nsRDFResource::GetValue ( char **  aURI) [inherited]

Definition at line 129 of file nsRDFResource.cpp.

{
    NS_ASSERTION(aURI, "Null out param.");
    
    *aURI = ToNewCString(mURI);

    if (!*aURI)
        return NS_ERROR_OUT_OF_MEMORY;

    return NS_OK;
}

Here is the call graph for this function:

NS_IMETHODIMP nsRDFResource::GetValueConst ( const char **  aURI) [inherited]

Definition at line 149 of file nsRDFResource.cpp.

{
    *aURI = mURI.get();
    return NS_OK;
}

Here is the call graph for this function:

void nsIRDFResource::GetValueConst ( [shared] out string  aConstValue) [inherited]

An unscriptable version used to avoid a string copy.

Meant for use as a performance optimization. The string is encoded in UTF-8.

wstring nsIAbDirectory::getValueForCard ( in nsIAbCard  card,
in string  name 
) [inherited]
NS_IMETHODIMP nsRDFResource::GetValueUTF8 ( nsACString &  aResult) [inherited]

Definition at line 142 of file nsRDFResource.cpp.

{
    aResult = mURI;
    return NS_OK;
}
boolean nsIAbDirectory::hasCard ( in nsIAbCard  cards) [inherited]

Here is the caller graph for this function:

Definition at line 788 of file nsAbOSXDirectory.mm.

{
    NS_ENSURE_ARG_POINTER(aCard);
    NS_ENSURE_ARG_POINTER(aHasCard);

    *aHasCard = mCardList.IsInitialized() && mCardList.GetEntry(aCard);

    return NS_OK;
}

Here is the call graph for this function:

NS_IMETHODIMP nsAbOSXDirectory::HasDirectory ( nsIAbDirectory aDirectory,
PRBool aHasDirectory 
)

Definition at line 799 of file nsAbOSXDirectory.mm.

{
    NS_ENSURE_ARG_POINTER(aDirectory);
    NS_ENSURE_ARG_POINTER(aHasDirectory);

    *aHasDirectory = m_AddressList && m_AddressList->IndexOf(aDirectory) >= 0;

    return NS_OK;
}
void nsIRDFResource::Init ( in string  uri) [inherited]

This method is called by the nsIRDFService after constructing a resource object to initialize it's URI.

You would not normally call this method directly

Reimplemented from nsAbDirectoryRDFResource.

void nsIAbDirectory::modifyDirectory ( in nsIAbDirectory  directory,
in nsIAbDirectoryProperties  aProperties 
) [inherited]

Implements nsAbDirSearchListenerContext.

Definition at line 811 of file nsAbOSXDirectory.mm.

{
    return NS_OK;
}

Implements nsAbDirSearchListenerContext.

Definition at line 817 of file nsAbOSXDirectory.mm.

Here is the call graph for this function:

NS_IMETHODIMP nsRDFResource::ReleaseDelegate ( const char *  aKey) [inherited]

Definition at line 228 of file nsRDFResource.cpp.

{
    NS_PRECONDITION(aKey != nsnull, "null ptr");
    if (! aKey)
        return NS_ERROR_NULL_POINTER;

    DelegateEntry* entry = mDelegates;
    DelegateEntry** link = &mDelegates;

    while (entry) {
        if (entry->mKey.Equals(aKey)) {
            *link = entry->mNext;
            delete entry;
            return NS_OK;
        }

        link = &(entry->mNext);
        entry = entry->mNext;
    }

    NS_WARNING("nsRDFResource::ReleaseDelegate() no delegate found");
    return NS_OK;
}

Force a delegate to be "unbound" from the resource.

Normally, a delegate object's lifetime will be identical to that of the resource to which it is bound; this method allows a delegate to unlink itself from an RDF resource prematurely.

nsresult nsAbDirProperty::SetAttributeName ( const PRUnichar aName,
nsString arrtibute 
) [protected, inherited]

Definition at line 150 of file nsAbDirProperty.cpp.

{
       if (aName)
              arrtibute = aName;
       return NS_OK;
}
void nsIAbDirectory::setValueForCard ( in nsIAbCard  card,
in string  name,
in wstring  value 
) [inherited]
nsresult nsAbOSXDirectory::UnassertCard ( nsIAddrBookSession aSession,
nsIAbCard aCard 
) [virtual]

Implements nsIAbOSXDirectory.

Definition at line 703 of file nsAbOSXDirectory.mm.

{
    NS_ASSERTION(mCardList.GetEntry(aCard), "Not found?");

    mCardList.RemoveEntry(aCard);
    return aSession->NotifyDirectoryItemDeleted(this, aCard);
}

Here is the call graph for this function:

nsresult nsAbOSXDirectory::UnassertDirectory ( nsIAddrBookSession aSession,
nsIAbDirectory aDirectory 
) [virtual]

Implements nsIAbOSXDirectory.

Definition at line 691 of file nsAbOSXDirectory.mm.

{
    NS_ASSERTION(m_AddressList->IndexOf(aDirectory) >= 0, "Not found?");

    nsresult rv = m_AddressList->RemoveElement(aDirectory);
    NS_ENSURE_SUCCESS(rv, rv);

    return aSession->NotifyDirectoryItemDeleted(this, aDirectory);
}

Here is the caller graph for this function:

Implements nsIAbOSXDirectory.

Definition at line 527 of file nsAbOSXDirectory.mm.

{
    nsresult rv;
    nsCOMPtr<nsIAddrBookSession> abSession = do_GetService(NS_ADDRBOOKSESSION_CONTRACTID, &rv);
    NS_ENSURE_SUCCESS(rv, rv);

    if (mIsQueryURI) {
        return NS_OK;
    }

    ABAddressBook *addressBook = [ABAddressBook sharedAddressBook];

    NSArray *groups, *cards;
    if (m_IsMailList) {
        ABGroup *group = (ABGroup*)[addressBook recordForUniqueId:[NSString stringWithUTF8String:nsCAutoString(Substring(mURINoQuery, 21)).get()]];
        groups = nil;
        cards = [[group members] arrayByAddingObjectsFromArray:[group subgroups]];
    }
    else {
        groups = [addressBook groups];
        cards = [[addressBook people] arrayByAddingObjectsFromArray:groups];
    }

    NSMutableArray *mutableArray = [NSMutableArray arrayWithArray:cards];
    if (mCardList.IsInitialized()) {
        nsEnumeratorData data = { mutableArray, this, abSession };

        mCardList.EnumerateEntries(Enumerator, &data);
    }

    NSEnumerator *enumerator = [mutableArray objectEnumerator];
    ABRecord *card;
    nsCOMPtr<nsIAbCard> abCard;
    while ((card = [enumerator nextObject])) {
        rv = ConvertToCard(gRDFService, card, getter_AddRefs(abCard));
        NS_ENSURE_SUCCESS(rv, rv);

        AssertCard(abSession, abCard);
    }

    card = (ABRecord*)[addressBook recordForUniqueId:[NSString stringWithUTF8String:nsCAutoString(Substring(mURINoQuery, 21)).get()]];
    NSString * stringValue = [card valueForProperty:kABGroupNameProperty];
    if (![stringValue isEqualToString:WrapString(m_DirName)]) {
        nsAutoString oldValue(m_DirName);
        AssignToString(stringValue, m_DirName);
        nsISupports *supports =
            NS_ISUPPORTS_CAST(nsAbDirectoryRDFResource*, this);
        abSession->NotifyItemPropertyChanged(supports, "DirName",
                                             oldValue.get(), m_DirName.get());
    }

    if (groups) {
        mutableArray = [NSMutableArray arrayWithArray:groups];
        nsCOMPtr<nsIAbDirectory> directory;
        if (m_AddressList) {
            PRUint32 i, count;
            m_AddressList->Count(&count);
            for (i = 0; i < count; ++i) {
                directory = do_QueryElementAt(m_AddressList, i);
                nsCOMPtr<nsIAbOSXDirectory> osxDirectory =
                    do_QueryInterface(directory);

                nsCAutoString uri;
                osxDirectory->GetURI(uri);
                uri.Cut(0, 21);
                NSString *uid = [NSString stringWithUTF8String:uri.get()];

                unsigned int j, arrayCount = [mutableArray count];
                for (j = 0; j < arrayCount; ++j) {
                    if ([[[mutableArray objectAtIndex:j] uniqueId] isEqualToString:uid]) {
                        [mutableArray removeObjectAtIndex:j];
                        break;
                    }
                }

                if (j == arrayCount) {
                    UnassertDirectory(abSession, directory);
                }
            }
        }

        enumerator = [mutableArray objectEnumerator];
        while ((card = [enumerator nextObject])) {
            rv = ConvertToGroupResource(gRDFService, [card uniqueId],
                                        getter_AddRefs(directory));
            NS_ENSURE_SUCCESS(rv, rv);

            AssertDirectory(abSession, directory);
        }
    }

    return NS_OK;
}

Here is the call graph for this function:


Member Data Documentation

Definition at line 163 of file nsIAbDirectory.idl.

Definition at line 103 of file nsIAbDirectory.idl.

Definition at line 98 of file nsIAbDirectory.idl.

Definition at line 177 of file nsIAbDirectory.idl.

Definition at line 95 of file nsIAbDirectory.idl.

attribute wstring nsIAbDirectory::dirName [inherited]

Definition at line 85 of file nsIAbDirectory.idl.

attribute ACString nsIAbDirectory::dirPrefId [inherited]

Definition at line 208 of file nsIAbDirectory.idl.

nsIRDFService * nsRDFResource::gRDFService = nsnull [static, protected, inherited]

Definition at line 75 of file nsRDFResource.h.

nsrefcnt nsRDFResource::gRDFServiceRefCnt = 0 [static, protected, inherited]

Definition at line 76 of file nsRDFResource.h.

Definition at line 92 of file nsIAbDirectory.idl.

directory is local (example, mork based) or remote (example, LDAP)

Definition at line 142 of file nsIAbDirectory.idl.

directory is secure (as in LDAP over SSL)

Definition at line 147 of file nsIAbDirectory.idl.

Definition at line 88 of file nsIAbDirectory.idl.

Definition at line 176 of file nsIAbDirectory.idl.

Definition at line 84 of file nsAbDirProperty.h.

nsString nsAbDirProperty::m_Description [protected, inherited]

Definition at line 79 of file nsAbDirProperty.h.

nsString nsAbDirProperty::m_DirName [protected, inherited]

Definition at line 74 of file nsAbDirProperty.h.

nsCString nsAbDirProperty::m_DirPrefId [protected, inherited]

Definition at line 81 of file nsAbDirProperty.h.

PRBool nsAbDirProperty::m_IsMailList [protected, inherited]

Definition at line 80 of file nsAbDirProperty.h.

Definition at line 75 of file nsAbDirProperty.h.

nsString nsAbDirProperty::m_ListName [protected, inherited]

Definition at line 77 of file nsAbDirProperty.h.

nsString nsAbDirProperty::m_ListNickName [protected, inherited]

Definition at line 78 of file nsAbDirProperty.h.

Definition at line 180 of file nsAbOSXDirectory.h.

DelegateEntry* nsRDFResource::mDelegates [protected, inherited]

Definition at line 87 of file nsRDFResource.h.

Definition at line 59 of file nsAbDirectoryRDFResource.h.

Definition at line 58 of file nsAbDirectoryRDFResource.h.

Definition at line 60 of file nsAbDirectoryRDFResource.h.

Definition at line 61 of file nsAbDirectoryRDFResource.h.

nsCString nsRDFResource::mURI [protected, inherited]

Definition at line 79 of file nsRDFResource.h.

Definition at line 62 of file nsAbDirectoryRDFResource.h.

Definition at line 82 of file nsIAbDirectory.idl.

const long nsIAbDirectory::opRead = 0x1 [inherited]

Definition at line 72 of file nsIAbDirectory.idl.

const long nsIAbDirectory::opSearch = 0x4 [inherited]

Definition at line 79 of file nsIAbDirectory.idl.

const long nsIAbDirectory::opWrite = 0x2 [inherited]

Definition at line 75 of file nsIAbDirectory.idl.

directory should be searched when doing local autocomplete

Definition at line 152 of file nsIAbDirectory.idl.

Definition at line 155 of file nsIAbDirectory.idl.

readonly attribute string nsIRDFResource::Value [inherited]

The single-byte string value of the resource.

Note:
THIS IS OBSOLETE. C++ should use GetValueConst and script should use .valueUTF8

Definition at line 53 of file nsIRDFResource.idl.

readonly attribute AUTF8String nsIRDFResource::ValueUTF8 [inherited]

The UTF-8 URI of the resource.

Definition at line 58 of file nsIRDFResource.idl.


The documentation for this class was generated from the following files: