|
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 //<cmail> |
|
24 #include "esmrutilsapiext.h" |
|
25 #include <barsc.h> |
|
26 #include "esmrdef.h" |
|
27 #include "tesmrscenariodata.h" |
|
28 |
|
29 class CESMRPolicy; |
|
30 class MESMRCalEntry; |
|
31 class MESMRPolicyChecker; |
|
32 class CESMRPolicyChecker; |
|
33 class CESMRPolicyExtensionManager; |
|
34 class CCoeEnv; |
|
35 |
|
36 /** |
|
37 * CESMRPolicyManager defines ESMR policymanager. |
|
38 * ES MR policies are relates to different roles and task scenarions. |
|
39 * Policies are used by user interface views and tasks. CESMRPolicyManager |
|
40 * provides interface for accessing these policies. |
|
41 * CESMRPolicyManager uses CCoeEnv. |
|
42 * |
|
43 * @see CESMRPolicy |
|
44 * @lib esmrpolicy.lib |
|
45 */ |
|
46 NONSHARABLE_CLASS(CESMRPolicyManager) : |
|
47 public CBase |
|
48 { |
|
49 public: // Construction and destruction |
|
50 /** |
|
51 * Two-phased constructor. Creates new CESMRPolicyManager object. |
|
52 * Ownership is transferred to caller. |
|
53 * |
|
54 * @return Pointer to created and initialized esmr policy object. |
|
55 */ |
|
56 IMPORT_C static CESMRPolicyManager* NewL(); |
|
57 |
|
58 /** |
|
59 * C++ destructor. |
|
60 */ |
|
61 IMPORT_C ~CESMRPolicyManager(); |
|
62 |
|
63 public: // Interface |
|
64 /** |
|
65 * Fetches current policy object. |
|
66 * @return Current policy object |
|
67 */ |
|
68 inline CESMRPolicy& CurrentPolicy(); |
|
69 |
|
70 /** |
|
71 * Fetches the extension UID for ES MR policy manager |
|
72 * @return Uid of extension |
|
73 */ |
|
74 IMPORT_C static TUid ExtensionUid(); |
|
75 |
|
76 /** |
|
77 * Resolves policy to be used. |
|
78 * @param aScenarioData Scenario Data for resolving correct policy |
|
79 * @param aESMREntry Reference to ES MR Entry. |
|
80 * @param aPolicyChecker to be used. If NULL, default checker is used |
|
81 */ |
|
82 IMPORT_C void ResolvePolicyL( |
|
83 const TESMRScenarioData& aScenarioData, |
|
84 MESMRCalEntry& aESMREntry, |
|
85 MESMRPolicyChecker* aPolicyChecker ); |
|
86 |
|
87 /** |
|
88 * Reads policy from resource file. Policies are appended |
|
89 * @param aPolicyFile Policy resource filename. |
|
90 * @param aPolicyArrayResourceId Policy array resource id |
|
91 */ |
|
92 IMPORT_C void ReadPolicyFromResourceL( |
|
93 const TDesC& aPolicyFile, |
|
94 TInt aPolicyArrayResourceId ); |
|
95 |
|
96 /** |
|
97 * Adds the current policy on stack for preserving it if a new policy |
|
98 * needs to be resolved and the current policy is still needed afterwards. |
|
99 */ |
|
100 IMPORT_C void PushPolicyL(); |
|
101 |
|
102 /** |
|
103 * Restores the topmost policy from the stack as the current policy. |
|
104 * @return the policy from stack or NULL if stack is empty. |
|
105 */ |
|
106 IMPORT_C CESMRPolicy* PopPolicy(); |
|
107 |
|
108 private: // Implementation |
|
109 |
|
110 CESMRPolicyManager(); |
|
111 void ConstructL(); |
|
112 void ReadPolicyL( |
|
113 TInt aResourceId, |
|
114 MESMRCalEntry& aESMREntry ); |
|
115 |
|
116 private: // data |
|
117 |
|
118 /** |
|
119 * Current policy object |
|
120 * Own. |
|
121 */ |
|
122 CESMRPolicy* iCurrentPolicy; |
|
123 |
|
124 /** |
|
125 * Policy resource file |
|
126 * Own |
|
127 */ |
|
128 RResourceFile iPolicyResourceFile; |
|
129 |
|
130 /** |
|
131 * ESMR policy resource ids |
|
132 * Own. |
|
133 */ |
|
134 RArray<TInt> iPolicyResourceIds; |
|
135 |
|
136 /** |
|
137 * Default ESMR policy checker. |
|
138 * Own. |
|
139 */ |
|
140 CESMRPolicyChecker* iDefaultPolicyChecker; |
|
141 |
|
142 // Own: Extension resource manager |
|
143 CESMRPolicyExtensionManager* iExtension; |
|
144 |
|
145 // Ref: Coe Env |
|
146 CCoeEnv* iCoeEnv; |
|
147 |
|
148 /** |
|
149 * Array for preserving policies |
|
150 */ |
|
151 RPointerArray< CESMRPolicy > iPolicyStack; |
|
152 }; |
|
153 |
|
154 #include "cesmrpolicymanager.inl" |
|
155 //</cmail> |
|
156 |
|
157 #endif // CESMRPOLICYMANAGER_H |