2 * Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
14 * Description: Virtual Phonebook manager class for contact attributes.
19 #ifndef MVPBKCONTACTATTRIBUTEMANAGER_H
20 #define MVPBKCONTACTATTRIBUTEMANAGER_H
26 // FORWARD DECLARATIONS
27 class MVPbkContactOperationBase;
28 class MVPbkContactLink;
29 class MVPbkContactFindObserver;
30 class MVPbkStoreContact;
31 class MVPbkStoreContactField;
32 class MVPbkContactAttribute;
33 class MVPbkStoreContactFieldCollection;
36 * Virtual Phonebook single attribute presense observer interface.
38 class MVPbkSingleAttributePresenceObserver
42 * Attribute presence query operation completed.
43 * @param aOperation Contact operation that was completed.
44 * @param aResult Result of the query.
46 virtual void AttributePresenceOperationComplete(
47 MVPbkContactOperationBase& aOperation, TBool aResult ) = 0;
50 * Attribute presence query operation failed.
51 * @param aOperation Contact operation that failed.
52 * @param aError Error code.
54 virtual void AttributePresenceOperationFailed(
55 MVPbkContactOperationBase& aOperation, TInt aError) = 0;
58 * Returns an extension point for this interface or NULL.
59 * @param aExtensionUid Extension identifier.
60 * @return Extension object.
62 virtual TAny* AttributeSinglePresenceOperationExtension(
63 TUid /*aExtensionUid*/) { return NULL; }
65 protected: // Destructor
69 virtual ~MVPbkSingleAttributePresenceObserver() { }
73 * Virtual Phonebook multiple attribute presense observer interface.
75 class MVPbkMultiAttributePresenceObserver
79 * Attribute presence query operation completed.
80 * @param aOperation Contact operation that was completed.
81 * @param aResult Fields with attribute aAttribute,
82 * or NULL if there is no fields with that
83 * attribute in this contact.
85 virtual void AttributePresenceOperationComplete(
86 MVPbkContactOperationBase& aOperation,
87 MVPbkStoreContactFieldCollection* aResult) = 0;
90 * Attribute presence query operation failed.
91 * @param aOperation Contact operation that failed.
92 * @param aError Error code.
94 virtual void AttributePresenceOperationFailed(
95 MVPbkContactOperationBase& aOperation, TInt aError) = 0;
98 * Returns an extension point for this interface or NULL.
99 * @param aExtensionUid Extension identifier.
100 * @return Extension object.
102 virtual TAny* AttributeMultiPresenceOperationExtension(
103 TUid /*aExtensionUid*/) { return NULL; }
105 protected: // Destructor
109 virtual ~MVPbkMultiAttributePresenceObserver() { }
114 * Virtual Phonebook Set attribute observer interface.
116 class MVPbkSetAttributeObserver
120 * Attribute operation completed.
121 * @param aOperation Contact operation that was completed.
123 virtual void AttributeOperationComplete(
124 MVPbkContactOperationBase& aOperation) = 0;
127 * Attribute operation failed.
128 * @param aOperation Contact operation that failed.
129 * @param aError Error code.
131 virtual void AttributeOperationFailed(
132 MVPbkContactOperationBase& aOperation, TInt aError) = 0;
135 * Returns an extension point for this interface or NULL.
136 * @param aExtensionUid Extension identifier.
137 * @return Extension object.
139 virtual TAny* SetAttributeObserverExtension(
140 TUid /*aExtensionUid*/) { return NULL; }
142 protected: // Destructor
146 ~MVPbkSetAttributeObserver() { }
150 * Abstract interface for contact attribute manager.
152 * Contact attribute manager can be used to set global attributes such as speed dials
153 * for contacts or fields of contacts. The attributes can be stored in external
154 * databases so that some kind of mapping is maintained between contacts and
155 * attributes. This interface provides unified access to all global attributes.
157 class MVPbkContactAttributeManager
163 virtual ~MVPbkContactAttributeManager() { }
166 * Lists all contacts having the requested type of
167 * attribute asynchronously.
169 * @param aAttributeType Type of the attribute to search for.
170 * @param aObserver Observer for the asynchronous process.
171 * @return Newly created handle to the process.
173 virtual MVPbkContactOperationBase* ListContactsL(
175 MVPbkContactFindObserver& aObserver) = 0;
178 * Lists all contacts matching the given attribute asynchronously.
180 * @param aAttribute Attribute prototype to match against.
181 * @param aObserver Observer for the asynchronous process.
182 * @return Newly created handle to the process.
184 virtual MVPbkContactOperationBase* ListContactsL(
185 const MVPbkContactAttribute& aAttribute,
186 MVPbkContactFindObserver& aObserver) = 0;
189 * Checks if the given contact has the given attribute.
191 * @param aAttributeType Type of the attribute to check for.
192 * @param aContact Contact whose attributes are checked.
193 * @return ETrue if aContact has an attribute of aAttributeType,
196 virtual TBool HasContactAttributeL(
198 const MVPbkStoreContact& aContact) const = 0;
201 * Checks if the given contact has an attribute matching the
204 * @param aAttribute Attribute prototype to match against.
205 * @param aContact Contact whose attributes are checked.
206 * @return ETrue if aContact has an attribute matching the aAttribute,
209 virtual TBool HasContactAttributeL(
210 const MVPbkContactAttribute& aAttribute,
211 const MVPbkStoreContact& aContact) const = 0;
214 * Checks if the given contact field has the given attribute.
216 * @param aAttributeType Type of the attribute to check for.
217 * @param aField Field whose attributes are checked.
218 * @return ETrue if aField has an attribute of aAttributeType,
221 virtual TBool HasFieldAttributeL(
223 const MVPbkStoreContactField& aField) const = 0;
226 * Checks if the given contact field has an attribute matching
227 * the given attribute.
229 * @param aAttribute Attribute prototype to match against.
230 * @param aField Contact field whose attribute is checked.
231 * @return ETrue if aField has an attribute matching the aAttribute,
234 virtual TBool HasFieldAttributeL(
235 const MVPbkContactAttribute& aAttribute,
236 const MVPbkStoreContactField& aField) const = 0;
239 * Returns fields with attribute type aAttributeType, or
240 * NULL if there is no fields with that attribute in this
243 * @param aAttributeType Type of the attribute to find for.
244 * @param aContact Contact whose attributes are checked.
246 virtual MVPbkStoreContactFieldCollection* FindFieldsWithAttributeLC(
248 MVPbkStoreContact& aContact) const = 0;
251 * Returns fields with attribute aAttribute, or NULL if there is no
252 * fields with that attribute in this contact.
254 * @param aAttribute Attribute prototype to match against.
255 * @param aContact Contact whose attributes are checked.
257 virtual MVPbkStoreContactFieldCollection* FindFieldsWithAttributeLC(
258 const MVPbkContactAttribute& aAttribute,
259 MVPbkStoreContact& aContact) const = 0;
262 * Finds the first field that has the aAttr and returns
263 * a reference to the field or NULL if not found.
265 * Note: the returned reference will become invalid if
266 * MVPbkStoreContactFieldCollection::FieldAt is called for
267 * different field. If this is a problem then use
268 * MVPbkStoreContactField::CloneLC for permanent copy of
271 * @param aAttr The attribute that is looked for.
272 * @param aContact Contact whose fields are iterated.
273 * @return Returns a reference to the field or NULL if not found.
275 virtual MVPbkStoreContactField* FindFieldWithAttributeL(
276 const MVPbkContactAttribute& aAttr,
277 MVPbkStoreContact& aContact) const = 0;
280 * Asynchronously sets the contact attribute for the contact referred
281 * by the given contact link.
283 * @param aContactLink Link to contact whose attribute to set.
284 * @param aAttribute Attribute to set for the contact.
285 * @param aObserver Observer for the asynchronous process.
286 * @return Newly created handle to the operation.
288 virtual MVPbkContactOperationBase* SetContactAttributeL(
289 const MVPbkContactLink& aContactLink,
290 const MVPbkContactAttribute& aAttribute,
291 MVPbkSetAttributeObserver& aObserver) = 0;
293 * Asynchronously sets the contact field attribute for the
294 * give contact field.
296 * @param aField Contact field whose attribute to set.
297 * @param aAttribute Attribute to set for the contact field.
298 * @param aObserver Observer for the asynchronous process.
299 * @return Newly created handle to the operation.
301 virtual MVPbkContactOperationBase* SetFieldAttributeL(
302 MVPbkStoreContactField& aField,
303 const MVPbkContactAttribute& aAttribute,
304 MVPbkSetAttributeObserver& aObserver) = 0;
307 * asynchronously removes the given attribute from the contact
308 * referred by the aContactLink.
310 * @param aContactLink Link to the contact whose attribute
312 * @param aAttribute Attribute to remove from the contact.
313 * @param aObserver Observer for the asynchronous process.
314 * @return Newly created handle to the operation.
316 virtual MVPbkContactOperationBase* RemoveContactAttributeL(
317 const MVPbkContactLink& aContactLink,
318 const MVPbkContactAttribute& aAttribute,
319 MVPbkSetAttributeObserver& aObserver) = 0;
322 * asynchronously removes all attributes having the attribute
323 * type aAttributeType from the contact.
325 * @param aContactLink Link to the contact whose attribute
327 * @param aAttributeType Type of the attributes to remove
329 * @param aObserver Observer for the asynchronous process.
330 * @return Newly created handle to the operation.
332 virtual MVPbkContactOperationBase* RemoveContactAttributeL(
333 const MVPbkContactLink& aContactLink,
335 MVPbkSetAttributeObserver& aObserver) = 0;
338 * Asynchronously removes the given attribute from the
339 * given contact field.
341 * @param aField Field whose attribute to remove.
342 * @param aAttribute Attribute to remove from the contact field.
343 * @param aObserver Observer for the asynchronous process.
344 * @return Newly created handle to the operation.
346 virtual MVPbkContactOperationBase* RemoveFieldAttributeL(
347 MVPbkStoreContactField& aField,
348 const MVPbkContactAttribute& aAttribute,
349 MVPbkSetAttributeObserver& aObserver) = 0;
352 * Asynchronously removes all attributes having the attribute
353 * type aAttributeType from the contact field.
355 * @param aField Field whose attribute to remove.
356 * @param aAttributeType Type of the attributes to remove
357 * from the contact field.
358 * @param aObserver Observer for the asynchronous process.
359 * @return Newly created handle to the operation.
361 virtual MVPbkContactOperationBase* RemoveFieldAttributeL(
362 MVPbkStoreContactField& aField,
364 MVPbkSetAttributeObserver& aObserver) = 0;
367 * Checks if the given contact has the given attribute asynchronously.
369 * @param aAttributeType Type of the attribute to check for.
370 * @param aContact Contact whose attributes are checked.
371 * @param aObserver Observer for the asynchronous process.
372 * @return Newly created handle to the operation.
374 virtual MVPbkContactOperationBase* HasContactAttributeL(
376 const MVPbkStoreContact& aContact,
377 MVPbkSingleAttributePresenceObserver& aObserver) const = 0;
380 * Checks if the given contact has an attribute matching the
381 * given attribute asynchronously.
383 * @param aAttribute Attribute prototype to match against.
384 * @param aContact Contact whose attributes are checked.
385 * @param aObserver Observer for the asynchronous process.
386 * @return Newly created handle to the operation.
388 virtual MVPbkContactOperationBase* HasContactAttributeL(
389 const MVPbkContactAttribute& aAttribute,
390 const MVPbkStoreContact& aContact,
391 MVPbkSingleAttributePresenceObserver& aObserver) const = 0;
394 * Checks if the given contact field has the given attribute
397 * @param aAttributeType Type of the attribute to check for.
398 * @param aField Field whose attributes are checked.
399 * @param aObserver Observer for the asynchronous process.
400 * @return Newly created handle to the operation.
402 virtual MVPbkContactOperationBase* HasFieldAttributeL(
404 const MVPbkStoreContactField& aField,
405 MVPbkSingleAttributePresenceObserver& aObserver) const = 0;
408 * Checks if the given contact field has an attribute matching
409 * the given attribute asynchronously.
411 * @param aAttribute Attribute prototype to match against.
412 * @param aField Contact field whose attribute is checked.
413 * @param aObserver Observer for the asynchronous process.
414 * @return Newly created handle to the operation.
416 virtual MVPbkContactOperationBase* HasFieldAttributeL(
417 const MVPbkContactAttribute& aAttribute,
418 const MVPbkStoreContactField& aField,
419 MVPbkSingleAttributePresenceObserver& aObserver) const = 0;
422 * Initiates an asynchronous operation, which finds the aAttribute type
423 * attributed fields from the contact.
425 * @param aAttributeType Type of the attribute to find for.
426 * @param aContact Contact whose attributes are checked.
427 * @param aObserver Observer for the asynchronous process.
428 * @return Newly created handle to the operation.
430 virtual MVPbkContactOperationBase* FindFieldsWithAttributeL(
432 MVPbkStoreContact& aContact,
433 MVPbkMultiAttributePresenceObserver& aObserver) const = 0;
436 * Initiates an asynchronous operation, which finds the aAttribute type
437 * attributed fields from the contact.
439 * @param aAttribute Attribute prototype to match against.
440 * @param aContact Contact whose attributes are checked.
441 * @param aObserver Observer for the asynchronous process.
442 * @return Newly created handle to the operation.
444 virtual MVPbkContactOperationBase* FindFieldsWithAttributeL(
445 const MVPbkContactAttribute& aAttribute,
446 MVPbkStoreContact& aContact,
447 MVPbkMultiAttributePresenceObserver& aObserver) const = 0;
450 * Returns an extension point for this interface or NULL.
451 * @param aExtensionUid Extension identifier.
452 * @return Extension point or NULL
454 virtual TAny* ContactAttributeManagerExtension(
455 TUid /*aExtensionUid*/) { return NULL; }
458 #endif // MVPBKCONTACTATTRIBUTEMANAGER_H