phonebookui/Phonebook2/inc/CPbk2ServiceManager.h
changeset 0 e686773b3f54
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:  Service manager for external service providers.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CPBK2SERVICEMANAGER_H_
       
    20 #define CPBK2SERVICEMANAGER_H_
       
    21 
       
    22 #include <spdefinitions.h>
       
    23 #include <Pbk2InternalUID.h>
       
    24 
       
    25 #include <mspnotifychangeobserver.h>
       
    26 #include <spsettings.h>
       
    27 //We use unique uid to provide private id space for external icons
       
    28 const TInt32 KPbk2ServManId = 0x2001B2C7;
       
    29 
       
    30 class RFs;
       
    31 class CFbsBitmap;
       
    32 class CSPSettings;
       
    33 class CSPNotifyChange;
       
    34 
       
    35 NONSHARABLE_CLASS(CPbk2ServiceManager) : public CBase,
       
    36     public MSPNotifyChangeObserver
       
    37     {
       
    38     public:
       
    39         enum TFlags
       
    40             {
       
    41             EWellKnown = 0x01,
       
    42             EInstalled = 0x02
       
    43             };
       
    44         
       
    45         struct TService
       
    46             {
       
    47             TPtrC iName;
       
    48             TPtrC iDisplayName;
       
    49             TInt iFlags;
       
    50             CFbsBitmap* iBitmap;
       
    51             CFbsBitmap* iMask;
       
    52             TInt iBitmapId;
       
    53 
       
    54             TPtrC iBrandId;
       
    55             TPtrC8 iApplicationId;
       
    56             TServiceId iServiceId;            
       
    57             
       
    58             void Delete();
       
    59             };
       
    60         
       
    61         typedef RArray<TService> RServicesArray;
       
    62 
       
    63     public:
       
    64         IMPORT_C static CPbk2ServiceManager* NewL(RFs& aRFs);
       
    65         ~CPbk2ServiceManager();
       
    66         
       
    67         IMPORT_C const RServicesArray& Services();
       
    68 
       
    69         //Call this to refresh the brand data.
       
    70         //RefreshDataL is needed because currently branding server
       
    71         //does not notify any brand updates (e.g. installation of
       
    72         //new brand packages). When notifications in future are
       
    73         //provided, this function can be removed from Phonebook.
       
    74         IMPORT_C void RefreshDataL();
       
    75 
       
    76     private:
       
    77         
       
    78         // from MSPNotifyChangeObserver
       
    79         void HandleNotifyChange( TUint aServiceId );
       
    80         void HandleError( TInt aError );        
       
    81     private:
       
    82         CPbk2ServiceManager(RFs& aRFs);
       
    83         void ConstructL();
       
    84         void DeleteData();
       
    85         void RunRefreshDataL();
       
    86         
       
    87         void ReadInstalledL();
       
    88         void ReadWellKnownServicesL();        
       
    89         void AppendInstalledServicesL(); 
       
    90         void UpdateServiceL(
       
    91             TService& aService,
       
    92             TServiceId aServiceId, 
       
    93             const TDesC& aServiceName);
       
    94         void AppendServiceL(TService aService);
       
    95         void UpdateBrandingInfoL();  
       
    96         void UpdateBrandL( TService& aService, TLanguage aLanguage ); 
       
    97 
       
    98     private:
       
    99         CSPSettings* iSettings;
       
   100         RServicesArray iServices;
       
   101         RPointerArray<HBufC> iStringsOwner; //for retaining ownership here 
       
   102         TInt iBitmapIdCounter;
       
   103         CSPNotifyChange* iSPNotifyChange;   
       
   104         RIdArray iSpIdsToObserve;
       
   105         RFs& iRFs;
       
   106         TBool iRunRefreshData;
       
   107     };
       
   108 
       
   109 
       
   110 #endif /*CPBK2SERVICEMANAGER_H_*/