|
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 filtered contact view implementation. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDES |
|
20 #include "CFilteredContactView.h" |
|
21 |
|
22 // VPbkCntModel |
|
23 #include "CContactStore.h" |
|
24 #include "CFieldFactory.h" |
|
25 #include "CCustomFilteredContactView.h" |
|
26 #include <VPbkCntModelRes.rsg> |
|
27 #include "VPbkCntModelRemoteViewPreferences.h" |
|
28 #include "NamedRemoteViewViewDefinitionStoreUtility.h" |
|
29 |
|
30 |
|
31 // VPbkEng |
|
32 #include <CVPbkFieldTypeSelector.h> |
|
33 #include <VPbkDataCaging.hrh> |
|
34 #include <CVPbkFieldType.h> |
|
35 #include <CVPbkFieldTypeList.h> |
|
36 #include <CVPbkContactViewDefinition.h> |
|
37 #include <TVPbkFieldVersitProperty.h> |
|
38 #include <VPbkSendEventUtility.h> |
|
39 #include <VPbkPrivateUid.h> // KFindPluingUID |
|
40 #include <CVPbkSortOrder.h> |
|
41 |
|
42 // VPbkEngUtils |
|
43 #include <RLocalizedResourceFile.h> |
|
44 |
|
45 // System includes |
|
46 #include <cntview.h> |
|
47 #include <barsread.h> |
|
48 |
|
49 // Debugging headers |
|
50 #include <VPbkDebug.h> |
|
51 |
|
52 namespace VPbkCntModel { |
|
53 |
|
54 // CONSTANTS |
|
55 |
|
56 _LIT( KResourceFile, "VPbkCntModelRes.rsc" ); |
|
57 |
|
58 /// Field type filter mapping structure |
|
59 struct TVPbkFieldTypeFilterMapping |
|
60 { |
|
61 /// Virtual Phonebook field type resource id |
|
62 TUint iFieldTypeResourceId; |
|
63 /// Contacst Model native filter matching the field type |
|
64 TUint iNativeFilter; |
|
65 }; |
|
66 |
|
67 /// Last element marker |
|
68 const TUint KLastElement = 0; |
|
69 |
|
70 /// Array of field type filter mappings |
|
71 static const TVPbkFieldTypeFilterMapping FilterMapping[] = |
|
72 { |
|
73 { R_CNTMODEL_NATIVE_FILTER_EMAIL_ADDRESS, |
|
74 CContactDatabase::EMailable }, |
|
75 |
|
76 { R_CNTMODEL_NATIVE_FILTER_PHONE_NUMBER, |
|
77 CContactDatabase::EPhonable }, |
|
78 |
|
79 { R_CNTMODEL_NATIVE_FILTER_SMS_ADDRESS, |
|
80 CContactDatabase::ESmsable }, |
|
81 |
|
82 { R_CNTMODEL_NATIVE_FILTER_FAX_NUMBER, |
|
83 CContactDatabase::EFaxable }, |
|
84 |
|
85 { R_CNTMODEL_NATIVE_FILTER_RINGING_TONE, |
|
86 CContactDatabase::ERingTone }, |
|
87 |
|
88 { R_CNTMODEL_NATIVE_FILTER_ASSISTANT_PHONE_NUMBER, |
|
89 CContactDatabase::EPhonable }, |
|
90 |
|
91 { R_CNTMODEL_NATIVE_FILTER_TOP_CONTACT, |
|
92 CContactDatabase::ECustomFilter2 }, |
|
93 |
|
94 /// This has to be the last |
|
95 { KLastElement, |
|
96 CContactDatabase::EUnfiltered } |
|
97 }; |
|
98 |
|
99 |
|
100 /** |
|
101 * Appends native filter aFilter based on the given field type resource id. |
|
102 * |
|
103 * @param aFieldTypeResourceId Field type resource id. |
|
104 * @param aFilter Native Contacts Model filter. |
|
105 */ |
|
106 inline void BuildNativeFilter( const TInt aFieldTypeResourceId, |
|
107 TUint& aFilter ) |
|
108 { |
|
109 for ( TInt i=0; |
|
110 FilterMapping[i].iFieldTypeResourceId != KLastElement; ++i ) |
|
111 { |
|
112 if ( aFieldTypeResourceId == FilterMapping[i].iFieldTypeResourceId ) |
|
113 { |
|
114 aFilter |= FilterMapping[i].iNativeFilter; |
|
115 break; |
|
116 } |
|
117 } |
|
118 } |
|
119 |
|
120 /** |
|
121 * Checks wheter custom filtering is needed. This is the case |
|
122 * when the native filters cannot provide all the necessary filtering. |
|
123 * |
|
124 * @param aFieldType The field type which matched selectors field type |
|
125 * collection. |
|
126 * @param aFilterType The filter type which matched aFieldType, or NULL. |
|
127 * @param aSelector The field type selector, the filtering criteria. |
|
128 * @return ETrue if custom filtering is needed. |
|
129 */ |
|
130 TBool RequiresCustomFiltering( |
|
131 const MVPbkFieldType& aFieldType, |
|
132 const MVPbkFieldType* aFilterType, |
|
133 const CVPbkFieldTypeSelector& aSelector ) |
|
134 { |
|
135 TBool ret = ETrue; |
|
136 |
|
137 if ( aFilterType ) |
|
138 { |
|
139 const TVPbkFieldVersitProperty* matchingProperty = |
|
140 aSelector.MatchingVersitProperty( aFieldType ); |
|
141 if ( matchingProperty ) |
|
142 { |
|
143 const TInt maxMatchPriority = |
|
144 aFilterType->VersitProperties().Count() - 1; |
|
145 for ( TInt matchPriority = 0; |
|
146 matchPriority <= maxMatchPriority; ++matchPriority ) |
|
147 { |
|
148 if ( matchingProperty->Matches( |
|
149 aFilterType->VersitProperties()[matchPriority]) ) |
|
150 { |
|
151 ret = EFalse; |
|
152 break; |
|
153 } |
|
154 } |
|
155 } |
|
156 else |
|
157 { |
|
158 TVPbkNonVersitFieldType matchingType = |
|
159 aSelector.MatchingNonVersitType( aFieldType ); |
|
160 if ( aFieldType.NonVersitType() == matchingType ) |
|
161 { |
|
162 ret = EFalse; |
|
163 } |
|
164 } |
|
165 } |
|
166 |
|
167 return ret; |
|
168 } |
|
169 |
|
170 /** |
|
171 * Checks does the given field type match any of the native filter types. |
|
172 * |
|
173 * @param aFieldType The field type to inspect. |
|
174 * @param aSupportedFilterTypes Field types which are supported |
|
175 * by the native filters. |
|
176 * @return Native filter field type which matched aFieldType, |
|
177 * or NULL if no matches. |
|
178 */ |
|
179 inline const MVPbkFieldType* MatchesNativeFilter |
|
180 ( const MVPbkFieldType& aFieldType, |
|
181 const CVPbkFieldTypeList& aSupportedFilterTypes ) |
|
182 |
|
183 { |
|
184 const MVPbkFieldType* matchingType = NULL; |
|
185 |
|
186 const TInt maxMatchPriority = |
|
187 aFieldType.VersitProperties().Count() - 1; |
|
188 |
|
189 for ( TInt matchPriority = 0; |
|
190 matchPriority <= maxMatchPriority && !matchingType; ++matchPriority ) |
|
191 { |
|
192 matchingType = aSupportedFilterTypes.FindMatch( |
|
193 aFieldType.VersitProperties()[matchPriority], |
|
194 matchPriority ); |
|
195 } |
|
196 |
|
197 if ( !matchingType && aFieldType.NonVersitType() != EVPbkNonVersitTypeNone ) |
|
198 { |
|
199 matchingType = aSupportedFilterTypes.FindMatch |
|
200 ( aFieldType.NonVersitType() ); |
|
201 } |
|
202 |
|
203 return matchingType; |
|
204 } |
|
205 |
|
206 /** |
|
207 * Converts VPbk field type filter to a native filter. |
|
208 * |
|
209 * @param aSource Field type filter to convert. |
|
210 * @param aFieldTypeList List of supported field types |
|
211 * of the store. |
|
212 * @param aFs File server session. |
|
213 * @param aCustomFilteringNeeded Indicates whether the native filters |
|
214 * are enough, or do we have to do custom |
|
215 * filtering. |
|
216 * @return Native Contacts model contact view filter. |
|
217 */ |
|
218 TUint ConvertFieldTypeFilterL |
|
219 ( const CVPbkFieldTypeSelector& aSource, |
|
220 const MVPbkFieldTypeList& aFieldTypeList, |
|
221 RFs& aFs, TBool& aCustomFilteringNeeded ) |
|
222 { |
|
223 TUint ret = CContactDatabase::EUnfiltered; |
|
224 |
|
225 // Build own field type list containing field types supported |
|
226 // by native filters |
|
227 VPbkEngUtils::RLocalizedResourceFile resFile; |
|
228 resFile.OpenLC( aFs, |
|
229 KVPbkRomFileDrive, KDC_RESOURCE_FILES_DIR, KResourceFile ); |
|
230 |
|
231 TResourceReader reader; |
|
232 reader.SetBuffer( resFile.AllocReadLC |
|
233 ( R_CNTMODEL_NATIVE_FILTER_FIELD_TYPES ) ); |
|
234 |
|
235 CVPbkFieldTypeList* supportedFilterTypes = |
|
236 CVPbkFieldTypeList::NewL( resFile, reader ); |
|
237 CleanupStack::PushL( supportedFilterTypes ); |
|
238 |
|
239 // Go through the store's field type list |
|
240 TInt typeCount = aFieldTypeList.FieldTypeCount(); |
|
241 for ( TInt i=0; i < typeCount; ++i ) |
|
242 { |
|
243 const MVPbkFieldType& fieldType = |
|
244 aFieldTypeList.FieldTypeAt( i ); |
|
245 |
|
246 if ( aSource.IsFieldTypeIncluded( fieldType ) ) |
|
247 { |
|
248 // We have a match. Now lets inspect does it match |
|
249 // any of the native filter field types |
|
250 const MVPbkFieldType* matchingType = |
|
251 MatchesNativeFilter( fieldType, *supportedFilterTypes ); |
|
252 |
|
253 if ( matchingType ) |
|
254 { |
|
255 // We found a match to a native filter, lets build |
|
256 // the native filter |
|
257 BuildNativeFilter( matchingType->FieldTypeResId(), ret ); |
|
258 } |
|
259 |
|
260 // Then, find out do we need to custom filtering |
|
261 TBool customFilteringRequired = RequiresCustomFiltering |
|
262 ( fieldType, matchingType, aSource ); |
|
263 aCustomFilteringNeeded = customFilteringRequired; |
|
264 |
|
265 if ( !matchingType && customFilteringRequired ) |
|
266 { |
|
267 // Custom filtering is required and there is no appropriate |
|
268 // native filter which could be used as a base filter. |
|
269 // In this case the custom filter has to handle all |
|
270 // the filtering. So reset the native filter and break out. |
|
271 ret = CContactDatabase::EUnfiltered; |
|
272 break; |
|
273 } |
|
274 } |
|
275 } |
|
276 |
|
277 CleanupStack::PopAndDestroy( 3 ); // supportedFilterTypes, |
|
278 // reader, resFile |
|
279 |
|
280 return ret; |
|
281 } |
|
282 |
|
283 // -------------------------------------------------------------------------- |
|
284 // CFilteredContactView::CFilteredContactView |
|
285 // -------------------------------------------------------------------------- |
|
286 // |
|
287 inline CFilteredContactView::CFilteredContactView |
|
288 ( CContactStore& aParentStore, |
|
289 RFs& aFs ) : |
|
290 CViewBase( aParentStore ), |
|
291 iFs( aFs ) |
|
292 { |
|
293 } |
|
294 |
|
295 // -------------------------------------------------------------------------- |
|
296 // CFilteredContactView::~CFilteredContactView |
|
297 // -------------------------------------------------------------------------- |
|
298 // |
|
299 CFilteredContactView::~CFilteredContactView() |
|
300 { |
|
301 // Customically filtered view has to be destructed first |
|
302 delete iCustomFilteredView; |
|
303 delete iFilter; |
|
304 |
|
305 // Set iView to NULL, so that CViewBase does not close it |
|
306 iView = NULL; |
|
307 |
|
308 if ( iFilteredView ) |
|
309 { |
|
310 //after iFilteredView->Close( *iNativeObserver ) |
|
311 //both iFilteredView and iBaseView are deleted |
|
312 iFilteredView->Close( *iNativeObserver ); |
|
313 } |
|
314 else if ( iBaseView ) |
|
315 { |
|
316 //but iBaseView's pointer is still not NULL |
|
317 //make sure iBaseView is unable to call its member function |
|
318 iBaseView->Close( *iNativeObserver ); |
|
319 } |
|
320 } |
|
321 |
|
322 // -------------------------------------------------------------------------- |
|
323 // CFilteredContactView::NewLC |
|
324 // -------------------------------------------------------------------------- |
|
325 // |
|
326 CFilteredContactView* CFilteredContactView::NewLC( |
|
327 const CVPbkContactViewDefinition& aViewDefinition, |
|
328 MVPbkContactViewObserver& aObserver, |
|
329 CContactStore& aParentStore, |
|
330 const MVPbkFieldTypeList& aSortOrder, |
|
331 RFs& aFs ) |
|
332 { |
|
333 CFilteredContactView* self = new ( ELeave ) CFilteredContactView |
|
334 ( aParentStore, aFs ); |
|
335 CleanupStack::PushL( self ); |
|
336 self->ConstructL( aViewDefinition, aObserver, aSortOrder ); |
|
337 return self; |
|
338 } |
|
339 |
|
340 // -------------------------------------------------------------------------- |
|
341 // CFilteredContactView::ConstructL |
|
342 // -------------------------------------------------------------------------- |
|
343 // |
|
344 void CFilteredContactView::ConstructL( |
|
345 const CVPbkContactViewDefinition& aViewDefinition, |
|
346 MVPbkContactViewObserver& aObserver, |
|
347 const MVPbkFieldTypeList& aSortOrder ) |
|
348 { |
|
349 CViewBase::ConstructL( aViewDefinition, aObserver, aSortOrder ); |
|
350 } |
|
351 |
|
352 // -------------------------------------------------------------------------- |
|
353 // CFilteredContactView::Type |
|
354 // -------------------------------------------------------------------------- |
|
355 // |
|
356 TVPbkContactViewType CFilteredContactView::Type() const |
|
357 { |
|
358 return EVPbkContactsView; |
|
359 } |
|
360 |
|
361 // -------------------------------------------------------------------------- |
|
362 // CFilteredContactView::DoInitializeViewL |
|
363 // -------------------------------------------------------------------------- |
|
364 // |
|
365 void CFilteredContactView::DoInitializeViewL( |
|
366 const CVPbkContactViewDefinition& aViewDefinition, |
|
367 RContactViewSortOrder& aViewSortOrder ) |
|
368 { |
|
369 // Construct the native filter |
|
370 if ( aViewDefinition.FieldTypeFilter() ) |
|
371 { |
|
372 const CFieldFactory& fieldFactory = Store().FieldFactory(); |
|
373 |
|
374 // Copy construct the filter |
|
375 iFilter = CVPbkFieldTypeSelector::NewL( |
|
376 *aViewDefinition.FieldTypeFilter() ); |
|
377 |
|
378 iNativeFilter = ConvertFieldTypeFilterL |
|
379 ( *iFilter, fieldFactory, iFs, iCustomFilteringNeeded ); |
|
380 } |
|
381 if ( aViewDefinition.ContactSelector() ) |
|
382 { |
|
383 iCustomFilteringNeeded = ETrue; |
|
384 // Custom filtering and MVPbkContactSelector filtering cannot be used at the same time. |
|
385 iNativeFilter = 0; // no filter |
|
386 } |
|
387 if ( iCustomFilteringNeeded ) |
|
388 { |
|
389 // Stop observing the base view, the custom view |
|
390 // will observe it and report back |
|
391 // Construction of the iCustomFilteredView should be done in two |
|
392 // phases. Due to that there is dependencies between views in this |
|
393 // and iCustomFilteredView class. |
|
394 iCustomFilteredView = |
|
395 new (ELeave) CCustomFilteredContactView( Store(), iFilter, |
|
396 *this, aViewDefinition.ContactSelector() ); |
|
397 ConstructBaseViewsL( aViewDefinition, *iCustomFilteredView, |
|
398 aViewSortOrder ); |
|
399 |
|
400 if ( iFilteredView ) |
|
401 { |
|
402 iBaseView->Close( *iCustomFilteredView ); |
|
403 } |
|
404 |
|
405 iCustomFilteredView->ConstructL |
|
406 ( aViewDefinition, *this, *iSortOrder, *iView ); |
|
407 |
|
408 iView = &iCustomFilteredView->ContactViewBase(); |
|
409 } |
|
410 else |
|
411 { |
|
412 ConstructBaseViewsL( aViewDefinition, *this, aViewSortOrder ); |
|
413 |
|
414 // If we built Contact's Model's native filtered view we must |
|
415 // stop observing the base view since otherwise we get double |
|
416 // view events and VPbk composite view does not tolerate double |
|
417 // events |
|
418 if ( iFilteredView ) |
|
419 { |
|
420 iBaseView->Close( *this ); |
|
421 } |
|
422 } |
|
423 } |
|
424 |
|
425 // -------------------------------------------------------------------------- |
|
426 // CFilteredContactView::DoTeardownView |
|
427 // -------------------------------------------------------------------------- |
|
428 // |
|
429 void CFilteredContactView::DoTeardownView() |
|
430 { |
|
431 } |
|
432 |
|
433 // -------------------------------------------------------------------------- |
|
434 // CFilteredContactView::DoChangeSortOrderL |
|
435 // -------------------------------------------------------------------------- |
|
436 // |
|
437 TBool CFilteredContactView::DoChangeSortOrderL( |
|
438 const CVPbkContactViewDefinition& aViewDefinition, |
|
439 RContactViewSortOrder& aSortOrder ) |
|
440 { |
|
441 TBool canBeChanged = ETrue; |
|
442 if ( iRemoteView ) |
|
443 { |
|
444 if ( RemoteViewName( aViewDefinition ).Compare( |
|
445 KVPbkAllContactsViewName ) == 0 ) |
|
446 { |
|
447 // Set Contacts Model default view setting only if client |
|
448 // is using KVPbkAllContactsViewName shared view. |
|
449 NamedRemoteViewViewDefinitionStoreUtility:: |
|
450 SetNamedRemoteViewViewDefinitionL( |
|
451 KVPbkAllContactsViewName, aSortOrder, |
|
452 KVPbkDefaultContactViewPrefs); |
|
453 } |
|
454 iRemoteView->ChangeSortOrderL( aSortOrder ); |
|
455 } |
|
456 else |
|
457 { |
|
458 // CContactLocalView doesn't support ChangeSortOrderL |
|
459 canBeChanged = EFalse; |
|
460 } |
|
461 |
|
462 return canBeChanged; |
|
463 } |
|
464 |
|
465 // -------------------------------------------------------------------------- |
|
466 // CFilteredContactView::ContactViewReady |
|
467 // -------------------------------------------------------------------------- |
|
468 // |
|
469 void CFilteredContactView::ContactViewReady( |
|
470 MVPbkContactViewBase& aView ) |
|
471 { |
|
472 VPBK_DEBUG_PRINT(VPBK_DEBUG_STRING |
|
473 ("CFilteredContactView::ContactViewReady(0x%x)"), &aView); |
|
474 |
|
475 /* when custom filtering view is used, MVPbkContactViewObserver doesn't support |
|
476 * sortOrder changed notification, CViewBase will send viewReady instead, |
|
477 * use it to keep sort order up to date */ |
|
478 if ( iCustomFilteringNeeded ) |
|
479 { |
|
480 DoUpdateTypeListL(); |
|
481 } |
|
482 |
|
483 VPbkEng::SendViewEventToObservers( *this, iFilteringObservers, |
|
484 &MFilteredViewSupportObserver::ContactViewReadyForFiltering, |
|
485 &MVPbkContactViewObserver::ContactViewError ); |
|
486 VPbkEng::SendViewEventToObservers( *this, iObservers, |
|
487 &MVPbkContactViewObserver::ContactViewReady, |
|
488 &MVPbkContactViewObserver::ContactViewError ); |
|
489 VPbkEng::SendViewEventToObservers( *this, iFilteringObservers, |
|
490 &MVPbkContactViewObserver::ContactViewReady, |
|
491 &MVPbkContactViewObserver::ContactViewError ); |
|
492 } |
|
493 |
|
494 // -------------------------------------------------------------------------- |
|
495 // CFilteredContactView::ContactViewUnavailable |
|
496 // -------------------------------------------------------------------------- |
|
497 // |
|
498 void CFilteredContactView::ContactViewUnavailable( |
|
499 MVPbkContactViewBase& aView ) |
|
500 { |
|
501 VPBK_DEBUG_PRINT(VPBK_DEBUG_STRING |
|
502 ("CFilteredContactView::ContactViewUnavailable(0x%x)"), &aView); |
|
503 |
|
504 VPbkEng::SendViewEventToObservers( *this, iFilteringObservers, |
|
505 &MFilteredViewSupportObserver::ContactViewUnavailableForFiltering, |
|
506 &MVPbkContactViewObserver::ContactViewError ); |
|
507 VPbkEng::SendViewEventToObservers( *this, iObservers, |
|
508 &MVPbkContactViewObserver::ContactViewUnavailable, |
|
509 &MVPbkContactViewObserver::ContactViewError ); |
|
510 VPbkEng::SendViewEventToObservers( *this, iFilteringObservers, |
|
511 &MVPbkContactViewObserver::ContactViewUnavailable, |
|
512 &MVPbkContactViewObserver::ContactViewError ); |
|
513 } |
|
514 |
|
515 // -------------------------------------------------------------------------- |
|
516 // CFilteredContactView::ContactAddedToView |
|
517 // -------------------------------------------------------------------------- |
|
518 // |
|
519 void CFilteredContactView::ContactAddedToView( |
|
520 MVPbkContactViewBase& aView, |
|
521 TInt aIndex, const MVPbkContactLink& aContactLink ) |
|
522 { |
|
523 VPBK_DEBUG_PRINT(VPBK_DEBUG_STRING |
|
524 ("CFilteredContactView::ContactAddedToView(0x%x)"), &aView); |
|
525 |
|
526 VPbkEng::SendViewEventToObservers( *this, aIndex, aContactLink, |
|
527 iObservers, |
|
528 &MVPbkContactViewObserver::ContactAddedToView, |
|
529 &MVPbkContactViewObserver::ContactViewError ); |
|
530 VPbkEng::SendViewEventToObservers( *this, aIndex, aContactLink, |
|
531 iFilteringObservers, |
|
532 &MVPbkContactViewObserver::ContactAddedToView, |
|
533 &MVPbkContactViewObserver::ContactViewError ); |
|
534 } |
|
535 |
|
536 // -------------------------------------------------------------------------- |
|
537 // CFilteredContactView::ContactRemovedFromView |
|
538 // -------------------------------------------------------------------------- |
|
539 // |
|
540 void CFilteredContactView::ContactRemovedFromView( |
|
541 MVPbkContactViewBase& aView, |
|
542 TInt aIndex, const MVPbkContactLink& aContactLink ) |
|
543 { |
|
544 VPBK_DEBUG_PRINT(VPBK_DEBUG_STRING |
|
545 ("CFilteredContactView::ContactRemovedFromView(0x%x)"), &aView); |
|
546 |
|
547 VPbkEng::SendViewEventToObservers( *this, aIndex, aContactLink, |
|
548 iObservers, |
|
549 &MVPbkContactViewObserver::ContactRemovedFromView, |
|
550 &MVPbkContactViewObserver::ContactViewError ); |
|
551 VPbkEng::SendViewEventToObservers( *this, aIndex, aContactLink, |
|
552 iFilteringObservers, |
|
553 &MVPbkContactViewObserver::ContactRemovedFromView, |
|
554 &MVPbkContactViewObserver::ContactViewError ); |
|
555 } |
|
556 |
|
557 // -------------------------------------------------------------------------- |
|
558 // CFilteredContactView::ContactViewError |
|
559 // -------------------------------------------------------------------------- |
|
560 // |
|
561 void CFilteredContactView::ContactViewError( |
|
562 MVPbkContactViewBase& aView, |
|
563 TInt aError, TBool aErrorNotified ) |
|
564 { |
|
565 VPBK_DEBUG_PRINT(VPBK_DEBUG_STRING |
|
566 ("CFilteredContactView::ContactViewError(0x%x)"), &aView); |
|
567 |
|
568 VPbkEng::SendEventToObservers( *this, aError, aErrorNotified, iObservers, |
|
569 &MVPbkContactViewObserver::ContactViewError ); |
|
570 VPbkEng::SendEventToObservers( *this, aError, aErrorNotified, |
|
571 iFilteringObservers, &MVPbkContactViewObserver::ContactViewError ); |
|
572 } |
|
573 |
|
574 // -------------------------------------------------------------------------- |
|
575 // CFilteredContactView::ConstructBaseViewsL |
|
576 // -------------------------------------------------------------------------- |
|
577 // |
|
578 void CFilteredContactView::ConstructBaseViewsL |
|
579 ( const CVPbkContactViewDefinition& aViewDefinition, |
|
580 MContactViewObserver& aObserver, |
|
581 RContactViewSortOrder& aViewSortOrder ) |
|
582 { |
|
583 iNativeObserver = &aObserver; |
|
584 |
|
585 // Construct the all contacts view first |
|
586 if ( RemoteViewDefinition( aViewDefinition ) ) |
|
587 { |
|
588 iRemoteView = CContactNamedRemoteView::NewL( |
|
589 *iNativeObserver, RemoteViewName( aViewDefinition ), |
|
590 Store().NativeDatabase(), aViewSortOrder, |
|
591 KVPbkDefaultContactViewPrefs ); |
|
592 |
|
593 iBaseView = iRemoteView; |
|
594 } |
|
595 else |
|
596 { |
|
597 iBaseView = CContactLocalView::NewL( *iNativeObserver, |
|
598 Store().NativeDatabase(), aViewSortOrder, |
|
599 KVPbkDefaultContactViewPrefs ); |
|
600 } |
|
601 |
|
602 // Set base class view pointer |
|
603 iView = iBaseView; |
|
604 |
|
605 // If there is a native filter, construct a native filtered view |
|
606 if ( iNativeFilter > 0 ) |
|
607 { |
|
608 iFilteredView = CContactFilteredView::NewL |
|
609 ( *iNativeObserver, Store().NativeDatabase(), |
|
610 *iBaseView, iNativeFilter ); |
|
611 // Set find plugin also for BaseView, otherwise searching doesn't |
|
612 // work properly with other languages in other clients. |
|
613 iView->SetViewFindConfigPlugin( TUid::Uid( KFindPluginUID ) ); |
|
614 iView = iFilteredView; |
|
615 } |
|
616 } |
|
617 |
|
618 } // namespace VPbkCntModel |
|
619 |
|
620 // End of File |