diff -r fd64c38c277d -r b46a585f6909 phonebookengines_old/contactsmodel/cntsrv/src/CActiveLoop.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/phonebookengines_old/contactsmodel/cntsrv/src/CActiveLoop.cpp Fri Jun 11 13:29:23 2010 +0300 @@ -0,0 +1,73 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#include "CActiveLoop.h" + +void CActiveLoop::Register(MActiveLoopCallBack & aCallBack, TBool aUseTimer) + { + iCallBack = &aCallBack; + if (aUseTimer) + { //Timer required for Cancel Asynchronous operation use case. + After(0); + } + else + { + CActive::SetActive(); + TRequestStatus* status = &iStatus; + User::RequestComplete(status, KErrNone); + } + } + + + +void CActiveLoop::RunL() + { + if (iCallBack->DoStepL()) + { + CActive::SetActive(); + TRequestStatus* status = &iStatus; + User::RequestComplete(status, KErrNone); + } + } + +CActiveLoop* CActiveLoop::NewL() + { + CActiveLoop* active = new (ELeave) CActiveLoop(); + CleanupStack::PushL(active); + active->ConstructL(); + CleanupStack::Pop(active); + return active; + } + +void CActiveLoop::DoCancel() + { + } + +CActiveLoop::CActiveLoop() :CTimer(EPriorityStandard) + { + CActiveScheduler::Add(this); + } + + +CActiveLoop::~CActiveLoop() + { + Cancel(); + } + +TInt CActiveLoop::RunError(TInt aError) + { + iCallBack->DoError(aError); + return KErrNone; + }