1.1 --- a/epoc32/include/cntvcard.h Tue Nov 24 13:55:44 2009 +0000
1.2 +++ b/epoc32/include/cntvcard.h Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -1,1 +1,131 @@
1.4 -cntvcard.h
1.5 +// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
1.6 +// All rights reserved.
1.7 +// This component and the accompanying materials are made available
1.8 +// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
1.9 +// which accompanies this distribution, and is available
1.10 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.11 +//
1.12 +// Initial Contributors:
1.13 +// Nokia Corporation - initial contribution.
1.14 +//
1.15 +// Contributors:
1.16 +//
1.17 +// Description:
1.18 +//
1.19 +
1.20 +#ifndef __CNTVCARD_H__
1.21 +#define __CNTVCARD_H__
1.22 +
1.23 +// System includes
1.24 +#include <cntdb.h>
1.25 +#include <vcard.h>
1.26 +
1.27 +// Classes referenced
1.28 +class CVCardAddress;
1.29 +class CVCardItemAndLabel;
1.30 +class CVCardToContactsAppConverter;
1.31 +
1.32 +// Enumerations
1.33 +/**
1.34 +@internalComponent
1.35 +@released
1.36 +*/
1.37 +enum TCntVCardImportType
1.38 + {
1.39 + ECntVCardImportTypeFirstSync,
1.40 + ECntVCardImportTypeMerge
1.41 + };
1.42 +
1.43 +class CContactVCardConverter : public CContactEcomConverter
1.44 +/**
1.45 +Plug-in vCard to CContactItem converter.
1.46 +@publishedAll
1.47 +@released
1.48 +*/
1.49 + {
1.50 +public:
1.51 + // Ideally each converter should be able to define its own flags relevant
1.52 + // to its own mode of operation. Due to the legacy design (defining flags
1.53 + // in CContactDatabase) they have to be redeclared here. Long term we hope
1.54 + // to deprecate the CContactDatabase flags and rely on those declared in
1.55 + // the converter implementation.
1.56 + /** Import and export format flags. Contacts can be imported into
1.57 + or exported from the contact database as vCards.
1.58 +
1.59 + The following options are available during import and export.
1.60 +
1.61 + @publishedAll
1.62 + @released
1.63 + */
1.64 + enum TOptions
1.65 + {
1.66 + EDefault = CContactDatabase::EDefault,
1.67 + /** Handle Symbian's extended vCard format options. */
1.68 + EIncludeX = CContactDatabase::EIncludeX,
1.69 + /** Support non-standard extensions requried by Symbian PC connectivity software
1.70 + and Microsoft, amongst others. */
1.71 + ETTFormat = CContactDatabase::ETTFormat ,
1.72 + /** Don't export the contact ID (for exporting only). */
1.73 + EExcludeUid = CContactDatabase::EExcludeUid,
1.74 + /** Decrease the contact's access count when importing and exporting. */
1.75 + EDecreaseAccessCount = CContactDatabase::EDecreaseAccessCount,
1.76 + /** Only import the first contact in the read stream (for importing only). */
1.77 + EImportSingleContact = CContactDatabase::EImportSingleContact,
1.78 + /** Increase the contact's access count when importing and exporting. */
1.79 + EIncreaseAccessCount = CContactDatabase::EIncreaseAccessCount,
1.80 + /** Sets a contact item to the local time when importing. */
1.81 + ELocalTime = CContactDatabase::ELocalTime,
1.82 + /** Allows to set a template to a contact item that does not exist. */
1.83 + ENullTemplateId = CContactDatabase::ENullTemplateId,
1.84 + /** Allows to set white spaces as value for an empty field. */
1.85 + EConnectWhitespace=0x0100, // Used to correctly manage the TimeIS protocol for syncing.
1.86 + /**
1.87 + During import ignore the UID property value of the vCard. By ignoring
1.88 + the UID the client is indicating that it knows that the contact does not
1.89 + already exist in the database (i.e. the contact is being added rather
1.90 + than being updated). Within the CContactVCardConverter::ImportL()
1.91 + method no attempt to search for the UID in the database will be made.
1.92 + For a series of addition of vCards with UIDs use of this option will
1.93 + give a performance improvement since the search for the UID in the
1.94 + Contacts database can become very costly as the number of contacts
1.95 + grows.
1.96 + */
1.97 + EIgnoreUid = CContactDatabase::EConverterReserved1,
1.98 + /**
1.99 + During import, if it is determined that the contact item being imported
1.100 + already exists in the database then the contact item in the database will
1.101 + be deleted before being replaced by the vCard being imported. This option
1.102 + should be used when the client does not want a merge type behaviour for
1.103 + existing contact items. This option will typically be used in a sync use case
1.104 + where the vCard data that the client is provided with has already been through a process
1.105 + of conflict resolution and so the existing contact item should be replaced not merged.
1.106 + */
1.107 + EReplaceIfExists = CContactDatabase::EConverterReserved2,
1.108 + };
1.109 +
1.110 + /**
1.111 + @internalComponent
1.112 + @released
1.113 + */
1.114 + enum TVersitPropertyType
1.115 + {
1.116 + EPropertyValueSingle,
1.117 + EPropertyValueComposite,
1.118 + EPropertyValueHandlingNotImplemented
1.119 + };
1.120 +public: // from CContactConverter
1.121 + static CContactVCardConverter* NewL();
1.122 + CArrayPtr<CContactItem>* ImportL(CContactDatabase& aDb,RReadStream& aReadStream,TBool& aImportSuccessful,TInt aOptions,TBool aImportSingle);
1.123 + void ExportL(CContactDatabase& aDb,const CContactIdArray& aSelectedContactIds,RWriteStream& aWriteStream,TInt aOptions,const Versit::TVersitCharSet aCharSet, TBool aExportPrivateFields, TInt aCommitNumber);
1.124 +public: // Utility
1.125 + static TBool ContainsExportableData(const TDesC& aText);
1.126 + static TBool ContainsImportableData(const TDesC& aText, TVersitPropertyType aType, TCntVCardImportType aImportType);
1.127 +private:
1.128 + static TBool ContainsData(const TDesC& aText);
1.129 + void doImportL(CVCardToContactsAppConverter& aConverter, CParserVCard& aVCard, CContactDatabase& aDb, TInt aOption, TBool aIncAccessCount, TBool aDecAccessCount, TBool& aImportSuccessful, CArrayPtr<CContactItem>* aContactItems, TBool aIsInTransaction, TContactItemId aIdForUpdate);
1.130 + TContactItemId IsVCardMergeNeededL(CVCardToContactsAppConverter& aConverter, CParserVCard& aVCard, CContactDatabase& aDb, TInt aOption);
1.131 + void ModifyAccessCountL(CContactItem& aContact, TBool aIncAccessCount, TBool aDecAccessCount);
1.132 + void HandleAgentsInVCardL(CVCardToContactsAppConverter& aConverter, CArrayPtr<CParserProperty>* aAgentProperties, CContactItem& aContact, CContactDatabase& aDb, TInt aOption, TBool aIncAccessCount, TBool aDecAccessCount, CArrayPtr<CContactItem>* aContactItemArray, TBool aMerge);
1.133 + };
1.134 +
1.135 +#endif