Attempt to represent the S^2->S^3 header reorganisation as a series of "hg rename" operations
1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // 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
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
16 #ifndef __CNTVCARD_H__
17 #define __CNTVCARD_H__
25 class CVCardItemAndLabel;
26 class CVCardToContactsAppConverter;
33 enum TCntVCardImportType
35 ECntVCardImportTypeFirstSync,
36 ECntVCardImportTypeMerge
39 class CContactVCardConverter : public CContactEcomConverter
41 Plug-in vCard to CContactItem converter.
47 // Ideally each converter should be able to define its own flags relevant
48 // to its own mode of operation. Due to the legacy design (defining flags
49 // in CContactDatabase) they have to be redeclared here. Long term we hope
50 // to deprecate the CContactDatabase flags and rely on those declared in
51 // the converter implementation.
52 /** Import and export format flags. Contacts can be imported into
53 or exported from the contact database as vCards.
55 The following options are available during import and export.
62 EDefault = CContactDatabase::EDefault,
63 /** Handle Symbian's extended vCard format options. */
64 EIncludeX = CContactDatabase::EIncludeX,
65 /** Support non-standard extensions requried by Symbian PC connectivity software
66 and Microsoft, amongst others. */
67 ETTFormat = CContactDatabase::ETTFormat ,
68 /** Don't export the contact ID (for exporting only). */
69 EExcludeUid = CContactDatabase::EExcludeUid,
70 /** Decrease the contact's access count when importing and exporting. */
71 EDecreaseAccessCount = CContactDatabase::EDecreaseAccessCount,
72 /** Only import the first contact in the read stream (for importing only). */
73 EImportSingleContact = CContactDatabase::EImportSingleContact,
74 /** Increase the contact's access count when importing and exporting. */
75 EIncreaseAccessCount = CContactDatabase::EIncreaseAccessCount,
76 /** Sets a contact item to the local time when importing. */
77 ELocalTime = CContactDatabase::ELocalTime,
78 /** Allows to set a template to a contact item that does not exist. */
79 ENullTemplateId = CContactDatabase::ENullTemplateId,
80 /** Allows to set white spaces as value for an empty field. */
81 EConnectWhitespace=0x0100, // Used to correctly manage the TimeIS protocol for syncing.
83 During import ignore the UID property value of the vCard. By ignoring
84 the UID the client is indicating that it knows that the contact does not
85 already exist in the database (i.e. the contact is being added rather
86 than being updated). Within the CContactVCardConverter::ImportL()
87 method no attempt to search for the UID in the database will be made.
88 For a series of addition of vCards with UIDs use of this option will
89 give a performance improvement since the search for the UID in the
90 Contacts database can become very costly as the number of contacts
93 EIgnoreUid = CContactDatabase::EConverterReserved1,
95 During import, if it is determined that the contact item being imported
96 already exists in the database then the contact item in the database will
97 be deleted before being replaced by the vCard being imported. This option
98 should be used when the client does not want a merge type behaviour for
99 existing contact items. This option will typically be used in a sync use case
100 where the vCard data that the client is provided with has already been through a process
101 of conflict resolution and so the existing contact item should be replaced not merged.
103 EReplaceIfExists = CContactDatabase::EConverterReserved2,
110 enum TVersitPropertyType
112 EPropertyValueSingle,
113 EPropertyValueComposite,
114 EPropertyValueHandlingNotImplemented
116 public: // from CContactConverter
117 static CContactVCardConverter* NewL();
118 CArrayPtr<CContactItem>* ImportL(CContactDatabase& aDb,RReadStream& aReadStream,TBool& aImportSuccessful,TInt aOptions,TBool aImportSingle);
119 void ExportL(CContactDatabase& aDb,const CContactIdArray& aSelectedContactIds,RWriteStream& aWriteStream,TInt aOptions,const Versit::TVersitCharSet aCharSet, TBool aExportPrivateFields, TInt aCommitNumber);
121 static TBool ContainsExportableData(const TDesC& aText);
122 static TBool ContainsImportableData(const TDesC& aText, TVersitPropertyType aType, TCntVCardImportType aImportType);
124 static TBool ContainsData(const TDesC& aText);
125 void doImportL(CVCardToContactsAppConverter& aConverter, CParserVCard& aVCard, CContactDatabase& aDb, TInt aOption, TBool aIncAccessCount, TBool aDecAccessCount, TBool& aImportSuccessful, CArrayPtr<CContactItem>* aContactItems, TBool aIsInTransaction, TContactItemId aIdForUpdate);
126 TContactItemId IsVCardMergeNeededL(CVCardToContactsAppConverter& aConverter, CParserVCard& aVCard, CContactDatabase& aDb, TInt aOption);
127 void ModifyAccessCountL(CContactItem& aContact, TBool aIncAccessCount, TBool aDecAccessCount);
128 void HandleAgentsInVCardL(CVCardToContactsAppConverter& aConverter, CArrayPtr<CParserProperty>* aAgentProperties, CContactItem& aContact, CContactDatabase& aDb, TInt aOption, TBool aIncAccessCount, TBool aDecAccessCount, CArrayPtr<CContactItem>* aContactItemArray, TBool aMerge);