|
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: Implementation of the contactsynccallback class. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 //system include |
|
20 #include <e32base.h> |
|
21 |
|
22 //user include |
|
23 #include "contactsynccallback.h" |
|
24 #include "singlecontact.h" |
|
25 /* |
|
26 ----------------------------------------------------------------------------- |
|
27 contactsynccallback::contactsynccallback() |
|
28 Description : Default Constructor |
|
29 Return values : N/A |
|
30 ----------------------------------------------------------------------------- |
|
31 */ |
|
32 CContactSyncCallback :: CContactSyncCallback(): |
|
33 iIter(NULL), |
|
34 iError(KErrNone), |
|
35 iWaitScheduler(NULL), |
|
36 iErrKey(0) |
|
37 { |
|
38 } |
|
39 |
|
40 /* |
|
41 ----------------------------------------------------------------------------- |
|
42 contactsynccallback::~contactsynccallback() |
|
43 Description : Destructor |
|
44 Return values : N/A |
|
45 ----------------------------------------------------------------------------- |
|
46 */ |
|
47 CContactSyncCallback :: ~CContactSyncCallback() |
|
48 { |
|
49 iIter=NULL; |
|
50 } |
|
51 |
|
52 /* |
|
53 ----------------------------------------------------------------------------- |
|
54 contactsynccallback :: GetIter() |
|
55 Description : Getter method to get a pointer to the iterator does a shallow copy. |
|
56 Return values : pointer to class CContactIter |
|
57 ----------------------------------------------------------------------------- |
|
58 */ |
|
59 |
|
60 CContactIter* CContactSyncCallback :: GetIter() |
|
61 { |
|
62 return iIter; |
|
63 } |
|
64 |
|
65 /* |
|
66 ----------------------------------------------------------------------------- |
|
67 contactsynccallback :: GetErrorCode() |
|
68 Description : Getter method to get error code. |
|
69 Return values : Integer error code. |
|
70 ----------------------------------------------------------------------------- |
|
71 */ |
|
72 TInt CContactSyncCallback :: GetErrorCode() |
|
73 { |
|
74 return iError; |
|
75 } |
|
76 /* |
|
77 ----------------------------------------------------------------------------- |
|
78 contactsynccallback :: SetWaitScheduler() |
|
79 Description : setter method for the wait shceduler shallow copy owned by core class. |
|
80 Return values : Integer error code. |
|
81 ----------------------------------------------------------------------------- |
|
82 */ |
|
83 void CContactSyncCallback::SetWaitScheduler(CActiveSchedulerWait *aWaitScheduler) |
|
84 { |
|
85 iWaitScheduler = aWaitScheduler; |
|
86 } |
|
87 /* |
|
88 ----------------------------------------------------------------------------- |
|
89 contactsynccallback :: HandleReturnValue( TOperationEvent aEvent, const TInt& aError, TInt aTransId ) |
|
90 Description : virtual method which is called by the core class if there is any event |
|
91 : in the asynchronous call. |
|
92 Return values : N/A |
|
93 ----------------------------------------------------------------------------- |
|
94 */ |
|
95 void CContactSyncCallback :: HandleReturnValue(TOperationEvent aEvent, |
|
96 const TInt& aError, |
|
97 TInt /*aTransId*/ ) |
|
98 { |
|
99 if(aEvent == EInvalidKey) |
|
100 { |
|
101 iError = KErrNotSupported; |
|
102 //TPtrC8 ptr = CSearchFields :: GetFieldKeyFromId(aError); |
|
103 iErrKey = aError; |
|
104 } |
|
105 else |
|
106 { |
|
107 iError = aError; |
|
108 } |
|
109 //can be CActiveScheduler::Stop(); or to be replaced by wait scheduler. |
|
110 iWaitScheduler->AsyncStop(); |
|
111 } |
|
112 |
|
113 |
|
114 /* |
|
115 ----------------------------------------------------------------------------- |
|
116 contactsynccallback :: HandleReturnIter( TOperationEvent aEvent, const TInt& aError, CContactIter* aIter, TInt aTransId ) |
|
117 Description : virtual method which is called by the core class if |
|
118 : any asynchronous call completes successfully |
|
119 Return values : N/A |
|
120 ----------------------------------------------------------------------------- |
|
121 */ |
|
122 |
|
123 void CContactSyncCallback :: HandleReturnIter( const TInt& /*aError*/, CContactIter* aIter, TInt /*aTransId*/ ) |
|
124 { |
|
125 iIter = aIter; |
|
126 //can be CActiveScheduler::Stop(); or to be replaced by wait scheduler. |
|
127 iWaitScheduler->AsyncStop(); |
|
128 } |