|
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: Missed alarms view description |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // System Includes |
|
21 #include <aknlists.h> |
|
22 #include <StringLoader.h> |
|
23 #include <eikmenup.h> |
|
24 #include <hlplch.h> |
|
25 #include <featmgr.h> |
|
26 #include <aknbutton.h> |
|
27 #include <akntoolbar.h> |
|
28 #include <Calendar.rsg> |
|
29 #include <CalenDefaultEditorsData.rsg> |
|
30 #include <calencommands.hrh> // Calendar commands |
|
31 #include <CalenStatusPaneUtils.h> |
|
32 #include <calennotificationhandler.h> |
|
33 #include <calencontext.h> |
|
34 |
|
35 // User Includes |
|
36 #include "calendarui_debug.h" |
|
37 #include "calenmissedalarmsview.h" |
|
38 #include "calenmissedalarmscontainer.h" |
|
39 #include "calencontainer.h" |
|
40 #include "calentitlepane.h" |
|
41 #include "CalenUid.h" |
|
42 |
|
43 _LIT8( KCommandMissedAlarmsView,"MAV" ); |
|
44 const TInt KSK2CBAPosition = 2; |
|
45 |
|
46 // ----------------------------------------------------------------------------- |
|
47 // CCalenMissedAlarmsView::NewLC |
|
48 // Symbian OS 2 phased constructor. |
|
49 // ----------------------------------------------------------------------------- |
|
50 // |
|
51 EXPORT_C CCalenMissedAlarmsView* CCalenMissedAlarmsView::NewL( MCalenServices& aServices ) |
|
52 { |
|
53 TRACE_ENTRY_POINT; |
|
54 |
|
55 CCalenMissedAlarmsView* self = new( ELeave )CCalenMissedAlarmsView(aServices); |
|
56 CleanupStack::PushL( self ); |
|
57 self->ConstructL(); |
|
58 CleanupStack::Pop( self ); |
|
59 |
|
60 TRACE_EXIT_POINT; |
|
61 return self; |
|
62 } |
|
63 |
|
64 // ----------------------------------------------------------------------------- |
|
65 // CCalenMissedAlarmsView::ConstructL |
|
66 // Performs the second phase construction. |
|
67 // ----------------------------------------------------------------------------- |
|
68 // |
|
69 void CCalenMissedAlarmsView::ConstructL() |
|
70 { |
|
71 TRACE_ENTRY_POINT; |
|
72 |
|
73 CommonConstructL( R_MISSED_ALARMS_VIEW ); |
|
74 |
|
75 TRACE_EXIT_POINT; |
|
76 } |
|
77 |
|
78 // ---------------------------------------------------------------------------- |
|
79 // CCalenMissedAlarmsView::CCalenEventView |
|
80 // C++ constructor. |
|
81 // ---------------------------------------------------------------------------- |
|
82 // |
|
83 CCalenMissedAlarmsView::CCalenMissedAlarmsView( MCalenServices& aServices ) |
|
84 : CCalenNativeView( aServices ), |
|
85 iPopulationStep( ENothingDone ) |
|
86 { |
|
87 TRACE_ENTRY_POINT; |
|
88 TRACE_EXIT_POINT; |
|
89 } |
|
90 |
|
91 // ---------------------------------------------------------------------------- |
|
92 // CCalenMissedAlarmsView::~CCalenMissedAlarmsView |
|
93 // Destructor |
|
94 // ---------------------------------------------------------------------------- |
|
95 // |
|
96 CCalenMissedAlarmsView::~CCalenMissedAlarmsView() |
|
97 { |
|
98 TRACE_ENTRY_POINT; |
|
99 TRACE_EXIT_POINT; |
|
100 } |
|
101 |
|
102 // ---------------------------------------------------------------------------- |
|
103 // CCalenMissedAlarmsView::ActiveStepL |
|
104 // From CCalenView:State machine for view population |
|
105 // ---------------------------------------------------------------------------- |
|
106 // |
|
107 CCalenView::TNextPopulationStep CCalenMissedAlarmsView::ActiveStepL() |
|
108 { |
|
109 TRACE_ENTRY_POINT; |
|
110 |
|
111 CCalenView::TNextPopulationStep nextStep = CCalenView::EDone; |
|
112 |
|
113 switch( iPopulationStep ) |
|
114 { |
|
115 case ENothingDone: |
|
116 { |
|
117 iPopulationStep = EPopulationDone; |
|
118 nextStep = CCalenView::EKeepGoing; |
|
119 } |
|
120 break; |
|
121 case EPopulationDone: |
|
122 { |
|
123 if(Container()) |
|
124 { |
|
125 // update missed alarm list |
|
126 Container()->UpdateMissedAlarmsArrayL(); |
|
127 |
|
128 // populate with missed alarms |
|
129 Container()->PopulateWithMissedAlarmsL(); |
|
130 |
|
131 // complete population |
|
132 Container()->CompletePopulationL(); |
|
133 |
|
134 RedrawStatusPaneL(); |
|
135 UpdateCbaL(); |
|
136 |
|
137 //no tool bar in missed alarms view |
|
138 MCalenToolbar* toolbar = iServices.ToolbarOrNull(); |
|
139 if(toolbar && toolbar->IsVisible()) |
|
140 { |
|
141 toolbar->SetToolbarVisibilityL(EFalse); |
|
142 } |
|
143 nextStep = CCalenView::EDone; |
|
144 } |
|
145 } |
|
146 break; |
|
147 } |
|
148 TRACE_EXIT_POINT; |
|
149 return nextStep; |
|
150 } |
|
151 |
|
152 // ---------------------------------------------------------------------------- |
|
153 // CCalenMissedAlarmsView::CancelPopulation |
|
154 // From CCalenView:Cencel view population |
|
155 // ---------------------------------------------------------------------------- |
|
156 // |
|
157 void CCalenMissedAlarmsView::CancelPopulation() |
|
158 { |
|
159 TRACE_ENTRY_POINT; |
|
160 |
|
161 iPopulationStep = ENothingDone; |
|
162 |
|
163 TRACE_EXIT_POINT; |
|
164 } |
|
165 |
|
166 // ---------------------------------------------------------------------------- |
|
167 // CCalenMissedAlarmsView::LocalisedViewNameL |
|
168 // From CCalenView:Localised view name |
|
169 // ---------------------------------------------------------------------------- |
|
170 // |
|
171 const TDesC& CCalenMissedAlarmsView::LocalisedViewNameL( CCalenView::TViewName aViewName ) |
|
172 { |
|
173 TRACE_ENTRY_POINT; |
|
174 |
|
175 HBufC* ret = NULL; |
|
176 |
|
177 switch ( aViewName ) |
|
178 { |
|
179 case CCalenView::EMenuName: |
|
180 if ( !iMenuName ) |
|
181 { |
|
182 iMenuName = StringLoader::LoadL( R_CALE_TITLE_MISSED_ALARMS, iCoeEnv ); |
|
183 } |
|
184 ret = iMenuName; |
|
185 break; |
|
186 case CCalenView::ESettingsName: |
|
187 if ( !iSettingsName ) |
|
188 { |
|
189 iSettingsName = StringLoader::LoadL( R_CALE_TITLE_MISSED_ALARMS, |
|
190 iCoeEnv ); |
|
191 } |
|
192 ret = iSettingsName; |
|
193 break; |
|
194 default: |
|
195 ASSERT( EFalse ); |
|
196 break; |
|
197 } |
|
198 |
|
199 TRACE_EXIT_POINT; |
|
200 return *ret; |
|
201 } |
|
202 |
|
203 // ---------------------------------------------------------------------------- |
|
204 // CCalenMissedAlarmsView::ViewIcon |
|
205 // From CCalenView: Returns view specific icon |
|
206 // ---------------------------------------------------------------------------- |
|
207 // |
|
208 CGulIcon* CCalenMissedAlarmsView::ViewIconL() const |
|
209 { |
|
210 TRACE_ENTRY_POINT; |
|
211 TRACE_EXIT_POINT; |
|
212 // using clear all missed alarms icon as view icon |
|
213 return iServices.GetIconL( MCalenServices::ECalenClearAllMissedAlarms ); |
|
214 } |
|
215 |
|
216 // ----------------------------------------------------------------------------- |
|
217 // CCalenMissedAlarmsView::HandleCommandL |
|
218 // Handles the commands that are passed from softkey generated commands and menus. |
|
219 // ----------------------------------------------------------------------------- |
|
220 // |
|
221 void CCalenMissedAlarmsView::HandleCommandL(TInt aCommand) |
|
222 { |
|
223 TRACE_ENTRY_POINT; |
|
224 |
|
225 switch(aCommand) |
|
226 { |
|
227 case ECalenMissedEventView: |
|
228 case EAknSoftkeyOpen: |
|
229 { |
|
230 iHighlightedRowNumber = Container()->CurrentItemIndex(); |
|
231 iServices.IssueCommandL(ECalenMissedEventView); |
|
232 break; |
|
233 } |
|
234 case ECalenCmdClear: |
|
235 { |
|
236 iHighlightedRowNumber = Container()->CurrentItemIndex(); |
|
237 iServices.IssueCommandL(aCommand); |
|
238 break; |
|
239 } |
|
240 case ECalenCmdClearAll: |
|
241 { |
|
242 iHighlightedRowNumber = 0; |
|
243 iServices.IssueCommandL(aCommand); |
|
244 } |
|
245 break; |
|
246 case ECalenCmdGotoCalendar: |
|
247 { |
|
248 iHighlightedRowNumber = 0; |
|
249 iServices.IssueNotificationL(ECalenNotifyClearMissedAlarms); |
|
250 iServices.IssueCommandL(aCommand); |
|
251 } |
|
252 break; |
|
253 case EAknSoftkeyBack: |
|
254 case EAknSoftkeyClose: |
|
255 { |
|
256 MCalenToolbar* toolbar = iServices.ToolbarOrNull(); |
|
257 if(toolbar) |
|
258 { |
|
259 toolbar->SetToolbarVisibilityL(ETrue); |
|
260 } |
|
261 iHighlightedRowNumber = 0; |
|
262 iServices.IssueNotificationL(ECalenNotifyMissedAlarmViewClosed); |
|
263 } |
|
264 break; |
|
265 case EAknSoftkeyExit: |
|
266 { |
|
267 iServices.IssueNotificationL(ECalenNotifyClearMissedAlarms); |
|
268 CCalenNativeView::HandleCommandL(aCommand); |
|
269 } |
|
270 break; |
|
271 default: |
|
272 CCalenNativeView::HandleCommandL(aCommand); |
|
273 break; |
|
274 } |
|
275 |
|
276 TRACE_EXIT_POINT; |
|
277 } |
|
278 |
|
279 // ---------------------------------------------------------------------------- |
|
280 // CCalenMissedAlarmsView::DoActivateImplL |
|
281 // Take action before activating the view |
|
282 // ---------------------------------------------------------------------------- |
|
283 // |
|
284 void CCalenMissedAlarmsView::DoActivateImplL( const TVwsViewId& aPrevViewId, |
|
285 TUid aCustomMessageId , |
|
286 const TDesC8& aCustomMessage ) |
|
287 { |
|
288 TRACE_ENTRY_POINT; |
|
289 |
|
290 // if missed alarms view launched from soft notification/indicator |
|
291 if( (aPrevViewId.iAppUid != KUidCalendar )|| |
|
292 (aCustomMessageId == KUidCalenShowCloseCba ) ) |
|
293 { |
|
294 iShowCloseButtonOnCba = ETrue; |
|
295 |
|
296 // get the custom view message |
|
297 HBufC8* temp = aCustomMessage.AllocLC(); |
|
298 TPtr8 des = temp->Des(); |
|
299 des.UpperCase(); |
|
300 |
|
301 if( des.Find( KCommandMissedAlarmsView) != KErrNotFound ) |
|
302 { |
|
303 iServices.IssueCommandL(ECalenMissedAlarmsViewFromIdle); |
|
304 } |
|
305 CleanupStack::PopAndDestroy( temp ); |
|
306 } |
|
307 else |
|
308 { |
|
309 iShowCloseButtonOnCba = EFalse; |
|
310 } |
|
311 |
|
312 UpdateCbaL(); |
|
313 |
|
314 |
|
315 TRACE_EXIT_POINT; |
|
316 } |
|
317 |
|
318 // ---------------------------------------------------------------------------- |
|
319 // CCalenMissedAlarmsView::DoDeactivateImpl |
|
320 // Take action before view deactivation |
|
321 // ---------------------------------------------------------------------------- |
|
322 // |
|
323 void CCalenMissedAlarmsView::DoDeactivateImpl() |
|
324 { |
|
325 TRACE_ENTRY_POINT; |
|
326 /*MCalenToolbar* toolbar = iServices.ToolbarOrNull(); |
|
327 if(toolbar) |
|
328 { |
|
329 toolbar->SetToolbarVisibilityL(ETrue); |
|
330 } */ |
|
331 TRACE_EXIT_POINT; |
|
332 } |
|
333 |
|
334 // ---------------------------------------------------------------------------- |
|
335 // CCalenMissedAlarmsView::OnLocaleChangedL |
|
336 // Handle locale changes |
|
337 // ---------------------------------------------------------------------------- |
|
338 // |
|
339 void CCalenMissedAlarmsView::OnLocaleChangedL(TInt aReason) |
|
340 { |
|
341 TRACE_ENTRY_POINT; |
|
342 |
|
343 if(iContainer) |
|
344 { |
|
345 if(IsContainerFocused()) |
|
346 { |
|
347 if (aReason & EChangesLocale) |
|
348 { |
|
349 BeginRepopulationL(); |
|
350 } |
|
351 else |
|
352 { |
|
353 RedrawStatusPaneL(); |
|
354 } |
|
355 } |
|
356 else |
|
357 { |
|
358 iLocChangeReason = EChangesLocale; |
|
359 } |
|
360 } |
|
361 |
|
362 TRACE_EXIT_POINT; |
|
363 } |
|
364 |
|
365 // ---------------------------------------------------------------------------- |
|
366 // CCalenMissedAlarmsView::RedrawStatusPaneL |
|
367 // Redraw status pane |
|
368 // ---------------------------------------------------------------------------- |
|
369 // |
|
370 void CCalenMissedAlarmsView::RedrawStatusPaneL() |
|
371 { |
|
372 TRACE_ENTRY_POINT; |
|
373 |
|
374 HBufC* titleText = StringLoader::LoadLC( R_CALE_TITLE_MISSED_ALARMS, iCoeEnv ); |
|
375 iSPUtils->UnderLineTitleText( EFalse ); |
|
376 iSPUtils->SetTitleText( titleText ); // ownership passed |
|
377 CleanupStack::Pop( titleText ); |
|
378 iSPUtils->RefreshStatusPane(); |
|
379 |
|
380 TRACE_EXIT_POINT; |
|
381 } |
|
382 |
|
383 // ---------------------------------------------------------------------------- |
|
384 // CCalenMissedAlarmsView::ClearViewSpecificDataL |
|
385 // Clear view specific data |
|
386 // ---------------------------------------------------------------------------- |
|
387 // |
|
388 void CCalenMissedAlarmsView::ClearViewSpecificDataL() |
|
389 { |
|
390 TRACE_ENTRY_POINT; |
|
391 TRACE_EXIT_POINT; |
|
392 } |
|
393 |
|
394 // ---------------------------------------------------------------------------- |
|
395 // CCalenMissedAlarmsView::CyclePosition |
|
396 // Returns view's cycle position |
|
397 // ---------------------------------------------------------------------------- |
|
398 // |
|
399 CCalenView::TCyclePosition CCalenMissedAlarmsView::CyclePosition() const |
|
400 { |
|
401 TRACE_ENTRY_POINT; |
|
402 TRACE_EXIT_POINT; |
|
403 |
|
404 return ENoCyclePosition; |
|
405 } |
|
406 |
|
407 // ----------------------------------------------------------------------------- |
|
408 // CCalenMissedAlarmsView::Id |
|
409 // Returns the unique id of the view. |
|
410 // ----------------------------------------------------------------------------- |
|
411 // |
|
412 TUid CCalenMissedAlarmsView::Id() const |
|
413 { |
|
414 TRACE_ENTRY_POINT; |
|
415 TRACE_EXIT_POINT; |
|
416 |
|
417 return KUidCalenMissedAlarmsView; |
|
418 } |
|
419 |
|
420 // ----------------------------------------------------------------------------- |
|
421 // CCalenMissedAlarmsView::DynInitMenuPaneL |
|
422 // Called by the framework for dynamically initializing the menu pane. |
|
423 // ----------------------------------------------------------------------------- |
|
424 // |
|
425 void CCalenMissedAlarmsView::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane) |
|
426 { |
|
427 TRACE_ENTRY_POINT; |
|
428 |
|
429 switch(aResourceId) |
|
430 { |
|
431 case R_MISSED_ALARMS_MENUPANE: |
|
432 { |
|
433 if(Container()->MissedAlarmsCount() == 0) |
|
434 { |
|
435 aMenuPane->DeleteMenuItem(ECalenMissedEventView); |
|
436 aMenuPane->DeleteMenuItem(ECalenCmdClear); |
|
437 aMenuPane->DeleteMenuItem(ECalenCmdClearAll); |
|
438 } |
|
439 break; |
|
440 } |
|
441 default: |
|
442 break; |
|
443 } |
|
444 |
|
445 TRACE_EXIT_POINT; |
|
446 } |
|
447 |
|
448 // ----------------------------------------------------------------------------- |
|
449 // CCalenMissedAlarmsView::UpdateCbaL |
|
450 // Updates the cba for Missed Alarms View |
|
451 // ----------------------------------------------------------------------------- |
|
452 // |
|
453 void CCalenMissedAlarmsView::UpdateCbaL() |
|
454 { |
|
455 TRACE_ENTRY_POINT; |
|
456 |
|
457 CEikButtonGroupContainer* cba = Cba(); |
|
458 cba->SetCommandSetL(R_MISSED_ALARMS_CBA); |
|
459 |
|
460 if(iShowCloseButtonOnCba) |
|
461 { |
|
462 cba->SetCommandL(KSK2CBAPosition,R_CALEN_CLOSE_CBA_BUTTON); |
|
463 } |
|
464 |
|
465 if(Container()->MissedAlarmsCount()) |
|
466 { |
|
467 // msk "open" is visible if there are missed alarms |
|
468 cba->MakeCommandVisible( EAknSoftkeyOpen, ETrue ); |
|
469 } |
|
470 else |
|
471 { |
|
472 // msk empty if there are no missed alarms |
|
473 cba->MakeCommandVisible( EAknSoftkeyOpen, EFalse ); |
|
474 } |
|
475 |
|
476 cba->DrawNow(); |
|
477 |
|
478 TRACE_EXIT_POINT; |
|
479 } |
|
480 |
|
481 // ---------------------------------------------------------------------------- |
|
482 // CCalenMissedAlarmsView::CreateContainerImplL |
|
483 // (other items were commented in a header). |
|
484 // ---------------------------------------------------------------------------- |
|
485 // |
|
486 CCalenContainer* CCalenMissedAlarmsView::CreateContainerImplL() |
|
487 { |
|
488 TRACE_ENTRY_POINT; |
|
489 TRACE_EXIT_POINT; |
|
490 return new( ELeave )CCalenMissedAlarmsContainer( this, |
|
491 iServices, iHighlightedRowNumber ); |
|
492 } |
|
493 |
|
494 // ---------------------------------------------------------------------------- |
|
495 // CCalenMissedAlarmsView::Container |
|
496 // Return the container pointer. |
|
497 // ---------------------------------------------------------------------------- |
|
498 // |
|
499 CCalenMissedAlarmsContainer* CCalenMissedAlarmsView::Container() |
|
500 { |
|
501 TRACE_ENTRY_POINT; |
|
502 TRACE_EXIT_POINT; |
|
503 |
|
504 return static_cast<CCalenMissedAlarmsContainer*>( iContainer ); |
|
505 } |
|
506 |
|
507 // end of file |