5
|
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 for importing a contact into the contacts database.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#ifndef C_IMPORTSTORELISTOBSERVER_H
|
|
20 |
#define C_IMPORTSTORELISTOBSERVER_H
|
|
21 |
|
|
22 |
#include <s32file.h> // Used for RFileReadStream
|
|
23 |
#include <mvpbkcontactstoreListobserver.h> //base class for vCardEng
|
|
24 |
#include <mvpbkcontactobserver.h> //base class for vCardEng
|
|
25 |
#include <mvpbkcontactcopyobserver.h> //base class for vCardEng
|
|
26 |
#include <CVPbkVCardEng.h>
|
|
27 |
#include <MVPbkContactStore.h>
|
|
28 |
|
|
29 |
#include "contactcallback.h"
|
|
30 |
#include "storelistobserver.h"
|
|
31 |
#include "contactservice.h"
|
|
32 |
#include "cancelasyncrquest.h"
|
|
33 |
|
|
34 |
class CVPbkVCardEng;
|
|
35 |
class CVPbkContactManager;
|
|
36 |
class MVPbkStoreContact;
|
|
37 |
class MVPbkFieldType;
|
|
38 |
class MVPbkContactLink;
|
|
39 |
class CContactService;
|
|
40 |
|
|
41 |
class CImportStoreListObserver;
|
|
42 |
class CImportStoreListObserver: public CBase,
|
|
43 |
public MContactStoreListObserver,
|
|
44 |
public MVPbkContactCopyObserver,
|
|
45 |
public MCancelAsync
|
|
46 |
{
|
|
47 |
public:
|
|
48 |
/**
|
|
49 |
* Called for creating an instance of import store list observer.
|
|
50 |
*/
|
|
51 |
static CImportStoreListObserver* NewL(RFs &aFs,
|
|
52 |
const TFileName& aFileName,
|
|
53 |
MContactCallback *aCallback,
|
|
54 |
TInt32 aTransId);
|
|
55 |
/*
|
|
56 |
* Destructor
|
|
57 |
*/
|
|
58 |
~CImportStoreListObserver();
|
|
59 |
/*
|
|
60 |
* Methods to set vcard engine and contact store.
|
|
61 |
*/
|
|
62 |
void SetEngine(CVPbkVCardEng* aEngine);
|
|
63 |
void SetContactStore(MVPbkContactStore* aContactStore);
|
|
64 |
void SetContactService(CContactService* aContactService);
|
|
65 |
/*
|
|
66 |
* Implementation of Cancel of MCancelAsync
|
|
67 |
*/
|
|
68 |
void Cancel();
|
|
69 |
|
|
70 |
private: // from MVPbkContactStoreListObserver
|
|
71 |
|
|
72 |
/**
|
|
73 |
* An indication that the contact store is ready.
|
|
74 |
*
|
|
75 |
* @param aContactStore A reference to the store sending the indication.
|
|
76 |
* @return None.
|
|
77 |
*/
|
|
78 |
void StoreReady( MVPbkContactStore& aContactStore );
|
|
79 |
|
|
80 |
/**
|
|
81 |
* An indication that the contact store is not ready.
|
|
82 |
*
|
|
83 |
* @param aContactStore A reference to the store sending the indication.
|
|
84 |
* @param aReason An error code defining the reason for unavailability.
|
|
85 |
* @return None.
|
|
86 |
*/
|
|
87 |
void StoreUnavailable( MVPbkContactStore& aContactStore,
|
|
88 |
TInt aReason );
|
|
89 |
|
|
90 |
/**
|
|
91 |
* An indication for a contact store event.
|
|
92 |
*
|
|
93 |
* @param aContactStore A reference to the store sending the indication.
|
|
94 |
* @param aStoreEvent The contact store event.
|
|
95 |
* @return None.
|
|
96 |
*/
|
|
97 |
void HandleStoreEventL( MVPbkContactStore& aContactStore,
|
|
98 |
TVPbkContactStoreEvent aStoreEvent );
|
|
99 |
|
|
100 |
/**
|
|
101 |
* An indication that the contact store is opened successfully.
|
|
102 |
*
|
|
103 |
* @return None.
|
|
104 |
*/
|
|
105 |
void OpenComplete();
|
|
106 |
|
|
107 |
private: // from MVPbkContactCopyObserver
|
|
108 |
|
|
109 |
/**
|
|
110 |
* An indication that a field has been added into a contact.
|
|
111 |
*
|
|
112 |
* @param aOperation A reference to the operation instance.
|
|
113 |
* @return None.
|
|
114 |
*/
|
|
115 |
void FieldAddedToContact( MVPbkContactOperationBase& aOperation );
|
|
116 |
|
|
117 |
/**
|
|
118 |
* An indication that a contact operation has failed.
|
|
119 |
*
|
|
120 |
* @param aOperation A reference to the operation instance.
|
|
121 |
* @param aError The error code for the operation.
|
|
122 |
* @return None.
|
|
123 |
*/
|
|
124 |
void FieldAddingFailed( MVPbkContactOperationBase& aOperation,
|
|
125 |
TInt aError );
|
|
126 |
|
|
127 |
/**
|
|
128 |
* An indication that contacts have been saved into a store.
|
|
129 |
*
|
|
130 |
* @param aOperation A reference to the operation instance.
|
|
131 |
* @param aResults An array of contact links pointing to the store.
|
|
132 |
* @return None.
|
|
133 |
*/
|
|
134 |
void ContactsSaved( MVPbkContactOperationBase& aOperation,
|
|
135 |
MVPbkContactLinkArray* aResults );
|
|
136 |
|
|
137 |
/**
|
|
138 |
* An indication that contact saving has failed.
|
|
139 |
*
|
|
140 |
* @param aOperation A reference to the operation instance.
|
|
141 |
* @param aError The error code for the operation.
|
|
142 |
* @return None.
|
|
143 |
*/
|
|
144 |
void ContactsSavingFailed( MVPbkContactOperationBase& aOperation,
|
|
145 |
TInt aError );
|
|
146 |
|
|
147 |
private:
|
|
148 |
/*
|
|
149 |
* Constructor.
|
|
150 |
*/
|
|
151 |
CImportStoreListObserver(RFs &aFs,
|
|
152 |
const TFileName& aFileName,
|
|
153 |
MContactCallback *aCallback,
|
|
154 |
TInt32 aTransId);
|
|
155 |
|
|
156 |
private: // Data members
|
|
157 |
/*
|
|
158 |
* A pointer to the Virtual Phonebook Engine instance.
|
|
159 |
* Not Own.
|
|
160 |
*/
|
|
161 |
CVPbkVCardEng* iEngine;
|
|
162 |
/*
|
|
163 |
* file session
|
|
164 |
*/
|
|
165 |
RFs iFs;
|
|
166 |
/**
|
|
167 |
* A read stream for reading from file.
|
|
168 |
*/
|
|
169 |
RFileReadStream iSource;
|
|
170 |
/*
|
|
171 |
* A pointer to contact store.
|
|
172 |
*/
|
|
173 |
MVPbkContactStore* iContactStore;
|
|
174 |
/*
|
|
175 |
* File name
|
|
176 |
*/
|
|
177 |
TFileName iFileName;
|
|
178 |
/*
|
|
179 |
* A pointer to callback instance.
|
|
180 |
*/
|
|
181 |
MContactCallback *iCallback;
|
|
182 |
/*
|
|
183 |
* Transaction Id.
|
|
184 |
*/
|
|
185 |
TInt32 iTransId;
|
|
186 |
/*
|
|
187 |
* ContactService Instance
|
|
188 |
*/
|
|
189 |
CContactService* iContactService;
|
|
190 |
/*
|
|
191 |
* Handle for underlying Import call
|
|
192 |
*/
|
|
193 |
MVPbkContactOperationBase* iOp;
|
|
194 |
};
|
|
195 |
|
|
196 |
|
|
197 |
|
|
198 |
#endif //// C_IMPORTSTORELISTOBSERVER_H |