author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 25 May 2010 13:38:11 +0300 | |
branch | RCL_3 |
changeset 59 | 1aa6688bfd6b |
parent 33 | 50974a8b132e |
permissions | -rw-r--r-- |
19 | 1 |
/* |
2 |
* Copyright (c) 2007 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 the License "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: Observer to add/delete contacts to/from a group in the contact store. |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
#ifndef C_ORGANISEGROUPSOBSERVER_H |
|
20 |
#define C_ORGANISEGROUPSOBSERVER_H |
|
21 |
||
22 |
||
23 |
#include <s32file.h> // Used for RFileReadStream and RFileWriteStream |
|
33
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
24 |
#include <MVPbkContactObserver.h> //base class for vCardExEng |
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
25 |
#include <MVPbkContactStoreObserver.h> //base class for vCardExEng |
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
26 |
#include <MVPbkSingleContactOperationObserver.h> |
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
27 |
#include <CVPbkContactLinkArray.h> |
19 | 28 |
#include "contactservice.h" |
29 |
||
30 |
class CVPbkContactManager; |
|
31 |
class MVPbkStoreContact; |
|
32 |
class MVPbkContactLink; |
|
33 |
class MVPbkContactLinkArray; |
|
34 |
class MContactCallback; |
|
35 |
class MVPbkContactGroup; |
|
36 |
class CContactService; |
|
37 |
||
38 |
class COrganiseGroupsObserver : public CBase, |
|
39 |
public MVPbkContactStoreObserver, |
|
40 |
public MVPbkSingleContactOperationObserver, |
|
41 |
public MCancelAsync |
|
42 |
{ |
|
43 |
public: |
|
44 |
/* |
|
45 |
* Called for creating an instace of organise groups observer. |
|
46 |
*/ |
|
47 |
static COrganiseGroupsObserver* NewL(CContactService* aContactService, |
|
48 |
const TDesC8& aGroupId, |
|
49 |
RPointerArray<TDesC8>& aContactIdArray, |
|
50 |
TBool aAssociateFlag, |
|
51 |
TInt aTransId, |
|
52 |
MContactCallback* aCallback , |
|
53 |
MVPbkContactStore* aContactStore); |
|
54 |
/* |
|
55 |
* Destructor. |
|
56 |
*/ |
|
57 |
~COrganiseGroupsObserver(); |
|
58 |
/* |
|
59 |
* Implementation of Cancel of MCancelAsync |
|
60 |
*/ |
|
61 |
void Cancel(); |
|
62 |
||
63 |
private: |
|
64 |
/* |
|
65 |
* Constructor |
|
66 |
*/ |
|
67 |
COrganiseGroupsObserver(); |
|
68 |
/* |
|
69 |
* Symbian second-phase constuctor |
|
70 |
*/ |
|
71 |
/* |
|
72 |
* Symbian second-phase construction |
|
73 |
*/ |
|
74 |
void ConstructL(CContactService* aContactService, |
|
75 |
const TDesC8& aGroupId , |
|
76 |
RPointerArray<TDesC8>& aContactIdArray, |
|
77 |
TBool aAssociateFlag, |
|
78 |
TInt aTransId, |
|
79 |
MContactCallback* aCallback , |
|
80 |
MVPbkContactStore* aContactStore); |
|
81 |
||
82 |
private: |
|
83 |
/* |
|
84 |
* Called for associating/disassociating a list of contacts to/from the group. |
|
85 |
*/ |
|
86 |
void DoOrganiseGroupsL(MVPbkStoreContact* aContact); |
|
87 |
/* |
|
88 |
* Called to get the pointer to the contact group. |
|
89 |
*/ |
|
90 |
void DoGetGroupL(); |
|
91 |
||
92 |
/* |
|
93 |
* Convert the contact ids into link array format. |
|
94 |
*/ |
|
95 |
void ConvertContactIdsToLinkArrayL( RPointerArray<TDesC8>& aContactIdArray ); |
|
96 |
||
97 |
private: //MVPbkContactStoreObserver |
|
98 |
/** |
|
99 |
* Called when a contact store is ready to use. |
|
100 |
*/ |
|
101 |
void StoreReady( MVPbkContactStore& aContactStore ); |
|
102 |
||
103 |
/** |
|
104 |
* Called when a contact store becomes unavailable. |
|
105 |
* Client may inspect the reason of the unavailability and decide whether or not |
|
106 |
* it will keep the store opened (ie. listen to the store events). |
|
107 |
* @param aContactStore The store that became unavailable. |
|
108 |
* @param aReason The reason why the store is unavailable. |
|
109 |
* This is one of the system wide error codes. |
|
110 |
*/ |
|
111 |
void StoreUnavailable( MVPbkContactStore& aContactStore, TInt aReason ); |
|
112 |
||
113 |
/** |
|
114 |
* Called when changes occur in the contact store. |
|
115 |
* @see TVPbkContactStoreEvent |
|
116 |
* @param aContactStore The store the event occurred in. |
|
117 |
* @param aStoreEvent Event that has occured. |
|
118 |
*/ |
|
119 |
virtual void HandleStoreEventL(MVPbkContactStore& aContactStore, |
|
120 |
TVPbkContactStoreEvent aStoreEvent); |
|
121 |
||
122 |
private: // from MVPbkSingleContactOperationObserver |
|
123 |
/** |
|
124 |
* Called when operation is completed. |
|
125 |
* |
|
126 |
* @param aOperation the completed operation. |
|
127 |
* @param aContact the contact returned by the operation. |
|
128 |
* Client must take the ownership immediately. |
|
129 |
* |
|
130 |
* !!! NOTICE !!! |
|
131 |
* If you use Cleanupstack for MVPbkStoreContact |
|
132 |
* Use MVPbkStoreContact::PushL or |
|
133 |
* CleanupDeletePushL from e32base.h. |
|
134 |
* (Do Not Use CleanupStack::PushL(TAny*) because |
|
135 |
* then the virtual destructor of the M-class |
|
136 |
* won't be called when the object is deleted). |
|
137 |
*/ |
|
138 |
virtual void VPbkSingleContactOperationComplete(MVPbkContactOperationBase& aOperation, |
|
139 |
MVPbkStoreContact* aContact); |
|
140 |
/** |
|
141 |
* Called if the operation fails. |
|
142 |
* |
|
143 |
* @param aOperation the failed operation. |
|
144 |
* @param aError error code of the failure. |
|
145 |
*/ |
|
146 |
virtual void VPbkSingleContactOperationFailed(MVPbkContactOperationBase& aOperation, |
|
147 |
TInt aError); |
|
148 |
||
149 |
||
150 |
private: //Data members |
|
151 |
||
152 |
/* |
|
153 |
* Pointer to a contact manager. |
|
154 |
*/ |
|
155 |
const CVPbkContactManager* iContactManager; |
|
156 |
/* |
|
157 |
* Pointer to a contact group id. |
|
158 |
*/ |
|
159 |
HBufC8* iGroupId; |
|
160 |
/* |
|
161 |
* Pointer to a contact id array. |
|
162 |
*/ |
|
163 |
CVPbkContactLinkArray* iContactLinkArray; |
|
164 |
/* |
|
165 |
* Flag to indicate associate or disassociate. |
|
166 |
*/ |
|
167 |
TBool iAssociateFlag; |
|
168 |
/* |
|
169 |
* Pointer to a callback. |
|
170 |
*/ |
|
171 |
MContactCallback* iCallback; |
|
172 |
||
173 |
/* |
|
174 |
* Transaction Id. |
|
175 |
*/ |
|
176 |
TInt iTransId; |
|
177 |
||
178 |
RPointerArray<MVPbkContactLinkArray> iLinkArrayToDelete; |
|
179 |
||
180 |
MVPbkContactLinkArray* iLinkArray; |
|
181 |
||
182 |
MVPbkContactStore* iContactStore; |
|
183 |
||
184 |
CContactService* iContactService; |
|
185 |
||
186 |
//OperationBase pointer to be used to cancel async request |
|
187 |
MVPbkContactOperationBase* iOp; |
|
188 |
||
189 |
}; |
|
190 |
||
191 |
#endif //C_ORGANISEGROUPSOBSERVER_H |