phonebookui/Phonebook2/ServerApplication/inc/CPbk2ItemFetcher.h
changeset 0 e686773b3f54
child 17 2666d9724c76
equal deleted inserted replaced
-1:000000000000 0:e686773b3f54
       
     1 /*
       
     2 * Copyright (c) 2005-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:  Phonebook 2 application server item fetcher.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CPBK2ITEMFETCHER_H
       
    20 #define CPBK2ITEMFETCHER_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <e32base.h>
       
    24 #include "MPbk2UiService.h"
       
    25 #include "mpbk2serverappstartupobserver.h"
       
    26 #include "MPbk2ServicePhaseObserver.h"
       
    27 #include <RVPbkContactFieldDefaultPriorities.h>
       
    28 #include <AiwContactSelectionDataTypes.h>
       
    29 #include <VPbkFieldTypeSelectorFactory.h>
       
    30 
       
    31 // FORWARD DECLARATIONS
       
    32 class CVPbkContactStoreUriArray;
       
    33 class MVPbkContactLinkArray;
       
    34 class MPbk2UiServiceObserver;
       
    35 class CVPbkFieldTypeSelector;
       
    36 class CPbk2ServerAppStoreManager;
       
    37 
       
    38 // CLASS DECLARATION
       
    39 
       
    40 /**
       
    41  * Phonebook 2 application server item fetcher.
       
    42  * Responsible for driving the item fetch service phases.
       
    43  */
       
    44 class CPbk2ItemFetcher : public CBase,
       
    45                          public MPbk2UiService,
       
    46                          public MPbk2ServicePhaseObserver,
       
    47                          private MPbk2ServerAppStartupObserver
       
    48     {
       
    49     public: // Construction and destruction
       
    50 
       
    51         /**
       
    52          * Creates a new instance of this class.
       
    53          *
       
    54          * @param aMessage      Client-Server message.
       
    55          * @param aObserver     UI service observer.
       
    56          * @param aFetchType    Fetch type.
       
    57          * @return  A new instance of this class.
       
    58          */
       
    59         static CPbk2ItemFetcher* NewL(
       
    60                 const RMessage2& aMessage,
       
    61                 MPbk2UiServiceObserver& aObserver,
       
    62                 TPbk2FetchType aFetchType );
       
    63 
       
    64         /**
       
    65          * Destructor.
       
    66          */
       
    67         ~CPbk2ItemFetcher();
       
    68 
       
    69     public: // From MPbk2UiService
       
    70         void LaunchServiceL();
       
    71         void CancelService();
       
    72         void AcceptDelayedContactsL(
       
    73                 const TDesC8& aContactLinkBuffer );
       
    74         void ExitServiceL(
       
    75                 TInt aExitCommandId );
       
    76         void ServiceResults(TServiceResults* aResults) const;
       
    77 
       
    78     public: // From MPbk2ServicePhaseObserver
       
    79         void NextPhase(
       
    80                 MPbk2ServicePhase& aPhase );
       
    81         void PreviousPhase(
       
    82                 MPbk2ServicePhase& aPhase );
       
    83         void PhaseCanceled(
       
    84                 MPbk2ServicePhase& aPhase );
       
    85         void PhaseAborted(
       
    86                 MPbk2ServicePhase& aPhase );
       
    87         void PhaseError(
       
    88                 MPbk2ServicePhase& aPhase,
       
    89                 TInt aErrorCode );
       
    90         TBool PhaseOkToExit(
       
    91                 MPbk2ServicePhase& aPhase,
       
    92                 TInt aCommandId );
       
    93         void PhaseAccept(
       
    94                 MPbk2ServicePhase& aPhase,
       
    95                 const TDesC8& aMarkedEntries,
       
    96                 const TDesC8& aLinkData );
       
    97 
       
    98     private: // From MPbk2ServerAppStartupObserver
       
    99         void ContactUiReadyL(
       
   100                 MPbk2StartupMonitor& aStartupMonitor );
       
   101         void  StartupCanceled(
       
   102                 TInt aErrorCode );
       
   103 
       
   104     private: // Implementation
       
   105         CPbk2ItemFetcher(
       
   106                 MPbk2UiServiceObserver& aObserver,
       
   107                 TPbk2FetchType aFetchType );
       
   108         void ConstructL(
       
   109                 const RMessage2& aMessage );
       
   110         void LaunchFetchPhaseL();
       
   111         void LaunchAddressSelectPhaseL(
       
   112                 MVPbkContactLinkArray& aContactLinks );
       
   113         void AddXSPStoresL();
       
   114         void GetDefaultPriorities( TUint aFlags );
       
   115 
       
   116     private: // Data
       
   117         /// Ref: UI service observer
       
   118         MPbk2UiServiceObserver& iObserver;
       
   119         /// Own: Fetch type
       
   120         TPbk2FetchType iFetchType;
       
   121         /// Own: Loaded store URIs
       
   122         CVPbkContactStoreUriArray* iStoreUris;
       
   123         /// Own: store URIs for fetch, not include xSP stores
       
   124         CVPbkContactStoreUriArray* iContactFetchStoreUris;
       
   125         /// Own: Initially marked contact links
       
   126         MVPbkContactLinkArray* iPreselectedContacts;
       
   127         /// Own: Fetch resource id
       
   128         TInt iFetchResId;
       
   129         /// Own: Address select resource id
       
   130         TInt iAddressSelectResourceId;
       
   131         /// Own: Defaults in priority order
       
   132         RVPbkContactFieldDefaultPriorities iDefaultPriorities;
       
   133         /// Own: Contact view filter
       
   134         CVPbkFieldTypeSelector* iContactViewFilter;
       
   135         /// Own: Server app store manager
       
   136         CPbk2ServerAppStoreManager* iStoreManager;
       
   137         /// Own: Fetch phase
       
   138         MPbk2ServicePhase* iFetchPhase;
       
   139         /// Own: Address select phase
       
   140         MPbk2ServicePhase* iAddressSelectPhase;
       
   141         /// Own: Address select type
       
   142         TAiwAddressSelectType iAddressSelectType;
       
   143         /// Own: communication address select type
       
   144         VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector
       
   145             iCommAddressSelectType;
       
   146         /// Own: ETrue if using default store configuration
       
   147         TBool iUseDeviceConfig;
       
   148         /// Own: Communication address select phase
       
   149         MPbk2ServicePhase* iCommAddressSelectPhase;
       
   150     };
       
   151 
       
   152 #endif // CPBK2ITEMFETCHER_H
       
   153 
       
   154 // End of File