meetingrequest/mrpolicy/inc/cesmrpolicy.h
changeset 0 8466d47a6819
child 16 4ce476e64c59
equal deleted inserted replaced
-1:000000000000 0:8466d47a6819
       
     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 CESMRPOLICY_H
       
    20 #define CESMRPOLICY_H
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <babitflags.h>
       
    24 //<cmail>
       
    25 #include "esmrdef.h"
       
    26 
       
    27 class RResourceFile;
       
    28 class TResourceReader;
       
    29 class TESMREntryField;
       
    30 
       
    31 /**
       
    32  *  CESMRPolicy defines ESMR policy.
       
    33  *  ES MR policies are relates to different roles and task scenarions.
       
    34  *  Policies are used by user interface views and tasks.
       
    35  *
       
    36  *  Policies can be defined in resource file with STRUCT ESMR_POLICY
       
    37  *  resource structure.
       
    38  *
       
    39  *  @see esmrservices.rh
       
    40  *  @lib esmrpolicy.lib
       
    41  */
       
    42 NONSHARABLE_CLASS(CESMRPolicy) :
       
    43         public CBase
       
    44     {
       
    45 public: // Construction and destruction
       
    46     /**
       
    47      * Two-phased constructor. Creates new CESMRPolicy object. Ownership is
       
    48      * tranferred to caller.
       
    49      *
       
    50      * @return Pointer to created and initialized esmr policy object.
       
    51      */
       
    52     IMPORT_C static CESMRPolicy* NewL();
       
    53 
       
    54     /**
       
    55      * Two-phased constructor. Reads esmr policy definition from
       
    56      * resource. Caller is responsible for filling the resource reader with
       
    57      * correct information.
       
    58      *
       
    59      * @param aRFile Resource file object.
       
    60      * @param aReader Resource reader object.
       
    61      * @return Pointer to created and initialized esmr policy object.
       
    62      */
       
    63     IMPORT_C static CESMRPolicy* NewL(
       
    64             RResourceFile& aRFile,
       
    65             TResourceReader& aReader );
       
    66 
       
    67     /**
       
    68      * C++ destructor.
       
    69      */
       
    70     IMPORT_C ~CESMRPolicy();
       
    71 
       
    72 public: // Interface
       
    73     /**
       
    74      * Reads policy definition from resource file. Caller is
       
    75      * responsible for filling the resource reader with
       
    76      * correct information.
       
    77      *
       
    78      * @param aRFile Resource file object.
       
    79      * @param aReader Resource reader object.
       
    80      */
       
    81     IMPORT_C void ReadFromResourceL(
       
    82             RResourceFile& aRFile,
       
    83             TResourceReader& aReader );
       
    84 
       
    85     /**
       
    86      * Checks, if field is included in policy.
       
    87      * @return ETrue if field is included in policy.
       
    88      * @param aFieldId Field id.
       
    89      */
       
    90     IMPORT_C TBool IsFieldIncluded(
       
    91             TESMREntryFieldId aFieldId ) const;
       
    92 
       
    93     /**
       
    94      * Fetches field matching field if from policy.
       
    95      * @param aFieldId Field id.
       
    96      * @return Reference to field id.
       
    97      * @error KErrNotFound Field cannot be found.
       
    98      */
       
    99     IMPORT_C const TESMREntryField& FieldL(
       
   100             TESMREntryFieldId aFieldId ) const;
       
   101 
       
   102     /**
       
   103      * Checks if <aCommand> belongs to default command list
       
   104      * @param aCommand Command id
       
   105      * @return ETrue if belongs to default commands
       
   106      */
       
   107     IMPORT_C TBool IsDefaultCommand(
       
   108             TInt aCommand ) const;
       
   109 
       
   110     /**
       
   111      * Checks if command belongs to additional commands
       
   112      * @param aCommand Command id
       
   113      * @return ETrue if belongs to additional commands
       
   114      */
       
   115     IMPORT_C TBool IsAdditionalCommand(
       
   116             TInt aCommand ) const;
       
   117 
       
   118     /**
       
   119      * Tests, if specific ES MR role is included in policy.
       
   120      * @param aRole Role of user
       
   121      * @return ETrue, if role is included in policy
       
   122      */
       
   123     IMPORT_C TBool IsRoleIncluded(
       
   124             TESMRRole aRole ) const;
       
   125 
       
   126     /**
       
   127     * Returns the event type
       
   128     * @return TESMRCalendarEventType
       
   129     */
       
   130     IMPORT_C TESMRCalendarEventType EventType() const;
       
   131 
       
   132     /**
       
   133      * Fetches policy id.
       
   134      * @return policy id.
       
   135      * @see TESMRPolicyID
       
   136      */
       
   137     inline TESMRPolicyID PolicyId() const;
       
   138 
       
   139     /**
       
   140      * Fetches policy view mode.
       
   141      * @return policy view mode.
       
   142      * @see TESMRViewMode
       
   143      */
       
   144     inline TESMRViewMode ViewMode() const;
       
   145 
       
   146     /**
       
   147      * Fetches default fields.
       
   148      * @return Default fields
       
   149      */
       
   150     inline const RArray<TESMREntryField>& Fields() const;
       
   151 
       
   152     /**
       
   153      * Fetches the allowed applicatio for this policy
       
   154      * @return TESMRUsingApp Parent application
       
   155      */
       
   156     inline TESMRUsingApp AllowedApp() const;
       
   157 
       
   158 private: // Implementation
       
   159     CESMRPolicy();
       
   160     void ConstructL(
       
   161             RResourceFile& aRFile,
       
   162             TResourceReader& aReader );
       
   163 
       
   164 private: // data
       
   165     /// Own Event type
       
   166     TESMRCalendarEventType iEventType;
       
   167     /// Own: Policy id
       
   168     TESMRPolicyID iPolicyId;
       
   169     /// Own: Policy MR view mode
       
   170     TESMRViewMode iViewMode;
       
   171     /// Own: Defines role flags
       
   172     TBitFlags16 iRoleFlags;
       
   173     /// Own: Application allowed in this policy
       
   174     TESMRUsingApp iAllowedApp;
       
   175     /// Own: Default MR fields
       
   176     RArray<TESMREntryField> iMRFields;
       
   177     /// Own: Additional MR fields
       
   178     RArray<TESMRCommand> iDefaultCommands;
       
   179     /// Own: Additional commands
       
   180     RArray<TESMRCommand> iAdditionalCommands;
       
   181     };
       
   182 
       
   183 #include "cesmrpolicy.inl"
       
   184 //</cmail>
       
   185 
       
   186 #endif // CESMRPOLICY_H
       
   187 
       
   188 // EOF