|
1 /* |
|
2 * Copyright (c) 2008 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: Model class for Events management UI start-up view. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CEVTMGMTUIMODEL_H |
|
20 #define CEVTMGMTUIMODEL_H |
|
21 |
|
22 // SYSTEM INCLUDES |
|
23 #include <e32base.h> // CBase |
|
24 #include <bamdesca.h> // MDesCArray |
|
25 #include "evtdefs.h" |
|
26 #include "evtmgmtuiengine.h" |
|
27 |
|
28 // Forward Declarations |
|
29 class CEvtBasicEventInfo; |
|
30 typedef TUint32 TEvtEventsStatusMask; |
|
31 |
|
32 /** |
|
33 * Events Management UI start-up view listbox model |
|
34 * |
|
35 * @lib evtmgmtui.exe |
|
36 * @since S60 v5.0 |
|
37 */ |
|
38 class CEvtMgmtUiModel : public CBase, public MDesCArray |
|
39 { |
|
40 public: |
|
41 /** |
|
42 * Enumeration to Currently shown Events |
|
43 */ |
|
44 enum TEvtShowAttribute |
|
45 { |
|
46 EEvtShowAttributeActive = 0x0001, |
|
47 EEvtShowAttributeDraft = 0x0002, |
|
48 EEvtShowAttributeCompleted = 0x0004 |
|
49 }; |
|
50 public: |
|
51 |
|
52 /** |
|
53 * Virtual destructor |
|
54 */ |
|
55 virtual ~CEvtMgmtUiModel(); |
|
56 |
|
57 /** |
|
58 * Static Two phase constructor |
|
59 * |
|
60 * @return CEvtMgmtUiModel*, Pointer to the newly created object. |
|
61 */ |
|
62 static CEvtMgmtUiModel* NewLC(); |
|
63 |
|
64 /** |
|
65 * Static Two phase constructor |
|
66 * |
|
67 * @return CEvtMgmtUiModel*, Pointer to the newly created object. |
|
68 */ |
|
69 static CEvtMgmtUiModel* NewL(); |
|
70 |
|
71 protected: |
|
72 /** |
|
73 * Default constructor |
|
74 */ |
|
75 CEvtMgmtUiModel(); |
|
76 |
|
77 /** |
|
78 * Two phased constructor |
|
79 */ |
|
80 void ConstructL(); |
|
81 |
|
82 public: |
|
83 /* |
|
84 * It will return Events array object reference. |
|
85 * @ret Events array object reference |
|
86 */ |
|
87 RPointerArray<CEvtBasicEventInfo>& EventsArray(); |
|
88 |
|
89 /** |
|
90 * returns eventinfo object. |
|
91 * @param[in] aIndex index of event in array |
|
92 */ |
|
93 CEvtBasicEventInfo& EventFromModel( TInt aIndex ); |
|
94 |
|
95 /** |
|
96 * Returns total events. |
|
97 * @ret Number of Events in the model |
|
98 */ |
|
99 TInt TotalEvents(); |
|
100 |
|
101 /** |
|
102 * Return Event Id based on the Index |
|
103 * @param[in] aIndex index of event in array |
|
104 * @ret Event Id |
|
105 */ |
|
106 TEvtEventId EventId( TInt aIndex ); |
|
107 |
|
108 /** |
|
109 * Returns the Updated current Item Index |
|
110 * Called after the model is updated. |
|
111 * @ret Updated current item Index |
|
112 */ |
|
113 TInt UpdatedCurrentItemIndex(); |
|
114 |
|
115 /** |
|
116 * Set the Current Item Index |
|
117 * Called before the model is updated. |
|
118 * @param[in] aIndex index of event in array |
|
119 */ |
|
120 void SetCurrentItemId( TInt aItemIndex ); |
|
121 |
|
122 /** |
|
123 * Check for Mandatory Fields of an Event |
|
124 * @param aIndex Index in the model. |
|
125 * @param[in] aIndex index of event in array |
|
126 * @ret ETrue If mandatory fields are filled. |
|
127 */ |
|
128 TBool MandatoryFieldsFilled( TInt aIndex ); |
|
129 |
|
130 /** |
|
131 * Return Event status based on the Index on the model |
|
132 * @param[in] aIndex index of event in array |
|
133 * @ret Event Status based on the Index |
|
134 */ |
|
135 TEvtEventStatus EventStatus( TInt aIndex ); |
|
136 |
|
137 /** |
|
138 * Update the Events Status Mask |
|
139 * Called after the Model is updated. |
|
140 */ |
|
141 void UpdateEventsStatus(); |
|
142 |
|
143 /** |
|
144 * Return Bit Mask which has the Status of all the |
|
145 * Events present in the Model |
|
146 * @ret Status Bit Mask of the events present in model |
|
147 */ |
|
148 TEvtEventsStatusMask EventsStatus(); |
|
149 |
|
150 /** |
|
151 * Currently active Status Filter |
|
152 * @ret Currently active Status Filter |
|
153 */ |
|
154 CEvtMgmtUiEngine::TEvtEventStatusFilter StatusFilter( ); |
|
155 |
|
156 /** |
|
157 * Set the Status Filter |
|
158 * @param[in] aFilter Filter to be Set for the model |
|
159 */ |
|
160 void SetStatusFilter( CEvtMgmtUiEngine::TEvtEventStatusFilter |
|
161 aFilter ); |
|
162 |
|
163 private: |
|
164 /** |
|
165 * Return Index based on the Status Filter |
|
166 */ |
|
167 TInt IndexBasedOnFilter( TInt aIndex ) const; |
|
168 |
|
169 /** |
|
170 * Return Index without the Status Filter |
|
171 */ |
|
172 TInt IndexWithoutFilter( TInt aIndex ) const; |
|
173 |
|
174 private: |
|
175 /** |
|
176 * Inherited from MDesCArray |
|
177 */ |
|
178 TInt MdcaCount() const; |
|
179 |
|
180 /** |
|
181 * Inherited from MDesCArray |
|
182 */ |
|
183 TPtrC16 MdcaPoint( TInt aIndex ) const; |
|
184 |
|
185 private: |
|
186 /** |
|
187 * Update Type |
|
188 */ |
|
189 enum TEvtModelUpdateState |
|
190 { |
|
191 EEvtCreate = 0x0001, |
|
192 EEvtModify, |
|
193 EEvtDelete |
|
194 }; |
|
195 private: |
|
196 /** |
|
197 * events array |
|
198 * Owns |
|
199 */ |
|
200 RPointerArray<CEvtBasicEventInfo> iEventsArray; |
|
201 |
|
202 /** |
|
203 * Conversion buffer |
|
204 * Owns |
|
205 */ |
|
206 HBufC* iBuffer; |
|
207 |
|
208 /** |
|
209 * Buffer containing the text for Create new trigger |
|
210 * Owns |
|
211 */ |
|
212 HBufC* iCreateNew; |
|
213 |
|
214 /** |
|
215 * Buffer containing the text for Unnamed String |
|
216 * Owns |
|
217 */ |
|
218 HBufC* iUnnamed; |
|
219 |
|
220 /** |
|
221 * Active Triggers count |
|
222 */ |
|
223 TInt iActiveTriggers; |
|
224 |
|
225 /** |
|
226 * Draft Triggers count |
|
227 */ |
|
228 TInt iDraftTriggers; |
|
229 |
|
230 /** |
|
231 * Completed Triggers count |
|
232 */ |
|
233 TInt iCompletedTriggers; |
|
234 |
|
235 /** |
|
236 * Currently Focused Event Id to be maintained before model Update |
|
237 */ |
|
238 TEvtEventId iCurrentEventId; |
|
239 |
|
240 /** |
|
241 * Currently Focused Event Index to be maintained before model Update |
|
242 */ |
|
243 TInt iCurrentEventIndex; |
|
244 |
|
245 /** |
|
246 * Bitmask Flag to hold the status of the currently present Events |
|
247 */ |
|
248 TEvtEventsStatusMask iEventsStatusMask; |
|
249 |
|
250 /** |
|
251 * Status Filter used to show the events based on Event Status |
|
252 */ |
|
253 CEvtMgmtUiEngine::TEvtEventStatusFilter iStatusFilter; |
|
254 }; |
|
255 |
|
256 #endif // CEVTMGMTUIMODEL_H |
|
257 // End of File |