phonebookui/Phonebook2/spbcontentprovider/inc/spbstatusprovider.h
changeset 0 e686773b3f54
equal deleted inserted replaced
-1:000000000000 0:e686773b3f54
       
     1 /*
       
     2 * Copyright (c) 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: Status provider
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef SPBSTATUSPROVIDER_H_
       
    20 #define SPBSTATUSPROVIDER_H_
       
    21 
       
    22 //  INCLUDES
       
    23 #include <e32base.h>
       
    24 #include <presencecachereadhandler2.h>
       
    25 
       
    26 class MPresenceCacheReader2;
       
    27 class CVPbkContactManager;
       
    28 class CSpbContent;
       
    29 class MVPbkContactLink;
       
    30 class CPresenceCacheBuddyIdCreator;
       
    31 
       
    32 /**
       
    33  * The real implementation of the status provider
       
    34  */
       
    35 NONSHARABLE_CLASS( CSpbStatusProvider ) :
       
    36         public CBase,
       
    37         public MPresenceCacheReadHandler2
       
    38     {
       
    39    
       
    40 public: // Construction & destruction
       
    41     static CSpbStatusProvider* NewL(
       
    42     		RPointerArray<CSpbContent>& aContentCache );
       
    43             
       
    44     ~CSpbStatusProvider();
       
    45 
       
    46 public: // Interface
       
    47     void FetchStatusDataL(
       
    48             CSpbContent& aContent);
       
    49     
       
    50 private:    // From MPresenceCacheReadHandler2
       
    51     void HandlePresenceReadL(TInt aErrorCode,
       
    52             RPointerArray<MPresenceBuddyInfo2>& aPresenceBuddyInfoList);
       
    53     void HandlePresenceNotificationL(TInt aErrorCode,
       
    54             MPresenceBuddyInfo2* aPresenceBuddyInfo);
       
    55     
       
    56 private:
       
    57     HBufC* CreateBuddyIdL(
       
    58             const MVPbkContactLink& aLink);
       
    59     CSpbContent* FindContentByBuddyId(
       
    60             const TDesC& aBuddyId);
       
    61     void NotifyChangeEventL(
       
    62             MPresenceBuddyInfo2& aBuddyInfo,
       
    63             CSpbContent& aContent);
       
    64     
       
    65 private:    // constructors
       
    66     inline CSpbStatusProvider(
       
    67             RPointerArray<CSpbContent>& aContentCache);
       
    68     inline void ConstructL();
       
    69    
       
    70 private: // data
       
    71     
       
    72     // Own. Presence cache read interface
       
    73     MPresenceCacheReader2* iPresenceCache;
       
    74     // Own. Buddy ID creator.
       
    75     CPresenceCacheBuddyIdCreator* iBuddyIdCreator;
       
    76     // Not own. Content cache
       
    77     RPointerArray<CSpbContent>& iContentCache;
       
    78     };
       
    79 
       
    80 #endif /*SPBSTATUSPROVIDER_H_*/