author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 24 Nov 2009 08:56:33 +0200 | |
changeset 23 | 50974a8b132e |
parent 10 | fc9cf246af83 |
permissions | -rw-r--r-- |
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: 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 |
} |
|
10
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
129 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
130 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
131 |
void CContactSyncCallback :: HandleReturnId(const TInt& /*aError*/,HBufC8* acntId , TInt /*aTransId*/ ) |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
132 |
{ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
133 |
icntId = acntId; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
134 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
135 |
iWaitScheduler->AsyncStop(); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
136 |
} |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
137 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
138 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
139 |
HBufC8* CContactSyncCallback :: GetId() |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
140 |
{ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
141 |
return icntId; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
142 |
} |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
143 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
144 |
void CContactSyncCallback :: HandleReturnArray( const TInt& /*aError*/, RPointerArray<HBufC8>& idArray, TInt /*aTransId*/ ) |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
145 |
{ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
146 |
//iIDArray = idArray; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
147 |
for(TInt i = 0; i<idArray.Count(); i++) |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
148 |
{ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
149 |
TDesC8* idVal = idArray[i]; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
150 |
HBufC8* idBufVal = idVal->AllocL(); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
151 |
iIDArray.AppendL(idBufVal); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
152 |
} |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
153 |
//can be CActiveScheduler::Stop(); or to be replaced by wait scheduler. |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
154 |
iWaitScheduler->AsyncStop(); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
155 |
} |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
156 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
157 |
void CContactSyncCallback::GetArray(RPointerArray<HBufC8>* aArray) |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
158 |
{ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
159 |
for(TInt i = 0; i<iIDArray.Count(); i++) |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
160 |
{ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
161 |
TDesC8* idVal = iIDArray[i]; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
162 |
HBufC8* idBufVal = idVal->AllocL(); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
163 |
aArray->AppendL(idBufVal); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
164 |
delete idVal; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
165 |
} |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
166 |
} |