|
1 /* |
|
2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef __CREATORPHONEBOOKWRAPPER_H__ |
|
21 #define __CREATORPHONEBOOKWRAPPER_H__ |
|
22 |
|
23 #include "creator_phonebookbase.h" |
|
24 #include "creator_randomdatafield.h" |
|
25 |
|
26 #include <map> |
|
27 |
|
28 #include "creator_phonebookapi.h" |
|
29 |
|
30 class CCreatorEngine; |
|
31 class CCreatorModuleBaseParameters; |
|
32 |
|
33 class CContactDatabase; |
|
34 //class CPhonebookWrapperParameters; |
|
35 class CPhonebookParameters; |
|
36 |
|
37 typedef typename std::map<const TInt, HBufC*> TCreatorContactFields; |
|
38 typedef typename std::pair<const TInt, HBufC*> TCreatorContactField; |
|
39 |
|
40 class CCreatorPhonebookWrapper : public CBase |
|
41 { |
|
42 public: |
|
43 enum ContactDetailType{ |
|
44 ELastName, //0 |
|
45 ELastNameReading, //1 |
|
46 EFirstName, |
|
47 EFirstNameReading, |
|
48 EPrefix, |
|
49 ESuffix, //5 |
|
50 ESecondName, |
|
51 ELandPhoneHome, |
|
52 EMobilePhoneHome, |
|
53 EVideoNumberHome, |
|
54 EFaxNumberHome, //10 |
|
55 EVoipHome, |
|
56 EEmailHome, |
|
57 EUrlHome, |
|
58 EAddrLabelHome, |
|
59 EAddrPoHome, //15 |
|
60 EAddrExtHome, |
|
61 EAddrStreetHome, |
|
62 EAddrLocalHome, |
|
63 EAddrRegionHome, |
|
64 EAddrPostCodeHome, //20 |
|
65 EAddrCountryHome, |
|
66 EJobTitle, |
|
67 ECompanyName, |
|
68 ELandPhoneWork, |
|
69 EMobilePhoneWork, //25 |
|
70 EVideoNumberWork, |
|
71 EFaxNumberWork, |
|
72 EVoipWork, |
|
73 EEmailWork, |
|
74 EUrlWork, //30 |
|
75 EAddrLabelWork, |
|
76 EAddrPoWork, |
|
77 EAddrExtWork, |
|
78 EAddrStreetWork, |
|
79 EAddrLocalWork, //35 |
|
80 EAddrRegionWork, |
|
81 EAddrPostCodeWork, |
|
82 EAddrCountryWork, |
|
83 ELandPhoneGen, |
|
84 EMobilePhoneGen, //40 |
|
85 EVideoNumberGen, |
|
86 EFaxNumberGen, |
|
87 EVoipGen, |
|
88 EPoc, |
|
89 ESwis, //45 |
|
90 ESip, |
|
91 EEmailGen, |
|
92 EUrlGen, |
|
93 EAddrLabelGen, |
|
94 EAddrPoGen, //50 |
|
95 EAddrExtGen, |
|
96 EAddrStreetGen, |
|
97 EAddrLocalGen, |
|
98 EAddrRegionGen, |
|
99 EAddrPostCodeGen, //55 |
|
100 EAddrCountryGen, |
|
101 EPagerNumber, |
|
102 EDtmfString, |
|
103 EWVAddress, |
|
104 EDate, //60 |
|
105 ENote, |
|
106 EThumbnailPic, |
|
107 ERingTone, |
|
108 ECallerObjImg, |
|
109 ECallerObjText, //65 |
|
110 EMiddleName, |
|
111 EDepartment, |
|
112 EAsstName, |
|
113 ESpouse, |
|
114 EChildren, //70 |
|
115 EAsstPhone, |
|
116 ECarPhone, |
|
117 EAnniversary, |
|
118 ESyncClass, |
|
119 ELocPrivacy, //75 |
|
120 EGenLabel, |
|
121 ETopContact, |
|
122 EIMPP, |
|
123 }; |
|
124 |
|
125 |
|
126 public: |
|
127 static CCreatorPhonebookWrapper* NewL(); |
|
128 static CCreatorPhonebookWrapper* NewLC(); |
|
129 ~CCreatorPhonebookWrapper(); |
|
130 |
|
131 private: |
|
132 CCreatorPhonebookWrapper(); |
|
133 void ConstructL(); |
|
134 |
|
135 public: |
|
136 TUint32 CreateContactEntryL(const TCreatorContactFields& Map); |
|
137 TUint32 CreateGroupEntryL( HBufC* aGroupName ); |
|
138 TInt CreateSubscribedContactEntryL(); |
|
139 |
|
140 /** |
|
141 * NumberOfContacts() will return all contacts from Contact API |
|
142 */ |
|
143 TInt NumberOfContacts(); |
|
144 |
|
145 TInt AddContactToGroup( TUint32 aGroupId, TUint32 aContact ); |
|
146 TInt AddToGroup( TUint32 aGroupId, TInt aAmount ); |
|
147 |
|
148 |
|
149 void DeleteAllL(); |
|
150 void DeleteAllGroupsL(); |
|
151 void DeleteContactsL( RArray<TUint32>& aContactsToDelete, TUid aStoreUid ); |
|
152 |
|
153 private: |
|
154 QList<QContactDetail> CreateContactDetailsFromParameters( const TCreatorContactFields& Map ); |
|
155 QContactDetail CreateContactDetail( QList<QContactDetail>& aContactDetailList,QString aDetail, QString aFieldContext, QString aFieldString, QString aData ); |
|
156 void AddFieldToList( QList<QContactDetail>& aDetailList, QContactDetail aDetail); |
|
157 |
|
158 TBool IsContactGroupL( TUint32& aLink ); |
|
159 |
|
160 void DeleteItemsCreatedWithCreatorL( TUid aStoreUid ); |
|
161 void DoDeleteItemsCreatedWithCreatorL( TUid aStoreUid, CDictionaryFileStore* aStore ); |
|
162 TBool HasOtherThanGroupsL(); |
|
163 |
|
164 |
|
165 private: |
|
166 |
|
167 TInt iOpCounter; |
|
168 |
|
169 static QString iPhoneNumberFields[]; |
|
170 static TInt iUrlFields[]; |
|
171 static TInt iEmailFields[]; |
|
172 |
|
173 RArray<TUint32> iContactLinkArray; |
|
174 RArray<TUint32> iContactsToDelete; |
|
175 RArray<TUint32> iContactGroupsToDelete; |
|
176 |
|
177 RArray<TUint32> iPreviousDeleteLinks; |
|
178 //RPointerArray<MVPbkContactLinkArray> iPreviousDeleteLinks; //modify |
|
179 |
|
180 private: |
|
181 //new variables |
|
182 /// Ref: the target of the copy |
|
183 QContact* iStore; |
|
184 |
|
185 /// Own: Contact database for this store |
|
186 CContactDatabase* iContactDb; |
|
187 |
|
188 //Contacts found in contacts db. |
|
189 QList<QContactId>* iContactResults; |
|
190 // Contact groups that are found in the store. These are used in filtering |
|
191 // the groups from the find results. |
|
192 QList<QContactId>* iContactGroupsInStore; |
|
193 |
|
194 CCreatorPhonebookAPI* iPhonebookAPI; |
|
195 }; |
|
196 |
|
197 #endif // __CREATORPHONEBOOKWRAPPER_H__ |