|
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: Container base class of Calendar application. |
|
15 * This class is the derivation origin of Calendar container. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef CALENMULTIDBUI_H_ |
|
21 #define CALENMULTIDBUI_H_ |
|
22 |
|
23 // System includes. |
|
24 #include <AknDialog.h> |
|
25 #include <coemain.h> |
|
26 #include <eiklbo.h> |
|
27 #include <aknlists.h> |
|
28 #include <calenservices.h> |
|
29 |
|
30 #include <calennotificationhandler.h> |
|
31 |
|
32 // User includes. |
|
33 #include "calencontroller.h" |
|
34 |
|
35 // Forward declarations. |
|
36 class CEikColumnListBox; |
|
37 class TAknsItemID; |
|
38 class CAknIconArray; |
|
39 class CAknSingleGraphicHeadingStyleListBox; |
|
40 class CAknsBasicBackgroundControlContext; |
|
41 class CAknNavigationControlContainer; |
|
42 class CAknToolbar; |
|
43 class CAknButton; |
|
44 class CCalenMultipleDbListbox; |
|
45 class CCalenMultiDBEditor; |
|
46 |
|
47 class CCalenMultipleDbUi : public CAknDialog, |
|
48 public MEikListBoxObserver, |
|
49 public MCalenNotificationHandler |
|
50 { |
|
51 private: |
|
52 |
|
53 /** |
|
54 * @brief Default constructor |
|
55 * |
|
56 * @param aController reference to the controller |
|
57 */ |
|
58 CCalenMultipleDbUi(CCalenController& aController ); |
|
59 |
|
60 /** |
|
61 * @brief second phase constructor |
|
62 */ |
|
63 void ConstructL(); |
|
64 |
|
65 public: |
|
66 |
|
67 /** |
|
68 * @brief first phase construction |
|
69 * |
|
70 * @aController reference to the controller |
|
71 */ |
|
72 static CCalenMultipleDbUi* NewL( CCalenController& aController ); |
|
73 |
|
74 /** |
|
75 * @brief destructor |
|
76 */ |
|
77 ~CCalenMultipleDbUi(); |
|
78 |
|
79 /** |
|
80 * @brief From CAknDialog.Handles focus change |
|
81 * |
|
82 * @param aDrawNow draw status from CAknDialog. |
|
83 */ |
|
84 void FocusChanged( TDrawNow aDrawNow ); |
|
85 |
|
86 protected: |
|
87 /** |
|
88 * @brief From CEikDialog.Dynamic initialization of the menu pane |
|
89 * |
|
90 * @param aResourceId menu pane resource |
|
91 * @param aMenuPane pointer to the menupane |
|
92 */ |
|
93 void DynInitMenuPaneL( TInt aResourceId,CEikMenuPane* aMenuPane ) ; |
|
94 |
|
95 /** |
|
96 * @brief From MEikMenuObserver.Handles the commands in dialog |
|
97 * |
|
98 * @param aCommandId Not used. |
|
99 */ |
|
100 void ProcessCommandL( TInt aCommandId ) ; |
|
101 |
|
102 /** |
|
103 * @brief From CCoeControl.Handles key events. |
|
104 * |
|
105 * @aKeyEvent key event generated |
|
106 * @aType type of the event code |
|
107 */ |
|
108 TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType) ; |
|
109 |
|
110 /** |
|
111 * @brief From CCoeControl.Handles pointer events |
|
112 * |
|
113 * aPointerEvent reference to the pointer event |
|
114 */ |
|
115 void HandlePointerEventL(const TPointerEvent& aPointerEvent); |
|
116 |
|
117 /** |
|
118 * @brief From CEikDialog.Handles a dialog button press |
|
119 * for the specified button. |
|
120 * |
|
121 * @aButtonId soft key pressed |
|
122 * @return |
|
123 */ |
|
124 TBool OkToExitL( TInt aButtonId ) ; |
|
125 |
|
126 /** |
|
127 * brief From MObjectProvider. |
|
128 * Gets Mop supply object of the given type. |
|
129 * |
|
130 * @param aId Identifier for the supply object. |
|
131 * @return Pointer to the supply object type ID. |
|
132 */ |
|
133 TTypeUid::Ptr MopSupplyObject(TTypeUid aId); |
|
134 |
|
135 /** |
|
136 * brief From CEikDialog.Prepare of controls |
|
137 */ |
|
138 void PreLayoutDynInitL(); |
|
139 |
|
140 /** |
|
141 * From @c CEikDialog. |
|
142 * |
|
143 **/ |
|
144 void PostLayoutDynInitL(); |
|
145 |
|
146 /** |
|
147 * From @c CCoeControl. |
|
148 * Called when controls extent is set. |
|
149 **/ |
|
150 void SizeChanged(); |
|
151 |
|
152 /** |
|
153 * From @c CCoeControl. |
|
154 **/ |
|
155 void HandleResourceChange(TInt aType); |
|
156 |
|
157 /** |
|
158 * From @c CCoeControl. |
|
159 * |
|
160 * @param aIndex index of the control |
|
161 * @return Pointer to the Control. |
|
162 **/ |
|
163 CCoeControl* ComponentControl( TInt aIndex) const; |
|
164 |
|
165 /** |
|
166 * From @c CCoeControl. |
|
167 * |
|
168 * @return Pointer to the Control. |
|
169 **/ |
|
170 TInt CountComponentControls() const; |
|
171 |
|
172 |
|
173 /** |
|
174 * From @c CCoeControl. |
|
175 * |
|
176 * @param aRect |
|
177 **/ |
|
178 void Draw(const TRect &aRect) const; |
|
179 |
|
180 |
|
181 |
|
182 private: //Internal |
|
183 |
|
184 /* |
|
185 * Construction of listbox ui |
|
186 * @return void |
|
187 */ |
|
188 void ConstructListL(); |
|
189 |
|
190 /* |
|
191 * Update listbox contents |
|
192 * @return void |
|
193 */ |
|
194 void UpdateListboxL(); |
|
195 |
|
196 /* |
|
197 * setup title pane for the status pane |
|
198 * @return void |
|
199 */ |
|
200 void SetTitlePaneL(); |
|
201 |
|
202 /* |
|
203 * Create icons based on MCalenServices::TCalenIcon indices |
|
204 * @param aIndexArray MCalenServices::TCalenIcons array for services |
|
205 * @return CAknIconArray* pointer to array of icons |
|
206 */ |
|
207 CAknIconArray* CreateIconsL(RArray<MCalenServices::TCalenIcons>& aIndexArray ); |
|
208 |
|
209 /* |
|
210 * Used for marking list item as visible/hidden |
|
211 * @param aMark TBool based on bool value item is made visible/hidden |
|
212 * @return void |
|
213 */ |
|
214 void DoSelectionL( TBool aMark ); |
|
215 |
|
216 /* |
|
217 * Add new listbox item (calendar) |
|
218 * @return TInt return value of editor |
|
219 */ |
|
220 TInt AddItemL(); |
|
221 |
|
222 /* |
|
223 * Editing listbox item (calendar) |
|
224 * @return TInt return value of editor |
|
225 */ |
|
226 TInt EditItemL(); |
|
227 |
|
228 /* |
|
229 * Delete an listbox item (calendar) |
|
230 * @return void |
|
231 */ |
|
232 TInt DeleteItemL(); |
|
233 /* |
|
234 * Load icons into memory |
|
235 * @return void |
|
236 */ |
|
237 void PrepareIconsL(); |
|
238 |
|
239 /* |
|
240 * Check if any chnages has occured before modifying an item(calendar) |
|
241 * @param aDbInfoOriginal CCalCalendarInfo object before editing |
|
242 * @param aDbInfoModified CCalCalendarInfo object after editing |
|
243 */ |
|
244 TBool CheckForChangesL( CCalCalendarInfo& aCalendarInfoOriginal, |
|
245 CCalCalendarInfo& aCalendarInfoModified); |
|
246 |
|
247 /* |
|
248 * Async exit for the dialog |
|
249 */ |
|
250 static TInt DoAsyncExit(TAny* aPtr); |
|
251 |
|
252 |
|
253 /* |
|
254 * @brief Creates button for the toolbar. |
|
255 * @param aIcon Icon to be displayed for a button. |
|
256 * @param aDisplayTextID text to be displayed for a button. |
|
257 * @param aToolbar toolbar reference. |
|
258 */ |
|
259 CAknButton* CreateButtonL( CGulIcon* aIcon, TInt aDisplayTextID, |
|
260 TInt aTooltipID, CAknToolbar& aToolbar ); |
|
261 |
|
262 /* |
|
263 * @brief set the calendar properties for newly added calendar |
|
264 * @param aCalendarinfo a reference to CCalCalendarInfo. |
|
265 */ |
|
266 void SetCalendarAddPropertiesL(CCalCalendarInfo& aCalendarInfo); |
|
267 |
|
268 /* |
|
269 * @brief update the calendar properties for calendar being edited. |
|
270 * @param aCalendarinfo a reference to CCalCalendarInfo. |
|
271 */ |
|
272 void SetCalendarUpdatePropertiesL(CCalCalendarInfo& aCalendarInfo); |
|
273 |
|
274 /* |
|
275 * Refocus the items in list when delete action happened. |
|
276 */ |
|
277 void ReAdjustListItemFocusL(const TInt aCurrentIndex); |
|
278 |
|
279 public: // from MCalenNotificationHandler |
|
280 /** |
|
281 * @brief Handle notifications |
|
282 * @param aNotification Nofication to be handled |
|
283 */ |
|
284 void HandleNotification(const TCalenNotification aNotification ); |
|
285 |
|
286 public: // from MEikListBoxObserver |
|
287 /** |
|
288 * Handles list box events. |
|
289 * |
|
290 * @param aListBox The originating list box. |
|
291 * @param aEventType A code for the event. Further information |
|
292 * may be obtained by accessing the list box itself. |
|
293 */ |
|
294 void HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType); |
|
295 |
|
296 private: |
|
297 CCalenMultipleDbListbox* iListBox; |
|
298 CAknsBasicBackgroundControlContext* iBgContext; //Owns |
|
299 CAknNavigationControlContainer* iNaviContainer; //Not own |
|
300 CCalenController& iController; |
|
301 CDesCArrayFlat* iDesArray; //Owns |
|
302 TRect iRect; |
|
303 TBool iFirstTap; |
|
304 TBool iDialogLaunched; |
|
305 RArray<MCalenServices::TCalenIcons> iIconIndices; |
|
306 CAknIconArray* iIconList; |
|
307 RArray<TInt32> iColorUidArray; |
|
308 CAsyncCallBack* iAsyncExit; |
|
309 TInt iAsyncExitCmd; |
|
310 CCalenMultiDBEditor* iDbEditor;//Not not owned |
|
311 TBool iConflictOccured; |
|
312 }; |
|
313 |
|
314 |
|
315 NONSHARABLE_CLASS( CCalenMultipleDbListboxItemDrawer ) : public CFormattedCellListBoxItemDrawer |
|
316 { |
|
317 |
|
318 public: |
|
319 CCalenMultipleDbListboxItemDrawer( MTextListBoxModel* aTextListBoxModel, |
|
320 const CFont* aFont, |
|
321 CFormattedCellListBoxData* aFormattedCellData, |
|
322 CEikListBox* aListBox , |
|
323 const RArray<TInt32>& aColorUidArray); |
|
324 |
|
325 ~CCalenMultipleDbListboxItemDrawer(); |
|
326 |
|
327 private: // from CWordWrappedFormattedCellItemDrawer |
|
328 void DrawItem(TInt aItemIndex, |
|
329 TPoint aItemRectPos, |
|
330 TBool aItemIsSelected, |
|
331 TBool aItemIsCurrent, |
|
332 TBool aViewIsEmphasized, |
|
333 TBool aViewIsDimmed) const; |
|
334 |
|
335 private: |
|
336 CEikListBox* iListBox; //Not owns |
|
337 const RArray<TInt32>& iColorUidArray; //Not owns |
|
338 CGulIcon* iIcon; |
|
339 }; |
|
340 |
|
341 NONSHARABLE_CLASS( CCalenMultipleDbListbox ): public CAknDoubleGraphicStyleListBox |
|
342 { |
|
343 public: |
|
344 CCalenMultipleDbListbox(const RArray<TInt32>& aColorUidArray); |
|
345 |
|
346 private: //from CAknDouble2GraphicStyleListBox |
|
347 //CListBoxView* MakeViewClassInstanceL(); |
|
348 void CreateItemDrawerL(); |
|
349 void SizeChanged(); |
|
350 void SizeChangedL(); |
|
351 |
|
352 private: |
|
353 const RArray<TInt32>& iColorUidArray;//Not owns |
|
354 }; |
|
355 |
|
356 #endif /*CALENMULTIDBUI_H_*/ |