226 |
227 |
227 __PRINTS( "CClockMainView::SetNewAlarmL - Exit" ); |
228 __PRINTS( "CClockMainView::SetNewAlarmL - Exit" ); |
228 } |
229 } |
229 |
230 |
230 // --------------------------------------------------------- |
231 // --------------------------------------------------------- |
231 // CClockMainView::RemoveAlarmL |
232 //papercut clock2 Remove_Snooze Start - rajender |
232 // rest of the details are commented in the header |
233 // CClockMainView::RemoveSnoozeL |
233 // --------------------------------------------------------- |
234 // rest of the details are commented in the header |
234 // |
235 // --------------------------------------------------------- |
235 void CClockMainView::RemoveAlarmL() |
236 // |
236 { |
237 void CClockMainView::RemoveSnoozeL() |
237 __PRINTS( "CClockMainView::RemoveAlarmL - Entry" ); |
238 { |
238 |
239 __PRINTS( "CClockMainView::RemoveSnoozeL - Entry" ); |
239 // First get the index of the selected item in the list. |
240 // First get the index of the selected item in the list. |
240 TInt itemIndex( iContainer->ListBox()->CurrentItemIndex() ); |
241 TInt itemIndex( iContainer->ListBox()->CurrentItemIndex() ); |
241 |
242 |
242 if( KErrNone >= itemIndex ) |
243 if( KErrNone > itemIndex ) |
243 { |
244 { |
244 __PRINTS( "CClockMainView::RemoveAlarmL - Exit" ); |
245 __PRINTS( "CClockMainView::RemoveSnoozeL - Exit" ); |
245 |
|
246 return; |
246 return; |
247 } |
247 } |
248 |
248 |
249 |
|
250 SClkAlarmInfo alarmInfo; |
249 SClkAlarmInfo alarmInfo; |
251 TAlarmId alarmId; |
250 TAlarmId alarmId; |
252 // Get the alarm id from alarm model. |
251 // Get the alarm id from alarm model. |
253 iAlarmArray->GetSortedAlmIdInfo( itemIndex, alarmId, alarmInfo ); |
252 iAlarmArray->GetSortedAlmIdInfo( itemIndex, alarmId, alarmInfo ); |
254 |
253 |
255 // Delete the alarm. |
254 // Delete the alarm. |
|
255 User::LeaveIfError( iAlarmModel->AlarmRemoveSnooze( alarmId ) ); |
|
256 |
|
257 // Update the container. |
|
258 iContainer->ListBox()->HandleItemAdditionL(); |
|
259 |
|
260 // Display the confirmation note to the user about alarm deletion. |
|
261 //CAknConfirmationNote* confNote = new( ELeave ) CAknConfirmationNote; |
|
262 //HBufC* confNoteText = StringLoader::LoadLC( R_QTN_CLOCK_SNOOZE_NOTE_REMOVED, iCoeEnv ); |
|
263 // Display the note. |
|
264 //confNote->ExecuteLD( *confNoteText ); |
|
265 // Cleanup. |
|
266 //CleanupStack::PopAndDestroy( confNoteText ); |
|
267 |
|
268 __PRINTS( "CClockMainView::RemoveSnoozeL - Exit" ); |
|
269 |
|
270 } |
|
271 |
|
272 // --------------------------------------------------------- |
|
273 // CClockMainView::RemoveAlarmL |
|
274 // rest of the details are commented in the header |
|
275 // --------------------------------------------------------- |
|
276 // |
|
277 void CClockMainView::RemoveAlarmL( TAlarmId aAlarmId ) |
|
278 { |
|
279 __PRINTS( "CClockMainView::RemoveAlarmL - Entry" ); |
|
280 |
|
281 // First get the index of the selected item in the list. |
|
282 TInt itemIndex( iAlarmArray->ListBoxIndex( aAlarmId ) ); |
|
283 |
|
284 if( KErrNone > itemIndex ) |
|
285 { |
|
286 __PRINTS( "CClockMainView::RemoveAlarmL - Exit" ); |
|
287 |
|
288 return; |
|
289 } |
|
290 // Delete the alarm. |
|
291 User::LeaveIfError( iAlarmModel->DeleteClockAlarm( aAlarmId ) ); |
|
292 // Update the container. |
|
293 iContainer->RemoveAlarmL( itemIndex ); |
|
294 |
|
295 __PRINTS( "CClockMainView::RemoveAlarmL - Exit" ); |
|
296 } |
|
297 |
|
298 // --------------------------------------------------------- |
|
299 // CClockMainView::RemoveAlarmL |
|
300 // rest of the details are commented in the header |
|
301 // --------------------------------------------------------- |
|
302 // |
|
303 void CClockMainView::RemoveAlarmL() |
|
304 { |
|
305 __PRINTS( "CClockMainView::RemoveAlarmL - Entry" ); |
|
306 |
|
307 // First get the index of the selected item in the list. |
|
308 TInt itemIndex( iContainer->ListBox()->CurrentItemIndex() ); |
|
309 |
|
310 if( KErrNone > itemIndex ) |
|
311 { |
|
312 __PRINTS( "CClockMainView::RemoveAlarmL - Exit" ); |
|
313 |
|
314 return; |
|
315 } |
|
316 |
|
317 |
|
318 SClkAlarmInfo alarmInfo; |
|
319 TAlarmId alarmId; |
|
320 // Get the alarm id from alarm model. |
|
321 iAlarmArray->GetSortedAlmIdInfo( itemIndex, alarmId, alarmInfo ); |
|
322 |
|
323 // Delete the alarm. |
256 User::LeaveIfError( iAlarmModel->DeleteClockAlarm( alarmId ) ); |
324 User::LeaveIfError( iAlarmModel->DeleteClockAlarm( alarmId ) ); |
257 |
|
258 // Display the confirmation note to the user about alarm deletion. |
|
259 CAknConfirmationNote* confNote = new( ELeave ) CAknConfirmationNote; |
|
260 HBufC* confNoteText = StringLoader::LoadLC( R_QTN_CLOCK_ALARM_NOTE_DELETED, iCoeEnv ); |
|
261 // Display the note. |
|
262 confNote->ExecuteLD( *confNoteText ); |
|
263 // Cleanup. |
|
264 CleanupStack::PopAndDestroy( confNoteText ); |
|
265 |
|
266 // Update the container. |
325 // Update the container. |
267 iContainer->RemoveAlarmL( itemIndex ); |
326 iContainer->RemoveAlarmL( itemIndex ); |
268 |
327 |
269 |
328 |
270 |
329 |
363 // Update the title pane text. |
422 // Update the title pane text. |
364 static_cast< CClockAppUi* > ( AppUi() )->SetTitlePaneTextL( R_CLOCK_TITLE_MAIN_VIEW ); |
423 static_cast< CClockAppUi* > ( AppUi() )->SetTitlePaneTextL( R_CLOCK_TITLE_MAIN_VIEW ); |
365 |
424 |
366 // Show the navigation pane again. |
425 // Show the navigation pane again. |
367 appUi->MakeNavigationPaneVisible( ETrue, EClockAppMainViewId ); |
426 appUi->MakeNavigationPaneVisible( ETrue, EClockAppMainViewId ); |
368 |
427 |
|
428 if( EClockAlarmDelete == iAlarmId ) |
|
429 { |
|
430 // Mark the alarm editor as closed. |
|
431 iAlarmEditorOpen = EFalse; |
|
432 |
|
433 if( alarmEditor ) |
|
434 { |
|
435 delete alarmEditor; |
|
436 alarmEditor = NULL; |
|
437 } |
|
438 __PRINTS( "CClockMainView::ResetAlarmL:EClockAlarmDelete - Exit" ); |
|
439 |
|
440 // do the removing of the alarm |
|
441 RemoveAlarmL( alarmId ); |
|
442 |
|
443 return; |
|
444 } |
|
445 |
369 if( EClockAlarmExit == iAlarmId ) |
446 if( EClockAlarmExit == iAlarmId ) |
370 { |
447 { |
371 // Mark the alarm editor as closed. |
448 // Mark the alarm editor as closed. |
372 iAlarmEditorOpen = EFalse; |
449 iAlarmEditorOpen = EFalse; |
373 |
450 |
553 |
630 |
554 // If opened from clock, display the navigation pane again. |
631 // If opened from clock, display the navigation pane again. |
555 clockAppUi->MakeNavigationPaneVisible( ETrue, EClockAppMainViewId ); |
632 clockAppUi->MakeNavigationPaneVisible( ETrue, EClockAppMainViewId ); |
556 |
633 |
557 // Activate the container. |
634 // Activate the container. |
558 iContainer->ActivateL(); |
635 if( clockAppUi->TransitionOngoing() ) |
|
636 { |
|
637 //clockAppUi->DoAppearTransition( iContainer ); |
|
638 iContainer->ActivateL(); |
|
639 } |
|
640 else |
|
641 { |
|
642 iContainer->ActivateL(); |
|
643 } |
559 |
644 |
560 __PRINTS( "CClockMainView::DoActivateL - Exit" ); |
645 __PRINTS( "CClockMainView::DoActivateL - Exit" ); |
561 } |
646 } |
562 |
647 |
563 // --------------------------------------------------------- |
648 // --------------------------------------------------------- |
739 aMenuPane->DeleteMenuItem( EAlarmHelpAlarmClock ); |
839 aMenuPane->DeleteMenuItem( EAlarmHelpAlarmClock ); |
740 }*/ |
840 }*/ |
741 |
841 |
742 |
842 |
743 TInt alarmCount = iAlarmArray->MdcaCount(); |
843 TInt alarmCount = iAlarmArray->MdcaCount(); |
744 |
844 TBool deleteRemoveSnooze( EFalse ); |
745 // There are no alarms set or the current focussed listitem is "New Alarm" then remove alarm specific options |
845 |
746 if( KZeroAlarms >= alarmCount || ( KErrNone == iContainer->ListBox()->CurrentItemIndex() ) ) |
846 // There are no alarms set |
|
847 if( KZeroAlarms >= alarmCount ) |
747 { |
848 { |
748 // There are no alarms set. Remove the irrelevant options from the menu. |
849 // There are no alarms set. Remove the irrelevant options from the menu. |
749 aMenuPane->DeleteMenuItem( EClockNewAlarm ); |
|
750 aMenuPane->DeleteMenuItem( EClockResetAlarm ); |
850 aMenuPane->DeleteMenuItem( EClockResetAlarm ); |
751 aMenuPane->DeleteMenuItem( EClockRemoveAlarm ); |
851 aMenuPane->DeleteMenuItem( EClockRemoveAlarm ); |
752 aMenuPane->DeleteMenuItem( EClockActivateAlarm ); |
852 aMenuPane->DeleteMenuItem( EClockActivateAlarm ); |
753 aMenuPane->DeleteMenuItem( EClockDeactivateAlarm ); |
853 aMenuPane->DeleteMenuItem( EClockDeactivateAlarm ); |
|
854 deleteRemoveSnooze = ETrue; |
754 } |
855 } |
755 else |
856 else |
756 { |
857 { |
757 // There is atleast one alarm set. Get the details to update the menu. |
858 // There is atleast one alarm set. Get the details to update the menu. |
758 SClkAlarmInfo alarmInfo; |
859 SClkAlarmInfo alarmInfo; |
771 if( ( EAlarmRepeatDefintionRepeatOnce == alarmInfo.iRepeat ) || |
872 if( ( EAlarmRepeatDefintionRepeatOnce == alarmInfo.iRepeat ) || |
772 ( EAlarmRepeatDefintionRepeatNext24Hours == alarmInfo.iRepeat) ) |
873 ( EAlarmRepeatDefintionRepeatNext24Hours == alarmInfo.iRepeat) ) |
773 { |
874 { |
774 // Alarm is not recurring. Remove the deactivate option from the menu. |
875 // Alarm is not recurring. Remove the deactivate option from the menu. |
775 aMenuPane->DeleteMenuItem( EClockDeactivateAlarm ); |
876 aMenuPane->DeleteMenuItem( EClockDeactivateAlarm ); |
|
877 // no snooze removing needed for not recurring |
|
878 deleteRemoveSnooze = ETrue; |
|
879 } |
|
880 // if the alarm is not snoozed, Remove the 'Remove snooze' option |
|
881 if (alarmInfo.iState != EAlarmStateSnoozed ) |
|
882 { |
|
883 deleteRemoveSnooze = ETrue; |
776 } |
884 } |
777 } |
885 } |
778 else |
886 else |
779 { |
887 { |
780 // Alarm is already inactive. Remove the deactivate option from the menu. |
888 // Alarm is already inactive. Remove the deactivate option from the menu. |
781 aMenuPane->DeleteMenuItem( EClockDeactivateAlarm ); |
889 aMenuPane->DeleteMenuItem( EClockDeactivateAlarm ); |
782 } |
890 deleteRemoveSnooze = ETrue; |
783 } |
891 } |
784 |
892 } |
785 |
893 if( deleteRemoveSnooze ) |
|
894 { |
|
895 aMenuPane->DeleteMenuItem( EClockRemoveSnooze ); |
|
896 } |
786 |
897 |
787 __PRINTS( "CClockMainView::DynInitMenuPaneL - Exit" ); |
898 __PRINTS( "CClockMainView::DynInitMenuPaneL - Exit" ); |
788 } |
899 } |
789 |
900 |
790 // --------------------------------------------------------- |
901 // --------------------------------------------------------- |