email/imap4mtm/imaputils/src/cimapobservabletimer.cpp
changeset 0 72b543305e3a
equal deleted inserted replaced
-1:000000000000 0:72b543305e3a
       
     1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #include "cimapobservabletimer.h"
       
    17 
       
    18 /**
       
    19 A static method that constructs a timer object.
       
    20 @param aObserver	An implementation of the MImapTimerObserver interface whose OnTimerL() method will
       
    21 					be called whenever a requested timer event occurs.
       
    22 @return A pointer to the newly created timer object
       
    23 */
       
    24 EXPORT_C CImapObservableTimer* CImapObservableTimer::NewL(MImapTimerObserver& aObserver)
       
    25 	{
       
    26 	CImapObservableTimer* self = new(ELeave)CImapObservableTimer(aObserver);
       
    27 	CleanupStack::PushL(self);
       
    28 	self->ConstructL(); // this calls CTimer::ConstructL()
       
    29 	CleanupStack::Pop(self);
       
    30 	return self;
       
    31 	}
       
    32 
       
    33 CImapObservableTimer::CImapObservableTimer(MImapTimerObserver& aObserver)
       
    34 	: CTimer(CActive::EPriorityStandard)
       
    35 	, iObserver(aObserver)
       
    36 	{
       
    37 	CActiveScheduler::Add(this);
       
    38 	}
       
    39 
       
    40 void CImapObservableTimer::RunL()
       
    41 	{
       
    42 	iObserver.OnTimerL(*this);
       
    43 	}