meetingrequest/mrpolicy/inc/cesmrpolicymanager.h
branchRCL_3
changeset 64 3533d4323edc
equal deleted inserted replaced
63:d189ee25cf9d 64:3533d4323edc
       
     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:  ESMR service policy
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CESMRPOLICYMANAGER_H
       
    20 #define CESMRPOLICYMANAGER_H
       
    21 
       
    22 #include <e32base.h>
       
    23 
       
    24 #include "esmrutilsapiext.h"
       
    25 #include "esmrdef.h"
       
    26 #include "tesmrscenariodata.h"
       
    27 #include "mmrpolicyprovider.h"
       
    28 
       
    29 #include <barsc.h>
       
    30 
       
    31 
       
    32 class CESMRPolicy;
       
    33 class MESMRCalEntry;
       
    34 class MMRPolicyResolver;
       
    35 class CMRPolicyResolver;
       
    36 
       
    37 /**
       
    38  *  CESMRPolicyManager defines ESMR policymanager.
       
    39  *  ES MR policies are relates to different roles and task scenarions.
       
    40  *  Policies are used by user interface views and tasks. CESMRPolicyManager
       
    41  *  provides interface for accessing these policies.
       
    42  *  CESMRPolicyManager uses CCoeEnv.
       
    43  *
       
    44  *  @see CESMRPolicy
       
    45  *  @lib esmrpolicy.lib
       
    46  */
       
    47 NONSHARABLE_CLASS(CESMRPolicyManager) : public CBase,
       
    48                                         public MMRPolicyProvider
       
    49     {
       
    50 public: // Construction and destruction
       
    51     /**
       
    52      * Two-phased constructor. Creates new CESMRPolicyManager object.
       
    53      * Ownership is transferred to caller.
       
    54      *
       
    55      * @return Pointer to created and initialized esmr policy object.
       
    56      */
       
    57     IMPORT_C static CESMRPolicyManager* NewL();
       
    58 
       
    59     /**
       
    60      * C++ destructor.
       
    61      */
       
    62     IMPORT_C ~CESMRPolicyManager();
       
    63 
       
    64 public: // Interface
       
    65     /**
       
    66      * Fetches current policy object.
       
    67      * @return Current policy object
       
    68      */
       
    69     IMPORT_C CESMRPolicy& CurrentPolicy();
       
    70 
       
    71     /**
       
    72      * Resolves policy to be used.
       
    73      * @param aScenarioData Scenario Data for resolving correct policy
       
    74      * @param aESMREntry Reference to ES MR Entry.
       
    75      * @param aCustomResolver to be used. If NULL, resolver is determined by
       
    76      * policy manager
       
    77      */
       
    78     IMPORT_C void ResolvePolicyL(
       
    79             const TESMRScenarioData& aScenarioData,
       
    80             MESMRCalEntry& aESMREntry,
       
    81             MMRPolicyResolver* aCustomResolver = NULL );
       
    82 
       
    83     /**
       
    84      * Adds the current policy on stack for preserving it if a new policy
       
    85      * needs to be resolved and the current policy is still needed afterwards.
       
    86      */
       
    87     IMPORT_C void PushPolicyL();
       
    88     
       
    89     /**
       
    90      * Restores the topmost policy from the stack as the current policy. 
       
    91      * @return the policy from stack or NULL if stack is empty.
       
    92      */
       
    93     IMPORT_C CESMRPolicy* PopPolicy();
       
    94 
       
    95 public: // from MMRPolicyProvider
       
    96     
       
    97     const CESMRPolicy& CurrentPolicy() const;
       
    98     
       
    99 private: // Implementation
       
   100 
       
   101     CESMRPolicyManager();
       
   102     void ConstructL();
       
   103     
       
   104 private: // data
       
   105 
       
   106     /**
       
   107      * Current policy resolver.
       
   108      * Own.
       
   109      */
       
   110     MMRPolicyResolver* iResolverPlugin;
       
   111     
       
   112     /**
       
   113     * Current policy object
       
   114     * Own.
       
   115     */
       
   116     CESMRPolicy* iCurrentPolicy;
       
   117 
       
   118     /**
       
   119      * Array for preserving policies
       
   120      */
       
   121     RPointerArray< CESMRPolicy > iPolicyStack;
       
   122     };
       
   123 
       
   124 #endif // CESMRPOLICYMANAGER_H