idlehomescreen/examples/mcsexample/src/mcspluginwatcher.cpp
branchRCL_3
changeset 102 ba63c83f4716
parent 93 b01126ce0bec
child 103 966d119a7e67
equal deleted inserted replaced
93:b01126ce0bec 102:ba63c83f4716
     1 /*
       
     2 * Copyright (c) 2010 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:  Menu item operation watcher. 
       
    15 *
       
    16 */
       
    17 
       
    18 #include <mcsmenuoperation.h>
       
    19 #include "mcspluginwatcher.h"
       
    20 #include "MCSExampleAppView.h"
       
    21 
       
    22 // ---------------------------------------------------------------------------
       
    23 // two-phased constructor
       
    24 // ---------------------------------------------------------------------------
       
    25 CMCSExampleWatcher* CMCSExampleWatcher::NewL(  )
       
    26 	{
       
    27 	CMCSExampleWatcher* self = new (ELeave) CMCSExampleWatcher(  );
       
    28 	CleanupStack::PushL( self );
       
    29 	self->ConstructL();
       
    30 	CleanupStack::Pop( self );
       
    31 	return self;
       
    32 	}
       
    33 
       
    34 // ---------------------------------------------------------------------------
       
    35 // default constructor
       
    36 // ---------------------------------------------------------------------------
       
    37 CMCSExampleWatcher::CMCSExampleWatcher(  )
       
    38 	: CActive( CActive::EPriorityStandard )
       
    39     {
       
    40     CActiveScheduler::Add( this );
       
    41     }
       
    42 
       
    43 // ---------------------------------------------------------------------------
       
    44 // destructor
       
    45 // ---------------------------------------------------------------------------
       
    46 CMCSExampleWatcher::~CMCSExampleWatcher()
       
    47     {
       
    48     Cancel();
       
    49     }
       
    50 
       
    51 // ---------------------------------------------------------------------------
       
    52 // second phase constructor
       
    53 // ---------------------------------------------------------------------------
       
    54 void CMCSExampleWatcher::ConstructL()
       
    55 	{
       
    56 	
       
    57 	}
       
    58 
       
    59 // ---------------------------------------------------------------------------
       
    60 // Watch  Async
       
    61 // ---------------------------------------------------------------------------
       
    62 void CMCSExampleWatcher::Watch( CMenuOperation* aOperation, CMCSExampleAppView* aObserver )
       
    63     {
       
    64     iObserver = aObserver;
       
    65     __ASSERT_DEBUG( KRequestPending == iStatus.Int(), User::Invariant() );
       
    66     //__ASSERT_DEBUG( !iOperation, User::Invariant() ); 
       
    67     iOperation = aOperation;
       
    68     SetActive();
       
    69     }
       
    70 
       
    71 // ---------------------------------------------------------------------------
       
    72 // Inherited from CActive class 
       
    73 // ---------------------------------------------------------------------------
       
    74 void CMCSExampleWatcher::RunL()
       
    75     {
       
    76     iObserver->ListAllItemsL();
       
    77     delete iOperation;
       
    78     iOperation = NULL;  
       
    79     }
       
    80 
       
    81 // ---------------------------------------------------------------------------
       
    82 // Inherited from CActive class 
       
    83 // ---------------------------------------------------------------------------
       
    84 void CMCSExampleWatcher::DoCancel()
       
    85     {
       
    86     delete iOperation;
       
    87     iOperation = NULL;
       
    88     }
       
    89 
       
    90 TInt CMCSExampleWatcher::GetStatus()
       
    91     {
       
    92     return iStatus.Int();
       
    93     }
       
    94