1 // Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). |
2 // All rights reserved. |
2 // All rights reserved. |
3 // This component and the accompanying materials are made available |
3 // This component and the accompanying materials are made available |
4 // under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members |
4 // under the terms of "Eclipse Public License v1.0" |
5 // which accompanies this distribution, and is available |
5 // which accompanies this distribution, and is available |
6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 // |
7 // |
8 // Initial Contributors: |
8 // Initial Contributors: |
9 // Nokia Corporation - initial contribution. |
9 // Nokia Corporation - initial contribution. |
10 // |
10 // |
11 // Contributors: |
11 // Contributors: |
303 inline void SetId(TContactItemId aId); |
303 inline void SetId(TContactItemId aId); |
304 inline void SetContactType(CViewContact::TViewContactType aContactType); |
304 inline void SetContactType(CViewContact::TViewContactType aContactType); |
305 static TBool HintFieldMatchesFilter(TInt aHintField, TInt aFilter); |
305 static TBool HintFieldMatchesFilter(TInt aHintField, TInt aFilter); |
306 TPtrC FindFirstPopulatedField(TInt aOffset, TInt& aFoundPosition) const; |
306 TPtrC FindFirstPopulatedField(TInt aOffset, TInt& aFoundPosition) const; |
307 |
307 |
308 #ifdef __SYMBIAN_CNTMODEL_USE_SQLITE__ |
|
309 IMPORT_C void ChangeToLightweightObject(); |
308 IMPORT_C void ChangeToLightweightObject(); |
310 TBool IsLightweightObject() const; |
309 TBool IsLightweightObject() const; |
311 void CopyL(const CViewContact& aContact); |
310 void CopyL(const CViewContact& aContact); |
312 #endif //__SYMBIAN_CNTMODEL_USE_SQLITE__ |
|
313 |
311 |
314 private: |
312 private: |
315 void ConstructL(TInt aLength = 0); |
313 void ConstructL(TInt aLength = 0); |
316 void ConstructL(const CViewContact& aContact); |
314 void ConstructL(const CViewContact& aContact); |
317 friend class CContactViewBase; |
315 friend class CContactViewBase; |
414 /** Filter for the contacts. */ |
412 /** Filter for the contacts. */ |
415 TInt iFilter; |
413 TInt iFilter; |
416 /** List of contacts matching the criteria. */ |
414 /** List of contacts matching the criteria. */ |
417 RArray<TContactIdWithMapping>& iMatchingContacts; |
415 RArray<TContactIdWithMapping>& iMatchingContacts; |
418 }; |
416 }; |
419 class TVirtualFunction3Params |
417 |
420 /** Holds the two parameters passed to the method InsertContactInView() from the |
|
421 reserved function CContactViewBase_Reserved_1(). It has an inline |
|
422 constructor to initialise the data members. |
|
423 |
|
424 @internalAll */ |
|
425 { |
|
426 public: |
|
427 inline TVirtualFunction3Params(RPointerArray<CViewContact>& aContacts, const CViewContact* aNewContact) :iContacts(aContacts), iNewContact(aNewContact){}; |
|
428 RPointerArray<CViewContact>& iContacts; |
|
429 const CViewContact* iNewContact; |
|
430 }; |
|
431 /** Search type. |
418 /** Search type. |
432 |
419 |
433 This controls whether a search term can occur anywhere in a contact item field, |
420 This controls whether a search term can occur anywhere in a contact item field, |
434 or just at the beginning of the field. */ |
421 or just at the beginning of the field. */ |
435 enum TSearchType |
422 enum TSearchType |
467 /** The view is ready to be used. */ |
454 /** The view is ready to be used. */ |
468 EReady, |
455 EReady, |
469 /** The view is not ready to be used, for instance immediately after the sort order |
456 /** The view is not ready to be used, for instance immediately after the sort order |
470 has changed, or after an error has occurred. */ |
457 has changed, or after an error has occurred. */ |
471 ENotReady |
458 ENotReady |
|
459 }; |
|
460 class TVirtualFunction3Params |
|
461 /** Holds the two parameters passed to the method InsertContactInView() from the |
|
462 reserved function CContactViewBase_Reserved_1(). It has an inline |
|
463 constructor to initialise the data members. |
|
464 */ |
|
465 { |
|
466 public: |
|
467 inline TVirtualFunction3Params(RPointerArray<CViewContact>& aContacts, const CViewContact* aNewContact) :iContacts(aContacts), iNewContact(aNewContact){}; |
|
468 RPointerArray<CViewContact>& iContacts; |
|
469 const CViewContact* iNewContact; |
472 }; |
470 }; |
473 public: |
471 public: |
474 IMPORT_C void OpenL(MContactViewObserver& aObserver); |
472 IMPORT_C void OpenL(MContactViewObserver& aObserver); |
475 IMPORT_C TInt Open(MContactViewObserver& aObserver); |
473 IMPORT_C TInt Open(MContactViewObserver& aObserver); |
476 IMPORT_C TBool Close(const MContactViewObserver& aObserver); |
474 IMPORT_C TBool Close(const MContactViewObserver& aObserver); |
577 struct TObserverAndEvent |
575 struct TObserverAndEvent |
578 { |
576 { |
579 TContactViewEvent iAsyncEvent; |
577 TContactViewEvent iAsyncEvent; |
580 MContactViewObserver* iObserverToNotify; |
578 MContactViewObserver* iObserverToNotify; |
581 }; |
579 }; |
|
580 |
582 protected: |
581 protected: |
583 // Reference to CContactDatabase class. |
582 // Reference to CContactDatabase class. |
584 const CContactDatabase& iDb; |
583 const CContactDatabase& iDb; |
585 // Different Contacts view states. |
584 // Different Contacts view states. |
586 TState iState; |
585 TState iState; |
590 RPointerArray<MContactViewObserver> iObserverArray; |
589 RPointerArray<MContactViewObserver> iObserverArray; |
591 CIdle* iAsyncNotifier; |
590 CIdle* iAsyncNotifier; |
592 RArray<TObserverAndEvent> iOutstandingNotifications; |
591 RArray<TObserverAndEvent> iOutstandingNotifications; |
593 }; |
592 }; |
594 |
593 |
595 inline TInt CContactViewBase::GetErrorValueFromExtensionClass() |
|
596 { |
|
597 return iExtension->iError; |
|
598 } |
|
599 |
594 |
600 class MLplPersistenceLayerFactory; |
595 class MLplPersistenceLayerFactory; |
601 |
|
602 #ifdef __SYMBIAN_CNTMODEL_USE_SQLITE__ |
|
603 |
|
604 class CViewContactManager; |
596 class CViewContactManager; |
605 |
|
606 #else //__SYMBIAN_CNTMODEL_USE_SQLITE__ |
|
607 |
|
608 class CViewIterator; |
|
609 |
|
610 #endif //__SYMBIAN_CNTMODEL_USE_SQLITE__ |
|
611 |
597 |
612 class CContactLocalView : public CContactViewBase, public MContactDbObserver |
598 class CContactLocalView : public CContactViewBase, public MContactDbObserver |
613 /** An instantiable base class for contact views. |
599 /** An instantiable base class for contact views. |
614 |
600 |
615 The data associated with a local view is allocated within the client's memory |
601 The data associated with a local view is allocated within the client's memory |
654 void SetState(TState aState); |
640 void SetState(TState aState); |
655 private: // From MContactDbObserver. |
641 private: // From MContactDbObserver. |
656 virtual void HandleDatabaseEventL(TContactDbObserverEvent aEvent); |
642 virtual void HandleDatabaseEventL(TContactDbObserverEvent aEvent); |
657 |
643 |
658 private: |
644 private: |
659 |
|
660 #ifdef __SYMBIAN_CNTMODEL_USE_SQLITE__ |
|
661 void SortComplete(TInt aSortErr); |
645 void SortComplete(TInt aSortErr); |
662 void SetSortOrderL(const RContactViewSortOrder& aSortOrder); |
646 void SetSortOrderL(const RContactViewSortOrder& aSortOrder); |
663 void SortL(); |
647 void SortL(); |
664 void SafeResort(); |
648 void SafeResort(); |
665 friend class CViewContactManager; |
649 friend class CViewContactManager; |
666 #else //__SYMBIAN_CNTMODEL_USE_SQLITE__ |
|
667 TInt SortCallBack(); |
|
668 TInt DoReadIncrementL(); |
|
669 void ResetSortL(); |
|
670 void InitialiseSortL(const RContactViewSortOrder& aSortOrder, TBool aChangingSortOrder); |
|
671 void SortL(); |
|
672 void SafeResort(); |
|
673 void ContactsArraySortL(); |
|
674 TBool ContactCorrectType(TUid aType,TContactViewPreferences aTypeToInclude); |
|
675 #endif //__SYMBIAN_CNTMODEL_USE_SQLITE__ |
|
676 |
650 |
677 private: // Metheds for event handling |
651 private: // Metheds for event handling |
678 void HandleOutstandingEvents(); |
652 void HandleOutstandingEvents(); |
679 void HandleOutstandingEventL(); |
653 void HandleOutstandingEventL(); |
680 friend class CIdleContactSorter; |
654 friend class CIdleContactSorter; |
690 MLplPersistenceLayerFactory* iFactory; |
664 MLplPersistenceLayerFactory* iFactory; |
691 RPointerArray<CViewContact> iContacts; |
665 RPointerArray<CViewContact> iContacts; |
692 RPointerArray<CViewContact> iUnSortedContacts; |
666 RPointerArray<CViewContact> iUnSortedContacts; |
693 RArray<TContactDbObserverEvent> iOutstandingEvents; |
667 RArray<TContactDbObserverEvent> iOutstandingEvents; |
694 CIdleContactSorter* iAsyncSorter; |
668 CIdleContactSorter* iAsyncSorter; |
695 |
|
696 #ifdef __SYMBIAN_CNTMODEL_USE_SQLITE__ |
|
697 CViewContactManager* iViewCntMgr; |
669 CViewContactManager* iViewCntMgr; |
698 #else //__SYMBIAN_CNTMODEL_USE_SQLITE__ |
|
699 CViewIterator* iViewIterator; |
|
700 #endif //__SYMBIAN_CNTMODEL_USE_SQLITE__ |
|
701 |
|
702 CContactTextDef* iTextDef; |
670 CContactTextDef* iTextDef; |
703 TContactViewPreferences iViewPreferences; |
671 TContactViewPreferences iViewPreferences; |
704 TBool iSpare0; |
672 TBool iSpare0; |
705 TInt iSpare; |
673 TInt iSpare; |
706 }; |
674 }; |
708 class RContactRemoteView : public RSubSessionBase |
676 class RContactRemoteView : public RSubSessionBase |
709 /** This class is used internally by remote contact views as the handle to the |
677 /** This class is used internally by remote contact views as the handle to the |
710 server side view object. |
678 server side view object. |
711 |
679 |
712 @see CContactRemoteViewBase |
680 @see CContactRemoteViewBase |
713 @internalComponent |
681 @publishedAll |
714 @released |
682 @released |
715 */ |
683 */ |
716 { |
684 { |
717 public: |
685 public: |
718 void OpenL(const CContactDatabase& aDb,const RContactViewSortOrder& aSortOrder,TContactViewPreferences aContactTypes,const TUid& aSortPluginImplUid,const TDesC8& aSortPluginName); |
686 void OpenL(const CContactDatabase& aDb,const RContactViewSortOrder& aSortOrder,TContactViewPreferences aContactTypes,const TUid& aSortPluginImplUid,const TDesC8& aSortPluginName); |