emailcontacts/remotecontactlookup/engine/src/cpbkxrcleventscheduler.cpp
branchRCL_3
changeset 12 4ce476e64c59
parent 11 0396474f30f5
child 13 8592a65ad3fb
equal deleted inserted replaced
11:0396474f30f5 12:4ce476e64c59
     1 /*
       
     2 * Copyright (c) 2007 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:  Implementation of the class CPbkxRclServiceUiContextImpl.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "emailtrace.h"
       
    20 #include "cpbkxrcleventscheduler.h"
       
    21 
       
    22 const TInt KDelay = 1;
       
    23 
       
    24 // ======== MEMBER FUNCTIONS ========
       
    25 
       
    26 // ---------------------------------------------------------------------------
       
    27 // CPbkxRclEventScheduler::NewL
       
    28 // ---------------------------------------------------------------------------
       
    29 //
       
    30 CPbkxRclEventScheduler* CPbkxRclEventScheduler::NewL( MPbkxRclEventHandler& aHandler )
       
    31     {
       
    32     FUNC_LOG;
       
    33     CPbkxRclEventScheduler* scheduler = new ( ELeave ) CPbkxRclEventScheduler( aHandler );
       
    34     CleanupStack::PushL( scheduler );
       
    35     scheduler->ConstructL();
       
    36     CleanupStack::Pop( scheduler );
       
    37     return scheduler;
       
    38     }
       
    39 
       
    40 // ---------------------------------------------------------------------------
       
    41 // CPbkxRclEventScheduler::CPbkxRclEventScheduler
       
    42 // ---------------------------------------------------------------------------
       
    43 //
       
    44 CPbkxRclEventScheduler::CPbkxRclEventScheduler( MPbkxRclEventHandler& aHandler ) :
       
    45     CActive( EPriorityStandard ), iEventHandler( aHandler )
       
    46     {
       
    47     FUNC_LOG;
       
    48     }
       
    49 
       
    50 CPbkxRclEventScheduler::~CPbkxRclEventScheduler()
       
    51     {
       
    52     FUNC_LOG;
       
    53     Cancel();
       
    54     iTimer.Close();
       
    55     }
       
    56 
       
    57 void CPbkxRclEventScheduler::ConstructL()
       
    58     {
       
    59     FUNC_LOG;
       
    60     CActiveScheduler::Add( this );
       
    61     User::LeaveIfError( iTimer.CreateLocal() );
       
    62     }
       
    63 
       
    64 void CPbkxRclEventScheduler::TriggerEvent()
       
    65     {
       
    66     FUNC_LOG;
       
    67     if ( !IsActive() )
       
    68         {
       
    69         iTimer.After( iStatus, TTimeIntervalMicroSeconds32( KDelay ) );
       
    70         SetActive();
       
    71         }
       
    72     }
       
    73 
       
    74 void CPbkxRclEventScheduler::RunL()
       
    75     {
       
    76     FUNC_LOG;
       
    77     if ( iStatus.Int() == KErrNone )
       
    78         {
       
    79         iEventHandler.EventTriggered();
       
    80         }
       
    81     }
       
    82 
       
    83 void CPbkxRclEventScheduler::DoCancel()
       
    84     {
       
    85     FUNC_LOG;
       
    86     iTimer.Cancel();
       
    87     }
       
    88     
       
    89