9 * Initial Contributors: |
9 * Initial Contributors: |
10 * Nokia Corporation - initial contribution. |
10 * Nokia Corporation - initial contribution. |
11 * |
11 * |
12 * Contributors: |
12 * Contributors: |
13 * |
13 * |
14 * Description: Calendar state machine |
14 * Description: Calendar state machine |
15 * |
15 * |
16 */ |
16 */ |
|
17 |
17 |
18 |
18 |
19 |
19 // includes |
20 // includes |
20 #include "calendeletingstate.h" |
21 #include "calendeletingstate.h" |
21 #include "calendarui_debug.h" // Debug macros |
22 #include "calendarui_debug.h" // Debug macros |
22 #include "calencontroller.h" |
23 #include "calencontroller.h" |
23 #include "calenstatemachine.h" |
24 #include "calenstatemachine.h" |
24 #include "calennotifier.h" |
25 #include "calennotifier.h" |
25 #include "OstTraceDefinitions.h" |
|
26 #ifdef OST_TRACE_COMPILER_IN_USE |
|
27 #include "calendeletingstateTraces.h" |
|
28 #endif |
|
29 |
26 |
30 // ---------------------------------------------------------------------------- |
27 // ---------------------------------------------------------------------------- |
31 // CCalenDeletingState::NewLC |
28 // CCalenDeletingState::NewLC |
32 // First stage construction |
29 // First stage construction |
33 // ---------------------------------------------------------------------------- |
30 // ---------------------------------------------------------------------------- |
34 CCalenDeletingState* CCalenDeletingState::NewLC( CCalenController& aController, |
31 CCalenDeletingState* CCalenDeletingState::NewLC( CCalenController& aController, |
35 RHashSet<TCalenNotification>& aOutstandingNotifications ) |
32 RHashSet<TCalenNotification>& aOutstandingNotifications ) |
36 { |
33 { |
37 OstTraceFunctionEntry0( CCALENDELETINGSTATE_NEWLC_ENTRY ); |
34 TRACE_ENTRY_POINT; |
38 |
35 |
39 CCalenDeletingState* self = new( ELeave ) CCalenDeletingState( aController,aOutstandingNotifications ); |
36 CCalenDeletingState* self = new( ELeave ) CCalenDeletingState( aController,aOutstandingNotifications ); |
40 |
37 |
41 CleanupStack::PushL( self ); |
38 CleanupStack::PushL( self ); |
42 self->ConstructL(); |
39 self->ConstructL(); |
43 |
40 |
44 OstTraceFunctionExit0( CCALENDELETINGSTATE_NEWLC_EXIT ); |
41 TRACE_EXIT_POINT; |
45 return self; |
42 return self; |
46 } |
43 } |
47 |
44 |
48 // ---------------------------------------------------------------------------- |
45 // ---------------------------------------------------------------------------- |
49 // CCalenDeletingState::ConstructL |
46 // CCalenDeletingState::ConstructL |
50 // Second stage construction |
47 // Second stage construction |
51 // ---------------------------------------------------------------------------- |
48 // ---------------------------------------------------------------------------- |
52 void CCalenDeletingState::ConstructL() |
49 void CCalenDeletingState::ConstructL() |
53 { |
50 { |
54 OstTraceFunctionEntry0( CCALENDELETINGSTATE_CONSTRUCTL_ENTRY ); |
51 TRACE_ENTRY_POINT; |
55 |
|
56 BaseConstructL(); |
52 BaseConstructL(); |
57 |
53 |
58 OstTraceFunctionExit0( CCALENDELETINGSTATE_CONSTRUCTL_EXIT ); |
54 TRACE_EXIT_POINT; |
59 } |
55 } |
60 |
56 |
61 // ---------------------------------------------------------------------------- |
57 // ---------------------------------------------------------------------------- |
62 // CCalenDeletingState::CCalenDeletingState |
58 // CCalenDeletingState::CCalenDeletingState |
63 // C++ Constructor |
59 // C++ Constructor |
64 // ---------------------------------------------------------------------------- |
60 // ---------------------------------------------------------------------------- |
65 CCalenDeletingState::CCalenDeletingState( CCalenController& aController, |
61 CCalenDeletingState::CCalenDeletingState( CCalenController& aController, |
66 RHashSet<TCalenNotification>& aOutstandingNotifications ) |
62 RHashSet<TCalenNotification>& aOutstandingNotifications ) |
67 : CCalenState( aController, aOutstandingNotifications ) |
63 : CCalenState( aController, aOutstandingNotifications ) |
68 { |
64 { |
69 OstTraceFunctionEntry0( CCALENDELETINGSTATE_CCALENDELETINGSTATE_ENTRY ); |
65 TRACE_ENTRY_POINT; |
70 |
66 |
71 OstTraceFunctionExit0( CCALENDELETINGSTATE_CCALENDELETINGSTATE_EXIT ); |
67 TRACE_EXIT_POINT; |
72 } |
68 } |
73 |
69 |
74 // ---------------------------------------------------------------------------- |
70 // ---------------------------------------------------------------------------- |
75 // CCalenDeletingState::CCalenDeletingState |
71 // CCalenDeletingState::CCalenDeletingState |
76 // Destructor |
72 // Destructor |
77 // ---------------------------------------------------------------------------- |
73 // ---------------------------------------------------------------------------- |
78 CCalenDeletingState::~CCalenDeletingState() |
74 CCalenDeletingState::~CCalenDeletingState() |
79 { |
75 { |
80 OstTraceFunctionEntry0( DUP1_CCALENDELETINGSTATE_CCALENDELETINGSTATE_ENTRY ); |
76 TRACE_ENTRY_POINT; |
81 |
77 |
82 OstTraceFunctionExit0( DUP1_CCALENDELETINGSTATE_CCALENDELETINGSTATE_EXIT ); |
78 TRACE_EXIT_POINT; |
83 } |
79 } |
84 |
80 |
85 // ---------------------------------------------------------------------------- |
81 // ---------------------------------------------------------------------------- |
86 // CCalenDeletingState::HandleCommandL |
82 // CCalenDeletingState::HandleCommandL |
87 // From CCCalenState |
83 // From CCalenState |
88 // ---------------------------------------------------------------------------- |
84 // ---------------------------------------------------------------------------- |
89 TBool CCalenDeletingState::HandleCommandL( const TCalenCommand& aCommand, |
85 TBool CCalenDeletingState::HandleCommandL( const TCalenCommand& aCommand, |
90 CCalenStateMachine& aStateMachine ) |
86 CCalenStateMachine& aStateMachine ) |
91 { |
87 { |
92 OstTraceFunctionEntry0( CCALENDELETINGSTATE_HANDLECOMMANDL_ENTRY ); |
88 TRACE_ENTRY_POINT; |
93 |
89 |
94 TInt cmd = aCommand.Command(); |
90 TInt cmd = aCommand.Command(); |
95 MCalenCommandHandler* handler = iController.GetCommandHandlerL( cmd ); |
91 MCalenCommandHandler* handler = iController.GetCommandHandlerL( cmd ); |
96 |
92 |
97 ASSERT( handler ); // FIXME: error ui |
93 ASSERT( handler ); // FIXME: error ui |
98 |
94 |
99 TBool cmdUsed = EFalse; |
95 TBool cmdUsed = EFalse; |
100 |
96 |
101 if( cmd == ECalenDeleteEntryWithoutQuery ) |
97 if(ECalenDeleteEntryWithoutQuery == cmd) |
102 { |
98 { |
103 RequestCallbackL( handler, aCommand ); |
99 RequestCallbackL( handler, aCommand ); |
104 cmdUsed = ETrue; |
100 cmdUsed = ETrue; |
105 } |
101 } |
106 else if( ECalenFasterAppExit == cmd ) |
102 else if(ECalenFasterAppExit == cmd) |
107 { |
103 { |
108 SetCurrentState( aStateMachine, CCalenStateMachine::ECalenIdleState ); |
104 SetCurrentState( aStateMachine, CCalenStateMachine::ECalenIdleState ); |
109 ActivateCurrentStateL(aStateMachine); |
105 ActivateCurrentStateL(aStateMachine); |
110 RequestCallbackL( handler, aCommand ); |
106 RequestCallbackL( handler, aCommand ); |
111 cmdUsed = ETrue; |
107 cmdUsed = ETrue; |
112 } |
108 } |
|
109 else if(ECalenStartActiveStep == cmd) |
|
110 { |
|
111 RequestCallbackL( handler, aCommand ); |
|
112 cmdUsed = ETrue; |
|
113 } |
|
114 |
|
115 else if(ECalenMissedEventViewFromIdle == cmd) |
|
116 { |
|
117 RequestCallbackL( handler, aCommand ); |
|
118 cmdUsed = ETrue; |
|
119 } |
|
120 else if(ECalenMissedAlarmsViewFromIdle == cmd) |
|
121 { |
|
122 RequestCallbackL( handler, aCommand ); |
|
123 cmdUsed = ETrue; |
|
124 } |
113 |
125 |
114 OstTraceFunctionExit0( CCALENDELETINGSTATE_HANDLECOMMANDL_EXIT ); |
126 TRACE_EXIT_POINT; |
115 return cmdUsed; |
127 return cmdUsed; |
116 } |
128 } |
117 |
129 |
118 // ---------------------------------------------------------------------------- |
130 // ---------------------------------------------------------------------------- |
119 // CCalenDeletingState::HandleNotificationL |
131 // CCalenDeletingState::HandleNotificationL |
120 // From CCCalenState |
132 // From CCalenState |
121 // ---------------------------------------------------------------------------- |
133 // ---------------------------------------------------------------------------- |
122 void CCalenDeletingState::HandleNotificationL(const TCalenNotification& aNotification, |
134 void CCalenDeletingState::HandleNotificationL(const TCalenNotification& aNotification, |
123 CCalenStateMachine& aStateMachine ) |
135 CCalenStateMachine& aStateMachine ) |
124 { |
136 { |
125 OstTraceFunctionEntry0( CCALENDELETINGSTATE_HANDLENOTIFICATIONL_ENTRY ); |
137 TRACE_ENTRY_POINT; |
126 |
138 |
127 switch( aNotification ) |
139 switch( aNotification ) |
128 { |
140 { |
129 case ECalenNotifyEntryDeleted: // issued when new entry dialog is cancelled |
141 case ECalenNotifyEntryDeleted: // issued when new entry dialog is cancelled |
130 case ECalenNotifyInstanceDeleted: |
142 case ECalenNotifyInstanceDeleted: |