74 // |
74 // |
75 // --------------------------------------------------------------------------- |
75 // --------------------------------------------------------------------------- |
76 // |
76 // |
77 void CAiProfilePlugin::ConstructL() |
77 void CAiProfilePlugin::ConstructL() |
78 { |
78 { |
79 iContent = AiUtility::CreateContentItemArrayIteratorL( KAiProfileContent ); |
79 iContent = |
80 iEvents = AiUtility::CreateContentItemArrayIteratorL( KAiProfileEvents ); |
80 AiUtility::CreateContentItemArrayIteratorL( KAiProfileContent ); |
81 iResources = AiUtility::CreateContentItemArrayIteratorL( KAiProfileResources ); |
81 |
|
82 iEvents = |
|
83 AiUtility::CreateContentItemArrayIteratorL( KAiProfileEvents ); |
|
84 |
|
85 iResources = |
|
86 AiUtility::CreateContentItemArrayIteratorL( KAiProfileResources ); |
|
87 |
|
88 iEngine = CAiProfileEngine::NewL( this ); |
|
89 |
|
90 iEngine->UpdateProfileNamesL(); |
82 } |
91 } |
83 |
92 |
84 // --------------------------------------------------------------------------- |
93 // --------------------------------------------------------------------------- |
85 // CAiProfilePlugin::~CAiProfilePlugin |
94 // CAiProfilePlugin::~CAiProfilePlugin |
86 // Deletes all data created to heap |
95 // Deletes all data created to heap |
87 // --------------------------------------------------------------------------- |
96 // --------------------------------------------------------------------------- |
88 // |
97 // |
89 CAiProfilePlugin::~CAiProfilePlugin() |
98 CAiProfilePlugin::~CAiProfilePlugin() |
90 { |
99 { |
91 CleanPublishedProfileNames(); |
|
92 |
|
93 Release( iContent ); |
100 Release( iContent ); |
94 Release( iEvents ); |
101 Release( iEvents ); |
95 Release( iResources ); |
102 Release( iResources ); |
96 |
103 |
97 delete iActiveProfileAndChar; |
104 delete iActiveProfileAndChar; |
287 // |
294 // |
288 // --------------------------------------------------------------------------- |
295 // --------------------------------------------------------------------------- |
289 // |
296 // |
290 void CAiProfilePlugin::Start( TStartReason /*aReason*/ ) |
297 void CAiProfilePlugin::Start( TStartReason /*aReason*/ ) |
291 { |
298 { |
|
299 iPublishRequired = ETrue; |
292 } |
300 } |
293 |
301 |
294 // --------------------------------------------------------------------------- |
302 // --------------------------------------------------------------------------- |
295 // CAiProfilePlugin::Stop |
303 // CAiProfilePlugin::Stop |
296 // |
304 // |
297 // --------------------------------------------------------------------------- |
305 // --------------------------------------------------------------------------- |
298 // |
306 // |
299 void CAiProfilePlugin::Stop( TStopReason /*aReason*/ ) |
307 void CAiProfilePlugin::Stop( TStopReason /*aReason*/ ) |
300 { |
308 { |
|
309 CleanPublishedProfileNames(); |
301 } |
310 } |
302 |
311 |
303 // --------------------------------------------------------------------------- |
312 // --------------------------------------------------------------------------- |
304 // CAiProfilePlugin::Resume |
313 // CAiProfilePlugin::Resume |
305 // |
314 // |
379 // |
388 // |
380 // --------------------------------------------------------------------------- |
389 // --------------------------------------------------------------------------- |
381 // |
390 // |
382 void CAiProfilePlugin::DoResumeL() |
391 void CAiProfilePlugin::DoResumeL() |
383 { |
392 { |
384 if( !iEngine ) |
393 if ( iPublishRequired ) |
385 { |
394 { |
386 iEngine = CAiProfileEngine::NewL( this ); |
395 iPublishRequired = EFalse; |
387 |
396 |
388 iEngine->UpdateProfileNamesL(); |
397 PublishL(); |
389 |
|
390 PublishL(); |
|
391 } |
398 } |
392 } |
399 } |
393 |
400 |
394 // --------------------------------------------------------------------------- |
401 // --------------------------------------------------------------------------- |
395 // CAiProfilePlugin::NotifyContentUpdate() |
402 // CAiProfilePlugin::NotifyContentUpdate() |
396 // This method is called from the engine, when the profile data has changed |
403 // This method is called from the engine, when the profile data has changed |
397 // --------------------------------------------------------------------------- |
404 // --------------------------------------------------------------------------- |
398 // |
405 // |
399 void CAiProfilePlugin::NotifyContentUpdate() |
406 void CAiProfilePlugin::NotifyContentUpdate() |
400 { |
407 { |
401 TRAP_IGNORE( PublishL() ); |
408 iPublishRequired = ETrue; |
|
409 |
|
410 TRAP_IGNORE( DoResumeL() ); |
402 } |
411 } |
403 |
412 |
404 // --------------------------------------------------------------------------- |
413 // --------------------------------------------------------------------------- |
405 // CAiProfilePlugin::CleanPublishedProfileNames |
414 // CAiProfilePlugin::CleanPublishedProfileNames |
406 // Clean profile names from content |
415 // Clean profile names from content |
417 for ( TInt j( 0 ); j < iCurrentCount && observer; j++ ) |
426 for ( TInt j( 0 ); j < iCurrentCount && observer; j++ ) |
418 { |
427 { |
419 observer->Clean( *this, EAiProfileContentProfileName, j + 1 ); |
428 observer->Clean( *this, EAiProfileContentProfileName, j + 1 ); |
420 } |
429 } |
421 } |
430 } |
|
431 |
|
432 delete iPreviousProfileNameAndChar; |
|
433 iPreviousProfileNameAndChar = NULL; |
|
434 |
|
435 iPreviousCount = 0; |
422 } |
436 } |
423 |
437 |
424 // ======== GLOBAL FUNCTIONS ======== |
438 // ======== GLOBAL FUNCTIONS ======== |
425 // --------------------------------------------------------------------------- |
439 // --------------------------------------------------------------------------- |
426 // Constructs and returns an application object. |
440 // Constructs and returns an application object. |