author | William Roberts <williamr@symbian.org> |
Wed, 31 Mar 2010 12:33:34 +0100 | |
branch | Symbian3 |
changeset 4 | 837f303aceeb |
permissions | -rw-r--r-- |
williamr@4 | 1 |
/* |
williamr@4 | 2 |
* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). |
williamr@4 | 3 |
* All rights reserved. |
williamr@4 | 4 |
* This component and the accompanying materials are made available |
williamr@4 | 5 |
* under the terms of "Eclipse Public License v1.0" |
williamr@4 | 6 |
* which accompanies this distribution, and is available |
williamr@4 | 7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
williamr@4 | 8 |
* |
williamr@4 | 9 |
* Initial Contributors: |
williamr@4 | 10 |
* Nokia Corporation - initial contribution. |
williamr@4 | 11 |
* |
williamr@4 | 12 |
* Contributors: |
williamr@4 | 13 |
* |
williamr@4 | 14 |
* Description: An interface for text based contact view filtering. |
williamr@4 | 15 |
* |
williamr@4 | 16 |
*/ |
williamr@4 | 17 |
|
williamr@4 | 18 |
|
williamr@4 | 19 |
#ifndef M_MVPBKCONTACTVIEWFILTERING_H |
williamr@4 | 20 |
#define M_MVPBKCONTACTVIEWFILTERING_H |
williamr@4 | 21 |
|
williamr@4 | 22 |
#include <e32def.h> |
williamr@4 | 23 |
#include <bamdesca.h> |
williamr@4 | 24 |
|
williamr@4 | 25 |
// FORWARDS DECLARATIONS |
williamr@4 | 26 |
class MVPbkContactViewBase; |
williamr@4 | 27 |
class MVPbkContactViewObserver; |
williamr@4 | 28 |
class MVPbkContactBookmarkCollection; |
williamr@4 | 29 |
|
williamr@4 | 30 |
/** |
williamr@4 | 31 |
* An interface for text based contact view filtering. |
williamr@4 | 32 |
* |
williamr@4 | 33 |
* Contact views can support filtering based on search string and |
williamr@4 | 34 |
* always included contacts by implementing this interface. |
williamr@4 | 35 |
* |
williamr@4 | 36 |
* A view stack usage: |
williamr@4 | 37 |
* |
williamr@4 | 38 |
* The client can create a stack structure of filtered views. E.g |
williamr@4 | 39 |
* |
williamr@4 | 40 |
* 1) Client creates a filtered view using find text "J" |
williamr@4 | 41 |
* 2) It then waits that the new view becomes ready. |
williamr@4 | 42 |
* 3) Then it uses the new view to create next level view for "Jo". |
williamr@4 | 43 |
* 4) The client waits that the new view becomes ready. |
williamr@4 | 44 |
* 5) The client again uses the new view for creating third level view "Joe" |
williamr@4 | 45 |
* 6) After the third filtered view becomes ready the client has 4 views: |
williamr@4 | 46 |
* The base view that includes all the contacts and 3 filtered views |
williamr@4 | 47 |
* for texts "J", "Jo" and "Joe". It's up to store implementation |
williamr@4 | 48 |
* to optimize the used resources in case the store supports thousands |
williamr@4 | 49 |
* of contacts. |
williamr@4 | 50 |
* |
williamr@4 | 51 |
* If client uses always included contacts then they must be same for all |
williamr@4 | 52 |
* views in a stack. |
williamr@4 | 53 |
* |
williamr@4 | 54 |
* View events must come in order: bottom view first. |
williamr@4 | 55 |
*/ |
williamr@4 | 56 |
class MVPbkContactViewFiltering |
williamr@4 | 57 |
{ |
williamr@4 | 58 |
public: |
williamr@4 | 59 |
/** |
williamr@4 | 60 |
* Creates a new filtered view asynchronously. |
williamr@4 | 61 |
* |
williamr@4 | 62 |
* The parent view will be filtered according to given criteria and |
williamr@4 | 63 |
* then the client will be notified via MVPbkContactViewObserver. |
williamr@4 | 64 |
* The parent view must be ready before creating a new filtered view, |
williamr@4 | 65 |
* The created view must be destroyed before the parent view and |
williamr@4 | 66 |
* not vice versa. |
williamr@4 | 67 |
* |
williamr@4 | 68 |
* @param aObserver The observer that will be notified when the view |
williamr@4 | 69 |
* is ready. Client shouldn't use the view before |
williamr@4 | 70 |
* it has been notified. |
williamr@4 | 71 |
* @param aFindWords An array of words that must match to the contact. |
williamr@4 | 72 |
* @param aAlwaysIncluded Contacts that must be in the view |
williamr@4 | 73 |
* even they don't match to aFindWords. |
williamr@4 | 74 |
* This an optional parameter. Give |
williamr@4 | 75 |
* NULL if not needed. Client must keep |
williamr@4 | 76 |
* the instance alive while the view exists. |
williamr@4 | 77 |
* @return a filtered view that must also support view filtering. |
williamr@4 | 78 |
*/ |
williamr@4 | 79 |
virtual MVPbkContactViewBase* CreateFilteredViewLC( |
williamr@4 | 80 |
MVPbkContactViewObserver& aObserver, |
williamr@4 | 81 |
const MDesCArray& aFindWords, |
williamr@4 | 82 |
const MVPbkContactBookmarkCollection* aAlwaysIncluded ) = 0; |
williamr@4 | 83 |
|
williamr@4 | 84 |
/** |
williamr@4 | 85 |
* Updates an existing filtered view asynchronously. |
williamr@4 | 86 |
* |
williamr@4 | 87 |
* This must be implemented by the views that were previously |
williamr@4 | 88 |
* created by CreateFilteredViewLC. Otherwise leaves with KErrNotSupported. |
williamr@4 | 89 |
* |
williamr@4 | 90 |
* @param aFindWords an array of words that must match to the contact. |
williamr@4 | 91 |
* @param aAlwaysIncluded Contacts that must be in the view |
williamr@4 | 92 |
* even they don't match to aFindWords. |
williamr@4 | 93 |
* This an optional parameter. Give |
williamr@4 | 94 |
* NULL if not needed. Client must keep |
williamr@4 | 95 |
* the instance alive while the view exists. |
williamr@4 | 96 |
* @exception KErrNotSupported if the view itself is not a filtered view. |
williamr@4 | 97 |
*/ |
williamr@4 | 98 |
virtual void UpdateFilterL( |
williamr@4 | 99 |
const MDesCArray& aFindWords, |
williamr@4 | 100 |
const MVPbkContactBookmarkCollection* aAlwaysIncluded ) = 0; |
williamr@4 | 101 |
|
williamr@4 | 102 |
/** |
williamr@4 | 103 |
* Returns an extension point for this interface or NULL. |
williamr@4 | 104 |
* |
williamr@4 | 105 |
* @param aExtensionUid no extensions defined currently. |
williamr@4 | 106 |
* @return an extension point for this interface or NULL. |
williamr@4 | 107 |
*/ |
williamr@4 | 108 |
virtual TAny* ContactViewFilteringExtension(TUid /*aExtensionUid*/) |
williamr@4 | 109 |
{ return NULL; } |
williamr@4 | 110 |
|
williamr@4 | 111 |
protected: |
williamr@4 | 112 |
|
williamr@4 | 113 |
/** |
williamr@4 | 114 |
* Virtual Phonebook client doesn't own this instance. |
williamr@4 | 115 |
*/ |
williamr@4 | 116 |
~MVPbkContactViewFiltering() {} |
williamr@4 | 117 |
}; |
williamr@4 | 118 |
|
williamr@4 | 119 |
|
williamr@4 | 120 |
#endif // M_MVPBKCONTACTVIEWFILTERING_H |