63
|
1 |
/*
|
|
2 |
* Copyright (c) 2002-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: Field Type selection utility used to enter the selection
|
|
15 |
* criteria.
|
|
16 |
*
|
|
17 |
*/
|
|
18 |
|
|
19 |
|
|
20 |
#ifndef CVPBKFIELDTYPESELECTOR_H
|
|
21 |
#define CVPBKFIELDTYPESELECTOR_H
|
|
22 |
|
|
23 |
// INCLUDES
|
|
24 |
#include <e32base.h>
|
|
25 |
#include <MVPbkContactFieldSelector.h>
|
|
26 |
#include <MVPbkFieldTypeSelector.h>
|
|
27 |
#include <VPbkFieldType.hrh>
|
|
28 |
#include <TVPbkFieldTypeParameters.h>
|
|
29 |
|
|
30 |
// FORWARD DECLARATIONS
|
|
31 |
class TVPbkFieldVersitProperty;
|
|
32 |
class MVPbkFieldType;
|
|
33 |
class MVPbkFieldTypeList;
|
|
34 |
class TResourceReader;
|
|
35 |
class RWriteStream;
|
|
36 |
class MVPbkStoreContactFieldCollection;
|
|
37 |
namespace VPbkEngUtils { class CTextStore; }
|
|
38 |
|
|
39 |
/**
|
|
40 |
* Virtual Phonebook field type selector. Responsible for creating
|
|
41 |
* a field or field type selection object. Clients can create a
|
|
42 |
* selector and then use e.g. IsFieldIncluded to detect whether
|
|
43 |
* the field matches the set criteria.
|
|
44 |
*/
|
|
45 |
class CVPbkFieldTypeSelector : public CBase,
|
|
46 |
public MVPbkContactFieldSelector,
|
|
47 |
public MVPbkFieldTypeSelector
|
|
48 |
{
|
|
49 |
public: // Construction and destruction
|
|
50 |
/**
|
|
51 |
* Constructs this object from a VPBK_FIELD_TYPE_SELECTOR
|
|
52 |
* ( VPbkFieldType.rh ) resource.
|
|
53 |
*
|
|
54 |
* @param aReader Resource reader initialized to the
|
|
55 |
* VPBK_FIELD_TYPE_SELECTOR resource
|
|
56 |
* structure.
|
|
57 |
* @param aFieldTypeList Field type list used to search
|
|
58 |
* for the field.
|
|
59 |
* @return A new instance of this class.
|
|
60 |
*/
|
|
61 |
IMPORT_C static CVPbkFieldTypeSelector* NewL(
|
|
62 |
TResourceReader& aReader,
|
|
63 |
const MVPbkFieldTypeList& aFieldTypeList );
|
|
64 |
|
|
65 |
/**
|
|
66 |
* Constructs an empty selector. Can be used in combination
|
|
67 |
* with InternalizeL or AppendL to create a selector.
|
|
68 |
*
|
|
69 |
* @param aFieldTypeList Field type list used to search
|
|
70 |
* for the field.
|
|
71 |
* @return A new instance of this class.
|
|
72 |
*/
|
|
73 |
IMPORT_C static CVPbkFieldTypeSelector* NewL(
|
|
74 |
const MVPbkFieldTypeList& aFieldTypeList );
|
|
75 |
|
|
76 |
/**
|
|
77 |
* Copy constructs this object.
|
|
78 |
*
|
|
79 |
* @param aSelector The object to copy construct from.
|
|
80 |
* @return A new instance of this class.
|
|
81 |
*/
|
|
82 |
IMPORT_C static CVPbkFieldTypeSelector* NewL(
|
|
83 |
const CVPbkFieldTypeSelector& aSelector );
|
|
84 |
|
|
85 |
/**
|
|
86 |
* Destructor.
|
|
87 |
*/
|
|
88 |
~CVPbkFieldTypeSelector();
|
|
89 |
|
|
90 |
public: // Interface
|
|
91 |
/**
|
|
92 |
* Outputs this objects state to a buffer.
|
|
93 |
*
|
|
94 |
* @return Buffer containg this object.
|
|
95 |
*/
|
|
96 |
IMPORT_C HBufC8* ExternalizeLC() const;
|
|
97 |
|
|
98 |
/**
|
|
99 |
* Initializes the instance from the buffer.
|
|
100 |
*
|
|
101 |
* @param aBuffer Buffer containing externalized object.
|
|
102 |
*/
|
|
103 |
IMPORT_C void InternalizeL(
|
|
104 |
const TDesC8& aBuffer );
|
|
105 |
|
|
106 |
/**
|
|
107 |
* Returns the matching Versit property or NULL.
|
|
108 |
*
|
|
109 |
* @param aFieldType The field type to test.
|
|
110 |
*/
|
|
111 |
IMPORT_C const TVPbkFieldVersitProperty* MatchingVersitProperty(
|
|
112 |
const MVPbkFieldType& aFieldType ) const;
|
|
113 |
|
|
114 |
/**
|
|
115 |
* Returns the matching non-Versit type or EVPbkNonVersitTypeNone.
|
|
116 |
*
|
|
117 |
* @param aFieldType The field type to test.
|
|
118 |
*/
|
|
119 |
IMPORT_C TVPbkNonVersitFieldType MatchingNonVersitType(
|
|
120 |
const MVPbkFieldType& aFieldType ) const;
|
|
121 |
|
|
122 |
/**
|
|
123 |
* Calculates the number of addresses
|
|
124 |
*
|
|
125 |
* @param aFields A field collection to test.
|
|
126 |
* @return Calculated number of addresses.
|
|
127 |
*/
|
|
128 |
IMPORT_C TInt AddressFieldsIncluded(
|
|
129 |
const MVPbkStoreContactFieldCollection& aFields ) const;
|
|
130 |
|
|
131 |
/**
|
|
132 |
* Returns the field type list with which this object
|
|
133 |
* was initialized with.
|
|
134 |
*
|
|
135 |
* @return Field type list.
|
|
136 |
*/
|
|
137 |
const MVPbkFieldTypeList& FieldTypeList() const;
|
|
138 |
|
|
139 |
/**
|
|
140 |
* Appends a VPBK_FIELD_TYPE_SELECTOR resource to this
|
|
141 |
* selector.
|
|
142 |
*
|
|
143 |
* @param aReader Resource reader initialized to the
|
|
144 |
* VPBK_FIELD_TYPE_SELECTOR resource
|
|
145 |
* structure.
|
|
146 |
*/
|
|
147 |
void AppendL(
|
|
148 |
TResourceReader& aReader );
|
|
149 |
|
|
150 |
/**
|
|
151 |
* Sets contact action type. Contact action type is used to filter
|
|
152 |
* xsp id fields according to data and service type.
|
|
153 |
*
|
|
154 |
* @param aContactActionType contact action type
|
|
155 |
*/
|
|
156 |
void SetContactActionType(TInt aContactActionType);
|
|
157 |
|
|
158 |
public: // From MVPbkContactFieldSelector
|
|
159 |
TBool IsFieldIncluded(
|
|
160 |
const MVPbkBaseContactField& aField ) const;
|
|
161 |
|
|
162 |
public: // From MVPbkFieldTypeSelector
|
|
163 |
TBool IsFieldTypeIncluded(
|
|
164 |
const MVPbkFieldType& aFieldType ) const;
|
|
165 |
|
|
166 |
private: // Implementation
|
|
167 |
CVPbkFieldTypeSelector(
|
|
168 |
const MVPbkFieldTypeList& aFieldTypeList );
|
|
169 |
void CommonConstructL();
|
|
170 |
void ConstructL(
|
|
171 |
TResourceReader& aReader );
|
|
172 |
void ConstructL(
|
|
173 |
const CVPbkFieldTypeSelector& aSelector );
|
|
174 |
void DoAppendL(
|
|
175 |
TResourceReader& aReader );
|
|
176 |
TInt CalculateBufferSize() const;
|
|
177 |
void DoFillBufferL(
|
|
178 |
RWriteStream& aWriteStream ) const;
|
|
179 |
void SelectionPropertyReset();
|
|
180 |
TBool IsFieldDataIncluded(
|
|
181 |
const MVPbkBaseContactField& aField) const;
|
|
182 |
TBool DoIsFieldDataIncludedL(
|
|
183 |
const MVPbkBaseContactField& aField) const;
|
|
184 |
|
|
185 |
private: // Data
|
|
186 |
/// Ref: Field type list to search for the field
|
|
187 |
const MVPbkFieldTypeList& iFieldTypeList;
|
|
188 |
|
|
189 |
/// Selection Property struct to associate
|
|
190 |
/// excludes for versit properties
|
|
191 |
struct TSelectionProperty;
|
|
192 |
|
|
193 |
/// Own: selection properties
|
|
194 |
RArray<TSelectionProperty> iSelectionProperties;
|
|
195 |
|
|
196 |
/// Own: contact action type
|
|
197 |
TInt iContactActionType;
|
|
198 |
};
|
|
199 |
|
|
200 |
#endif // CVPBKFIELDTYPESELECTOR_H
|
|
201 |
|
|
202 |
// End of File
|
|
203 |
|