5
|
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 the License "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: Sync behaviour implemetation for getlist iterator.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
#include "syncbehaviour.h"
|
|
22 |
|
|
23 |
//------------------------------------
|
|
24 |
// Adds itself to the active scheduler
|
|
25 |
//------------------------------------
|
|
26 |
CContactSyncIter::CContactSyncIter():CActive(0)
|
|
27 |
{
|
|
28 |
CActiveScheduler::Add(this);
|
|
29 |
}
|
|
30 |
|
|
31 |
//---------------------
|
|
32 |
// RunL() calls Signal()
|
|
33 |
//----------------------
|
|
34 |
void CContactSyncIter::RunL()
|
|
35 |
{
|
|
36 |
Signal();
|
|
37 |
}
|
|
38 |
|
|
39 |
void CContactSyncIter::DoCancel()
|
|
40 |
{
|
|
41 |
|
|
42 |
}
|
|
43 |
|
|
44 |
//------------------------------------
|
|
45 |
// Stops the scheduler and does cleanup
|
|
46 |
//------------------------------------
|
|
47 |
void CContactSyncIter::Signal()
|
|
48 |
{
|
|
49 |
iWaitScheduler->AsyncStop();
|
|
50 |
}
|
|
51 |
|
|
52 |
//------------------------------------
|
|
53 |
// Sets the status of the Scheduler
|
|
54 |
// and starts it
|
|
55 |
//------------------------------------
|
|
56 |
void CContactSyncIter::Wait()
|
|
57 |
{
|
|
58 |
if(!IsActive())
|
|
59 |
{
|
|
60 |
iStatus = KRequestPending;
|
|
61 |
SetActive();
|
|
62 |
}
|
|
63 |
iWaitScheduler->Start();
|
|
64 |
}
|
|
65 |
|
|
66 |
//----------------------------------
|
|
67 |
// NewL() Method
|
|
68 |
//----------------------------------
|
|
69 |
CContactSyncIter* CContactSyncIter::NewL()
|
|
70 |
{
|
|
71 |
CContactSyncIter* self = new( ELeave ) CContactSyncIter( );
|
|
72 |
CleanupStack::PushL( self );
|
|
73 |
self->ConstructL();
|
|
74 |
CleanupStack::Pop( self );
|
|
75 |
return self;
|
|
76 |
|
|
77 |
}
|
|
78 |
|
|
79 |
//----------------------------------------------------
|
|
80 |
// ConstructL method -
|
|
81 |
// Installs the active scheduler if not already installed
|
|
82 |
//----------------------------------------------------
|
|
83 |
void CContactSyncIter::ConstructL()
|
|
84 |
{
|
|
85 |
/*
|
|
86 |
iInstalled = 0;
|
|
87 |
if(!CActiveScheduler::Current())
|
|
88 |
{
|
|
89 |
iNewscheduler = new (ELeave) CActiveScheduler();
|
|
90 |
CActiveScheduler::Install(iNewscheduler);
|
|
91 |
iInstalled = 1;
|
|
92 |
}
|
|
93 |
*/
|
|
94 |
iWaitScheduler = new (ELeave) CActiveSchedulerWait;
|
|
95 |
}
|
|
96 |
|
|
97 |
CContactSyncIter::~CContactSyncIter()
|
|
98 |
{
|
|
99 |
delete iNewscheduler;
|
|
100 |
delete iWaitScheduler;
|
|
101 |
}
|