63
|
1 |
/*
|
|
2 |
* Copyright (c) 2004-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: Find contact view
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#ifndef CVPBKFINDVIEW_H
|
|
20 |
#define CVPBKFINDVIEW_H
|
|
21 |
|
|
22 |
#include <e32base.h>
|
|
23 |
#include <MVPbkContactViewBase.h>
|
|
24 |
#include <MVPbkContactViewObserver.h>
|
|
25 |
#include <MVPbkContactViewFiltering.h>
|
|
26 |
#include <badesca.h>
|
|
27 |
|
|
28 |
namespace VPbkEngUtils { class CVPbkAsyncOperation; }
|
|
29 |
|
|
30 |
class CVPbkContactFindPolicy;
|
|
31 |
|
|
32 |
/**
|
|
33 |
* Virtual Phonebook Find view
|
|
34 |
*
|
|
35 |
* This class can be used for find from an existing view. A client
|
|
36 |
* gives the view for find.
|
|
37 |
*/
|
|
38 |
NONSHARABLE_CLASS( CVPbkFindView ): public CBase,
|
|
39 |
public MVPbkContactViewBase,
|
|
40 |
public MVPbkContactViewObserver,
|
|
41 |
public MVPbkContactViewFiltering
|
|
42 |
{
|
|
43 |
public:
|
|
44 |
/**
|
|
45 |
* Two-phase constructor.
|
|
46 |
*
|
|
47 |
* @param aBaseView The view to filter.
|
|
48 |
* @param aObserver an observer that is notified when this
|
|
49 |
* view is ready for use.
|
|
50 |
* @param aFindWords an array words that must match to the contact.
|
|
51 |
* @param aAlwaysIncludedContacts contacts that must be in the view
|
|
52 |
* even they don't match to aFindWords.
|
|
53 |
* This an optional parameter. Give
|
|
54 |
* NULL if not needed.
|
|
55 |
* @param aMasterFieldTypeList Field type list
|
|
56 |
* @return a new instance of this class
|
|
57 |
*/
|
|
58 |
static CVPbkFindView* NewLC(
|
|
59 |
MVPbkContactViewBase& aBaseView,
|
|
60 |
MVPbkContactViewObserver& aObserver,
|
|
61 |
const MDesCArray& aFindWords,
|
|
62 |
const MVPbkContactBookmarkCollection* aAlwaysIncludedContacts,
|
|
63 |
const MVPbkFieldTypeList& aMasterFieldTypeList );
|
|
64 |
~CVPbkFindView();
|
|
65 |
|
|
66 |
protected: // From MVPbkContactViewBase
|
|
67 |
TVPbkContactViewType Type() const;
|
|
68 |
void ChangeSortOrderL(const MVPbkFieldTypeList& aSortOrder);
|
|
69 |
const MVPbkFieldTypeList& SortOrder() const;
|
|
70 |
void RefreshL();
|
|
71 |
TInt ContactCountL() const;
|
|
72 |
const MVPbkViewContact& ContactAtL(TInt aIndex) const;
|
|
73 |
MVPbkContactLink* CreateLinkLC(TInt aIndex) const;
|
|
74 |
TInt IndexOfLinkL(const MVPbkContactLink& aContactLink) const;
|
|
75 |
void AddObserverL(MVPbkContactViewObserver& aObserver);
|
|
76 |
void RemoveObserver(MVPbkContactViewObserver& aObserver);
|
|
77 |
TBool MatchContactStore(const TDesC& aContactStoreUri) const;
|
|
78 |
TBool MatchContactStoreDomain(const TDesC& aContactStoreDomain) const;
|
|
79 |
MVPbkContactBookmark* CreateBookmarkLC(TInt aIndex) const;
|
|
80 |
TInt IndexOfBookmarkL(
|
|
81 |
const MVPbkContactBookmark& aContactBookmark) const;
|
|
82 |
MVPbkContactViewFiltering* ViewFiltering();
|
|
83 |
|
|
84 |
private: // From MVPbkContactViewFiltering
|
|
85 |
MVPbkContactViewBase* CreateFilteredViewLC(
|
|
86 |
MVPbkContactViewObserver& aObserver,
|
|
87 |
const MDesCArray& aFindWords,
|
|
88 |
const MVPbkContactBookmarkCollection* aAlwaysIncludedContacts );
|
|
89 |
|
|
90 |
void UpdateFilterL(
|
|
91 |
const MDesCArray& aFindWords,
|
|
92 |
const MVPbkContactBookmarkCollection* aAlwaysIncludedContacts );
|
|
93 |
|
|
94 |
private: // From MVPbkContactViewObserver
|
|
95 |
void ContactViewReady(MVPbkContactViewBase& aView);
|
|
96 |
void ContactViewUnavailable(MVPbkContactViewBase& aView);
|
|
97 |
void ContactAddedToView(
|
|
98 |
MVPbkContactViewBase& aView,
|
|
99 |
TInt aIndex,
|
|
100 |
const MVPbkContactLink& aContactLink );
|
|
101 |
void ContactRemovedFromView(
|
|
102 |
MVPbkContactViewBase& aView,
|
|
103 |
TInt aIndex,
|
|
104 |
const MVPbkContactLink& aContactLink );
|
|
105 |
void ContactViewError(
|
|
106 |
MVPbkContactViewBase& aView,
|
|
107 |
TInt aError,
|
|
108 |
TBool aErrorNotified );
|
|
109 |
|
|
110 |
private: // Implementation
|
|
111 |
CVPbkFindView(
|
|
112 |
MVPbkContactViewBase& aBaseView,
|
|
113 |
const MVPbkFieldTypeList* aMasterFieldTypeList );
|
|
114 |
void ConstructL(
|
|
115 |
const MDesCArray& aFindWords,
|
|
116 |
const MVPbkContactBookmarkCollection* aAlwaysIncludedContacts );
|
|
117 |
void BuildViewMappingL();
|
|
118 |
void HandleBuildViewMapping();
|
|
119 |
void DoAddObserverL(MVPbkContactViewObserver& aObserver);
|
|
120 |
void AddObserverError(MVPbkContactViewObserver& aObserver, TInt aError);
|
|
121 |
|
|
122 |
void SetFindStringsL( const MDesCArray& aFindWords );
|
|
123 |
void SetAlwaysIncludedContactsL(
|
|
124 |
const MVPbkContactBookmarkCollection* aAlwaysIncludedContacts );
|
|
125 |
void SendViewEventToObservers(
|
|
126 |
void( MVPbkContactViewObserver::* aObserverFunc)
|
|
127 |
( MVPbkContactViewBase& ) );
|
|
128 |
void SendViewErrorEventToObservers( TInt aError, TBool
|
|
129 |
aErrorNotified );
|
|
130 |
|
|
131 |
private: // Data
|
|
132 |
///Own: indicated whether view is ready
|
|
133 |
TBool iIsReady;
|
|
134 |
///Ref: contact base view
|
|
135 |
MVPbkContactViewBase& iBaseView;
|
|
136 |
///Ref: Master field type list
|
|
137 |
const MVPbkFieldTypeList* iMasterFieldTypeList;
|
|
138 |
///Own: Asynchronous operation
|
|
139 |
VPbkEngUtils::CVPbkAsyncOperation* iAsyncOperation;
|
|
140 |
///Own: mapping between base view and filtered view
|
|
141 |
RArray<TInt> iContactMapping;
|
|
142 |
///Ref: array to view observers
|
|
143 |
RPointerArray<MVPbkContactViewObserver> iObservers;
|
|
144 |
/// Own: find words for filtering
|
|
145 |
CDesCArrayFlat* iFindStrings;
|
|
146 |
/// Own: a policy for match
|
|
147 |
CVPbkContactFindPolicy* iContactFindPolicy;
|
|
148 |
/// Own: always included contacts
|
|
149 |
const MVPbkContactBookmarkCollection* iAlwaysIncludedContacts;
|
|
150 |
};
|
|
151 |
|
|
152 |
#endif // CVPBKFINDVIEW_H
|
|
153 |
|
|
154 |
//End of file
|
|
155 |
|
|
156 |
|