meetingui/attendeeview/EngSrc/CAttendeeEng.h
changeset 0 f979ecb2b13e
equal deleted inserted replaced
-1:000000000000 0:f979ecb2b13e
       
     1 /*
       
     2 * Copyright (c) 2004 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:  Implements Attendee View's engine class.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef __CATTENDEE_ENG_H__
       
    21 #define __CATTENDEE_ENG_H__
       
    22 
       
    23 //  INCLUDES
       
    24 #include "MAttendeeEng.h"
       
    25 #include <MPbkContactDbObserver.h>
       
    26 #include <cntdb.h> //MIdleFindObserver
       
    27 
       
    28 // FORWARD DECLARATION
       
    29 class CAttendeeItemList;
       
    30 class MAttendeeItemList;
       
    31 class CPbkIdleFinder;
       
    32 class CPbkContactEngine;
       
    33 class CPbkFieldIdArray;
       
    34 class CPbkContactItem;
       
    35 class TPbkContactItemField;
       
    36 class MPbkContactDbObserver;
       
    37 class CPbkContactChangeNotifier;
       
    38 
       
    39 // CLASS DECLARATION
       
    40 /**
       
    41 *  Implements AttendeeView's engine
       
    42 */
       
    43 class CAttendeeEng : public CBase, 
       
    44                      public MAttendeeEng,
       
    45                      public MIdleFindObserver,
       
    46                      public MPbkContactDbObserver
       
    47     {
       
    48     public:
       
    49         /**
       
    50         * Two-phased constructor.
       
    51         * @param aAgnEntry
       
    52         * @return CAttendeeEng object.
       
    53         */	
       
    54         static CAttendeeEng* NewL( CCalEntry& aCalEntry );
       
    55 
       
    56         /**
       
    57         * Destructor.
       
    58         */	
       
    59         virtual ~CAttendeeEng();
       
    60 
       
    61     private:
       
    62         /**
       
    63         * By default Symbian 2nd phase constructor is private.
       
    64         */	
       
    65         void ConstructL();
       
    66 
       
    67         /**
       
    68         * C++ default constructor.
       
    69         * @param aCalEntry
       
    70         * @return aCalEntry
       
    71         */	
       
    72         CAttendeeEng( CCalEntry& aCalEntry );
       
    73 
       
    74     public: //From MAttendeeEng        	
       
    75     	void ParseAgnEntryL();    	
       
    76 		void AddItemL( TDesC& aEmailAddress );	
       
    77 		void AddItemL( CPbkContactItem& aPbkItem, 
       
    78                        const TPbkContactItemField* aAddress );	
       
    79 		void DeleteItemL( const TInt aIndex );	
       
    80 		void DeleteItemsL( const CArrayFix<TInt>& aIndexes );	
       
    81         void ChangeAttendanceL( const TInt aIndex, 
       
    82                                const CAttendeeItem::TAttendance aAttendance );	
       
    83         void ChangeAttendancesL( const CArrayFix<TInt>& aIndexes, 
       
    84                                 const CAttendeeItem::TAttendance aAttendance );	
       
    85 		TInt NumberOfItems() const;	
       
    86 		CAttendeeItem& At( const TInt aIndex ) const;	
       
    87         TBool IsEditedL() const;	
       
    88         void SortAttendeesL();	
       
    89         void SetObserver( MAttendeeEngObserver* aObserver );	
       
    90     	void RemoveObserver();                       	
       
    91         CPbkContactEngine& ContactEngine() const;	
       
    92         CPbkContactItem* PbkContactItemL( const TInt aIndex ) const;           
       
    93                         
       
    94     public: //from MIdleFindObserver	
       
    95         void IdleFindCallback(); 
       
    96 
       
    97     public: //New functions
       
    98         /**
       
    99         * Returns attendee item list
       
   100         * @return Attendee list
       
   101         */	
       
   102         MAttendeeItemList& Attendees() const;
       
   103 
       
   104         /**
       
   105         * Returns deleted attendee item list
       
   106         * @return deleted attendee list
       
   107         */	
       
   108         MAttendeeItemList& DeletedAttendees() const;
       
   109         
       
   110     protected: //From MPbkContactDbObserver	
       
   111         void HandleDatabaseEventL( TContactDbObserverEvent aEvent );               
       
   112                     
       
   113     private: //New functions
       
   114         /**
       
   115         * Match CCalEntry's email addresses to phonebook's contacts        
       
   116         */	
       
   117         void MatchEmailsL();
       
   118 
       
   119         /**
       
   120         * Find next email match from phonebook
       
   121         */	
       
   122         void FindNextEmailL();
       
   123         
       
   124         /**
       
   125         * Update CAttendeeItem 
       
   126         * @param aFoundContacts, ownership is transfered
       
   127         */        	
       
   128         void UpdateAttendeesL( CContactIdArray* aFoundContacts );
       
   129 
       
   130         /**
       
   131         * Notify observer that list have changed        
       
   132         */	
       
   133         void NotifyL() const;
       
   134 
       
   135         /**
       
   136         * Notify observer that error have occured
       
   137         * @param aErrorCode
       
   138         */	
       
   139         void NotifyError( const TInt aErrorCode ) const;
       
   140               
       
   141     private:    // data
       
   142         ///CArrayPtrFlat<CAttendeeItem> item's index which is used to
       
   143         ///find contact
       
   144         TInt iFindedIndex;
       
   145 
       
   146     	///Ref:
       
   147     	MAttendeeEngObserver* iObserver;
       
   148 
       
   149     	///Own: List of attendees
       
   150     	CAttendeeItemList* iAttendees;
       
   151 
       
   152         ///Own: List of deleted attendees
       
   153     	CAttendeeItemList* iDeletedAttendees;
       
   154 
       
   155         ///Ref:
       
   156         CCalEntry* iCalEntry;
       
   157 
       
   158         ///Own:
       
   159         CPbkContactEngine* iContactEngine;
       
   160 
       
   161         ///Own:	
       
   162         CPbkIdleFinder* iIdleFinder;             
       
   163 
       
   164         ///Own: Contain id of field which used to find contacts
       
   165         CPbkFieldIdArray* iFind;
       
   166 
       
   167         ///Own: Get and handle contact db events	
       
   168         CPbkContactChangeNotifier*  iNotifier;
       
   169                 
       
   170         
       
   171     };
       
   172 
       
   173 #endif // __CATTENDEE_ENG_H__
       
   174 
       
   175 // End of File