serviceproviders/sapi_contacts_vpbk/contactservice/src/syncbehaviour.cpp
changeset 19 989d2f495d90
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serviceproviders/sapi_contacts_vpbk/contactservice/src/syncbehaviour.cpp	Fri Jul 03 15:51:24 2009 +0100
@@ -0,0 +1,101 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:  Sync behaviour implemetation for getlist iterator.
+*
+*/
+
+
+
+
+#include "syncbehaviour.h"
+
+//------------------------------------
+// Adds itself to the active scheduler
+//------------------------------------
+CContactSyncIter::CContactSyncIter():CActive(0)
+    {
+    CActiveScheduler::Add(this);
+    }
+
+//---------------------
+// RunL() calls Signal()
+//----------------------
+void CContactSyncIter::RunL()
+    {
+    Signal();
+    }
+
+void CContactSyncIter::DoCancel()
+    {
+    	
+    }
+
+//------------------------------------
+// Stops the scheduler and does cleanup
+//------------------------------------
+void CContactSyncIter::Signal()
+    {
+    iWaitScheduler->AsyncStop();    	
+    }
+
+//------------------------------------
+// Sets the status of the Scheduler 
+// and starts it
+//------------------------------------
+void CContactSyncIter::Wait()
+    {
+    if(!IsActive()) 
+    	{
+    	iStatus = KRequestPending;
+    	SetActive();
+    	}
+    iWaitScheduler->Start();
+    }
+
+//----------------------------------
+// NewL() Method
+//----------------------------------
+CContactSyncIter* CContactSyncIter::NewL()
+    {
+    CContactSyncIter* self = new( ELeave ) CContactSyncIter( );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+
+    }
+
+//----------------------------------------------------
+// ConstructL method - 
+// Installs the active scheduler if not already installed
+//----------------------------------------------------
+void CContactSyncIter::ConstructL()
+{
+/*
+   iInstalled = 0;
+   if(!CActiveScheduler::Current())
+   {
+   		iNewscheduler = new (ELeave) CActiveScheduler(); 
+   		CActiveScheduler::Install(iNewscheduler);
+		iInstalled = 1;
+   }
+*/   
+   iWaitScheduler = new (ELeave) CActiveSchedulerWait;
+}
+
+CContactSyncIter::~CContactSyncIter()
+{
+	delete iNewscheduler;
+	delete iWaitScheduler;
+}