32 #include <aicontentobserver.h> |
32 #include <aicontentobserver.h> |
33 #include <aiutility.h> |
33 #include <aiutility.h> |
34 #include <aipspropertyobserver.h> |
34 #include <aipspropertyobserver.h> |
35 #include <aipluginsettings.h> |
35 #include <aipluginsettings.h> |
36 #include <activeidle2domainpskeys.h> |
36 #include <activeidle2domainpskeys.h> |
|
37 #include <debug.h> |
37 |
38 |
38 #include "sapidatapluginconst.h" |
39 #include "sapidatapluginconst.h" |
39 #include "sapidatapluginuids.hrh" |
40 #include "sapidatapluginuids.hrh" |
40 #include "sapidataplugin.h" |
41 #include "sapidataplugin.h" |
41 #include "sapidata.h" |
42 #include "sapidata.h" |
76 // --------------------------------------------------------------------------- |
77 // --------------------------------------------------------------------------- |
77 // Default constructor |
78 // Default constructor |
78 // --------------------------------------------------------------------------- |
79 // --------------------------------------------------------------------------- |
79 // |
80 // |
80 CSapiDataPlugin::CSapiDataPlugin() |
81 CSapiDataPlugin::CSapiDataPlugin() |
81 : iNetworkStatus( EUnknown ), iPluginState( ENone ) |
82 : iNetworkStatus( EUnknown ), iPluginState( ENone ) |
82 { |
83 { |
83 } |
84 } |
84 |
85 |
85 // --------------------------------------------------------------------------- |
86 // --------------------------------------------------------------------------- |
86 // Symbian 2nd phase constructor can leave |
87 // Symbian 2nd phase constructor can leave |
99 // --------------------------------------------------------------------------- |
100 // --------------------------------------------------------------------------- |
100 // |
101 // |
101 CSapiDataPlugin::~CSapiDataPlugin() |
102 CSapiDataPlugin::~CSapiDataPlugin() |
102 { |
103 { |
103 // deactivate the publishers |
104 // deactivate the publishers |
104 if ( iData ) |
105 delete iData; |
105 { |
|
106 TRAP_IGNORE( iData->ChangePublisherStatusL( KDeActive )); |
|
107 |
|
108 delete iData; |
|
109 } |
|
110 |
|
111 iObservers.Close(); |
106 iObservers.Close(); |
112 Release( iContent ); |
107 Release( iContent ); |
113 |
|
114 iDataArray.ResetAndDestroy(); |
108 iDataArray.ResetAndDestroy(); |
115 |
109 |
116 if ( iContentModel ) |
110 if ( iContentModel ) |
117 { |
111 { |
118 for ( TInt i = iDataCount - 1; i >= 0 ; i-- ) |
112 for ( TInt i = iDataCount - 1; i >= 0 ; i-- ) |
150 } |
143 } |
151 |
144 |
152 // Release memory of the published text |
145 // Release memory of the published text |
153 iDataArray.ResetAndDestroy(); |
146 iDataArray.ResetAndDestroy(); |
154 // Release memory of the published icons |
147 // Release memory of the published icons |
155 iIconArray.Reset(); |
148 iIconArray.Reset(); |
156 |
149 } |
157 } |
|
158 } |
150 } |
159 |
151 |
160 // --------------------------------------------------------------------------- |
152 // --------------------------------------------------------------------------- |
161 // Publish a specific text of the widget |
153 // Publish a specific text of the widget |
162 // --------------------------------------------------------------------------- |
154 // --------------------------------------------------------------------------- |
357 |
349 |
358 return KNullDesC(); |
350 return KNullDesC(); |
359 } |
351 } |
360 |
352 |
361 // --------------------------------------------------------------------------- |
353 // --------------------------------------------------------------------------- |
362 //Refresh a specific image of text in the widget |
354 //Refresh a specific image or text in the widget |
363 // --------------------------------------------------------------------------- |
355 // --------------------------------------------------------------------------- |
364 // |
356 // |
365 void CSapiDataPlugin::RefreshL( TDesC& aContentType, |
357 void CSapiDataPlugin::RefreshL( TDesC& aContentType, |
366 TDesC& aOperation, |
358 TDesC& aOperation, |
367 CLiwDefaultMap* aDataMap ) |
359 CLiwDefaultMap* aDataMap ) |
368 { |
360 { |
|
361 __PRINTS("*** CSapiDataPlugin::RefreshL ***"); |
|
362 |
|
363 __PRINT( __DBG_FORMAT( "* Publisher name: %S, uid: 0x%x, content type: %S, operation: %S" ), |
|
364 &PublisherInfo().Name(), PublisherInfo().Uid().iUid, &aContentType, &aOperation ); |
|
365 |
369 const TInt observerCount( iObservers.Count() ); |
366 const TInt observerCount( iObservers.Count() ); |
370 const TInt transactionId = reinterpret_cast<TInt>( this ); |
367 const TInt transactionId = reinterpret_cast<TInt>( this ); |
371 |
368 |
372 for( TInt obsIndex = 0; obsIndex < observerCount; obsIndex++ ) |
369 for( TInt obsIndex = 0; obsIndex < observerCount; obsIndex++ ) |
373 { |
370 { |
396 |
393 |
397 // Relese memory of the published text |
394 // Relese memory of the published text |
398 iDataArray.ResetAndDestroy(); |
395 iDataArray.ResetAndDestroy(); |
399 iIconArray.Reset(); |
396 iIconArray.Reset(); |
400 } |
397 } |
|
398 |
|
399 __PRINTS("*** CSapiDataPlugin::RefreshL - done ***"); |
401 } |
400 } |
402 |
401 |
403 // --------------------------------------------------------------------------- |
402 // --------------------------------------------------------------------------- |
404 // Cleans a data from the widget |
403 // Cleans a data from the widget |
405 // --------------------------------------------------------------------------- |
404 // --------------------------------------------------------------------------- |
432 else if( aReason == EPluginStartup ) |
431 else if( aReason == EPluginStartup ) |
433 { |
432 { |
434 TRAP_IGNORE( PublishL() ); |
433 TRAP_IGNORE( PublishL() ); |
435 TRAP_IGNORE( iData->SetStartupReasonL( KPluginStartup)); |
434 TRAP_IGNORE( iData->SetStartupReasonL( KPluginStartup)); |
436 } |
435 } |
|
436 |
|
437 // Listen for publisher registration to resend the events |
|
438 TRAP_IGNORE( iData->RegisterPublisherObserverL() ); |
437 } |
439 } |
438 |
440 |
439 // ---------------------------------------------------------------------------- |
441 // ---------------------------------------------------------------------------- |
440 // CSapiDataPlugin::Stop |
442 // CSapiDataPlugin::Stop |
441 // |
443 // |
452 TRAP_IGNORE( iData->ChangePublisherStatusL( KPageShutdown )); |
454 TRAP_IGNORE( iData->ChangePublisherStatusL( KPageShutdown )); |
453 } |
455 } |
454 else if( aReason == EPluginShutdown ) |
456 else if( aReason == EPluginShutdown ) |
455 { |
457 { |
456 TRAP_IGNORE( iData->ChangePublisherStatusL( KPluginShutdown )); |
458 TRAP_IGNORE( iData->ChangePublisherStatusL( KPluginShutdown )); |
|
459 } |
|
460 |
|
461 if ( iData ) |
|
462 { |
|
463 TRAP_IGNORE( iData->ChangePublisherStatusL( KDeActive )); |
457 } |
464 } |
458 } |
465 } |
459 |
466 |
460 // ---------------------------------------------------------------------------- |
467 // ---------------------------------------------------------------------------- |
461 // CSapiDataPlugin::Resume |
468 // CSapiDataPlugin::Resume |
610 |
617 |
611 // Configurations |
618 // Configurations |
612 iData->ConfigureL( configurationItemsArr ); |
619 iData->ConfigureL( configurationItemsArr ); |
613 |
620 |
614 iPluginState = ESuspend; |
621 iPluginState = ESuspend; |
|
622 |
|
623 // Listen the publisher content update |
|
624 iData->RegisterContentObserverL(); |
615 |
625 |
616 // Activate the publisher |
626 // Activate the publisher |
617 iData->ChangePublisherStatusL( KActive ); |
627 iData->ChangePublisherStatusL( KActive ); |
618 // Register for notifications |
|
619 iData->RegisterPublisherObserverL(); |
|
620 // Execute the active trigger |
628 // Execute the active trigger |
621 iData->TriggerActiveL(); |
629 iData->TriggerActiveL(); |
622 // There must be at least 1 milli second delay |
630 |
623 // to register the second observer as both are using the |
|
624 // same MLiwInterface object |
|
625 iData->RegisterContentObserverL(); |
|
626 } |
631 } |
627 |
632 |
628 contentItemsArr.Reset(); |
633 contentItemsArr.Reset(); |
629 configurationItemsArr.Reset(); |
634 configurationItemsArr.Reset(); |
630 |
635 |
631 // We own the array so destroy it |
636 // We own the array so destroy it |
632 aSettings.ResetAndDestroy(); |
637 aSettings.ResetAndDestroy(); |
633 } |
638 } |
634 |
639 |
635 // ---------------------------------------------------------------------------- |
640 // ---------------------------------------------------------------------------- |
|
641 // CSapiDataPlugin::SetProperty |
|
642 // |
|
643 // ---------------------------------------------------------------------------- |
|
644 // |
|
645 void CSapiDataPlugin::SetProperty( TProperty aProperty, TAny* aAny ) |
|
646 { |
|
647 if (aProperty == ECpsCmdBuffer ) |
|
648 { |
|
649 iData->SetCommandBuffer( aAny ); |
|
650 } |
|
651 } |
|
652 // ---------------------------------------------------------------------------- |
636 // CSapiDataPlugin::GetProperty |
653 // CSapiDataPlugin::GetProperty |
637 // |
654 // |
638 // ---------------------------------------------------------------------------- |
655 // ---------------------------------------------------------------------------- |
639 // |
656 // |
640 TAny* CSapiDataPlugin::GetProperty( TProperty aProperty ) |
657 TAny* CSapiDataPlugin::GetProperty( TProperty aProperty ) |