calendarui/controller/src/caleneditingstate.cpp
changeset 18 c198609911f9
parent 0 f979ecb2b13e
child 51 0b38fc5b94c6
child 58 ef813d54df51
equal deleted inserted replaced
0:f979ecb2b13e 18:c198609911f9
    26 // ----------------------------------------------------------------------------
    26 // ----------------------------------------------------------------------------
    27 // CCalenEditingState::NewLC
    27 // CCalenEditingState::NewLC
    28 // First stage construction
    28 // First stage construction
    29 // ----------------------------------------------------------------------------
    29 // ----------------------------------------------------------------------------
    30 CCalenEditingState* CCalenEditingState::NewLC( CCalenController& aController,
    30 CCalenEditingState* CCalenEditingState::NewLC( CCalenController& aController,
    31                     RHashSet<TCalenNotification>& aOutstandingNotifications )
    31                                                             RHashSet<TCalenNotification>& aOutstandingNotifications )
    32     {
    32     {
    33     TRACE_ENTRY_POINT;
    33     TRACE_ENTRY_POINT;
    34 
    34 
    35     CCalenEditingState* self = new( ELeave ) CCalenEditingState( aController,
    35     CCalenEditingState* self = new( ELeave ) CCalenEditingState( aController, aOutstandingNotifications );
    36                                                     aOutstandingNotifications );
       
    37     CleanupStack::PushL( self );
    36     CleanupStack::PushL( self );
    38     self->ConstructL();
    37     self->ConstructL();
    39 
    38 
    40     TRACE_EXIT_POINT;
    39     TRACE_EXIT_POINT;
    41     return self;
    40     return self;
    56 // ----------------------------------------------------------------------------
    55 // ----------------------------------------------------------------------------
    57 // CCalenEditingState::CCalenEditingState
    56 // CCalenEditingState::CCalenEditingState
    58 // C++ Constructor
    57 // C++ Constructor
    59 // ----------------------------------------------------------------------------
    58 // ----------------------------------------------------------------------------
    60 CCalenEditingState::CCalenEditingState( CCalenController& aController,
    59 CCalenEditingState::CCalenEditingState( CCalenController& aController,
    61             RHashSet<TCalenNotification>& aOutstandingNotifications )
    60                                                         RHashSet<TCalenNotification>& aOutstandingNotifications )
    62     : CCalenState( aController, aOutstandingNotifications )
    61     : CCalenState( aController, aOutstandingNotifications )
    63     {
    62     {
    64     TRACE_ENTRY_POINT;
    63     TRACE_ENTRY_POINT;
    65 
    64 
    66     TRACE_EXIT_POINT;
    65     TRACE_EXIT_POINT;
    91 	    
    90 	    
    92 	ASSERT( handler );
    91 	ASSERT( handler );
    93      
    92      
    94     TBool cmdUsed = EFalse;
    93     TBool cmdUsed = EFalse;
    95     switch( cmd )
    94     switch( cmd )
    96         {
    95     {
    97     	case ECalenDeleteCurrentEntry:
    96     	case ECalenDeleteCurrentEntry:
    98     	case ECalenDeleteSeries:
    97     	case ECalenDeleteSeries:
    99     	case ECalenDeleteCurrentOccurrence:
    98     	case ECalenDeleteCurrentOccurrence:
   100     		{
    99     		{
   101     		CCalenStateMachine::TCalenStateIndex cachedState = GetCurrentState(aStateMachine);
   100     		CCalenStateMachine::TCalenStateIndex cachedState = GetCurrentState(aStateMachine);
   104 	        ActivateCurrentStateL(aStateMachine);
   103 	        ActivateCurrentStateL(aStateMachine);
   105 	        
   104 	        
   106 	        cmdUsed = ETrue;
   105 	        cmdUsed = ETrue;
   107 	        break;
   106 	        break;
   108     		}
   107     		}
       
   108     		
   109     	case ECalenSend: // For handling send in viewer
   109     	case ECalenSend: // For handling send in viewer
   110     		{
   110     		{
   111     		CCalenStateMachine::TCalenStateIndex cachedState = GetCurrentState(aStateMachine);
   111     		CCalenStateMachine::TCalenStateIndex cachedState = GetCurrentState(aStateMachine);
   112 	        SetCurrentState( aStateMachine, CCalenStateMachine::ECalenSendingState );
   112 	        SetCurrentState( aStateMachine, CCalenStateMachine::ECalenSendingState );
   113 	        SetCurrentPreviousState( aStateMachine, cachedState );
   113 	        SetCurrentPreviousState( aStateMachine, cachedState );
   114 	        ActivateCurrentStateL(aStateMachine);        
   114 	        ActivateCurrentStateL(aStateMachine);        
   115 	        
   115 	        
   116 	        cmdUsed = ETrue;
   116 	        cmdUsed = ETrue;
   117 	        break;	
   117 	        break;	
   118     		}
   118     		}
       
   119     		
   119     	case ECalenFasterAppExit:
   120     	case ECalenFasterAppExit:
   120     		{
   121     		{
   121 	        SetCurrentState( aStateMachine, CCalenStateMachine::ECalenIdleState );
   122 	        SetCurrentState( aStateMachine, CCalenStateMachine::ECalenIdleState );
   122 	        ActivateCurrentStateL(aStateMachine);
   123 	        ActivateCurrentStateL(aStateMachine);
   123 	        cmdUsed = ETrue;
   124 	        cmdUsed = ETrue;
   124 	        break;
   125 	        break;
   125         	}
   126         	}
       
   127         	
   126     	case ECalenGetLocation:
   128     	case ECalenGetLocation:
   127     	case ECalenShowLocation:
   129     	case ECalenShowLocation:
   128     		{
   130     		{       	
   129     		CCalenStateMachine::TCalenStateIndex cachedState = GetCurrentState(aStateMachine);
   131     		}	
   130 	        SetCurrentState( aStateMachine, CCalenStateMachine::ECalenMapState );
   132 	
   131 	        SetCurrentPreviousState( aStateMachine, cachedState );
       
   132 	        ActivateCurrentStateL(aStateMachine);        
       
   133 	        cmdUsed = ETrue;
       
   134 	        break;	
       
   135     		}
       
   136     	case ECalenAddAttachment:
       
   137     	case ECalenRemoveAttachment:
       
   138     	case ECalenViewAttachmentList:
       
   139     	case ECalenAddAttachmentFromViewer:
       
   140             {
       
   141             CCalenStateMachine::TCalenStateIndex cachedState = GetCurrentState(aStateMachine);
       
   142             SetCurrentState( aStateMachine, CCalenStateMachine::ECalenAttachmentState );
       
   143             SetCurrentPreviousState( aStateMachine, cachedState );
       
   144             ActivateCurrentStateL(aStateMachine);        
       
   145             cmdUsed = ETrue;
       
   146             }
       
   147             break;
       
   148     	case ECalenMissedEventViewFromIdle:
       
   149     	    {
       
   150     	    cmdUsed = ETrue;
       
   151     	    break;
       
   152     	    }
       
   153     	case ECalenEventViewFromAlarm:
       
   154     	case ECalenEventViewFromAlarmStopOnly:
       
   155     	    {
       
   156     	    cmdUsed = ETrue;
       
   157     	    break;
       
   158     	    }   
       
   159     	default:
   133     	default:
   160     		break;
   134     		break;
   161     		
   135     		
   162         }
   136     }
   163     
   137     
   164 	if(cmdUsed)
   138 	if(cmdUsed)
   165 	    {
   139 		RequestCallbackL( handler, aCommand );
   166 	    RequestCallbackL( handler, aCommand );
       
   167 	    }
       
   168 	
   140 	
   169     TRACE_EXIT_POINT;
   141     TRACE_EXIT_POINT;
   170     
   142     
   171     return cmdUsed;
   143     return cmdUsed;
   172     }
   144     }
   185         case ECalenNotifyEntryClosed:  // issued when new entry dialog is cancelled
   157         case ECalenNotifyEntryClosed:  // issued when new entry dialog is cancelled
   186         case ECalenNotifyEntrySaved:
   158         case ECalenNotifyEntrySaved:
   187         case ECalenNotifyInstanceSaved:
   159         case ECalenNotifyInstanceSaved:
   188         case ECalenNotifyDialogClosed:
   160         case ECalenNotifyDialogClosed:
   189         case ECalenNotifyEntryDeleted:
   161         case ECalenNotifyEntryDeleted:
   190         case ECalenNotifyMarkedEntryCompleted:
   162         case ECalenNotifyEditorClosedFromViewer:
   191             {
   163             {
   192             SetCurrentState( aStateMachine, iPreviousState );
   164             SetCurrentState( aStateMachine, iPreviousState );
   193             // Let new state does the broadcast
   165             // Let new state does the broadcast
   194             iOutstandingNotifications.InsertL(aNotification);
   166             iOutstandingNotifications.InsertL(aNotification);
   195 			ActivateCurrentStateL(aStateMachine);
   167 			ActivateCurrentStateL(aStateMachine);
   196             }
   168             }
   197             break;
       
   198         case ECalenNotifyCancelStatusUpdation:
       
   199               {
       
   200               SetCurrentState( aStateMachine, iPreviousState);
       
   201               SetCurrentPreviousState( aStateMachine, GetCurrentState(aStateMachine) );
       
   202 
       
   203               iOutstandingNotifications.InsertL(aNotification);
       
   204               ActivateCurrentStateL(aStateMachine);
       
   205               
       
   206               CancelPreviousCmd(aStateMachine);
       
   207               }
       
   208             break;
   169             break;
   209         default:
   170         default:
   210            CCalenState::HandleNotificationL( aNotification, aStateMachine );
   171            CCalenState::HandleNotificationL( aNotification, aStateMachine );
   211             break;
   172             break;
   212         }
   173         }