1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). |
2 // All rights reserved. |
2 // All rights reserved. |
3 // This component and the accompanying materials are made available |
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 |
4 // under the terms of "Eclipse Public License v1.0" |
5 // which accompanies this distribution, and is available |
5 // which accompanies this distribution, and is available |
6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 // |
7 // |
8 // Initial Contributors: |
8 // Initial Contributors: |
9 // Nokia Corporation - initial contribution. |
9 // Nokia Corporation - initial contribution. |
10 // |
10 // |
11 // Contributors: |
11 // Contributors: |
55 class MLplPersistenceLayerFactory; |
55 class MLplPersistenceLayerFactory; |
56 class CContactOpenOperation; |
56 class CContactOpenOperation; |
57 class CDataBaseChangeObserver; |
57 class CDataBaseChangeObserver; |
58 class CContactConverter; |
58 class CContactConverter; |
59 |
59 |
|
60 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS |
|
61 class CContactSynchroniser; |
|
62 #endif |
|
63 |
60 // Constants |
64 // Constants |
|
65 |
|
66 /** |
|
67 Maximum string length used to separate the fields in the text definition. |
|
68 @see TContactTextDefItem |
|
69 @publishedAll |
|
70 @released |
|
71 */ |
61 const TInt KMaxContactTextSeperator=4; |
72 const TInt KMaxContactTextSeperator=4; |
|
73 /** |
|
74 Constant used during sorting and searching of contacts. |
|
75 @publishedAll |
|
76 @released |
|
77 */ |
62 const TInt KTextFieldMinimalLength=64; |
78 const TInt KTextFieldMinimalLength=64; |
|
79 /** |
|
80 Maximum number of fields that can be set as filterable fields by licensees. |
|
81 @publishedAll |
|
82 @released |
|
83 */ |
63 const TInt KMaxCustomFilterableFields=4; |
84 const TInt KMaxCustomFilterableFields=4; |
64 |
85 |
|
86 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS |
|
87 |
|
88 /** @internalComponent */ |
65 const TInt KMajorVersion=1; |
89 const TInt KMajorVersion=1; |
|
90 /** @internalComponent */ |
66 const TInt KMinorVersion=0; |
91 const TInt KMinorVersion=0; |
|
92 /** @internalComponent */ |
67 const TInt KBuildNumber=40; |
93 const TInt KBuildNumber=40; |
68 |
94 |
|
95 #endif //SYMBIAN_ENABLE_SPLIT_HEADERS |
69 |
96 |
70 // |
97 // |
71 // Classes used for compact |
98 // Classes used for compact |
72 // |
99 // |
73 |
100 |
110 IMPORT_C virtual void MContactUiActive_Reserved1(); |
137 IMPORT_C virtual void MContactUiActive_Reserved1(); |
111 }; |
138 }; |
112 |
139 |
113 class CContactActiveBase : public CBase, public MContactUiActive |
140 class CContactActiveBase : public CBase, public MContactUiActive |
114 /** |
141 /** |
115 @internalTechnology |
142 @publishedAll |
|
143 @released |
116 */ |
144 */ |
117 { |
145 { |
118 public: |
146 public: |
119 ~CContactActiveBase(); |
147 ~CContactActiveBase(); |
120 void SetObserver(MContactUiCompactObserver *aObserver); |
148 void SetObserver(MContactUiCompactObserver *aObserver); |
121 void Cancel(); |
149 void Cancel(); |
122 TInt StepsTogo() const; |
150 TInt StepsTogo() const; |
123 TInt Step(); |
151 TInt Step(); |
124 TInt Error() const; |
152 TInt Error() const; |
125 void SetContactDatabase(CContactDatabase* aContactDatabase); |
153 void SetContactDatabase(CContactDatabase* aContactDatabase); |
126 void SetFileManager(RCntModel& aCntSvr); |
154 void SetFileManagerL(RCntModel& aCntSvr); |
127 |
155 |
128 #ifndef __SYMBIAN_CNTMODEL_USE_SQLITE__ |
156 #ifndef __SYMBIAN_CNTMODEL_USE_SQLITE__ |
129 protected: |
|
130 void ConstructL(); |
|
131 static TInt CompactCallBack(TAny *aThis); |
|
132 protected: |
157 protected: |
133 MContactUiCompactObserver *iObserver; |
158 MContactUiCompactObserver *iObserver; |
134 RCntModel* iCntSvr; |
159 RCntModel* iCntSvr; |
135 CIdle *iIdle; |
160 CIdle *iIdle; |
136 TInt iStep; |
161 TInt iStep; |
506 @deprecated |
529 @deprecated |
507 */ |
530 */ |
508 virtual void HandleSortEventL(TInt aContactsSorted, TInt aContactsTotal)=0; |
531 virtual void HandleSortEventL(TInt aContactsSorted, TInt aContactsTotal)=0; |
509 }; |
532 }; |
510 |
533 |
|
534 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS |
511 class MConverterCallBack |
535 class MConverterCallBack |
512 /** |
536 /** |
513 Interface class for providing Intra-Contact Properties during a PBAP specific contacts export. |
537 Interface class for providing Intra-Contact Properties during a PBAP specific contacts export. |
514 @prototype |
538 @released |
515 @internalTechnology |
539 @internalTechnology |
516 */ |
540 */ |
517 { |
541 { |
518 public: |
542 public: |
519 /** |
543 /** |
520 PBAP clients are supposed to provide any information regarding the contact item represented by aContactId. |
544 PBAP clients are supposed to provide any information regarding the contact item represented by aContactId. |
521 This information should be in form of standard vCard property, all such properties should be appended to the array aPropertyList. |
545 This information should be in form of standard vCard property, all such properties should be appended to the array aPropertyList. |
522 */ |
546 */ |
523 virtual void AddIntraContactPropertiesL(const TContactItemId& aContactId, CArrayPtr<CParserProperty>* aPropertyList) = 0; |
547 virtual void AddIntraContactPropertiesL(const TContactItemId& aContactId, CArrayPtr<CParserProperty>* aPropertyList) = 0; |
524 }; |
548 }; |
|
549 #else |
|
550 class MConverterCallBack; |
|
551 #endif //SYMBIAN_ENABLE_SPLIT_HEADERS |
525 |
552 |
526 enum TVCardVersion |
553 enum TVCardVersion |
527 /** |
554 /** |
528 Specifies type of export of contact items. |
555 Specifies type of export of contact items. |
529 PBAP clients should use EPBAPVCard21 and EPBAPVCard30. |
556 PBAP clients should use EPBAPVCard21 and EPBAPVCard30. |
530 @prototype |
557 @publishedAll |
531 @internalTechnology |
558 @released |
532 */ |
559 */ |
533 { |
560 { |
534 EVCardUDEF = -1, |
561 EVCardUDEF = -1, |
535 EVCard21 = 0, |
562 EVCard21 = 0, |
536 EVCard30, |
563 EVCard30, |
713 /** Allows for a multi-threaded program to access the contact database from multiple |
740 /** Allows for a multi-threaded program to access the contact database from multiple |
714 threads but note that the contacts model provides no synchronisation support |
741 threads but note that the contacts model provides no synchronisation support |
715 for such use. */ |
742 for such use. */ |
716 EMultiThread |
743 EMultiThread |
717 }; |
744 }; |
|
745 |
|
746 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS |
718 /** |
747 /** |
719 @internalComponent |
748 @internalComponent |
720 */ |
749 */ |
721 enum TSortDataSource |
750 enum TSortDataSource |
722 { |
751 { |
723 ENoOrder, |
752 ENoOrder, |
724 EUsesIdentityTableOnly, |
753 EUsesIdentityTableOnly, |
725 EUsesAllTables, |
754 EUsesAllTables, |
726 EIdentityTableNotUsed //Not used |
755 EIdentityTableNotUsed //Not used |
727 }; |
756 }; |
|
757 #endif |
728 public: |
758 public: |
729 IMPORT_C static CContactDatabase* OpenL(TThreadAccess aAccess=ESingleThread); |
759 IMPORT_C static CContactDatabase* OpenL(TThreadAccess aAccess=ESingleThread); |
730 IMPORT_C static CContactDatabase* OpenL(const TDesC& aFileName,TThreadAccess aAccess=ESingleThread); |
760 IMPORT_C static CContactDatabase* OpenL(const TDesC& aFileName,TThreadAccess aAccess=ESingleThread); |
731 IMPORT_C static CContactDatabase* CreateL(TThreadAccess aAccess=ESingleThread); |
761 IMPORT_C static CContactDatabase* CreateL(TThreadAccess aAccess=ESingleThread); |
732 IMPORT_C static CContactDatabase* CreateL(const TDesC& aFileName,TThreadAccess aAccess=ESingleThread); |
762 IMPORT_C static CContactDatabase* CreateL(const TDesC& aFileName,TThreadAccess aAccess=ESingleThread); |
985 |
1015 |
986 void OpenDatabaseAsyncL(TRequestStatus& aStatus, const TDesC& aFileName = KNullDesC); |
1016 void OpenDatabaseAsyncL(TRequestStatus& aStatus, const TDesC& aFileName = KNullDesC); |
987 static void CleanupLastLockedContact(TAny *aDatabase); |
1017 static void CleanupLastLockedContact(TAny *aDatabase); |
988 |
1018 |
989 private: |
1019 private: |
990 CContactConverter& CContactDatabase::ConverterL(const TUid& aFormat); |
1020 CContactConverter& ConverterL(const TUid& aFormat); |
991 CContactConverter& CContactDatabase::ConverterL(const TUid& aFormat, const TInt64 aContactFieldFilter, MConverterCallBack* aCallback, const TVCardVersion aVersion,const TBool aExportTel); |
1021 CContactConverter& ConverterL(const TUid& aFormat, const TInt64 aContactFieldFilter, MConverterCallBack* aCallback, const TVCardVersion aVersion,const TBool aExportTel); |
992 static void CleanupDatabaseRollback(TAny *aDatabase); |
1022 static void CleanupDatabaseRollback(TAny *aDatabase); |
993 |
1023 |
994 CContactIdArray* SortLC(const CArrayFix<TSortPref>* aSortOrder, const CContactIdArray* aIdArray); |
1024 CContactIdArray* SortLC(const CArrayFix<TSortPref>* aSortOrder, const CContactIdArray* aIdArray); |
995 TBool CheckType(TUid aUid) const; |
1025 TBool CheckType(TUid aUid) const; |
996 void SortDuplicatesL(const CArrayFix<TSortPref>& aSortOrder,CSortArray& aList,TInt aPos); |
1026 void SortDuplicatesL(const CArrayFix<TSortPref>& aSortOrder,CSortArray& aList,TInt aPos); |
1057 MLplPersistenceLayerFactory* FactoryL(); |
1087 MLplPersistenceLayerFactory* FactoryL(); |
1058 |
1088 |
1059 private: |
1089 private: |
1060 CContactItem* doCreateContactGroupLC(const TDesC& aGroupLabel = KNullDesC); |
1090 CContactItem* doCreateContactGroupLC(const TDesC& aGroupLabel = KNullDesC); |
1061 void AddCntToOpenedGroupL(TContactItemId aItemId, CContactItem& aGroup); |
1091 void AddCntToOpenedGroupL(TContactItemId aItemId, CContactItem& aGroup); |
1062 void ReadTemplateIds(); |
1092 void ReadTemplateIdsL(); |
1063 void AddToTemplateListL(const TContactItemId aNewTemplateId); |
1093 void AddToTemplateListL(const TContactItemId aNewTemplateId); |
1064 void RemoveFromTemplateList(const TContactItemId aOldTemplateId); |
1094 void RemoveFromTemplateList(const TContactItemId aOldTemplateId); |
1065 TBool SystemTemplateFieldsValid(const CContactItem& aContact); |
1095 TBool SystemTemplateFieldsValid(const CContactItem& aContact); |
1066 void RespondToEventL(const TContactDbObserverEventType aEventType, const TContactItemId aContactId); |
1096 void RespondToEventL(const TContactDbObserverEventType aEventType, const TContactItemId aContactId); |
1067 void HandleDbObserverEventGroupOrContactChangedL(const TContactItemId aContactId); |
1097 void HandleDbObserverEventGroupOrContactChangedL(const TContactItemId aContactId); |
1105 TTime iSyncDate; //was TInt64 iMachineUniqueId; |
1135 TTime iSyncDate; //was TInt64 iMachineUniqueId; |
1106 TCollationMethod iCollateMethod; //remains: used for sorting contacts |
1136 TCollationMethod iCollateMethod; //remains: used for sorting contacts |
1107 |
1137 |
1108 TInt iAsyncActivityCount; |
1138 TInt iAsyncActivityCount; |
1109 CContactSynchroniser* iContactSynchroniser; //a handle to the synchroniser plugin |
1139 CContactSynchroniser* iContactSynchroniser; //a handle to the synchroniser plugin |
1110 CArrayFix<TSortPref>* iSortOrder; // holds a sort order passed into SortL(), as in cntmodelv1, |
1140 CArrayFix<TSortPref>* iSortOrder; // holds a sort order passed into SortL(), as in cntmodelv1, |
1111 // for delayed deletion to maintain backwards compatibility |
1141 // for delayed deletion to maintain backwards compatibility |
1112 }; |
1142 }; |
1113 |
1143 |
1114 |
1144 |
1115 class CContactChangeNotifier : public CBase |
1145 class CContactChangeNotifier : public CBase |
1116 /** Receives events reporting changes to a contact database. |
1146 /** Receives events reporting changes to a contact database. |
1132 CContactDatabase &iDatabase; |
1162 CContactDatabase &iDatabase; |
1133 MContactDbObserver* iObserver; |
1163 MContactDbObserver* iObserver; |
1134 }; |
1164 }; |
1135 |
1165 |
1136 |
1166 |
1137 /** The UID of the default vCard converter implemented by an ECom plugin. */ |
1167 /** The UID of the default vCard converter implemented by an ECom plugin. |
|
1168 @publishedAll |
|
1169 @released |
|
1170 */ |
1138 #define KUidEComCntVCardConverterDefaultImplementation 0x102035F9 |
1171 #define KUidEComCntVCardConverterDefaultImplementation 0x102035F9 |
1139 /** The UID of the default vCard converter plugin implementation. This |
1172 /** The UID of the default vCard converter plugin implementation. This |
1140 implementation is independent of the plugin framework used. */ |
1173 implementation is independent of the plugin framework used. |
|
1174 @publishedAll |
|
1175 @released |
|
1176 */ |
1141 #define KUidVCardConvDefaultImpl KUidEComCntVCardConverterDefaultImplementation |
1177 #define KUidVCardConvDefaultImpl KUidEComCntVCardConverterDefaultImplementation |
1142 |
1178 |
1143 /** The UID of the vCard converter ECom plugin interface. */ |
1179 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS |
|
1180 |
|
1181 /** The UID of the vCard converter ECom plugin interface. |
|
1182 @released |
|
1183 @internalTechnology |
|
1184 */ |
1144 const TUid KUidEcomCntVCardConverterInterface = {0x102035F7}; |
1185 const TUid KUidEcomCntVCardConverterInterface = {0x102035F7}; |
1145 |
1186 |
1146 /** The UID of the phone number parser ECom plugin interface. */ |
1187 /** The UID of the phone number parser ECom plugin interface. |
|
1188 @released |
|
1189 @internalTechnology |
|
1190 */ |
1147 const TUid KUidEcomCntPhoneNumberParserInterface = {0x102035FA}; |
1191 const TUid KUidEcomCntPhoneNumberParserInterface = {0x102035FA}; |
1148 |
1192 |
1149 /** The UID of PBAP vCard Converter plugin Implementation. |
1193 /** The UID of PBAP vCard Converter plugin Implementation. |
1150 @prototype |
|
1151 @internalTechnology |
1194 @internalTechnology |
|
1195 @released |
1152 */ |
1196 */ |
1153 #define KUidPBAPVCardConvImpl 0xA00015C1 |
1197 #define KUidPBAPVCardConvImpl 0xA00015C1 |
|
1198 |
|
1199 #endif //SYMBIAN_ENABLE_SPLIT_HEADERS |
1154 |
1200 |
1155 class TPluginParameters |
1201 class TPluginParameters |
1156 /** |
1202 /** |
1157 Class used to pack the extra arguments required for a PBAP conveter, |
1203 Class used to pack the extra arguments required for a PBAP conveter, |
1158 PBAP client provides these arguments using overloaded CContactDatabase::ExportSelectedContacts. |
1204 PBAP client provides these arguments using overloaded CContactDatabase::ExportSelectedContacts. |
1159 @prototype |
1205 @publishedAll |
1160 @internalComponent |
1206 @released |
1161 */ |
1207 */ |
1162 { |
1208 { |
1163 public: |
1209 public: |
1164 TPluginParameters(TInt64 aContactFieldFilter, MConverterCallBack* aCallback, TVCardVersion aVersion, TBool aExportTel); |
1210 TPluginParameters(TInt64 aContactFieldFilter, MConverterCallBack* aCallback, TVCardVersion aVersion, TBool aExportTel); |
1165 TInt64 GetFilter()const; |
1211 TInt64 GetFilter()const; |
1198 |
1244 |
1199 class CContactConverter : public CBase |
1245 class CContactConverter : public CBase |
1200 /** Provides functionality to import and export vCards. |
1246 /** Provides functionality to import and export vCards. |
1201 One or more vCards can be imported from a read stream (the vCards are converted |
1247 One or more vCards can be imported from a read stream (the vCards are converted |
1202 into contact items and added to the database). Also, contact items can be exported as vCards. |
1248 into contact items and added to the database). Also, contact items can be exported as vCards. |
1203 |
1249 @publishedAll |
1204 @publishedPartner |
|
1205 @released |
1250 @released |
1206 */ |
1251 */ |
1207 { |
1252 { |
1208 public: |
1253 public: |
1209 virtual CArrayPtr<CContactItem>* ImportL(CContactDatabase& aDb,RReadStream& aReadStream,TBool& aImportSuccessful,TInt aOptions,TBool aImportSingle)=0; |
1254 virtual CArrayPtr<CContactItem>* ImportL(CContactDatabase& aDb,RReadStream& aReadStream,TBool& aImportSuccessful,TInt aOptions,TBool aImportSingle)=0; |
1213 |
1258 |
1214 class CContactEcomConverter : public CContactConverter |
1259 class CContactEcomConverter : public CContactConverter |
1215 /** |
1260 /** |
1216 It provides Ecom Framework based facilities to resolve and load the appropriate implementations at run-time. |
1261 It provides Ecom Framework based facilities to resolve and load the appropriate implementations at run-time. |
1217 The framework supplies a default resolver for selecting appropriate implementations. |
1262 The framework supplies a default resolver for selecting appropriate implementations. |
1218 @publishedPartner |
1263 @publishedAll |
1219 @released |
1264 @released |
1220 */ |
1265 */ |
1221 { |
1266 { |
1222 public: |
1267 public: |
1223 static CContactEcomConverter* NewL(TUid aImplementationUid); |
1268 static CContactEcomConverter* NewL(TUid aImplementationUid); |
1260 /** The destruction of the interface implementation referred to by iDtor_ID_Key */ |
1305 /** The destruction of the interface implementation referred to by iDtor_ID_Key */ |
1261 { |
1306 { |
1262 REComSession::DestroyedImplementation(iDtor_ID_Key); |
1307 REComSession::DestroyedImplementation(iDtor_ID_Key); |
1263 } |
1308 } |
1264 |
1309 |
1265 |
1310 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS |
1266 class CContactPhoneNumberParser : public CBase |
1311 class CContactPhoneNumberParser : public CBase |
1267 /** Provides functionality to extract the real phone number from a contact's phone number field. |
1312 /** Provides functionality to extract the real phone number from a contact's phone number field. |
1268 @publishedPartner |
1313 @publishedPartner |
1269 @released |
1314 @released |
1270 */ |
1315 */ |
1302 inline CContactEcomPhoneNumberParser::~CContactEcomPhoneNumberParser() |
1347 inline CContactEcomPhoneNumberParser::~CContactEcomPhoneNumberParser() |
1303 /** The destruction of the interface implementation referred to by iDtor_ID_Key */ |
1348 /** The destruction of the interface implementation referred to by iDtor_ID_Key */ |
1304 { |
1349 { |
1305 REComSession::DestroyedImplementation(iDtor_ID_Key); |
1350 REComSession::DestroyedImplementation(iDtor_ID_Key); |
1306 } |
1351 } |
1307 |
1352 #endif //SYMBIAN_ENABLE_SPLIT_HEADERS |
1308 |
1353 |
1309 inline TInt CContactDatabase::TemplateCount() const |
1354 inline TInt CContactDatabase::TemplateCount() const |
1310 /** Gets the number of contact card templates that exist in the database. |
1355 /** Gets the number of contact card templates that exist in the database. |
1311 This does not include the system template. |
1356 This does not include the system template. |
1312 @deprecated |
1357 @deprecated |