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 Delete contacts from the contact store
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#ifndef C_DELETECONTACTOBSERVER_H
|
|
20 |
#define C_DELETECONTACTOBSERVER_H
|
|
21 |
|
|
22 |
#include <s32file.h> // Used for RFileReadStream and RFileWriteStream
|
|
23 |
|
|
24 |
#include <mvpbkcontactobserver.h> //base class for vCardExEng
|
|
25 |
#include <mvpbkbatchoperationobserver.h>
|
|
26 |
#include <mvpbkcontactstoreobserver.h>
|
|
27 |
#include <cvpbkcontactlinkarray.h>
|
|
28 |
|
|
29 |
#include "contactservice.h"
|
|
30 |
#include "cancelasyncrquest.h"
|
|
31 |
|
|
32 |
class CVPbkContactManager;
|
|
33 |
class MVPbkStoreContact;
|
|
34 |
class MVPbkContactLink;
|
|
35 |
class MContactCallback;
|
|
36 |
class MVPbkContactLinkArray;
|
|
37 |
class MCancelAsync;
|
|
38 |
|
|
39 |
|
|
40 |
class CDeleteContactObserver : public CBase,
|
|
41 |
public MVPbkBatchOperationObserver,
|
|
42 |
public MVPbkContactStoreObserver,
|
|
43 |
public MCancelAsync
|
|
44 |
{
|
|
45 |
public:
|
|
46 |
/*
|
|
47 |
* called for creating an instace of delete contact observer
|
|
48 |
*/
|
|
49 |
static CDeleteContactObserver* NewL(CContactService* aContactService,
|
|
50 |
MVPbkContactStore* aContactStore,
|
|
51 |
RPointerArray<TDesC8>& aContactIdArray,
|
|
52 |
TInt aTransId,
|
|
53 |
MContactCallback* aCallback);
|
|
54 |
/*
|
|
55 |
* Destructor
|
|
56 |
*/
|
|
57 |
~CDeleteContactObserver();
|
|
58 |
/*
|
|
59 |
* Implementation of Cancel of MCancelAsync
|
|
60 |
*/
|
|
61 |
void Cancel();
|
|
62 |
|
|
63 |
private:
|
|
64 |
/*
|
|
65 |
* Constructor
|
|
66 |
*/
|
|
67 |
CDeleteContactObserver();
|
|
68 |
/*
|
|
69 |
* Symbian second-phase construction
|
|
70 |
*/
|
|
71 |
void ConstructL(CContactService* aContactService,
|
|
72 |
MVPbkContactStore* aContactStore,
|
|
73 |
RPointerArray<TDesC8>& aContactIdArray,
|
|
74 |
TInt aTransId,
|
|
75 |
MContactCallback* aCallback);
|
|
76 |
|
|
77 |
/*
|
|
78 |
* Called for deleting contacts from the contacts database.
|
|
79 |
*/
|
|
80 |
void DoDeleteL();
|
|
81 |
|
|
82 |
/*
|
|
83 |
* Convert the contact ids into link array format.
|
|
84 |
*/
|
|
85 |
void ConvertContactIdsToLinkArrayL( RPointerArray<TDesC8>& aContactIdArray );
|
|
86 |
|
|
87 |
private: //MVPbkBatchOperationObserver
|
|
88 |
/**
|
|
89 |
* Called when one step of the operation is complete.
|
|
90 |
* @param aOperation Operation whose step has completed.
|
|
91 |
* @param aStepSize Size of the performed step
|
|
92 |
*/
|
|
93 |
void StepComplete( MVPbkContactOperationBase& aOperation,
|
|
94 |
TInt aStepSize );
|
|
95 |
|
|
96 |
/**
|
|
97 |
* Called when one step of the operation fails.
|
|
98 |
* @param aOperation Operation whose step has completed.
|
|
99 |
* @param aStepSize Size of the performed step
|
|
100 |
* @param aError Error that occured.
|
|
101 |
* @return ETrue if the batch operation should continue,
|
|
102 |
* EFalse otherwise.
|
|
103 |
*/
|
|
104 |
TBool StepFailed( MVPbkContactOperationBase& aOperation,
|
|
105 |
TInt aStepSize, TInt aError );
|
|
106 |
|
|
107 |
/**
|
|
108 |
* Called when operation is completed.
|
|
109 |
*
|
|
110 |
* @param aOperation the completed operation.
|
|
111 |
*/
|
|
112 |
void OperationComplete( MVPbkContactOperationBase& aOperation );
|
|
113 |
|
|
114 |
|
|
115 |
private: //MVPbkContactStoreObserver
|
|
116 |
/**
|
|
117 |
* Called when a contact store is ready to use.
|
|
118 |
*/
|
|
119 |
void StoreReady( MVPbkContactStore& aContactStore );
|
|
120 |
|
|
121 |
/**
|
|
122 |
* Called when a contact store becomes unavailable.
|
|
123 |
* Client may inspect the reason of the unavailability and decide whether or not
|
|
124 |
* it will keep the store opened (ie. listen to the store events).
|
|
125 |
* @param aContactStore The store that became unavailable.
|
|
126 |
* @param aReason The reason why the store is unavailable.
|
|
127 |
* This is one of the system wide error codes.
|
|
128 |
*/
|
|
129 |
void StoreUnavailable( MVPbkContactStore& aContactStore, TInt aReason );
|
|
130 |
|
|
131 |
/**
|
|
132 |
* Called when changes occur in the contact store.
|
|
133 |
* @see TVPbkContactStoreEvent
|
|
134 |
* @param aContactStore The store the event occurred in.
|
|
135 |
* @param aStoreEvent Event that has occured.
|
|
136 |
*/
|
|
137 |
virtual void HandleStoreEventL(MVPbkContactStore& aContactStore,
|
|
138 |
TVPbkContactStoreEvent aStoreEvent );
|
|
139 |
|
|
140 |
private: //Data members
|
|
141 |
/*
|
|
142 |
* Pointer to a contact service
|
|
143 |
*/
|
|
144 |
CContactService* iContactService;
|
|
145 |
/*
|
|
146 |
* Pointer to a contact store
|
|
147 |
*/
|
|
148 |
MVPbkContactStore* iContactStore;
|
|
149 |
/*
|
|
150 |
* Pointer to a contact link array.
|
|
151 |
*/
|
|
152 |
CVPbkContactLinkArray* iContactLinkArray;
|
|
153 |
/*
|
|
154 |
* Pointer to a callback.
|
|
155 |
*/
|
|
156 |
MContactCallback* iCallback;
|
|
157 |
|
|
158 |
/*
|
|
159 |
* Transaction Id.
|
|
160 |
*/
|
|
161 |
TInt iTransId;
|
|
162 |
|
|
163 |
RPointerArray<MVPbkContactLinkArray> iLinkArrayToDelete;
|
|
164 |
|
|
165 |
/*
|
|
166 |
* OperationBase pointer to be used to cancel async request
|
|
167 |
*/
|
|
168 |
MVPbkContactOperationBase* iOp;
|
|
169 |
|
|
170 |
};
|
|
171 |
|
|
172 |
#endif //C_DELETECONTACTOBSERVER_H |