ximpfw/presence/srcpresencedatamodel/presenceauthorization/groupmemberspresenceconfigurationitem.h
changeset 0 e6b17d312c8b
equal deleted inserted replaced
-1:000000000000 0:e6b17d312c8b
       
     1 /*
       
     2 * Copyright (c) 2006 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:  Group members presence configuration item
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef CPSCGROUPMEMBERSPRESENCECONFIGURATIONITEM_H
       
    19 #define CPSCGROUPMEMBERSPRESENCECONFIGURATIONITEM_H
       
    20 
       
    21 #include <e32base.h>
       
    22 #include "presenceinfoimp.h"
       
    23 #include "ximpconfigurationitembase.h"
       
    24 #include "groupcontenteventobserver.h"
       
    25 
       
    26 class MXIMPItemParentBase;
       
    27 class MXIMPPscContext;
       
    28 class CPresenceInfoFilterImp;
       
    29 class MXIMPIdentity;
       
    30 class CXIMPIdentityImp;
       
    31 class CGroupContentSubscriptionItem;
       
    32 
       
    33 /**
       
    34  * Group members presence configuration item
       
    35  *
       
    36  * @since S60 v3.2
       
    37  */
       
    38 class CGroupMembersPresenceConfigurationItem : public CXIMPConfigurationItemBase, 
       
    39                                                public MGroupContentEventObserver
       
    40     {
       
    41 public: // Construction and destruction
       
    42 
       
    43     /**
       
    44      * Construction
       
    45      * @param aParent. Parent has to be informed when this object is deleted by RemoveMe method.
       
    46      */
       
    47     static CGroupMembersPresenceConfigurationItem* NewLC( MXIMPItemParentBase& aParent,
       
    48                                                           CGroupContentSubscriptionItem& aContentItem );
       
    49 
       
    50     /**
       
    51      * Destruction
       
    52      * - Remember to inform parent about delete.
       
    53      */
       
    54     ~CGroupMembersPresenceConfigurationItem();
       
    55 
       
    56 private: // Construction and destruction
       
    57 
       
    58     /**
       
    59      * Construction
       
    60      * @param aParent. Parent has to be informed when this object is deleted by RemoveMe method.
       
    61      */
       
    62     CGroupMembersPresenceConfigurationItem( MXIMPItemParentBase& aParent, 
       
    63                                             CGroupContentSubscriptionItem& aContentItem );
       
    64 
       
    65     /**
       
    66      * Construction
       
    67      */
       
    68     void ConstructL();
       
    69 
       
    70 public: // New methods
       
    71 
       
    72 
       
    73     /**
       
    74      * Current presence information filter.
       
    75      * @return Current presence information filter.
       
    76      */
       
    77     IMPORT_C CPresenceInfoFilterImp& ConfigurationPif();
       
    78     
       
    79     /**
       
    80      * Set current presence information filter. Overwrites existing one.
       
    81      * Ownership is transferred to callee.
       
    82      * @param aPif Current presence information filter.
       
    83      */
       
    84     IMPORT_C void SetConfigurationPif( CPresenceInfoFilterImp* aPif );
       
    85 
       
    86     /**
       
    87      * Collect aggregated presence information filter without given context.
       
    88      * @param aContext. Exluded context from aggregated pif.
       
    89      * @return Aggregated pif without exluded context.
       
    90      */    
       
    91     IMPORT_C CPresenceInfoFilterImp* CollectConfigurationPifWithoutCtxL( 
       
    92                                                     MXIMPPscContext* aContext );
       
    93     
       
    94     /**
       
    95      * For ordering items.
       
    96      * @param aA Key item for ordering.
       
    97      * @param aB Item to compare
       
    98      * @return -1 if aB is greater than aA
       
    99      *          0 if they are same
       
   100      *          1 if aA if greater than aB.
       
   101      */    
       
   102     IMPORT_C static TInt Order( const CGroupMembersPresenceConfigurationItem& aA,
       
   103                          const CGroupMembersPresenceConfigurationItem& aB );
       
   104     /**
       
   105      * For ordering items using identity as key.
       
   106      * @param aA Key identity for ordering.
       
   107      * @param aB Item to compare
       
   108      * @return -1 if aB is greater than aA
       
   109      *          0 if they are same
       
   110      *          1 if aA if greater than aB.
       
   111      */    
       
   112     IMPORT_C static TInt IdentityOrder( const CXIMPIdentityImp* aA,
       
   113                          const CGroupMembersPresenceConfigurationItem& aB );
       
   114     /**
       
   115      * Identity of item.
       
   116      * @return Identity of item.     
       
   117      */
       
   118     IMPORT_C const MXIMPIdentity& Identity() const;
       
   119 
       
   120     /**
       
   121      * Set identity for item
       
   122      * @param aIdentity. New identity for item. Ownership is transferred.
       
   123      */
       
   124     IMPORT_C void SetIdentity( CXIMPIdentityImp* aIdentity );
       
   125     
       
   126 public: // From MXIMPSubscriptionItem
       
   127 
       
   128     /**
       
   129      * @see MXIMPSubscriptionItem
       
   130      */
       
   131     void SynthesiseSubscriptionEventToL( MXIMPPscContext* aContext, TBool aForceEvent );
       
   132     void ActivateSubscriberL( MXIMPPscContext* aContext );
       
   133     
       
   134 private: // From CXIMPSubscriptionItemBase
       
   135 
       
   136     /**
       
   137      * @see CXIMPSubscriptionItemBase
       
   138      */
       
   139     void CleanExpired();
       
   140 
       
   141 public: // From CXIMPConfigurationItemBase
       
   142 
       
   143     /**
       
   144      * @see CXIMPConfigurationItemBase
       
   145      */
       
   146     IMPORT_C void AddConfiguratorL( MXIMPPscContext* aContext );
       
   147     IMPORT_C void RemoveConfigurator( MXIMPPscContext* aContext );    
       
   148         
       
   149 private: // From MGroupContentSubscriptionEventObserver    
       
   150 
       
   151     /** 
       
   152      * @see MGroupContentSubscriptionEventObserver
       
   153      */
       
   154     void HandleChangeL( RPrGrpMemInfoImpArray& aAdded, RPrGrpMemInfoImpArray& aRemoved );
       
   155     void HandleSynthesiseL( RPrGrpMemInfoImpArray& aAdded );
       
   156     
       
   157 private: // Data
       
   158 
       
   159     /**
       
   160      * Current presence information filter.
       
   161      * Own
       
   162      */
       
   163     CPresenceInfoFilterImp* iPif;
       
   164         
       
   165     /**
       
   166      * Identity of item.
       
   167      * Own
       
   168      */
       
   169     CXIMPIdentityImp* iIdentity;
       
   170     
       
   171     /**
       
   172      * Owns reference to content item. Use close for delete.
       
   173      */
       
   174     CGroupContentSubscriptionItem& iContentItem;
       
   175     };
       
   176 
       
   177 
       
   178 /* ======================================================================== */
       
   179 
       
   180 
       
   181 
       
   182 #endif // CPSCGROUPMEMBERSPRESENCECONFIGURATIONITEM_H