|
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: Contacts Model store contact view implementation. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef VPBKCNTMODEL_CFINDVIEW_H |
|
20 #define VPBKCNTMODEL_CFINDVIEW_H |
|
21 |
|
22 // INCLUDES |
|
23 #include "CFindViewBase.h" |
|
24 |
|
25 // FORWARD DECLARATIONS |
|
26 class CVPbkContactFindPolicy; |
|
27 |
|
28 namespace VPbkCntModel { |
|
29 |
|
30 |
|
31 /** |
|
32 * Virtual phonebook view that holds the search results from Contact model |
|
33 */ |
|
34 NONSHARABLE_CLASS( CFindView ): public CFindViewBase |
|
35 { |
|
36 public: // Constructor and destructor |
|
37 |
|
38 /** |
|
39 * Creates a new instance of this class. |
|
40 * |
|
41 * @param aFindStrings Search words |
|
42 * @param aBaseView Virtual phonebook's view where the search |
|
43 * is pointed |
|
44 * @param aExternalViewObserver An observer that was given |
|
45 * by the Virtual Phonebook client |
|
46 * @param aAlwaysIncludedContacts A collection of contacts that |
|
47 * must be included even they don't match to find words. |
|
48 * @param aRFs File session |
|
49 * @return A new instance of this class. |
|
50 */ |
|
51 static CFindView* NewLC( |
|
52 const MDesCArray& aFindStrings, |
|
53 CViewBase& aBaseView, |
|
54 MVPbkContactViewObserver& aExternalViewObserver, |
|
55 const MVPbkContactBookmarkCollection* aAlwaysIncludedContacts, |
|
56 RFs& aRFs ); |
|
57 |
|
58 /** |
|
59 * Destructor. |
|
60 */ |
|
61 ~CFindView(); |
|
62 |
|
63 private: // From CFindViewBase |
|
64 void MatchL( RPointerArray<CCntModelViewContact>& aMatchedContacts ); |
|
65 void DoContactAddedToViewL( MVPbkContactViewBase& aView, |
|
66 TInt aIndex, const MVPbkContactLink& aContactLink, |
|
67 RPointerArray<CCntModelViewContact>& aMatchedContacts ); |
|
68 |
|
69 private: // From MVPbkContactViewFiltering |
|
70 /// Subclasses must implement this |
|
71 void UpdateFilterL( |
|
72 const MDesCArray& aFindWords, |
|
73 const MVPbkContactBookmarkCollection* aAlwaysIncludedContacts ); |
|
74 |
|
75 private: // From MAlwaysIncludedContacts |
|
76 TBool IsContactAlwaysIncluded( const CViewContact& aContact ) const; |
|
77 |
|
78 private: // Implementation |
|
79 CFindView( CViewBase& aBaseView ); |
|
80 void ConstructL( const MDesCArray& aFindStrings, |
|
81 const MVPbkContactBookmarkCollection* aAlwaysIncludedContacts, |
|
82 MVPbkContactViewObserver& aExternalViewObserver, RFs& aRFs ); |
|
83 void SetAlwaysIncludedContactsL( |
|
84 const MVPbkContactBookmarkCollection* aAlwaysIncludedContacts ); |
|
85 void MatchContactL( const CViewContact& aViewContact, |
|
86 RPointerArray<CCntModelViewContact>& aMatchedContacts ); |
|
87 TBool IsContactsModelMatchL( const CViewContact& aContact, |
|
88 TInt& aMatchArrayIndex ) const; |
|
89 void RemoveFromMatchArrayIfFound( const CViewContact& aContact ); |
|
90 TInt FindFromMatchArray( const CViewContact& aContact ) const; |
|
91 |
|
92 private: // Data |
|
93 /// Own: the find policy |
|
94 CVPbkContactFindPolicy* iFindPolicy; |
|
95 /// Own: always included contacts |
|
96 RArray<TContactItemId> iAlwaysIncluded; |
|
97 /// Own: Matched contacts from Contacts Model |
|
98 RPointerArray<CCntModelViewContact> iContactsModelMatchContacts; |
|
99 }; |
|
100 |
|
101 } // namespace VPbkCntModel |
|
102 |
|
103 #endif // VPBKCNTMODEL_CFINDVIEW_H |
|
104 |
|
105 // End of File |