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