videocollection/mpxmyvideoscollection/src/vcxmyvideosactivetask.cpp
changeset 36 8aed59de29f9
parent 34 bbb98528c666
equal deleted inserted replaced
35:3738fe97f027 36:8aed59de29f9
    77     iCurTask = aTask;
    77     iCurTask = aTask;
    78     iCurStep = 0;
    78     iCurStep = 0;
    79 
    79 
    80     // Start the AO
    80     // Start the AO
    81     iStatus = KRequestPending;
    81     iStatus = KRequestPending;
       
    82     MPX_DEBUG1("CVcxMyVideosActiveTask::StartL SetActive");
    82     SetActive();
    83     SetActive();
    83     TRequestStatus* status = &iStatus;
    84     TRequestStatus* status = &iStatus;
    84     User::RequestComplete( status, KErrNone );
    85     User::RequestComplete( status, KErrNone );
    85     }
    86     }
    86 
    87 
   124 // From CActive
   125 // From CActive
   125 // ---------------------------------------------------------------------------
   126 // ---------------------------------------------------------------------------
   126 //
   127 //
   127 void CVcxMyVideosActiveTask::RunL()
   128 void CVcxMyVideosActiveTask::RunL()
   128     {
   129     {
       
   130     MPX_DEBUG1("CVcxMyVideosActiveTask::RunL() start");
       
   131 
   129     switch ( iObserver.HandleStepL() )
   132     switch ( iObserver.HandleStepL() )
   130         {
   133         {
   131         case MVcxMyVideosActiveTaskObserver::EDone:
   134         case MVcxMyVideosActiveTaskObserver::EDone:
   132             Done();
   135             Done();
   133             break;
   136             break;
   134 
   137 
   135         case MVcxMyVideosActiveTaskObserver::EMoreToCome:
   138         case MVcxMyVideosActiveTaskObserver::EMoreToCome:
   136             ContinueStepping();
   139             ContinueStepping();
   137             break;
   140             break;
   138 
   141 
   139         //observer is responsible for calling Done or ContinueStepping
   142         //observer is responsible for calling Done, Cancel or ContinueStepping
   140         case MVcxMyVideosActiveTaskObserver::EStopStepping:
   143         case MVcxMyVideosActiveTaskObserver::EStopStepping:
       
   144             MPX_DEBUG1("CVcxMyVideosActiveTask::RunL stopped stepping");
       
   145             iStopped = ETrue;
   141             break;
   146             break;
   142         }
   147         }
       
   148     MPX_DEBUG1("CVcxMyVideosActiveTask::RunL() exit");
   143     }
   149     }
   144 
   150 
   145 // ---------------------------------------------------------------------------
   151 // ---------------------------------------------------------------------------
   146 // CVcxMyVideosActiveTask::Done
   152 // CVcxMyVideosActiveTask::Done
   147 // ---------------------------------------------------------------------------
   153 // ---------------------------------------------------------------------------
   151     MPX_DEBUG1("CVcxMyVideosActiveTask::Done() start");
   157     MPX_DEBUG1("CVcxMyVideosActiveTask::Done() start");
   152 
   158 
   153     iObserver.HandleOperationCompleted( KErrNone );
   159     iObserver.HandleOperationCompleted( KErrNone );
   154     delete iCurCommand;
   160     delete iCurCommand;
   155     iCurCommand = NULL;
   161     iCurCommand = NULL;
       
   162     iStopped = EFalse;
   156 
   163 
   157     MPX_DEBUG1("CVcxMyVideosActiveTask::Done() exit");
   164     MPX_DEBUG1("CVcxMyVideosActiveTask::Done() exit");
   158     }
   165     }
   159 
   166 
   160 // ---------------------------------------------------------------------------
   167 // ---------------------------------------------------------------------------
   163 //
   170 //
   164 void CVcxMyVideosActiveTask::ContinueStepping()
   171 void CVcxMyVideosActiveTask::ContinueStepping()
   165     {
   172     {
   166     ++iCurStep;
   173     ++iCurStep;
   167     iStatus = KRequestPending;
   174     iStatus = KRequestPending;
       
   175     MPX_DEBUG1("CVcxMyVideosActiveTask::ContinueStepping SetActive");
   168     SetActive();
   176     SetActive();
       
   177     iStopped = EFalse;
   169     TRequestStatus* status = &iStatus;
   178     TRequestStatus* status = &iStatus;
   170     User::RequestComplete( status, KErrNone );
   179     User::RequestComplete( status, KErrNone );
   171     }
   180     }
   172 
   181 
       
   182 void CVcxMyVideosActiveTask::Cancel()
       
   183     {
       
   184     if ( iStopped && !IsActive() )
       
   185         {
       
   186         MPX_DEBUG1("CVcxMyVideosActiveTask:: was paused, calling DoCancel()");
       
   187         DoCancel();
       
   188         }
       
   189     else
       
   190         {
       
   191         MPX_DEBUG1("CVcxMyVideosActiveTask:: wasn't paused, calling CActive::Cancel() normally");
       
   192         CActive::Cancel();
       
   193         }
       
   194     }
   173 // ---------------------------------------------------------------------------
   195 // ---------------------------------------------------------------------------
   174 // From CActive
   196 // From CActive
   175 // ---------------------------------------------------------------------------
   197 // ---------------------------------------------------------------------------
   176 //
   198 //
   177 void CVcxMyVideosActiveTask::DoCancel()
   199 void CVcxMyVideosActiveTask::DoCancel()
   178     {
   200     {
       
   201     MPX_DEBUG1("CVcxMyVideosActiveTask::DoCancel() start");
   179     // Callback and cleanup
   202     // Callback and cleanup
   180     iObserver.HandleOperationCompleted( KErrCancel );
   203     iObserver.HandleOperationCompleted( KErrCancel );
   181     delete iCurCommand;
   204     delete iCurCommand;
   182     iCurCommand = NULL;
   205     iCurCommand = NULL;
       
   206     iStopped = EFalse;
       
   207     MPX_DEBUG1("CVcxMyVideosActiveTask::DoCancel() exit");
   183     }
   208     }
   184 
   209 
   185 // ---------------------------------------------------------------------------
   210 // ---------------------------------------------------------------------------
   186 // From CActive
   211 // From CActive
   187 // ---------------------------------------------------------------------------
   212 // ---------------------------------------------------------------------------
   188 //
   213 //
   189 TInt CVcxMyVideosActiveTask::RunError( TInt aError )
   214 TInt CVcxMyVideosActiveTask::RunError( TInt aError )
   190     {
   215     {
       
   216     MPX_DEBUG1("CVcxMyVideosActiveTask::RunError() start");
       
   217     
   191     // Callback and cleanup
   218     // Callback and cleanup
   192     iObserver.HandleOperationCompleted( aError );
   219     iObserver.HandleOperationCompleted( aError );
   193     delete iCurCommand;
   220     delete iCurCommand;
   194     iCurCommand = NULL;
   221     iCurCommand = NULL;
   195 
   222     iStopped = EFalse;
       
   223 
       
   224     MPX_DEBUG1("CVcxMyVideosActiveTask::RunError() exit");
   196     return KErrNone;
   225     return KErrNone;
   197     }
   226     }
   198 
   227 
   199 // END OF FILE
   228 // END OF FILE