homesync/contentmanager/cmserver/cmserver/src/client/cmactive.cpp
branchIOP_Improvements
changeset 40 08b5eae9f9ff
parent 39 6369bfd1b60d
child 41 b4d83ea1d6e2
equal deleted inserted replaced
39:6369bfd1b60d 40:08b5eae9f9ff
     1 /*
       
     2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Content Manager server's client ao implementation
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "cmactive.h"
       
    20 #include "msdebug.h"
       
    21 
       
    22 // ---------------------------------------------------------------------------
       
    23 // CCmActive::NewL
       
    24 // ---------------------------------------------------------------------------
       
    25 CCmActive* CCmActive::NewL( RContentManager& aCm )
       
    26     {
       
    27     LOG(_L("[Cm Server]\t CCmActive::NewL"));
       
    28     CCmActive* self = CCmActive::NewLC( aCm );
       
    29     CleanupStack::Pop( self );
       
    30     return self;
       
    31     }
       
    32 
       
    33 // ---------------------------------------------------------------------------
       
    34 // CCmActive::NewLC
       
    35 // ---------------------------------------------------------------------------
       
    36 CCmActive* CCmActive::NewLC( RContentManager& aCm )
       
    37     {
       
    38     LOG(_L("[Cm Server]\t CCmActive::NewL"));
       
    39     CCmActive* self = new ( ELeave ) CCmActive( aCm );
       
    40     CleanupStack::PushL( self );
       
    41     self->ConstructL();
       
    42     return self;
       
    43     }
       
    44         
       
    45 // ---------------------------------------------------------------------------
       
    46 // CCmActive::~CCmActive
       
    47 // ---------------------------------------------------------------------------
       
    48 CCmActive::~CCmActive()
       
    49     {
       
    50     LOG(_L("[Cm Server]\t CCmActive::~CCmActive"));
       
    51     }
       
    52 
       
    53 // ---------------------------------------------------------------------------
       
    54 // CCmActive::CCmActive
       
    55 // ---------------------------------------------------------------------------
       
    56 CCmActive::CCmActive( RContentManager& aCm )
       
    57     : CActive( EPriorityHigh ),
       
    58       iCm( aCm ), iIdle( ETrue )
       
    59     {
       
    60     CActiveScheduler::Add( this );
       
    61     }
       
    62 
       
    63 // ---------------------------------------------------------------------------
       
    64 // CCmActive::ConstructL
       
    65 // ---------------------------------------------------------------------------
       
    66 void CCmActive::ConstructL()
       
    67     {
       
    68     LOG(_L("[Cm Server]\t CCmActive::ConstructL"));
       
    69     }
       
    70 
       
    71 // ---------------------------------------------------------------------------
       
    72 // CCmActive::RunL
       
    73 // ---------------------------------------------------------------------------
       
    74 void CCmActive::RunL()
       
    75     {
       
    76     LOG(_L("[Cm Server]\t CCmActive::RunL"));
       
    77     TRACE(Print(_L("[Cm Server]\t status %d"), iStatus.Int() ));
       
    78 
       
    79     if ( iIdle )
       
    80         {
       
    81         LOG(_L("[Cm Server]\t CCmActive::RunL set active"));
       
    82         SetActive();
       
    83         iIdle = EFalse;
       
    84         }
       
    85     else
       
    86         {
       
    87         LOG(_L("[Cm Server]\t CCmActive::RunL operation completed"));
       
    88         iCm.OperationCompletedL( iStatus.Int() );
       
    89         }
       
    90     }
       
    91 
       
    92 // ---------------------------------------------------------------------------
       
    93 // CCmActive::DoCancel
       
    94 // ---------------------------------------------------------------------------
       
    95 void CCmActive::DoCancel()
       
    96     {
       
    97     LOG(_L("[Cm Server]\t CCmActive::DoCancel"));
       
    98     TRAPD( error, iCm.OperationCompletedL( KErrCancel ) );
       
    99     if ( error )
       
   100         {
       
   101         TRACE(Print(_L("[Cm Server]\tCCmActive::DoCancel \
       
   102         error = %d"), error ));
       
   103         }
       
   104     }
       
   105 
       
   106 // ---------------------------------------------------------------------------
       
   107 // CCmActive::RunError
       
   108 // ---------------------------------------------------------------------------
       
   109 TInt CCmActive::RunError( TInt aError )
       
   110     {
       
   111     TRACE( Print(_L("[Cm Server]\t CCmActive::RunError \
       
   112     error = %d"), aError ));
       
   113 
       
   114     // let it leave
       
   115     return aError;
       
   116     }
       
   117 
       
   118 // End of file