|
1 /* |
|
2 * Copyright (c) 2007-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: A stack for the base view and filtered views. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CPBK2FILTEREDVIEWSTACK_H |
|
20 #define CPBK2FILTEREDVIEWSTACK_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32base.h> |
|
24 #include <MVPbkContactViewObserver.h> |
|
25 #include <MVPbkContactViewBase.h> |
|
26 #include <badesca.h> |
|
27 #include "MPbk2FilteredViewStack.h" |
|
28 // FORWARD DECLARATIONS |
|
29 class CVPbkContactFindPolicy; |
|
30 class MVPbkContactBookmarkCollection; |
|
31 class MPbk2FilteredViewStackElement; |
|
32 class CElementStack; |
|
33 |
|
34 // CLASS DECLARATION |
|
35 |
|
36 /** |
|
37 * A stack for the base view and filtered views that can be used |
|
38 * as a contact view. MVPbkContactViewBase reuqests are forwarded |
|
39 * to the top view. |
|
40 * |
|
41 * Responsible for: |
|
42 * -creating filtered views based on given find string. |
|
43 * -managing the created views, keeping them on stacks |
|
44 */ |
|
45 NONSHARABLE_CLASS(CPbk2FilteredViewStack) : public CBase, |
|
46 public MPbk2FilteredViewStack, |
|
47 public MVPbkContactViewObserverExtension, |
|
48 private MVPbkContactViewObserver |
|
49 { |
|
50 public: // Constructors and destructor |
|
51 |
|
52 /** |
|
53 * Creates a new instance of this class. |
|
54 * |
|
55 * @param aBaseView The non-filtered base view. |
|
56 * @param aConfigurationFlags a set of TConfigurationFlags |
|
57 * @return A new instance of this class. |
|
58 */ |
|
59 static CPbk2FilteredViewStack* NewL( |
|
60 MVPbkContactViewBase& aBaseView ); |
|
61 |
|
62 /** |
|
63 * Destructor. |
|
64 */ |
|
65 ~CPbk2FilteredViewStack(); |
|
66 |
|
67 public: // Interface |
|
68 |
|
69 |
|
70 void UpdateFilterL( |
|
71 const MDesCArray& aFindStrings, |
|
72 const MVPbkContactBookmarkCollection* aAlwaysincluded, |
|
73 TBool aAlwaysIncludedChanged ); |
|
74 |
|
75 void Reset(); |
|
76 |
|
77 MVPbkContactViewBase& BaseView() const; |
|
78 |
|
79 |
|
80 void SetNewBaseViewL( |
|
81 MVPbkContactViewBase& aBaseView ); |
|
82 |
|
83 |
|
84 TInt Level() const; |
|
85 |
|
86 void AddStackObserverL( |
|
87 MPbk2FilteredViewStackObserver& aStackObserver ); |
|
88 |
|
89 |
|
90 void RemoveStackObserver( |
|
91 MPbk2FilteredViewStackObserver& aStackObserver ); |
|
92 |
|
93 |
|
94 public: // From MVPbkContactViewBase |
|
95 TVPbkContactViewType Type() const; |
|
96 void ChangeSortOrderL( |
|
97 const MVPbkFieldTypeList& aSortOrder ); |
|
98 const MVPbkFieldTypeList& SortOrder() const; |
|
99 void RefreshL(); |
|
100 TInt ContactCountL() const; |
|
101 const MVPbkViewContact& ContactAtL( |
|
102 TInt aIndex ) const; |
|
103 MVPbkContactLink* CreateLinkLC( |
|
104 TInt aIndex ) const; |
|
105 TInt IndexOfLinkL( |
|
106 const MVPbkContactLink& aContactLink ) const; |
|
107 void AddObserverL( |
|
108 MVPbkContactViewObserver& aObserver ); |
|
109 void RemoveObserver( |
|
110 MVPbkContactViewObserver& aObserver ); |
|
111 TBool MatchContactStore( |
|
112 const TDesC& aContactStoreUri ) const; |
|
113 TBool MatchContactStoreDomain( |
|
114 const TDesC& aContactStoreDomain ) const; |
|
115 MVPbkContactBookmark* CreateBookmarkLC( |
|
116 TInt aIndex ) const; |
|
117 TInt IndexOfBookmarkL( |
|
118 const MVPbkContactBookmark& aContactBookmark ) const; |
|
119 MVPbkContactViewFiltering* ViewFiltering(); |
|
120 |
|
121 private: // From MVPbkContactViewObserver |
|
122 void ContactViewReady( |
|
123 MVPbkContactViewBase& aView ); |
|
124 void ContactViewUnavailable( |
|
125 MVPbkContactViewBase& aView ); |
|
126 void ContactAddedToView( |
|
127 MVPbkContactViewBase& aView, |
|
128 TInt aIndex, |
|
129 const MVPbkContactLink& aContactLink ); |
|
130 void ContactRemovedFromView( |
|
131 MVPbkContactViewBase& aView, |
|
132 TInt aIndex, |
|
133 const MVPbkContactLink& aContactLink ); |
|
134 void ContactViewError( |
|
135 MVPbkContactViewBase& aView, |
|
136 TInt aError, |
|
137 TBool aErrorNotified ); |
|
138 TAny* ContactViewObserverExtension(TUid aExtensionUid ); |
|
139 |
|
140 private: // From MVPbkContactViewObserverExtension |
|
141 void FilteredContactRemovedFromView( |
|
142 MVPbkContactViewBase& aView ); |
|
143 |
|
144 private: // Implementation |
|
145 CPbk2FilteredViewStack(); |
|
146 void ConstructL( |
|
147 MVPbkContactViewBase& aBaseView ); |
|
148 MPbk2FilteredViewStackElement& TopElement() const; |
|
149 MVPbkContactViewBase& TopView() const; |
|
150 void DoHandleContactViewReadyL( |
|
151 MVPbkContactViewBase& aView ); |
|
152 void UpdateStackL(); |
|
153 class CCallback; |
|
154 void DoAddObserverL( |
|
155 MVPbkContactViewObserver& aObserver, |
|
156 CCallback& aCallback ); |
|
157 void DoAddObserverError( |
|
158 TInt aError, |
|
159 CCallback& aCallback ); |
|
160 void SendTopViewChangedEvent( |
|
161 MVPbkContactViewBase& aOldTopView ); |
|
162 void SendTopViewUpdatedEvent(); |
|
163 void SendBaseViewChangedEvent(); |
|
164 void DeleteCallback( |
|
165 CCallback& aCallback ); |
|
166 TInt CountLengthOfStrings( |
|
167 const MDesCArray& aStringArray ) const; |
|
168 MDesCArray* CopySearchWordsByLevelL( |
|
169 const MDesCArray& aStringArray, |
|
170 TInt aLevel ); |
|
171 TBool IsElementsUnderDestruction(); |
|
172 |
|
173 private: // Data |
|
174 /// Own: the stacked views that are currently used |
|
175 CElementStack* iViewStack; |
|
176 /// Own: Array construction views |
|
177 CElementStack* iConstructionStack; |
|
178 /// Own: An element that contains the base view |
|
179 MPbk2FilteredViewStackElement* iBaseViewElement; |
|
180 /// Ref: View observers |
|
181 RPointerArray<MVPbkContactViewObserver> iViewObservers; |
|
182 /// Ref: Stack observers |
|
183 RPointerArray<MPbk2FilteredViewStackObserver> iStackObservers; |
|
184 /// Own: View observer callbacks |
|
185 RPointerArray<CCallback> iCallbacks; |
|
186 /// Own: Contact find policy |
|
187 CVPbkContactFindPolicy* iFindPolicy; |
|
188 |
|
189 #ifdef _DEBUG |
|
190 void __DbgTestInvariant() const; |
|
191 #endif // _DEBUG |
|
192 }; |
|
193 |
|
194 #endif // CPBK2FILTEREDVIEWSTACK_H |
|
195 |
|
196 // End of File |