63
|
1 |
/*
|
|
2 |
* Copyright (c) 2006-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 "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: Exporting the contact field from contact to
|
|
15 |
* CParserProperty field
|
|
16 |
*
|
|
17 |
*/
|
|
18 |
|
|
19 |
|
|
20 |
#ifndef CVPBKVCARDPROPERTYEXPORTER_H
|
|
21 |
#define CVPBKVCARDPROPERTYEXPORTER_H
|
|
22 |
|
|
23 |
// INCLUDES
|
|
24 |
#include "TVPbkFieldVersitProperty.h"
|
|
25 |
#include "CVPbkVCardActiveIncremental.h"
|
|
26 |
#include <MVPbkSingleContactOperationObserver.h>
|
|
27 |
#include "CVPbkOwnCardHandler.h"
|
|
28 |
#include "CVPbkGroupCardHandler.h"
|
|
29 |
|
|
30 |
#include <e32base.h>
|
|
31 |
#include <badesca.h>
|
|
32 |
|
|
33 |
|
|
34 |
// FORWARD DECLARATIONS
|
|
35 |
class CParserVCard;
|
|
36 |
class MVPbkStoreContact;
|
|
37 |
class CVPbkVCardFieldTypeProperty;
|
|
38 |
class CVPbkVCardIdNameMapping;
|
|
39 |
class MVPbkFieldTypeList;
|
|
40 |
class CParserPropertyValue;
|
|
41 |
class CVPbkVCardParserParamArray;
|
|
42 |
class MVPbkBaseContactField;
|
|
43 |
class TVPbkVCardIndexedProperty;
|
|
44 |
class RWriteStream;
|
|
45 |
class MVPbkContactLink;
|
|
46 |
class CVPbkContactManager;
|
|
47 |
class MVPbkStoreContactField;
|
|
48 |
class CParserVCard;
|
|
49 |
|
|
50 |
// CLASS DECLARATIONS
|
|
51 |
/**
|
|
52 |
* Class is exporting the contact field from contact to
|
|
53 |
* CParserProperty field
|
|
54 |
*/
|
|
55 |
NONSHARABLE_CLASS(CVPbkVCardPropertyExporter)
|
|
56 |
: public CVPbkVCardActiveIncremental,
|
|
57 |
public MVPbkVCardIncremental,
|
|
58 |
public MVPbkSingleContactOperationObserver
|
|
59 |
{
|
|
60 |
public:
|
|
61 |
/**
|
|
62 |
* Create new instance of this class.
|
|
63 |
*/
|
|
64 |
static CVPbkVCardPropertyExporter* NewLC(
|
|
65 |
CVPbkVCardData& aData,
|
|
66 |
const MVPbkStoreContact* aSourceItem,
|
|
67 |
RWriteStream& aDestStream,
|
|
68 |
MVPbkSingleContactOperationObserver& aObserver,
|
|
69 |
const TBool aBeamed);
|
|
70 |
|
|
71 |
static CVPbkVCardPropertyExporter* NewLC(
|
|
72 |
CVPbkVCardData& aData,
|
|
73 |
RWriteStream& aDestStream,
|
|
74 |
MVPbkSingleContactOperationObserver& aObserver,
|
|
75 |
const TBool aBeamed);
|
|
76 |
|
|
77 |
~CVPbkVCardPropertyExporter();
|
|
78 |
|
|
79 |
protected: // From MVPbkVCardIncremental
|
|
80 |
|
|
81 |
virtual TInt Next(TInt& aRemainingSteps);
|
|
82 |
virtual void CloseL();
|
|
83 |
virtual void HandleLeave(TInt aError);
|
|
84 |
virtual void HandleCancel();
|
|
85 |
|
|
86 |
protected: // From MVPbkContactOperation
|
|
87 |
|
|
88 |
virtual void StartL();
|
|
89 |
|
|
90 |
private:
|
|
91 |
CVPbkVCardPropertyExporter(
|
|
92 |
CVPbkVCardData& aData,
|
|
93 |
const MVPbkStoreContact* aSourceItem,
|
|
94 |
RWriteStream& aDestStream,
|
|
95 |
MVPbkSingleContactOperationObserver& aObserver,
|
|
96 |
const TBool aBeamed);
|
|
97 |
|
|
98 |
CVPbkVCardPropertyExporter(
|
|
99 |
CVPbkVCardData& aData,
|
|
100 |
RWriteStream& aDestStream,
|
|
101 |
MVPbkSingleContactOperationObserver& aObserver,
|
|
102 |
const TBool aBeamed);
|
|
103 |
|
|
104 |
void ConstructL(CVPbkVCardData& aData);
|
|
105 |
|
|
106 |
public: // New functions
|
|
107 |
|
|
108 |
void InitLinkL(
|
|
109 |
const MVPbkContactLink& aContactLink,
|
|
110 |
CVPbkContactManager& aContactManager );
|
|
111 |
|
|
112 |
public: // From MVPbkSingleContactOperationObserver
|
|
113 |
|
|
114 |
void VPbkSingleContactOperationComplete(
|
|
115 |
MVPbkContactOperationBase& aOperation,
|
|
116 |
MVPbkStoreContact* aContact);
|
|
117 |
|
|
118 |
void VPbkSingleContactOperationFailed
|
|
119 |
(MVPbkContactOperationBase& aOperation, TInt aError);
|
|
120 |
|
|
121 |
private:
|
|
122 |
void ExportFieldL( CVPbkVCardFieldTypeProperty& aVCardProperty );
|
|
123 |
|
|
124 |
void GetValuesFromIndexedPropertiesL( TBool aSingleItem );
|
|
125 |
|
|
126 |
TBool GetSingleValueAndParamsL(
|
|
127 |
const TVPbkVCardIndexedProperty& aIndexedProperty,
|
|
128 |
CVPbkVCardParserParamArray& aParamArray,
|
|
129 |
TInt& aFindIndex );
|
|
130 |
|
|
131 |
MVPbkStoreContactField*
|
|
132 |
FindFieldFromContact(
|
|
133 |
const TVPbkVCardIndexedProperty& aIndexedProperty,
|
|
134 |
TInt& aIndex );
|
|
135 |
|
|
136 |
CParserPropertyValue* FetchDataFromFieldL(
|
|
137 |
MVPbkStoreContactField&,
|
|
138 |
CVPbkVCardParserParamArray& aParameters );
|
|
139 |
|
|
140 |
TBool AddPropertyToParserL( RPointerArray< CParserPropertyValue >& aValues,
|
|
141 |
CVPbkVCardParserParamArray* aParams);
|
|
142 |
|
|
143 |
TBool HasValues();
|
|
144 |
|
|
145 |
CParserPropertyValue* GetExportTextValueL(
|
|
146 |
const MVPbkBaseContactField& aField);
|
|
147 |
|
|
148 |
CParserPropertyValue* GetExportUriValueL(
|
|
149 |
const MVPbkBaseContactField& aField);
|
|
150 |
|
|
151 |
CParserPropertyValue* GetExportDateValueL(
|
|
152 |
const MVPbkBaseContactField& aField);
|
|
153 |
|
|
154 |
CParserPropertyValue* GetExportBinaryValueL(
|
|
155 |
const MVPbkBaseContactField& aField,
|
|
156 |
CVPbkVCardParserParamArray& aParameters );
|
|
157 |
|
|
158 |
TBool ContainsValidTextualDataL(const TDesC& aDataText) const;
|
|
159 |
|
|
160 |
void GetAdditionalParamsL(
|
|
161 |
MVPbkStoreContactField& aField, CVPbkVCardParserParamArray& aParams );
|
|
162 |
|
|
163 |
CParserPropertyValue* GetValueL(
|
|
164 |
RPointerArray< CParserPropertyValue >& aValues);
|
|
165 |
|
|
166 |
void InitDataL();
|
|
167 |
|
|
168 |
void DoNextL();
|
|
169 |
void HandleOwnCardL();
|
|
170 |
void HandleGroupCardL();
|
|
171 |
void AddRevL();
|
|
172 |
CParserPropertyValueDateTime* CreateDateTimePropertyL(
|
|
173 |
const TTime& aDateTime,
|
|
174 |
TVersitDateTime::TRelativeTime aRelativeTime);
|
|
175 |
|
|
176 |
private:
|
|
177 |
CParserVCard* iParser;
|
|
178 |
/// Own: Array of property values
|
|
179 |
RPointerArray< CParserPropertyValue > iValues;
|
|
180 |
/// Ref: Current VCard property
|
|
181 |
CVPbkVCardFieldTypeProperty* iVCardProperty;
|
|
182 |
/// Ref: Source contact
|
|
183 |
const MVPbkStoreContact* iContact;
|
|
184 |
/// Ref: Destination stream
|
|
185 |
RWriteStream& iDestinationStream;
|
|
186 |
/// Own: Internal index for execution loop
|
|
187 |
TInt iCurrentPropertyIndex;
|
|
188 |
/// Own: Maximum property count
|
|
189 |
TInt iMaxPropertyCount;
|
|
190 |
/// Own: The source contact which is owned by exporter
|
|
191 |
MVPbkStoreContact* iOwnedContact;
|
|
192 |
/// Own: The last operation executed
|
|
193 |
MVPbkContactOperationBase* iOperation;
|
|
194 |
/// Own: Internal state of the class
|
|
195 |
enum TVPbkVCardExporterState
|
|
196 |
{
|
|
197 |
ECreatingRetriever,
|
|
198 |
EExporting
|
|
199 |
} iState;
|
|
200 |
|
|
201 |
// Ref: Array to hold those fields masked during a beamed export
|
|
202 |
const CDesC8ArrayFlat* iMaskedFieldsArray;
|
|
203 |
|
|
204 |
// ETrue if the current orperation is a beamed export, otherwise EFalse
|
|
205 |
const TBool iBeamed;
|
|
206 |
CVPbkOwnCardHandler* iOwncardHandler;
|
|
207 |
//Own: GroupCard Handler
|
|
208 |
CVPbkGroupCardHandler* iGroupcardHandler;
|
|
209 |
};
|
|
210 |
|
|
211 |
#endif // CVPBKVCARDPROPERTYEXPORTER_H
|
|
212 |
|
|
213 |
// End of file
|