зеркало из https://github.com/mozilla/pjs.git
Backout all changes from bug 360777 due to Win32 bustage.
This commit is contained in:
Родитель
eeaa7dc7bd
Коммит
96aa54e943
|
@ -2349,7 +2349,7 @@ function allowRemoteContentForSender()
|
|||
{
|
||||
// set the property for remote content
|
||||
cardForEmailAddress.allowRemoteContent = true;
|
||||
addrbook.modifyCard(cardForEmailAddress);
|
||||
cardForEmailAddress.editCardToDatabase("");
|
||||
allowRemoteContent = true;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -237,7 +237,7 @@ function EditCardOKButton()
|
|||
|
||||
CheckAndSetCardValues(gEditCard.card, document, false);
|
||||
|
||||
directory.modifyCard(gEditCard.card);
|
||||
gEditCard.card.editCardToDatabase(gEditCard.abURI);
|
||||
|
||||
for (i=0; i < foundDirectoriesCount; i++) {
|
||||
// Update the addressLists item for this card
|
||||
|
@ -245,7 +245,7 @@ function EditCardOKButton()
|
|||
SetElementAt(foundDirectories[i].index, gEditCard.card);
|
||||
}
|
||||
|
||||
NotifySaveListeners(directory);
|
||||
NotifySaveListeners();
|
||||
|
||||
// callback to allow caller to update
|
||||
if (gOkCallback)
|
||||
|
@ -325,7 +325,7 @@ function RegisterSaveListener(func)
|
|||
|
||||
// this is used by people who extend the ab card dialog
|
||||
// like Netscape does for screenname
|
||||
function NotifySaveListeners(directory)
|
||||
function NotifySaveListeners()
|
||||
{
|
||||
if (!gOnSaveListeners.length)
|
||||
return;
|
||||
|
@ -335,7 +335,7 @@ function NotifySaveListeners(directory)
|
|||
|
||||
// the save listeners might have tweaked the card
|
||||
// in which case we need to commit it.
|
||||
directory.modifyCard(gEditCard.card);
|
||||
gEditCard.card.editCardToDatabase(gEditCard.abURI);
|
||||
}
|
||||
|
||||
function InitPhoneticFields()
|
||||
|
|
|
@ -44,7 +44,7 @@ interface nsIAbPreferMailFormat {
|
|||
const unsigned long html = 2;
|
||||
};
|
||||
|
||||
[scriptable, uuid(e4e2a043-4b06-43a3-b52b-146e155d9ec5)]
|
||||
[scriptable, uuid(6B46BDD5-10DB-44f4-99C9-C7FFE0D3D954)]
|
||||
interface nsIAbCard : nsISupports {
|
||||
// Card properties
|
||||
attribute wstring firstName;
|
||||
|
@ -123,13 +123,17 @@ interface nsIAbCard : nsISupports {
|
|||
|
||||
void setCardValue(in string attrname, in wstring value);
|
||||
|
||||
/**
|
||||
* This function will copy all values from one card to another.
|
||||
*
|
||||
* @param srcCard The source card to copy values from.
|
||||
*/
|
||||
// Copies the card attributes from srcCard
|
||||
void copy(in nsIAbCard srcCard);
|
||||
|
||||
// Edits an existing card in the directory defined by 'uri'
|
||||
// Rename to editCardInDirectory
|
||||
// Component will be an RDF card, since it has already
|
||||
// been created
|
||||
//
|
||||
// XXX FIX ME, this should not be a the card, it should be on the addressbook.
|
||||
void editCardToDatabase(in string uri);
|
||||
|
||||
boolean equals(in nsIAbCard card);
|
||||
|
||||
string convertToBase64EncodedXML();
|
||||
|
|
|
@ -72,7 +72,7 @@ interface nsIAbDirectoryProperties : nsISupports {
|
|||
attribute long position;
|
||||
};
|
||||
|
||||
[scriptable, uuid(fe882bec-0fd8-41cf-913b-72db4ca11901)]
|
||||
[scriptable, uuid(b81e0275-7b19-46e2-9f4a-086f1fc55080)]
|
||||
interface nsIAbDirectory : nsISupports {
|
||||
|
||||
// Types of operation
|
||||
|
@ -144,6 +144,9 @@ interface nsIAbDirectory : nsISupports {
|
|||
// preferences
|
||||
void deleteDirectory(in nsIAbDirectory dierctory);
|
||||
|
||||
// Delete the array of cards
|
||||
void deleteCards(in nsISupportsArray cards);
|
||||
|
||||
// Check if directory contains card
|
||||
// If the implementation is asynchronous the card
|
||||
// may not yet have arrived. If it is in the process
|
||||
|
@ -156,23 +159,14 @@ interface nsIAbDirectory : nsISupports {
|
|||
boolean hasDirectory(in nsIAbDirectory dir);
|
||||
|
||||
/**
|
||||
* Adds a card to the database. card may be an abstract card.
|
||||
*
|
||||
* @return "Real" card (eg nsIAbMDBCard) that can be used for some
|
||||
* extra functions.
|
||||
* 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 or similar) to get / set
|
||||
* non-standard card values
|
||||
*/
|
||||
nsIAbCard addCard(in nsIAbCard card);
|
||||
|
||||
/**
|
||||
* Modifies a card in the database to match that supplied.
|
||||
*/
|
||||
void modifyCard(in nsIAbCard modifiedCard);
|
||||
|
||||
/**
|
||||
* Deletes the array of cards from the database
|
||||
*/
|
||||
void deleteCards(in nsISupportsArray cards);
|
||||
|
||||
void dropCard(in nsIAbCard card, in boolean needToCopyCard);
|
||||
|
||||
/**
|
||||
|
|
|
@ -236,14 +236,14 @@ function EditCardOKButton()
|
|||
|
||||
CheckAndSetCardValues(gEditCard.card, document, false);
|
||||
|
||||
directory.modifyCard(gEditCard.card);
|
||||
gEditCard.card.editCardToDatabase(gEditCard.abURI);
|
||||
|
||||
for (i=0; i<foundDirectoriesCount; i++) {
|
||||
// Update the addressLists item for this card
|
||||
foundDirectories[i].directory.addressLists.
|
||||
SetElementAt(foundDirectories[i].index, gEditCard.card);
|
||||
}
|
||||
NotifySaveListeners(directory);
|
||||
NotifySaveListeners();
|
||||
|
||||
// callback to allow caller to update
|
||||
if (gOkCallback)
|
||||
|
@ -323,7 +323,7 @@ function RegisterSaveListener(func)
|
|||
|
||||
// this is used by people who extend the ab card dialog
|
||||
// like Netscape does for screenname
|
||||
function NotifySaveListeners(directory)
|
||||
function NotifySaveListeners()
|
||||
{
|
||||
if (!gOnSaveListeners.length)
|
||||
return;
|
||||
|
@ -333,7 +333,7 @@ function NotifySaveListeners(directory)
|
|||
|
||||
// the save listeners might have tweaked the card
|
||||
// in which case we need to commit it.
|
||||
directory.modifyCard(gEditCard.card);
|
||||
gEditCard.card.editCardToDatabase(gEditCard.abURI);
|
||||
}
|
||||
|
||||
function InitPhoneticFields()
|
||||
|
|
|
@ -190,8 +190,8 @@ NS_IMETHODIMP nsAbAddressCollecter::CollectAddress(const char *aAddress, PRBool
|
|||
}
|
||||
}
|
||||
|
||||
if ((setScreenName || setNames || setPreferMailFormat) && m_directory)
|
||||
m_directory->ModifyCard(existingCard);
|
||||
if (setScreenName || setNames || setPreferMailFormat)
|
||||
existingCard->EditCardToDatabase(m_abURI.get());
|
||||
}
|
||||
|
||||
curName += strlen(curName) + 1;
|
||||
|
|
|
@ -1166,12 +1166,8 @@ NS_IMETHODIMP
|
|||
nsAbCardProperty::SetLastModifiedDate(PRUint32 aLastModifiedDate)
|
||||
{ return m_LastModDate = aLastModifiedDate; }
|
||||
|
||||
// This function may be overriden by derived classes for
|
||||
// nsAb*Card specific implementations.
|
||||
NS_IMETHODIMP nsAbCardProperty::Copy(nsIAbCard* srcCard)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(srcCard);
|
||||
|
||||
nsXPIDLString str;
|
||||
srcCard->GetFirstName(getter_Copies(str));
|
||||
SetFirstName(str);
|
||||
|
@ -1292,17 +1288,14 @@ NS_IMETHODIMP nsAbCardProperty::Copy(nsIAbCard* srcCard)
|
|||
srcCard->GetNotes(getter_Copies(str));
|
||||
SetNotes(str);
|
||||
|
||||
PRBool isMailList;
|
||||
srcCard->GetIsMailList(&isMailList);
|
||||
SetIsMailList(isMailList);
|
||||
|
||||
nsXPIDLCString mailListURI;
|
||||
srcCard->GetMailListURI(getter_Copies(mailListURI));
|
||||
SetMailListURI(mailListURI);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAbCardProperty::EditCardToDatabase(const char *uri)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAbCardProperty::Equals(nsIAbCard *card, PRBool *result)
|
||||
{
|
||||
*result = (card == this);
|
||||
|
|
|
@ -260,10 +260,15 @@ NS_IMETHODIMP
|
|||
nsAbDirProperty::ModifyDirectory(nsIAbDirectory *directory, nsIAbDirectoryProperties *aProperties)
|
||||
{ return NS_ERROR_NOT_IMPLEMENTED; }
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAbDirProperty::DeleteDirectory(nsIAbDirectory *dierctory)
|
||||
{ return NS_ERROR_NOT_IMPLEMENTED; }
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAbDirProperty::DeleteCards(nsISupportsArray *cards)
|
||||
{ return NS_ERROR_NOT_IMPLEMENTED; }
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAbDirProperty::HasCard(nsIAbCard *cards, PRBool *hasCard)
|
||||
{ return NS_ERROR_NOT_IMPLEMENTED; }
|
||||
|
@ -288,12 +293,6 @@ NS_IMETHODIMP nsAbDirProperty::EditMailListToDatabase(const char *uri, nsIAbCard
|
|||
NS_IMETHODIMP nsAbDirProperty::AddCard(nsIAbCard *childCard, nsIAbCard **addedCard)
|
||||
{ return NS_ERROR_NOT_IMPLEMENTED; }
|
||||
|
||||
NS_IMETHODIMP nsAbDirProperty::ModifyCard(nsIAbCard *aModifiedCard)
|
||||
{ return NS_ERROR_NOT_IMPLEMENTED; }
|
||||
|
||||
NS_IMETHODIMP nsAbDirProperty::DeleteCards(nsISupportsArray *cards)
|
||||
{ return NS_ERROR_NOT_IMPLEMENTED; }
|
||||
|
||||
NS_IMETHODIMP nsAbDirProperty::DropCard(nsIAbCard *childCard, PRBool needToCopyCard)
|
||||
{ return NS_ERROR_NOT_IMPLEMENTED; }
|
||||
|
||||
|
|
|
@ -38,10 +38,6 @@
|
|||
|
||||
#include "nsAbLDAPCard.h"
|
||||
|
||||
// XXX Although this has no real use at the moment, its planned to be
|
||||
// used for writeable ldap directories as part of bug 86405 so we don't
|
||||
// want to remove it just to add it back in later...
|
||||
|
||||
nsAbLDAPCard::nsAbLDAPCard()
|
||||
{
|
||||
}
|
||||
|
@ -50,5 +46,11 @@ nsAbLDAPCard::~nsAbLDAPCard()
|
|||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAbLDAPCard::EditCardToDatabase(const char *aURI)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED0(nsAbLDAPCard, nsAbCardProperty)
|
||||
|
||||
|
|
|
@ -47,6 +47,8 @@ class nsAbLDAPCard : public nsAbCardProperty
|
|||
public:
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
NS_IMETHOD EditCardToDatabase(const char *aURI);
|
||||
|
||||
nsAbLDAPCard();
|
||||
virtual ~nsAbLDAPCard();
|
||||
};
|
||||
|
|
|
@ -73,3 +73,5 @@ nsresult nsAbMDBCard::NotifyPropertyChanged(const char *property, const PRUnicha
|
|||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -129,6 +129,55 @@ NS_IMETHODIMP nsAbMDBCardProperty::GetStringAttribute(const char *name, PRUnicha
|
|||
return mCardDatabase->GetCardValue(this, name, value);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAbMDBCardProperty::EditCardToDatabase(const char *uri)
|
||||
{
|
||||
if (!mCardDatabase && uri)
|
||||
GetCardDatabase(uri);
|
||||
|
||||
if (mCardDatabase)
|
||||
{
|
||||
mCardDatabase->EditCard(this, PR_TRUE);
|
||||
mCardDatabase->Commit(nsAddrDBCommitType::kLargeCommit);
|
||||
return NS_OK;
|
||||
}
|
||||
else
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// protected class methods
|
||||
|
||||
nsresult nsAbMDBCardProperty::GetCardDatabase(const char *uri)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
nsCOMPtr<nsIAddrBookSession> abSession =
|
||||
do_GetService(NS_ADDRBOOKSESSION_CONTRACTID, &rv);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
nsCOMPtr<nsILocalFile> dbPath;
|
||||
rv = abSession->GetUserProfileDirectory(getter_AddRefs(dbPath));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
||||
rv = dbPath->AppendNative(nsDependentCString(&(uri[kMDBDirectoryRootLen])));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
PRBool fileExists;
|
||||
rv = dbPath->Exists(&fileExists);
|
||||
if (NS_SUCCEEDED(rv) && fileExists)
|
||||
{
|
||||
nsCOMPtr<nsIAddrDatabase> addrDBFactory =
|
||||
do_GetService(NS_ADDRDATABASE_CONTRACTID, &rv);
|
||||
|
||||
if (NS_SUCCEEDED(rv) && addrDBFactory)
|
||||
rv = addrDBFactory->Open(dbPath, PR_TRUE, PR_TRUE, getter_AddRefs(mCardDatabase));
|
||||
}
|
||||
else
|
||||
rv = NS_ERROR_FAILURE;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAbMDBCardProperty::Equals(nsIAbCard *card, PRBool *result)
|
||||
{
|
||||
nsresult rv;
|
||||
|
|
|
@ -53,8 +53,11 @@ public:
|
|||
nsAbMDBCardProperty(void);
|
||||
virtual ~nsAbMDBCardProperty();
|
||||
|
||||
NS_IMETHOD EditCardToDatabase(const char *uri);
|
||||
NS_IMETHOD Equals(nsIAbCard *card, PRBool *result);
|
||||
|
||||
protected:
|
||||
nsresult GetCardDatabase(const char *uri);
|
||||
|
||||
PRUint32 m_key;
|
||||
PRUint32 m_dbTableID;
|
||||
|
|
|
@ -698,22 +698,6 @@ NS_IMETHODIMP nsAbMDBDirectory::AddCard(nsIAbCard* card, nsIAbCard **addedCard)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAbMDBDirectory::ModifyCard(nsIAbCard *aModifiedCard)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aModifiedCard);
|
||||
|
||||
nsresult rv;
|
||||
if (!mDatabase)
|
||||
{
|
||||
rv = GetAbDatabase();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
rv = mDatabase->EditCard(aModifiedCard, PR_TRUE);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
return mDatabase->Commit(nsAddrDBCommitType::kLargeCommit);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAbMDBDirectory::DropCard(nsIAbCard* aCard, PRBool needToCopyCard)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aCard);
|
||||
|
|
|
@ -97,7 +97,6 @@ public:
|
|||
NS_IMETHOD CreateDirectoryByURI(const PRUnichar *dirName, const char *uri, PRBool migrating);
|
||||
NS_IMETHOD AddMailList(nsIAbDirectory *list);
|
||||
NS_IMETHOD AddCard(nsIAbCard *card, nsIAbCard **addedCard);
|
||||
NS_IMETHOD ModifyCard(nsIAbCard *aModifiedCard);
|
||||
NS_IMETHOD DropCard(nsIAbCard *card, PRBool needToCopyCard);
|
||||
NS_IMETHOD EditMailListToDatabase(const char *uri, nsIAbCard *listCard);
|
||||
|
||||
|
|
|
@ -37,6 +37,12 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
#include "nsAbOutlookCard.h"
|
||||
#include "nsAbWinHelper.h"
|
||||
#include "nsIPrefService.h"
|
||||
#include "nsIPrefBranch.h"
|
||||
#include "nsIAddrBookSession.h"
|
||||
#include "nsAbBaseCID.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsCRT.h"
|
||||
#include "prlog.h"
|
||||
|
||||
|
@ -86,6 +92,63 @@ static void wordToUnicode(WORD aWord, nsString& aUnicode)
|
|||
aUnicode.AppendInt((PRInt32) aWord) ;
|
||||
}
|
||||
|
||||
enum
|
||||
{
|
||||
index_DisplayName = 0,
|
||||
index_EmailAddress,
|
||||
index_FirstName,
|
||||
index_LastName,
|
||||
index_NickName,
|
||||
index_WorkPhoneNumber,
|
||||
index_HomePhoneNumber,
|
||||
index_WorkFaxNumber,
|
||||
index_PagerNumber,
|
||||
index_MobileNumber,
|
||||
index_HomeCity,
|
||||
index_HomeState,
|
||||
index_HomeZip,
|
||||
index_HomeCountry,
|
||||
index_WorkCity,
|
||||
index_WorkState,
|
||||
index_WorkZip,
|
||||
index_WorkCountry,
|
||||
index_JobTitle,
|
||||
index_Department,
|
||||
index_Company,
|
||||
index_WorkWebPage,
|
||||
index_HomeWebPage,
|
||||
index_Comments,
|
||||
index_LastProp
|
||||
} ;
|
||||
|
||||
static const ULONG OutlookCardMAPIProps [] =
|
||||
{
|
||||
PR_DISPLAY_NAME_W,
|
||||
PR_EMAIL_ADDRESS_W,
|
||||
PR_GIVEN_NAME_W,
|
||||
PR_SURNAME_W,
|
||||
PR_NICKNAME_W,
|
||||
PR_BUSINESS_TELEPHONE_NUMBER_W,
|
||||
PR_HOME_TELEPHONE_NUMBER_W,
|
||||
PR_BUSINESS_FAX_NUMBER_W,
|
||||
PR_PAGER_TELEPHONE_NUMBER_W,
|
||||
PR_MOBILE_TELEPHONE_NUMBER_W,
|
||||
PR_HOME_ADDRESS_CITY_W,
|
||||
PR_HOME_ADDRESS_STATE_OR_PROVINCE_W,
|
||||
PR_HOME_ADDRESS_POSTAL_CODE_W,
|
||||
PR_HOME_ADDRESS_COUNTRY_W,
|
||||
PR_BUSINESS_ADDRESS_CITY_W,
|
||||
PR_BUSINESS_ADDRESS_STATE_OR_PROVINCE_W,
|
||||
PR_BUSINESS_ADDRESS_POSTAL_CODE_W,
|
||||
PR_BUSINESS_ADDRESS_COUNTRY_W,
|
||||
PR_TITLE_W,
|
||||
PR_DEPARTMENT_NAME_W,
|
||||
PR_COMPANY_NAME_W,
|
||||
PR_BUSINESS_HOME_PAGE_W,
|
||||
PR_PERSONAL_HOME_PAGE_W,
|
||||
PR_COMMENT_W
|
||||
} ;
|
||||
|
||||
nsresult nsAbOutlookCard::Init(const char *aUri)
|
||||
{
|
||||
nsresult retCode = nsRDFResource::Init(aUri) ;
|
||||
|
@ -170,3 +233,125 @@ nsresult nsAbOutlookCard::Init(const char *aUri)
|
|||
}
|
||||
return retCode ;
|
||||
}
|
||||
|
||||
static void UnicodeToWord(const PRUnichar *aUnicode, WORD& aWord)
|
||||
{
|
||||
aWord = 0 ;
|
||||
if (aUnicode == nsnull || *aUnicode == 0) { return ; }
|
||||
PRInt32 errorCode = 0 ;
|
||||
nsAutoString unichar (aUnicode) ;
|
||||
|
||||
aWord = NS_STATIC_CAST(WORD, unichar.ToInteger(&errorCode)) ;
|
||||
if (errorCode != 0) {
|
||||
PRINTF(("Error conversion string %S: %08x.\n", unichar.get(), errorCode)) ;
|
||||
}
|
||||
}
|
||||
|
||||
#define PREF_MAIL_ADDR_BOOK_LASTNAMEFIRST "mail.addr_book.lastnamefirst"
|
||||
|
||||
NS_IMETHODIMP nsAbOutlookCard::EditCardToDatabase(const char *aUru)
|
||||
{
|
||||
nsresult retCode = NS_OK ;
|
||||
nsXPIDLString *properties = nsnull ;
|
||||
nsAutoString utility ;
|
||||
nsAbWinHelperGuard mapiAddBook (mAbWinType) ;
|
||||
|
||||
if (!mapiAddBook->IsOK()) { return NS_ERROR_FAILURE ; }
|
||||
// First, all the standard properties in one go
|
||||
properties = new nsXPIDLString [index_LastProp] ;
|
||||
if (!properties) {
|
||||
return NS_ERROR_OUT_OF_MEMORY ;
|
||||
}
|
||||
GetFirstName(getter_Copies(properties [index_FirstName])) ;
|
||||
GetLastName(getter_Copies(properties [index_LastName])) ;
|
||||
// This triple search for something to put in the name
|
||||
// is because in the case of a mailing list edition in
|
||||
// Mozilla, the display name will not be provided, and
|
||||
// MAPI doesn't allow that, so we fall back on an optional
|
||||
// name, and when all fails, on the email address.
|
||||
GetDisplayName(getter_Copies(properties [index_DisplayName])) ;
|
||||
if (*properties [index_DisplayName].get() == 0) {
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIPrefBranch> prefBranch = do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
PRInt32 format;
|
||||
rv = prefBranch->GetIntPref(PREF_MAIL_ADDR_BOOK_LASTNAMEFIRST, &format);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
nsCOMPtr<nsIAddrBookSession> abSession = do_GetService(NS_ADDRBOOKSESSION_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
rv = abSession->GenerateNameFromCard(this, format, getter_Copies(properties [index_DisplayName]));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
if (*properties[index_DisplayName].get() == 0) {
|
||||
GetPrimaryEmail(getter_Copies(properties [index_DisplayName])) ;
|
||||
}
|
||||
}
|
||||
SetDisplayName(properties [index_DisplayName]) ;
|
||||
GetNickName(getter_Copies(properties [index_NickName])) ;
|
||||
GetPrimaryEmail(getter_Copies(properties [index_EmailAddress])) ;
|
||||
GetWorkPhone(getter_Copies(properties [index_WorkPhoneNumber])) ;
|
||||
GetHomePhone(getter_Copies(properties [index_HomePhoneNumber])) ;
|
||||
GetFaxNumber(getter_Copies(properties [index_WorkFaxNumber])) ;
|
||||
GetPagerNumber(getter_Copies(properties [index_PagerNumber])) ;
|
||||
GetCellularNumber(getter_Copies(properties [index_MobileNumber])) ;
|
||||
GetHomeCity(getter_Copies(properties [index_HomeCity])) ;
|
||||
GetHomeState(getter_Copies(properties [index_HomeState])) ;
|
||||
GetHomeZipCode(getter_Copies(properties [index_HomeZip])) ;
|
||||
GetHomeCountry(getter_Copies(properties [index_HomeCountry])) ;
|
||||
GetWorkCity(getter_Copies(properties [index_WorkCity])) ;
|
||||
GetWorkState(getter_Copies(properties [index_WorkState])) ;
|
||||
GetWorkZipCode(getter_Copies(properties [index_WorkZip])) ;
|
||||
GetWorkCountry(getter_Copies(properties [index_WorkCountry])) ;
|
||||
GetJobTitle(getter_Copies(properties [index_JobTitle])) ;
|
||||
GetDepartment(getter_Copies(properties [index_Department])) ;
|
||||
GetCompany(getter_Copies(properties [index_Company])) ;
|
||||
GetWebPage1(getter_Copies(properties [index_WorkWebPage])) ;
|
||||
GetWebPage2(getter_Copies(properties [index_HomeWebPage])) ;
|
||||
GetNotes(getter_Copies(properties [index_Comments])) ;
|
||||
if (!mapiAddBook->SetPropertiesUString(*mMapiData, OutlookCardMAPIProps,
|
||||
index_LastProp, properties)) {
|
||||
PRINTF(("Cannot set general properties.\n")) ;
|
||||
}
|
||||
delete [] properties ;
|
||||
nsXPIDLString unichar ;
|
||||
nsXPIDLString unichar2 ;
|
||||
WORD year = 0 ;
|
||||
WORD month = 0 ;
|
||||
WORD day = 0 ;
|
||||
|
||||
GetHomeAddress(getter_Copies(unichar)) ;
|
||||
GetHomeAddress2(getter_Copies(unichar2)) ;
|
||||
utility.Assign(unichar.get()) ;
|
||||
if (!utility.IsEmpty()) { utility.AppendWithConversion(CRLF) ; }
|
||||
utility.Append(unichar2.get()) ;
|
||||
if (!mapiAddBook->SetPropertyUString(*mMapiData, PR_HOME_ADDRESS_STREET_W, utility.get())) {
|
||||
PRINTF(("Cannot set home address.\n")) ;
|
||||
}
|
||||
GetWorkAddress(getter_Copies(unichar)) ;
|
||||
GetWorkAddress2(getter_Copies(unichar2)) ;
|
||||
utility.Assign(unichar.get()) ;
|
||||
if (!utility.IsEmpty()) { utility.AppendWithConversion(CRLF) ; }
|
||||
utility.Append(unichar2.get()) ;
|
||||
if (!mapiAddBook->SetPropertyUString(*mMapiData, PR_BUSINESS_ADDRESS_STREET_W, utility.get())) {
|
||||
PRINTF(("Cannot set work address.\n")) ;
|
||||
}
|
||||
GetBirthYear(getter_Copies(unichar)) ;
|
||||
UnicodeToWord(unichar.get(), year) ;
|
||||
GetBirthMonth(getter_Copies(unichar)) ;
|
||||
UnicodeToWord(unichar.get(), month) ;
|
||||
GetBirthDay(getter_Copies(unichar)) ;
|
||||
UnicodeToWord(unichar.get(), day) ;
|
||||
if (!mapiAddBook->SetPropertyDate(*mMapiData, PR_BIRTHDAY, year, month, day)) {
|
||||
PRINTF(("Cannot set date.\n")) ;
|
||||
}
|
||||
return retCode ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -40,67 +40,9 @@
|
|||
|
||||
#include "nsRDFResource.h"
|
||||
#include "nsAbCardProperty.h"
|
||||
#include "nsAbWinHelper.h"
|
||||
|
||||
struct nsMapiEntry ;
|
||||
|
||||
enum
|
||||
{
|
||||
index_DisplayName = 0,
|
||||
index_EmailAddress,
|
||||
index_FirstName,
|
||||
index_LastName,
|
||||
index_NickName,
|
||||
index_WorkPhoneNumber,
|
||||
index_HomePhoneNumber,
|
||||
index_WorkFaxNumber,
|
||||
index_PagerNumber,
|
||||
index_MobileNumber,
|
||||
index_HomeCity,
|
||||
index_HomeState,
|
||||
index_HomeZip,
|
||||
index_HomeCountry,
|
||||
index_WorkCity,
|
||||
index_WorkState,
|
||||
index_WorkZip,
|
||||
index_WorkCountry,
|
||||
index_JobTitle,
|
||||
index_Department,
|
||||
index_Company,
|
||||
index_WorkWebPage,
|
||||
index_HomeWebPage,
|
||||
index_Comments,
|
||||
index_LastProp
|
||||
} ;
|
||||
|
||||
static const ULONG OutlookCardMAPIProps [] =
|
||||
{
|
||||
PR_DISPLAY_NAME_W,
|
||||
PR_EMAIL_ADDRESS_W,
|
||||
PR_GIVEN_NAME_W,
|
||||
PR_SURNAME_W,
|
||||
PR_NICKNAME_W,
|
||||
PR_BUSINESS_TELEPHONE_NUMBER_W,
|
||||
PR_HOME_TELEPHONE_NUMBER_W,
|
||||
PR_BUSINESS_FAX_NUMBER_W,
|
||||
PR_PAGER_TELEPHONE_NUMBER_W,
|
||||
PR_MOBILE_TELEPHONE_NUMBER_W,
|
||||
PR_HOME_ADDRESS_CITY_W,
|
||||
PR_HOME_ADDRESS_STATE_OR_PROVINCE_W,
|
||||
PR_HOME_ADDRESS_POSTAL_CODE_W,
|
||||
PR_HOME_ADDRESS_COUNTRY_W,
|
||||
PR_BUSINESS_ADDRESS_CITY_W,
|
||||
PR_BUSINESS_ADDRESS_STATE_OR_PROVINCE_W,
|
||||
PR_BUSINESS_ADDRESS_POSTAL_CODE_W,
|
||||
PR_BUSINESS_ADDRESS_COUNTRY_W,
|
||||
PR_TITLE_W,
|
||||
PR_DEPARTMENT_NAME_W,
|
||||
PR_COMPANY_NAME_W,
|
||||
PR_BUSINESS_HOME_PAGE_W,
|
||||
PR_PERSONAL_HOME_PAGE_W,
|
||||
PR_COMMENT_W
|
||||
} ;
|
||||
|
||||
class nsAbOutlookCard : public nsRDFResource,
|
||||
public nsAbCardProperty
|
||||
{
|
||||
|
@ -112,6 +54,8 @@ public:
|
|||
|
||||
// nsIRDFResource method
|
||||
NS_IMETHOD Init(const char *aUri) ;
|
||||
// nsIAbCard methods
|
||||
NS_IMETHOD EditCardToDatabase(const char *aUri) ;
|
||||
|
||||
protected:
|
||||
nsMapiEntry *mMapiData ;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
|
@ -43,7 +43,6 @@
|
|||
|
||||
#include "nsAbBaseCID.h"
|
||||
#include "nsIAbCard.h"
|
||||
#include "nsAbOutlookCard.h"
|
||||
#include "nsXPIDLString.h"
|
||||
#include "nsAbDirectoryQuery.h"
|
||||
#include "nsIAbBooleanExpression.h"
|
||||
|
@ -58,8 +57,6 @@
|
|||
#include "nsCRT.h"
|
||||
#include "prlog.h"
|
||||
#include "prthread.h"
|
||||
#include "nsIPrefService.h"
|
||||
#include "nsIPrefBranch.h"
|
||||
|
||||
#ifdef PR_LOGGING
|
||||
static PRLogModuleInfo* gAbOutlookDirectoryLog
|
||||
|
@ -119,7 +116,7 @@ NS_IMETHODIMP nsAbOutlookDirectory::Init(const char *aUri)
|
|||
|
||||
mAbWinType = getAbWinType(kOutlookDirectoryScheme, mURINoQuery.get(), stub, entry) ;
|
||||
if (mAbWinType == nsAbWinType_Unknown) {
|
||||
PRINTF(("Huge problem URI=%s.\n", mURINoQuery))
|
||||
PRINTF(("Huge problem URI=%s.\n", mURINoQuery)) ;
|
||||
return NS_ERROR_INVALID_ARG ;
|
||||
}
|
||||
nsAbWinHelperGuard mapiAddBook (mAbWinType) ;
|
||||
|
@ -130,11 +127,11 @@ NS_IMETHODIMP nsAbOutlookDirectory::Init(const char *aUri)
|
|||
if (!mapiAddBook->IsOK()) { return NS_ERROR_FAILURE ; }
|
||||
mMapiData->Assign(entry) ;
|
||||
if (!mapiAddBook->GetPropertyLong(*mMapiData, PR_OBJECT_TYPE, objectType)) {
|
||||
PRINTF(("Cannot get type.\n"))
|
||||
PRINTF(("Cannot get type.\n")) ;
|
||||
return NS_ERROR_FAILURE ;
|
||||
}
|
||||
if (!mapiAddBook->GetPropertyUString(*mMapiData, PR_DISPLAY_NAME_W, unichars)) {
|
||||
PRINTF(("Cannot get name.\n"))
|
||||
PRINTF(("Cannot get name.\n")) ;
|
||||
return NS_ERROR_FAILURE ;
|
||||
}
|
||||
if (mAbWinType == nsAbWinType_Outlook) { prefix.AssignLiteral("OP ") ; }
|
||||
|
@ -337,7 +334,7 @@ NS_IMETHODIMP nsAbOutlookDirectory::DeleteCards(nsISupportsArray *aCardList)
|
|||
|
||||
cardEntry.Assign(entryString) ;
|
||||
if (!mapiAddBook->DeleteEntry(*mMapiData, cardEntry)) {
|
||||
PRINTF(("Cannot delete card %s.\n", entryString.get()))
|
||||
PRINTF(("Cannot delete card %s.\n", entryString.get())) ;
|
||||
}
|
||||
else {
|
||||
nsVoidKey key (NS_STATIC_CAST(void *, element)) ;
|
||||
|
@ -349,7 +346,7 @@ NS_IMETHODIMP nsAbOutlookDirectory::DeleteCards(nsISupportsArray *aCardList)
|
|||
}
|
||||
}
|
||||
else {
|
||||
PRINTF(("Card doesn't belong in this directory.\n"))
|
||||
PRINTF(("Card doesn't belong in this directory.\n")) ;
|
||||
}
|
||||
}
|
||||
return NS_OK ;
|
||||
|
@ -376,7 +373,7 @@ NS_IMETHODIMP nsAbOutlookDirectory::DeleteDirectory(nsIAbDirectory *aDirectory)
|
|||
|
||||
directoryEntry.Assign(entryString) ;
|
||||
if (!mapiAddBook->DeleteEntry(*mMapiData, directoryEntry)) {
|
||||
PRINTF(("Cannot delete directory %s.\n", entryString.get()))
|
||||
PRINTF(("Cannot delete directory %s.\n", entryString.get())) ;
|
||||
}
|
||||
else {
|
||||
m_AddressList->RemoveElement(aDirectory) ;
|
||||
|
@ -385,7 +382,7 @@ NS_IMETHODIMP nsAbOutlookDirectory::DeleteDirectory(nsIAbDirectory *aDirectory)
|
|||
}
|
||||
}
|
||||
else {
|
||||
PRINTF(("Directory doesn't belong to this folder.\n"))
|
||||
PRINTF(("Directory doesn't belong to this folder.\n")) ;
|
||||
}
|
||||
return retCode ;
|
||||
}
|
||||
|
@ -403,7 +400,7 @@ NS_IMETHODIMP nsAbOutlookDirectory::AddCard(nsIAbCard *aData, nsIAbCard **addedC
|
|||
retCode = HasCard(aData, &hasCard) ;
|
||||
NS_ENSURE_SUCCESS(retCode, retCode) ;
|
||||
if (hasCard) {
|
||||
PRINTF(("Has card.\n"))
|
||||
PRINTF(("Has card.\n")) ;
|
||||
NS_IF_ADDREF(*addedCard = aData);
|
||||
return NS_OK ;
|
||||
}
|
||||
|
@ -737,11 +734,11 @@ static nsresult BuildRestriction(nsIAbBooleanExpression *aLevel,
|
|||
retCode = expressions->Count(&nbExpressions) ;
|
||||
NS_ENSURE_SUCCESS(retCode, retCode) ;
|
||||
if (nbExpressions == 0) {
|
||||
PRINTF(("Error, no expressions.\n"))
|
||||
PRINTF(("Error, no expressions.\n")) ;
|
||||
return NS_OK ;
|
||||
}
|
||||
if (operationType == nsIAbBooleanOperationTypes::NOT && nbExpressions != 1) {
|
||||
PRINTF(("Error, unary operation NOT with multiple operands.\n"))
|
||||
PRINTF(("Error, unary operation NOT with multiple operands.\n")) ;
|
||||
return NS_OK ;
|
||||
}
|
||||
LPSRestriction restrictionArray = new SRestriction [nbExpressions] ;
|
||||
|
@ -760,7 +757,7 @@ static nsresult BuildRestriction(nsIAbBooleanExpression *aLevel,
|
|||
if (NS_SUCCEEDED(retCode)) {
|
||||
if (!skipItem) { ++ restrictionArray ; ++ realNbExpressions ; }
|
||||
}
|
||||
else { PRINTF(("Cannot build restriction for item %d %08x.\n", i, retCode)) }
|
||||
else { PRINTF(("Cannot build restriction for item %d %08x.\n", i, retCode)) ; }
|
||||
}
|
||||
else {
|
||||
nsCOMPtr<nsIAbBooleanExpression> subExpression (do_QueryInterface(element, &retCode)) ;
|
||||
|
@ -773,12 +770,10 @@ static nsresult BuildRestriction(nsIAbBooleanExpression *aLevel,
|
|||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
PRINTF(("Cannot get interface for item %d %08x.\n", i, retCode));
|
||||
else { PRINTF(("Cannot get interface for item %d %08x.\n", i, retCode)) ; }
|
||||
}
|
||||
}
|
||||
else
|
||||
PRINTF(("Cannot get item %d %08x.\n", i, retCode));
|
||||
else { PRINTF(("Cannot get item %d %08x.\n", i, retCode)) ; }
|
||||
}
|
||||
restrictionArray -= realNbExpressions ;
|
||||
if (realNbExpressions > 1) {
|
||||
|
@ -792,9 +787,10 @@ static nsresult BuildRestriction(nsIAbBooleanExpression *aLevel,
|
|||
aRestriction.res.resAnd.lpRes = restrictionArray ;
|
||||
aRestriction.res.resAnd.cRes = realNbExpressions ;
|
||||
}
|
||||
else
|
||||
else {
|
||||
PRINTF(("Unsupported operation %d.\n", operationType)) ;
|
||||
}
|
||||
}
|
||||
else if (realNbExpressions == 1) {
|
||||
if (operationType == nsIAbBooleanOperationTypes::NOT) {
|
||||
aRestriction.rt = RES_NOT ;
|
||||
|
@ -1132,7 +1128,7 @@ nsresult nsAbOutlookDirectory::GetChildCards(nsISupportsArray **aCards,
|
|||
retCode = NS_NewISupportsArray(getter_AddRefs(cards)) ;
|
||||
NS_ENSURE_SUCCESS(retCode, retCode) ;
|
||||
if (!mapiAddBook->GetCards(*mMapiData, restriction, cardEntries)) {
|
||||
PRINTF(("Cannot get cards.\n"))
|
||||
PRINTF(("Cannot get cards.\n")) ;
|
||||
return NS_ERROR_FAILURE ;
|
||||
}
|
||||
nsCAutoString entryId ;
|
||||
|
@ -1170,7 +1166,7 @@ nsresult nsAbOutlookDirectory::GetChildNodes(nsISupportsArray **aNodes)
|
|||
retCode = NS_NewISupportsArray(getter_AddRefs(nodes)) ;
|
||||
NS_ENSURE_SUCCESS(retCode, retCode) ;
|
||||
if (!mapiAddBook->GetNodes(*mMapiData, nodeEntries)) {
|
||||
PRINTF(("Cannot get nodes.\n"))
|
||||
PRINTF(("Cannot get nodes.\n")) ;
|
||||
return NS_ERROR_FAILURE ;
|
||||
}
|
||||
nsCAutoString entryId ;
|
||||
|
@ -1221,7 +1217,7 @@ nsresult nsAbOutlookDirectory::CommitAddressList(void)
|
|||
PRUint32 i = 0 ;
|
||||
|
||||
if (!m_IsMailList) {
|
||||
PRINTF(("We are not in a mailing list, no commit can be done.\n"))
|
||||
PRINTF(("We are not in a mailing list, no commit can be done.\n")) ;
|
||||
return NS_ERROR_UNEXPECTED ;
|
||||
}
|
||||
retCode = GetChildCards(getter_AddRefs(oldList), nsnull) ;
|
||||
|
@ -1338,138 +1334,10 @@ nsresult nsAbOutlookDirectory::CreateCard(nsIAbCard *aData, nsIAbCard **aNewCard
|
|||
if (!didCopy) {
|
||||
retCode = newCard->Copy(aData) ;
|
||||
NS_ENSURE_SUCCESS(retCode, retCode) ;
|
||||
retCode = ModifyCard(newCard) ;
|
||||
retCode = newCard->EditCardToDatabase(mURINoQuery.get()) ;
|
||||
NS_ENSURE_SUCCESS(retCode, retCode) ;
|
||||
}
|
||||
*aNewCard = newCard ;
|
||||
NS_ADDREF(*aNewCard) ;
|
||||
return retCode ;
|
||||
}
|
||||
|
||||
static void UnicodeToWord(const PRUnichar *aUnicode, WORD& aWord)
|
||||
{
|
||||
aWord = 0 ;
|
||||
if (aUnicode == nsnull || *aUnicode == 0) { return ; }
|
||||
PRInt32 errorCode = 0 ;
|
||||
nsAutoString unichar (aUnicode) ;
|
||||
|
||||
aWord = NS_STATIC_CAST(WORD, unichar.ToInteger(&errorCode)) ;
|
||||
if (errorCode != 0) {
|
||||
PRINTF(("Error conversion string %S: %08x.\n", unichar.get(), errorCode))
|
||||
}
|
||||
}
|
||||
|
||||
#define PREF_MAIL_ADDR_BOOK_LASTNAMEFIRST "mail.addr_book.lastnamefirst"
|
||||
|
||||
NS_IMETHODIMP nsAbOutlookDirectory::ModifyCard(nsIAbCard *aModifiedCard)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aModifiedCard);
|
||||
|
||||
nsresult retCode = NS_OK;
|
||||
nsXPIDLString *properties = nsnull;
|
||||
nsAutoString utility;
|
||||
nsAbWinHelperGuard mapiAddBook(mAbWinType);
|
||||
|
||||
if (!mapiAddBook->IsOK())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
// First, all the standard properties in one go
|
||||
properties = new nsXPIDLString[index_LastProp];
|
||||
if (!properties) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
aModifiedCard->GetFirstName(getter_Copies(properties[index_FirstName]));
|
||||
aModifiedCard->GetLastName(getter_Copies(properties[index_LastName]));
|
||||
// This triple search for something to put in the name
|
||||
// is because in the case of a mailing list edition in
|
||||
// Mozilla, the display name will not be provided, and
|
||||
// MAPI doesn't allow that, so we fall back on an optional
|
||||
// name, and when all fails, on the email address.
|
||||
aModifiedCard->GetDisplayName(getter_Copies(properties[index_DisplayName]));
|
||||
if (*properties[index_DisplayName].get() == 0) {
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIPrefBranch> prefBranch =
|
||||
do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
PRInt32 format;
|
||||
rv = prefBranch->GetIntPref(PREF_MAIL_ADDR_BOOK_LASTNAMEFIRST, &format);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
nsCOMPtr<nsIAddrBookSession> abSession =
|
||||
do_GetService(NS_ADDRBOOKSESSION_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
rv = abSession->GenerateNameFromCard(aModifiedCard, format, getter_Copies(properties [index_DisplayName]));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
if (*properties[index_DisplayName].get() == 0) {
|
||||
aModifiedCard->GetPrimaryEmail(getter_Copies(properties[index_DisplayName]));
|
||||
}
|
||||
}
|
||||
aModifiedCard->SetDisplayName(properties[index_DisplayName]);
|
||||
aModifiedCard->GetNickName(getter_Copies(properties[index_NickName]));
|
||||
aModifiedCard->GetPrimaryEmail(getter_Copies(properties[index_EmailAddress]));
|
||||
aModifiedCard->GetWorkPhone(getter_Copies(properties[index_WorkPhoneNumber]));
|
||||
aModifiedCard->GetHomePhone(getter_Copies(properties[index_HomePhoneNumber]));
|
||||
aModifiedCard->GetFaxNumber(getter_Copies(properties[index_WorkFaxNumber]));
|
||||
aModifiedCard->GetPagerNumber(getter_Copies(properties[index_PagerNumber]));
|
||||
aModifiedCard->GetCellularNumber(getter_Copies(properties[index_MobileNumber]));
|
||||
aModifiedCard->GetHomeCity(getter_Copies(properties[index_HomeCity]));
|
||||
aModifiedCard->GetHomeState(getter_Copies(properties[index_HomeState]));
|
||||
aModifiedCard->GetHomeZipCode(getter_Copies(properties[index_HomeZip]));
|
||||
aModifiedCard->GetHomeCountry(getter_Copies(properties[index_HomeCountry]));
|
||||
aModifiedCard->GetWorkCity(getter_Copies(properties[index_WorkCity]));
|
||||
aModifiedCard->GetWorkState(getter_Copies(properties[index_WorkState]));
|
||||
aModifiedCard->GetWorkZipCode(getter_Copies(properties[index_WorkZip]));
|
||||
aModifiedCard->GetWorkCountry(getter_Copies(properties[index_WorkCountry]));
|
||||
aModifiedCard->GetJobTitle(getter_Copies(properties[index_JobTitle]));
|
||||
aModifiedCard->GetDepartment(getter_Copies(properties[index_Department]));
|
||||
aModifiedCard->GetCompany(getter_Copies(properties[index_Company]));
|
||||
aModifiedCard->GetWebPage1(getter_Copies(properties[index_WorkWebPage]));
|
||||
aModifiedCard->GetWebPage2(getter_Copies(properties[index_HomeWebPage]));
|
||||
aModifiedCard->GetNotes(getter_Copies(properties[index_Comments]));
|
||||
if (!mapiAddBook->SetPropertiesUString(*mMapiData, OutlookCardMAPIProps,
|
||||
index_LastProp, properties))
|
||||
PRINTF(("Cannot set general properties.\n"))
|
||||
|
||||
delete [] properties;
|
||||
nsXPIDLString unichar;
|
||||
nsXPIDLString unichar2;
|
||||
WORD year = 0;
|
||||
WORD month = 0;
|
||||
WORD day = 0;
|
||||
|
||||
aModifiedCard->GetHomeAddress(getter_Copies(unichar));
|
||||
aModifiedCard->GetHomeAddress2(getter_Copies(unichar2));
|
||||
|
||||
utility.Assign(unichar.get());
|
||||
if (!utility.IsEmpty())
|
||||
utility.AppendWithConversion(CRLF);
|
||||
|
||||
utility.Append(unichar2.get());
|
||||
if (!mapiAddBook->SetPropertyUString(*mMapiData, PR_HOME_ADDRESS_STREET_W, utility.get()))
|
||||
PRINTF(("Cannot set home address.\n"))
|
||||
|
||||
aModifiedCard->GetWorkAddress(getter_Copies(unichar));
|
||||
aModifiedCard->GetWorkAddress2(getter_Copies(unichar2));
|
||||
|
||||
utility.Assign(unichar.get());
|
||||
if (!utility.IsEmpty())
|
||||
utility.AppendWithConversion(CRLF);
|
||||
|
||||
utility.Append(unichar2.get());
|
||||
if (!mapiAddBook->SetPropertyUString(*mMapiData, PR_BUSINESS_ADDRESS_STREET_W, utility.get()))
|
||||
PRINTF(("Cannot set work address.\n"))
|
||||
|
||||
aModifiedCard->GetBirthYear(getter_Copies(unichar));
|
||||
UnicodeToWord(unichar.get(), year);
|
||||
aModifiedCard->GetBirthMonth(getter_Copies(unichar));
|
||||
UnicodeToWord(unichar.get(), month);
|
||||
aModifiedCard->GetBirthDay(getter_Copies(unichar));
|
||||
UnicodeToWord(unichar.get(), day);
|
||||
if (!mapiAddBook->SetPropertyDate(*mMapiData, PR_BIRTHDAY, year, month, day))
|
||||
PRINTF(("Cannot set date.\n"))
|
||||
|
||||
return retCode;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
|
@ -71,7 +71,6 @@ public:
|
|||
NS_IMETHOD ModifyDirectory(nsIAbDirectory *directory, nsIAbDirectoryProperties *aProperties);
|
||||
NS_IMETHOD DeleteDirectory(nsIAbDirectory *aDirectory) ;
|
||||
NS_IMETHOD AddCard(nsIAbCard *aData, nsIAbCard **addedCard);
|
||||
NS_IMETHOD ModifyCard(nsIAbCard *aModifiedCard);
|
||||
NS_IMETHOD DropCard(nsIAbCard *aData, PRBool needToCopyCard);
|
||||
NS_IMETHOD AddMailList(nsIAbDirectory *aMailList) ;
|
||||
NS_IMETHOD EditMailListToDatabase(const char *aUri, nsIAbCard *listCard) ;
|
||||
|
|
Загрузка…
Ссылка в новой задаче