22 #include "mdeobjectdef.h" |
22 #include "mdeobjectdef.h" |
23 #include "mdeobjectquery.h" |
23 #include "mdeobjectquery.h" |
24 |
24 |
25 using namespace MdeConstants; |
25 using namespace MdeConstants; |
26 |
26 |
|
27 |
|
28 // -------------------------------------------------------------------------- |
|
29 // CLocationRemappingAO::NewL() |
|
30 // -------------------------------------------------------------------------- |
|
31 // |
27 CLocationRemappingAO* CLocationRemappingAO::NewL() |
32 CLocationRemappingAO* CLocationRemappingAO::NewL() |
28 { |
33 { |
29 LOG( "CLocationRemappingAO::NewL" ); // DEBUG INFO |
34 LOG( "CLocationRemappingAO::NewL" ); // DEBUG INFO |
30 |
35 |
31 CLocationRemappingAO* self = new (ELeave) CLocationRemappingAO(); |
36 CLocationRemappingAO* self = new (ELeave) CLocationRemappingAO(); |
33 self->ConstructL(); |
38 self->ConstructL(); |
34 CleanupStack::Pop( self ); |
39 CleanupStack::Pop( self ); |
35 return self; |
40 return self; |
36 } |
41 } |
37 |
42 |
|
43 // -------------------------------------------------------------------------- |
|
44 // CLocationRemappingAO::ConstructL() |
|
45 // -------------------------------------------------------------------------- |
|
46 // |
38 void CLocationRemappingAO::ConstructL() |
47 void CLocationRemappingAO::ConstructL() |
39 { |
48 { |
40 LOG( "CLocationRemappingAO::ConstructL" ); // DEBUG INFO |
49 LOG( "CLocationRemappingAO::ConstructL" ); // DEBUG INFO |
41 CActiveScheduler::Add( this ); |
50 CActiveScheduler::Add( this ); |
42 iMdEClient = NULL; |
51 iMdEClient = NULL; |
47 LOG( "CLocationRemappingAO::ConstructL, Can not read timelimit value from CenRep"); |
56 LOG( "CLocationRemappingAO::ConstructL, Can not read timelimit value from CenRep"); |
48 iTimeLimit = TTimeIntervalSeconds( KRemappingTime ); |
57 iTimeLimit = TTimeIntervalSeconds( KRemappingTime ); |
49 } |
58 } |
50 } |
59 } |
51 |
60 |
|
61 // -------------------------------------------------------------------------- |
|
62 // CLocationRemappingAO::~CLocationRemappingAO() |
|
63 // -------------------------------------------------------------------------- |
|
64 // |
52 CLocationRemappingAO::~CLocationRemappingAO() |
65 CLocationRemappingAO::~CLocationRemappingAO() |
53 { |
66 { |
54 LOG( "CLocationRemappingAO::~CLocationRemappingAO" ); // DEBUG INFO |
67 LOG( "CLocationRemappingAO::~CLocationRemappingAO" ); // DEBUG INFO |
55 |
68 |
56 StopRemapping(); |
69 StopRemapping(); |
57 Cancel(); |
70 Cancel(); |
58 |
71 |
59 iObjects.ResetAndDestroy(); |
72 iObjects.ResetAndDestroy(); |
60 } |
73 } |
61 |
74 |
|
75 // -------------------------------------------------------------------------- |
|
76 // CLocationRemappingAO::CLocationRemappingAO() |
|
77 // -------------------------------------------------------------------------- |
|
78 // |
62 CLocationRemappingAO::CLocationRemappingAO() : CActive( CActive::EPriorityStandard ), |
79 CLocationRemappingAO::CLocationRemappingAO() : CActive( CActive::EPriorityStandard ), |
63 iState ( EIdle ), |
80 iState ( EIdle ), |
64 iContinue( EFalse ), |
81 iContinue( EFalse ), |
65 iTimed( EFalse ), |
82 iTimed( EFalse ), |
66 iRequested( EFalse ), |
83 iRequested( EFalse ), |
69 iTimeLimit( 0 ) |
86 iTimeLimit( 0 ) |
70 { |
87 { |
71 // No implementation required |
88 // No implementation required |
72 } |
89 } |
73 |
90 |
74 |
91 // -------------------------------------------------------------------------- |
|
92 // CLocationRemappingAO::InitialiseL() |
|
93 // -------------------------------------------------------------------------- |
|
94 // |
75 void CLocationRemappingAO::InitialiseL(CMdESession* aMdEClient) |
95 void CLocationRemappingAO::InitialiseL(CMdESession* aMdEClient) |
76 { |
96 { |
77 LOG( "CLocationRemappingAO::Initialise start" ); // DEBUG INFO |
97 LOG( "CLocationRemappingAO::Initialise start" ); // DEBUG INFO |
78 iMdEClient = aMdEClient; |
98 iMdEClient = aMdEClient; |
79 |
99 |
95 iContainsLocationRelDef = &iNamespaceDef->GetRelationDefL( Relations::KContainsLocation ); |
115 iContainsLocationRelDef = &iNamespaceDef->GetRelationDefL( Relations::KContainsLocation ); |
96 |
116 |
97 LOG( "CLocationRemappingAO::Initialise end" ); |
117 LOG( "CLocationRemappingAO::Initialise end" ); |
98 } |
118 } |
99 |
119 |
|
120 |
|
121 // -------------------------------------------------------------------------- |
|
122 // CLocationRemappingAO::Append() |
|
123 // -------------------------------------------------------------------------- |
|
124 // |
100 void CLocationRemappingAO::Append( TRemapItem aItem ) |
125 void CLocationRemappingAO::Append( TRemapItem aItem ) |
101 { |
126 { |
102 iRemapItems.Append( aItem ); |
127 iRemapItems.Append( aItem ); |
103 } |
128 } |
104 |
129 |
|
130 |
|
131 // -------------------------------------------------------------------------- |
|
132 // CLocationRemappingAO::ResetQueue() |
|
133 // -------------------------------------------------------------------------- |
|
134 // |
105 void CLocationRemappingAO::ResetQueue() |
135 void CLocationRemappingAO::ResetQueue() |
106 { |
136 { |
107 iRemapItems.Reset(); |
137 iRemapItems.Reset(); |
108 } |
138 } |
109 |
139 |
|
140 |
|
141 // -------------------------------------------------------------------------- |
|
142 // CLocationRemappingAO::ItemsInQueue() |
|
143 // -------------------------------------------------------------------------- |
|
144 // |
110 TBool CLocationRemappingAO::ItemsInQueue() |
145 TBool CLocationRemappingAO::ItemsInQueue() |
111 { |
146 { |
112 return iRemapItems.Count() > 0; |
147 return iRemapItems.Count() > 0; |
113 } |
148 } |
114 |
149 |
|
150 |
|
151 // -------------------------------------------------------------------------- |
|
152 // CLocationRemappingAO::CheckQueue() |
|
153 // -------------------------------------------------------------------------- |
|
154 // |
115 TBool CLocationRemappingAO::CheckQueue() |
155 TBool CLocationRemappingAO::CheckQueue() |
116 { |
156 { |
117 LOG( "CLocationRemappingAO::CheckQueue - start" ); |
157 LOG( "CLocationRemappingAO::CheckQueue - start" ); |
118 TBool create( EFalse ); |
158 TBool create( EFalse ); |
119 TInt index = iRemapItems.Count() - 1; |
159 TInt index = iRemapItems.Count() - 1; |
163 removeLocations.Close(); |
203 removeLocations.Close(); |
164 LOG( "CLocationRemappingAO::CheckQueue - end" ); |
204 LOG( "CLocationRemappingAO::CheckQueue - end" ); |
165 return create; |
205 return create; |
166 } |
206 } |
167 |
207 |
168 |
208 // -------------------------------------------------------------------------- |
|
209 // CLocationRemappingAO::StopRemapping() |
|
210 // -------------------------------------------------------------------------- |
|
211 // |
169 void CLocationRemappingAO::StopRemapping() |
212 void CLocationRemappingAO::StopRemapping() |
170 { |
213 { |
171 LOG( "CLocationRemappingAO::StopRemapping" ); // DEBUG INFO |
214 LOG( "CLocationRemappingAO::StopRemapping" ); // DEBUG INFO |
172 NextState(EIdle); |
215 NextState(EIdle); |
173 } |
216 } |
174 |
217 |
|
218 |
|
219 // -------------------------------------------------------------------------- |
|
220 // CLocationRemappingAO::StartRemappingObjects() |
|
221 // -------------------------------------------------------------------------- |
|
222 // |
175 void CLocationRemappingAO::StartRemappingObjects( const TLocationData& aLocationData ) |
223 void CLocationRemappingAO::StartRemappingObjects( const TLocationData& aLocationData ) |
176 { |
224 { |
177 iLocationData = aLocationData; |
225 iLocationData = aLocationData; |
178 LOG( "CLocationRemappingAO::StartRemappingObjects" ); // DEBUG INFO |
226 LOG( "CLocationRemappingAO::StartRemappingObjects" ); // DEBUG INFO |
179 TInt count = iRemapItems.Count(); |
227 TInt count = iRemapItems.Count(); |
183 return; |
231 return; |
184 } |
232 } |
185 NextState( ERemapObjects ); |
233 NextState( ERemapObjects ); |
186 } |
234 } |
187 |
235 |
|
236 |
|
237 // -------------------------------------------------------------------------- |
|
238 // CLocationRemappingAO::NextState() |
|
239 // -------------------------------------------------------------------------- |
|
240 // |
188 void CLocationRemappingAO::NextState(TMappingState aState) |
241 void CLocationRemappingAO::NextState(TMappingState aState) |
189 { |
242 { |
190 LOG1( "CLocationRemappingAO::NextState - state: %d", aState ); // DEBUG INFO |
243 LOG1( "CLocationRemappingAO::NextState - state: %d", aState ); // DEBUG INFO |
191 iState = aState; |
244 iState = aState; |
192 // Request complete if not idling |
245 // Request complete if not idling |
196 User::RequestComplete( pStatus, KErrNone ); |
249 User::RequestComplete( pStatus, KErrNone ); |
197 SetActive(); |
250 SetActive(); |
198 } |
251 } |
199 } |
252 } |
200 |
253 |
|
254 |
|
255 // -------------------------------------------------------------------------- |
|
256 // CLocationRemappingAO::DoCancel() |
|
257 // -------------------------------------------------------------------------- |
|
258 // |
201 void CLocationRemappingAO::DoCancel() |
259 void CLocationRemappingAO::DoCancel() |
202 { |
260 { |
203 LOG( "CLocationRemappingAO::DoCancel" ); // DEBUG INFO |
261 LOG( "CLocationRemappingAO::DoCancel" ); // DEBUG INFO |
204 // back to idle |
262 // back to idle |
205 NextState(EIdle); |
263 NextState(EIdle); |
206 } |
264 } |
207 |
265 |
|
266 |
|
267 // -------------------------------------------------------------------------- |
|
268 // CLocationRemappingAO::RunError() |
|
269 // -------------------------------------------------------------------------- |
|
270 // |
208 TInt CLocationRemappingAO::RunError( TInt aError ) |
271 TInt CLocationRemappingAO::RunError( TInt aError ) |
209 { |
272 { |
210 if (aError != KErrNone) |
273 if (aError != KErrNone) |
211 { |
274 { |
212 LOG1( "CLocationRemappingAO::RunError with error code: %d", aError ); // DEBUG INFO |
275 LOG1( "CLocationRemappingAO::RunError with error code: %d", aError ); // DEBUG INFO |
250 break; |
318 break; |
251 } |
319 } |
252 } |
320 } |
253 } |
321 } |
254 |
322 |
255 |
323 // -------------------------------------------------------------------------- |
|
324 // CLocationRemappingAO::RemapObjectsL() |
|
325 // -------------------------------------------------------------------------- |
|
326 // |
256 void CLocationRemappingAO::RemapObjectsL() |
327 void CLocationRemappingAO::RemapObjectsL() |
257 { |
328 { |
258 LOG( "CLocationRemappingAO::RemapObjects - start" ); // DEBUG INFO |
329 LOG( "CLocationRemappingAO::RemapObjects - start" ); // DEBUG INFO |
259 // remap location data to location objects |
330 // remap location data to location objects |
260 TInt count = iRemapItems.Count(); |
331 TInt count = iRemapItems.Count(); |
329 ResetQueue(); |
400 ResetQueue(); |
330 |
401 |
331 LOG( "CLocationRemappingAO::RemapObjects - end" ); |
402 LOG( "CLocationRemappingAO::RemapObjects - end" ); |
332 } |
403 } |
333 |
404 |
|
405 |
|
406 // -------------------------------------------------------------------------- |
|
407 // CLocationRemappingAO::CommitObjectsL() |
|
408 // -------------------------------------------------------------------------- |
|
409 // |
334 void CLocationRemappingAO::CommitObjectsL() |
410 void CLocationRemappingAO::CommitObjectsL() |
335 { |
411 { |
336 LOG( "CLocationRemappingAO::CommitObjects" ); // DEBUG INFO |
412 LOG( "CLocationRemappingAO::CommitObjects" ); // DEBUG INFO |
337 // commit location objects |
413 // commit location objects |
338 if( iObjects.Count() > 0 ) |
414 if( iObjects.Count() > 0 ) |
358 iTimeLimit = TTimeIntervalSeconds( value ); |
434 iTimeLimit = TTimeIntervalSeconds( value ); |
359 |
435 |
360 LOG( "CLocationRemappingAO::ReadTimeFromCenRepL(), end" ); |
436 LOG( "CLocationRemappingAO::ReadTimeFromCenRepL(), end" ); |
361 } |
437 } |
362 |
438 |
363 |
439 // -------------------------------------------------------------------------- |
|
440 // CLocationRemappingAO::UpdateRelationsL() |
|
441 // -------------------------------------------------------------------------- |
|
442 // |
364 void CLocationRemappingAO::UpdateRelationsL( TItemId aLocationId ) |
443 void CLocationRemappingAO::UpdateRelationsL( TItemId aLocationId ) |
365 { |
444 { |
366 LOG("CLocationRemappingAO::UpdateRelationsL - start"); |
445 LOG("CLocationRemappingAO::UpdateRelationsL - start"); |
367 CMdENamespaceDef& namespaceDef = iMdEClient->GetDefaultNamespaceDefL(); |
446 CMdENamespaceDef& namespaceDef = iMdEClient->GetDefaultNamespaceDefL(); |
368 |
447 |
394 } |
473 } |
395 } |
474 } |
396 LOG("CLocationRemappingAO::UpdateRelationsL - end"); |
475 LOG("CLocationRemappingAO::UpdateRelationsL - end"); |
397 } |
476 } |
398 |
477 |
|
478 #ifdef LOC_REVERSEGEOCODE |
|
479 // -------------------------------------------------------------------------- |
|
480 // CLocationRemapping::AttachGeoTagsL |
|
481 // -------------------------------------------------------------------------- |
|
482 // |
|
483 void CLocationRemappingAO::AttachGeoTagsL( CTagCreator *aTagCreator, |
|
484 const TItemId aCountryTagId, const TItemId aCityTagId ) |
|
485 { |
|
486 LOG("CLocationRemapping::AttachGeoTagsL - start"); |
|
487 |
|
488 TInt count = iObjectIds.Count() - 1; |
|
489 for( TInt i = count; i >= 0; i-- ) |
|
490 { |
|
491 aTagCreator->AttachTagsL( iObjectIds[i], aCountryTagId, aCityTagId ); |
|
492 } |
|
493 |
|
494 iObjectIds.Reset(); |
|
495 |
|
496 LOG("CLocationRemapping::AttachGeoTagsL - end"); |
|
497 } |
|
498 |
|
499 #endif //LOC_REVERSEGEOCODE |
|
500 |
|
501 |
399 // -------------------------------------------------------------------------- |
502 // -------------------------------------------------------------------------- |
400 // TRemapItem constructor |
503 // TRemapItem constructor |
401 // -------------------------------------------------------------------------- |
504 // -------------------------------------------------------------------------- |
402 // |
505 // |
403 TRemapItem::TRemapItem() : |
506 TRemapItem::TRemapItem() : |