1 /* |
|
2 * Copyright (c) 2008 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: Class that provides handling of vpbk server store |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_CVIMPSTSTORAGESERVERSTORE_H |
|
20 #define C_CVIMPSTSTORAGESERVERSTORE_H |
|
21 |
|
22 #include <e32base.h> |
|
23 #include "mvimpststoragevpbkcontactstore.h" |
|
24 #include "mvimpststoragevpbkstorehandler.h" |
|
25 |
|
26 class CVIMPSTStorageVPbkStoreHandler; |
|
27 class MVIMPSTStorageServiceCacheWriter; |
|
28 class MVPbkContactLink; |
|
29 class MVPbkStoreContact; |
|
30 class MVIMPSTStorageContact; |
|
31 |
|
32 // CLASS DECLARATION |
|
33 /** |
|
34 * vpbk local store |
|
35 * This class implements the use of Virtual Phonebook for Local Store(Contacts.cdb) |
|
36 * |
|
37 * @lib vimpststorage.lib |
|
38 * @since S60 5.0 |
|
39 */ |
|
40 NONSHARABLE_CLASS( CVIMPSTStorageVPbkServerStore ) : public CActive, |
|
41 public MVIMPSTStorageVPbkContactStore, |
|
42 public MVIMPSTStorageVPbkStoreHandler |
|
43 { |
|
44 |
|
45 public: |
|
46 |
|
47 |
|
48 /** |
|
49 * Two-phased constructor. |
|
50 * |
|
51 * @param aContactDb, contact database |
|
52 * @param aListId, Default List ID |
|
53 * @param aServiceId - Service Id |
|
54 * @param aServiceName - Service Name |
|
55 * @param aStorageView, Ref to Storage (CVIMPSTStorageViewId) |
|
56 */ |
|
57 static CVIMPSTStorageVPbkServerStore* NewL(const TDesC& aContactDb, |
|
58 const TDesC& aServiceName, |
|
59 MVIMPSTStorageServiceCacheWriter& aServiceCacheWriter ); |
|
60 |
|
61 /** |
|
62 * Two-phased constructor. |
|
63 * |
|
64 * @param aContactDb, contact database |
|
65 * @param aListId, Default List ID |
|
66 * @param aServiceId - Service Id |
|
67 * @param aServiceName - Service Name |
|
68 * @param aStorageView, Ref to Storage (CVIMPSTStorageViewId) |
|
69 */ |
|
70 static CVIMPSTStorageVPbkServerStore* NewLC( const TDesC& aContactDb, |
|
71 const TDesC& aServiceName, |
|
72 MVIMPSTStorageServiceCacheWriter& aServiceCacheWriter ); |
|
73 |
|
74 /** |
|
75 * Standard C++ destructor |
|
76 */ |
|
77 ~CVIMPSTStorageVPbkServerStore(); |
|
78 |
|
79 public: // from MVIMPSTStorageVPbkContactStore |
|
80 |
|
81 /** |
|
82 * See @MVIMPSTStorageVPbkContactStore |
|
83 * @ return ETrue |
|
84 **/ |
|
85 TBool LocalStore() const ; |
|
86 |
|
87 TInt CreateVPbkContactL(const TDesC& aUserId, |
|
88 const TDesC& aDisplayName, |
|
89 TBool aInvitationAutoAccept = EFalse ) ; |
|
90 |
|
91 TInt RemoveVPbkContactL(const MVPbkContactLink& aContactLink) ; |
|
92 |
|
93 TInt RetrieveVPbkXSPIdL(const TDesC8& aPackedLinks ) ; |
|
94 |
|
95 TInt CreateRetriveVPbkContactL(TInt aIndexToUse ) ; |
|
96 |
|
97 TInt deleteRetriveVPbkContactL(TInt aIndexToUse ) ; |
|
98 |
|
99 TInt UpdateAvatarFieldDataL(const MVPbkContactLink& aContactLink, |
|
100 const TDesC8& aAvatartData ); |
|
101 |
|
102 TInt RemoveAvatarFieldL(MVPbkStoreContact& aStoreContact); |
|
103 |
|
104 |
|
105 void AddVPbkFetchContactsL( RArray <TPtrC> &aFirstNameList, |
|
106 RArray <TPtrC> &aServiceField ) ; |
|
107 |
|
108 const TDesC& GetRetrieveVPbkXSPIdL(TInt aIndex ) ; |
|
109 |
|
110 TInt RemoveAllVPbkContactsL(); |
|
111 |
|
112 |
|
113 void DeleteDatabaseL(); |
|
114 public : |
|
115 /** |
|
116 * From MVPbkContactStoreObserver |
|
117 * Callback: Store event occured |
|
118 * |
|
119 * @since S60 5.0 |
|
120 * @param aContactStore, contact store |
|
121 * @param aStoreEvent, event |
|
122 */ |
|
123 void HandleVPbkStoreEventL(TVIMPSTVPbkStoreEvent aVPbkStoreEvent) ; |
|
124 |
|
125 private: // From CActive |
|
126 void RunL(); |
|
127 void DoCancel(); |
|
128 TInt RunError(TInt aError ); |
|
129 |
|
130 private: |
|
131 |
|
132 /** |
|
133 * Issues Request |
|
134 * |
|
135 */ |
|
136 void IssueRequest(); |
|
137 |
|
138 private: // Implementation |
|
139 |
|
140 /** |
|
141 * Standard C++ constructor |
|
142 */ |
|
143 CVIMPSTStorageVPbkServerStore(MVIMPSTStorageServiceCacheWriter& aServiceCacheWriter); |
|
144 |
|
145 /** |
|
146 * Performs the 2nd phase of construction. |
|
147 * |
|
148 * @param aContactDb, contact database address |
|
149 * @param aServiceName, service name |
|
150 */ |
|
151 void ConstructL(const TDesC& aContactDb,const TDesC& aServiceName ); |
|
152 |
|
153 /* |
|
154 * helper method for deleing the etry from iFetchContactsToBeAdded |
|
155 */ |
|
156 void ResetAndDestroyLocalArrayL(); |
|
157 |
|
158 |
|
159 private: // Data |
|
160 MVIMPSTStorageServiceCacheWriter& iServiceCacheWriter; |
|
161 // Own: pointer to a class which interact with Virtual phonebook |
|
162 CVIMPSTStorageVPbkStoreHandler* iVPbkStoreHandler; |
|
163 // owns : fetched contacts |
|
164 RArray<TVIMPSTContactInfo> iFetchContactsToBeAdded; |
|
165 // owns |
|
166 TVIMPSTFetchingSteps iFetchStep; |
|
167 // owns : list of xsp id |
|
168 RPointerArray<HBufC> iRetrivedXSPIdArray; |
|
169 |
|
170 |
|
171 }; |
|
172 |
|
173 #endif // C_CVIMPSTSTORAGELOCALSTORE_H |
|
174 |
|
175 // End of file |
|