calendarui/controller/src/calenidlestate.cpp
changeset 89 b57382753122
parent 51 0b38fc5b94c6
--- a/calendarui/controller/src/calenidlestate.cpp	Fri Oct 15 12:10:36 2010 +0530
+++ b/calendarui/controller/src/calenidlestate.cpp	Wed Nov 03 17:12:22 2010 +0530
@@ -17,31 +17,29 @@
 
 
 // includes
+#include <featmgr.h>
 #include "calenidlestate.h"
 #include "calendarui_debug.h"           // Debug macros
 #include "calencontroller.h"
 #include "calenstatemachine.h"
 #include "calennotifier.h"
-#include "OstTraceDefinitions.h"
-#ifdef OST_TRACE_COMPILER_IN_USE
-#include "calenidlestateTraces.h"
-#endif
+#include "calenviewmanager.h"
 
 // ----------------------------------------------------------------------------
-// CalenIdleState::NewLC
+// CCalenIdleState::NewLC
 // First stage construction
 // ----------------------------------------------------------------------------
 CCalenIdleState* CCalenIdleState::NewLC( CCalenController& aController, 
                     RHashSet<TCalenNotification>&  aOutstandingNotifications  )
     {
-    OstTraceFunctionEntry0( CCALENIDLESTATE_NEWLC_ENTRY );
-    
+    TRACE_ENTRY_POINT;
+
     CCalenIdleState* self = new ( ELeave ) CCalenIdleState( aController, 
                                                     aOutstandingNotifications );
     CleanupStack::PushL( self );
     self->ConstructL();
 
-    OstTraceFunctionExit0( CCALENIDLESTATE_NEWLC_EXIT );
+    TRACE_EXIT_POINT;
     return self;
     }
 
@@ -51,11 +49,10 @@
 // ----------------------------------------------------------------------------
 void CCalenIdleState::ConstructL()
     {
-    OstTraceFunctionEntry0( CCALENIDLESTATE_CONSTRUCTL_ENTRY );
-    
+    TRACE_ENTRY_POINT;
     BaseConstructL();
     
-    OstTraceFunctionExit0( CCALENIDLESTATE_CONSTRUCTL_EXIT );
+    TRACE_EXIT_POINT;
     }
     
 // ----------------------------------------------------------------------------
@@ -66,9 +63,9 @@
                     RHashSet<TCalenNotification>&  aOutstandingNotifications )
     : CCalenState( aController, aOutstandingNotifications )
     {
-    OstTraceFunctionEntry0( CCALENIDLESTATE_CCALENIDLESTATE_ENTRY );
+    TRACE_ENTRY_POINT;
     
-    OstTraceFunctionExit0( CCALENIDLESTATE_CCALENIDLESTATE_EXIT );
+    TRACE_EXIT_POINT;
     }
     
 // ----------------------------------------------------------------------------
@@ -77,9 +74,9 @@
 // ----------------------------------------------------------------------------    
 CCalenIdleState::~CCalenIdleState()
     {
-    OstTraceFunctionEntry0( DUP1_CCALENIDLESTATE_CCALENIDLESTATE_ENTRY );
+    TRACE_ENTRY_POINT;
     
-    OstTraceFunctionExit0( DUP1_CCALENIDLESTATE_CCALENIDLESTATE_EXIT );
+    TRACE_EXIT_POINT;
     }
 
 // ----------------------------------------------------------------------------
@@ -89,7 +86,7 @@
 TBool CCalenIdleState::HandleCommandL( const TCalenCommand& aCommand,
                                        CCalenStateMachine& aStateMachine )
     {
-    OstTraceFunctionEntry0( CCALENIDLESTATE_HANDLECOMMANDL_ENTRY );
+    TRACE_ENTRY_POINT;
     
     TInt cmd = aCommand.Command();
     MCalenCommandHandler* handler = iController.GetCommandHandlerL( cmd );
@@ -101,21 +98,11 @@
     switch( cmd )
         {
         case ECalenMonthView:
+        case ECalenWeekView:
         case ECalenDayView:
-        case ECalenAgendaView:
-        case ECalenStartActiveStep:
-            {
-            // set previous state to idle
-            CCalenStateMachine::TCalenStateIndex cachedState = GetCurrentState(aStateMachine);
-            SetCurrentState( aStateMachine, CCalenStateMachine::ECalenPopulationState );
-            SetCurrentPreviousState( aStateMachine, cachedState );
-            ActivateCurrentStateL(aStateMachine);               
-            cmdUsed = ETrue;
-            }
-            break;
-        case ECalenTodoEditor:
-        case ECalenTodoEditorDone:
+        case ECalenTodoView:
         case ECalenForwardsToDayView:
+        case ECalenForwardsToWeekView:
         case ECalenNextView:
         case ECalenPrevView:
         case ECalenSwitchView:
@@ -123,6 +110,8 @@
         case ECalenShowPreview:
         case ECalenGotoToday:
         case ECalenGotoDate:
+        case ECalenGotoNextDay:
+        case ECalenGotoPrevDay:    
         case ECalenNotifyFocusChange:
         case ECalenCompleteTodo:
         case ECalenRestoreTodo:
@@ -135,12 +124,26 @@
         	 cmdUsed = ETrue;
              break;
         
-        
+        case ECalenStartActiveStep:
+        	{
+        	// set previous state to idle
+            CCalenStateMachine::TCalenStateIndex cachedState = GetCurrentState(aStateMachine);
+            SetCurrentState( aStateMachine, CCalenStateMachine::ECalenPopulationState );
+           	SetCurrentPreviousState( aStateMachine, cachedState );
+            ActivateCurrentStateL(aStateMachine);           	
+           	cmdUsed = ETrue;
+           	}
+           	break;
         case ECalenEventView: 
         case ECalenMissedEventView: 
-            {
-        	// set previous state to idle
-            CCalenStateMachine::TCalenStateIndex cachedState = GetCurrentState(aStateMachine);
+            {       	
+            //update the previous before going to the eventview
+            if ( FeatureManager::FeatureSupported( KFeatureIdFfEnhancedCalendarEventUi  ) )
+                {
+                iController.ViewManager().SetPreviousViewUid(iController.ViewManager().CurrentView());
+                }
+            // set previous state to idle
+			CCalenStateMachine::TCalenStateIndex cachedState = GetCurrentState(aStateMachine);
             SetCurrentState( aStateMachine, CCalenStateMachine::ECalenViewingState);
             SetCurrentPreviousState( aStateMachine, cachedState );
             ActivateCurrentStateL(aStateMachine);            
@@ -148,16 +151,22 @@
         	}
         	break;
         case ECalenNewMeeting:
+        case ECalenNewTodo:
         case ECalenNewAnniv:
         case ECalenNewDayNote:
         case ECalenNewReminder:
         case ECalenNewMeetingRequest:
-        case ECalenNewEntry:
+        case ECalenNewMeetingTimeSpan:
         case ECalenEditCurrentEntry:
         case ECalenEditSeries:
         case ECalenEditOccurrence:
         case ECalenViewCurrentEntry:
             {
+            //update the previous before going to the new event
+            if ( FeatureManager::FeatureSupported( KFeatureIdFfEnhancedCalendarEventUi  ) )
+                {
+                iController.ViewManager().SetPreviousViewUid(iController.ViewManager().CurrentView());
+                }
             // set previous state to idle
             CCalenStateMachine::TCalenStateIndex cachedState = GetCurrentState(aStateMachine);
             SetCurrentState( aStateMachine, CCalenStateMachine::ECalenEditingState);
@@ -213,8 +222,35 @@
         case ECalenGetLocation:
     	case ECalenShowLocation:
     	case ECalenGetLocationAndSave:
-    		{    		
-    		}       
+    		{
+    		CCalenStateMachine::TCalenStateIndex cachedState = GetCurrentState(aStateMachine);
+	        SetCurrentState( aStateMachine, CCalenStateMachine::ECalenMapState );
+	        SetCurrentPreviousState( aStateMachine, cachedState );
+	        ActivateCurrentStateL(aStateMachine);        
+	        cmdUsed = ETrue;
+    		}
+			break;
+		case ECalenEventViewFromAlarm:
+        case ECalenEventViewFromAlarmStopOnly:	
+			{
+			CCalenStateMachine::TCalenStateIndex cachedState = GetCurrentState(aStateMachine);
+            SetCurrentState( aStateMachine, CCalenStateMachine::ECalenAlarmState);
+            SetCurrentPreviousState( aStateMachine, cachedState );
+            ActivateCurrentStateL(aStateMachine);            
+            cmdUsed = ETrue;
+			}
+			break;
+    	case ECalenAddAttachment:
+    	case ECalenRemoveAttachment:
+    	case ECalenViewAttachmentList:    
+    	    {
+    	    CCalenStateMachine::TCalenStateIndex cachedState = GetCurrentState(aStateMachine);
+    	    SetCurrentState( aStateMachine, CCalenStateMachine::ECalenAttachmentState );
+            SetCurrentPreviousState( aStateMachine, cachedState );
+            ActivateCurrentStateL(aStateMachine);        
+            cmdUsed = ETrue;
+    	    }
+    	    break;
         default:
             // This a valid custom command as there is a command handler
             // do not modify the new start and remain in idle.
@@ -225,7 +261,7 @@
         
     RequestCallbackL( handler, aCommand );
 
-    OstTraceFunctionExit0( CCALENIDLESTATE_HANDLECOMMANDL_EXIT );
+    TRACE_EXIT_POINT;
     return cmdUsed;
     }
 
@@ -236,11 +272,11 @@
 void CCalenIdleState::HandleNotificationL(const TCalenNotification& aNotification,
                                           CCalenStateMachine& aStateMachine)
     {
-    OstTraceFunctionEntry0( CCALENIDLESTATE_HANDLENOTIFICATIONL_ENTRY );
+    TRACE_ENTRY_POINT;
     
     CCalenState::HandleNotificationL( aNotification, aStateMachine );
     
-    OstTraceFunctionExit0( CCALENIDLESTATE_HANDLENOTIFICATIONL_EXIT );
+    TRACE_EXIT_POINT;
     }
 
 // end of file