meetingrequest/mrcasplugin/inc/cesmrcasplugincontactretriever.h
changeset 0 8466d47a6819
equal deleted inserted replaced
-1:000000000000 0:8466d47a6819
       
     1 /*
       
     2 * Copyright (c) 2007-2009 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:  Definition of CAS plug-in contact retriever
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CESMRCASPLUGINCONTACTRETRIEVER_H
       
    20 #define CESMRCASPLUGINCONTACTRETRIEVER_H
       
    21 
       
    22 #include <e32base.h>
       
    23 //<cmail>
       
    24 #include "mfsccontactsetobserver.h"
       
    25 //</cmail>
       
    26 
       
    27 // FORWARD DECLARATIONS
       
    28 class MVPbkStoreContact;
       
    29 class MFscContactSet;
       
    30 class TFscContactActionPluginParams;
       
    31 class MESMRCasPluginContactRetrieverObserver;
       
    32 class CCalUser;
       
    33 
       
    34 /**
       
    35  *  Create meeting Request plugin implementation.
       
    36  *  Contains implementation of create meeting request action plugin.
       
    37  *
       
    38  *  part contact action menu Ecom plugin based API
       
    39  */
       
    40 NONSHARABLE_CLASS (CESMRCasPluginContactRetriever) :
       
    41         public CBase,
       
    42         public MFscContactSetObserver
       
    43     {
       
    44 public: // Constructors and destructor
       
    45 
       
    46     /**
       
    47      * Two-phased constructor. Creates and initializes
       
    48      * CESMRCasPluginContactRetriever object. Ownership transferred to caller.
       
    49      *
       
    50      * @param aParams set of contact action plugin configuration parameters
       
    51      * @return Pointer to ContactRetriever object.
       
    52      */
       
    53     static CESMRCasPluginContactRetriever* NewL(
       
    54             const TFscContactActionPluginParams& aParams );
       
    55 
       
    56     /**
       
    57      * C++ Destructor.
       
    58      */
       
    59     virtual ~CESMRCasPluginContactRetriever( );
       
    60 
       
    61 public: // From Interface
       
    62     void CanExecuteL(
       
    63             MFscContactSet& aContactSet,
       
    64             MESMRCasPluginContactRetrieverObserver& aObserver );
       
    65     void GetAttendeesL(
       
    66             MFscContactSet& aContactSet,
       
    67             MESMRCasPluginContactRetrieverObserver& aObserver );
       
    68     void Cancel();
       
    69 
       
    70 private: // from MFscContactSetObserver
       
    71     void NextContactComplete( MVPbkStoreContact* aContact );
       
    72     void NextContactFailed( TInt aError );
       
    73     void NextGroupComplete( MVPbkStoreContact* aContact );
       
    74     void NextGroupFailed( TInt aError );
       
    75     void GetGroupContactComplete( MVPbkStoreContact* aContact );
       
    76     void GetGroupContactFailed( TInt aError );
       
    77 
       
    78 private: // Implementation
       
    79     CESMRCasPluginContactRetriever(
       
    80             const TFscContactActionPluginParams& aParams );
       
    81     void ConstructL( );
       
    82 
       
    83     void StartIterationL();
       
    84     void HandleNextContactCompleteL( MVPbkStoreContact& aContact );
       
    85     void HandleNextGroupCompleteL( MVPbkStoreContact* aGroup );
       
    86     void NotifyFinished();
       
    87     void NotifyError( TInt aError );
       
    88 private: // data
       
    89 
       
    90     /** States of operations */
       
    91     enum TLastEvent
       
    92         {
       
    93         EActionEventNextContact,
       
    94         EActionEventNextGroup,
       
    95         EActionEventGetGroupContact
       
    96         };
       
    97     
       
    98     /** State current operation */
       
    99     enum TOperation
       
   100         {
       
   101         EOperationCanExecute,
       
   102         EOperationGetAttendees
       
   103         };
       
   104 
       
   105     /// Own: Operation in progress
       
   106     TOperation iOperation;
       
   107     /// Own: Last event
       
   108     TLastEvent iLastEvent;
       
   109     /// Own: Fetched MR addresses
       
   110     RPointerArray<CCalUser> iAttendees;
       
   111     /// Own: Contact count with email
       
   112     TInt iContactCountWithEmail;
       
   113     /// Own: Total contact count
       
   114     TInt iContactCount;
       
   115     /// Ref: Current observer
       
   116     MESMRCasPluginContactRetrieverObserver* iObserver;
       
   117     /// Ref: Plugin parameters
       
   118     const TFscContactActionPluginParams& iParams;
       
   119     /// Ref: Contact set to be handled
       
   120     MFscContactSet* iContactSet;
       
   121     /// Own: Contact index in current group
       
   122     TInt iCurrentGroupContactIndex;
       
   123     /// Own: Contact count in current group
       
   124     TInt iCurrentGroupContactCount;
       
   125     /// Ref: Current group in progress
       
   126     MVPbkStoreContact* iCurrentGroup;
       
   127     };
       
   128 
       
   129 #endif // CESMRCASPLUGINCONTACTRETRIEVER_H