76 |
76 |
77 // --------------------------------------------------------------------------- |
77 // --------------------------------------------------------------------------- |
78 // Constructor |
78 // Constructor |
79 // --------------------------------------------------------------------------- |
79 // --------------------------------------------------------------------------- |
80 // |
80 // |
81 CMusicContentPublisher::CMusicContentPublisher( MLiwInterface* aCPSInterface ) |
81 CMusicContentPublisher::CMusicContentPublisher( MLiwInterface* aCPSInterface ): |
82 { |
82 iCPSInterface (aCPSInterface) |
83 iCPSInterface = aCPSInterface; |
83 { |
84 iActivePlugin=NULL; |
|
85 iIsPublisherActive = EFalse; |
|
86 |
|
87 } |
84 } |
88 |
85 |
89 // --------------------------------------------------------------------------- |
86 // --------------------------------------------------------------------------- |
90 // Symbian 2nd phase constructor can leave. |
87 // Symbian 2nd phase constructor can leave. |
91 // --------------------------------------------------------------------------- |
88 // --------------------------------------------------------------------------- |
305 TPtrC type ( reinterpret_cast<const TUint16*>( |
302 TPtrC type ( reinterpret_cast<const TUint16*>( |
306 tmpdstitemp->type) ); |
303 tmpdstitemp->type) ); |
307 TPtrC8 dataKey ( reinterpret_cast<const TUint8*>( |
304 TPtrC8 dataKey ( reinterpret_cast<const TUint8*>( |
308 tmpdstitemp->dataKey ) ); |
305 tmpdstitemp->dataKey ) ); |
309 TPtrC content ( reinterpret_cast<const TUint16*>( |
306 TPtrC content ( reinterpret_cast<const TUint16*>( |
310 tmpdstitemp->content) ); |
307 tmpdstitemp->content) ); |
311 |
308 |
312 aType.Set(type); |
309 aType.Set(type); |
313 aDataKey.Set(dataKey); |
310 aDataKey.Set(dataKey); |
314 |
311 |
315 if ( !content.Compare( KWildCard ) ) |
312 if ( !content.Compare( KWildCard ) ) |
316 { |
313 { |
317 aContent.Set( iInstanceId->Des() ); |
314 aContent.Set(iInstanceId ? iInstanceId->Des(): KNullDesC() ); |
318 } |
315 } |
319 else |
316 else |
320 { |
317 { |
321 aContent.Set(content); |
318 aContent.Set(content); |
322 } |
319 } |
1074 } |
1071 } |
1075 |
1072 |
1076 void CMusicContentPublisher::HandlePublisherNotificationL( const TDesC& aContentId, const TDesC8& aTrigger ) |
1073 void CMusicContentPublisher::HandlePublisherNotificationL( const TDesC& aContentId, const TDesC8& aTrigger ) |
1077 { |
1074 { |
1078 MPX_DEBUG1("CMusicContentPublisher::HandlePublisherNotificationL <---"); |
1075 MPX_DEBUG1("CMusicContentPublisher::HandlePublisherNotificationL <---"); |
1079 if ( aTrigger == KMyActive ) |
1076 if ( aTrigger == KMyActive && !iWidgetActivated) |
1080 { |
1077 { |
|
1078 iWidgetActivated = ETrue; |
1081 MPX_DEBUG1("CMusicContentPublisher::HandlePublisherNotificationL activate"); |
1079 MPX_DEBUG1("CMusicContentPublisher::HandlePublisherNotificationL activate"); |
1082 if ( !iInstanceId ) |
1080 if ( !iInstanceId ) |
1083 { |
1081 { |
1084 iInstanceId = aContentId.AllocL(); |
1082 iInstanceId = aContentId.AllocL(); |
1085 //Reset The Widget |
1083 //Reset The Widget |
1086 MPX_DEBUG1("CMusicContentPublisher::HandlePublisherNotificationL activate --> Reset Widget"); |
1084 MPX_DEBUG1("CMusicContentPublisher::HandlePublisherNotificationL activate --> Reset Widget"); |
1087 RDebug::Print(aContentId); |
1085 RDebug::Print(aContentId); |
1088 PublishImageL(NULL,EMusicWidgetImage1,KEmpty); |
1086 PublishImageL(NULL,EMusicWidgetImage1,KEmpty); |
1089 InstallGoToAlbumL( EMusicWidgetTrigger1 ); |
1087 InstallGoToAlbumL( EMusicWidgetTrigger1 ); |
1090 PublishTextL( NULL,EMusicWidgetText1, KEmpty ); |
1088 PublishTextL( NULL,EMusicWidgetText1, KEmpty ); |
1091 PublishImageL(NULL,EMusicWidgetToolbarB1,KEmpty); |
1089 PublishImageL(NULL,EMusicWidgetToolbarB1,KEmpty); |
1092 PublishImageL(NULL,EMusicWidgetToolbarB2,KEmpty); |
1090 PublishImageL(NULL,EMusicWidgetToolbarB2,KEmpty); |
1093 PublishImageL(NULL,EMusicWidgetToolbarB3,KEmpty); |
1091 PublishImageL(NULL,EMusicWidgetToolbarB3,KEmpty); |
1094 InstallEmptyActionL(EMusicWidgetTB1Trigger); |
1092 InstallEmptyActionL(EMusicWidgetTB1Trigger); |
1095 InstallEmptyActionL(EMusicWidgetTB2Trigger); |
1093 InstallEmptyActionL(EMusicWidgetTB2Trigger); |
1096 InstallEmptyActionL(EMusicWidgetTB3Trigger); |
1094 InstallEmptyActionL(EMusicWidgetTB3Trigger); |
1097 PublishTextL( NULL,EMusicWidgetDefaultText, iGoToMusicBuffer->Des() ); |
1095 PublishTextL( NULL,EMusicWidgetDefaultText, iGoToMusicBuffer->Des() ); |
1098 InstallGoToAlbumL( EMusicWidgetTrigger2 ); |
1096 InstallGoToAlbumL( EMusicWidgetTrigger2 ); |
1099 } |
1097 } |
1100 else |
1098 else |
1101 { |
1099 { |
1102 delete iInstanceId; |
1100 delete iInstanceId; |
1103 iInstanceId = NULL; |
1101 iInstanceId = NULL; |
1104 iInstanceId = aContentId.AllocL(); |
1102 iInstanceId = aContentId.AllocL(); |
1105 } |
1103 } |
1106 } |
1104 } |
1107 else if ( aTrigger == KMyDeActive) |
1105 else if ( aTrigger == KMyDeActive && iWidgetActivated) |
1108 { |
1106 { |
|
1107 iWidgetActivated = EFalse; |
1109 MPX_DEBUG1("CMusicContentPublisher::HandlePublisherNotificationL deactivate"); |
1108 MPX_DEBUG1("CMusicContentPublisher::HandlePublisherNotificationL deactivate"); |
1110 //Removing al the CPS entrys to prevent flicker of old text and unwanted images (old/expired handles). |
1109 //Removing al the CPS entrys to prevent flicker of old text and unwanted images (old/expired handles). |
1111 RemoveL( EMusicWidgetImage1 ); |
1110 RemoveL( EMusicWidgetImage1 ); |
1112 RemoveL( EMusicWidgetText1 ); |
1111 RemoveL( EMusicWidgetText1 ); |
1113 RemoveL( EMusicWidgetToolbarB1 ); |
1112 RemoveL( EMusicWidgetToolbarB1 ); |
1114 RemoveL( EMusicWidgetToolbarB2 ); |
1113 RemoveL( EMusicWidgetToolbarB2 ); |
1115 RemoveL( EMusicWidgetToolbarB3 ); |
1114 RemoveL( EMusicWidgetToolbarB3 ); |
1116 RemoveL( EMusicWidgetDefaultText ); |
1115 RemoveL( EMusicWidgetDefaultText ); |
1117 } |
1116 } |
1118 else if ( aTrigger == KMySuspend) |
1117 else if ( aTrigger == KMySuspend && iWidgetActivated && iWidgetForeground) |
1119 { |
1118 { |
1120 MPX_DEBUG1("CMusicContentPublisher::HandlePublisherNotificationL suspend"); |
1119 MPX_DEBUG1("CMusicContentPublisher::HandlePublisherNotificationL suspend"); |
1121 iIsPublisherActive = EFalse; |
1120 iWidgetForeground = EFalse; |
1122 } |
1121 } |
1123 else if ( aTrigger == KMyResume) |
1122 else if ( aTrigger == KMyResume && iWidgetActivated && !iWidgetForeground) |
1124 { |
1123 { |
1125 MPX_DEBUG1("CMusicContentPublisher::HandlePublisherNotificationL resume"); |
1124 MPX_DEBUG1("CMusicContentPublisher::HandlePublisherNotificationL resume"); |
1126 iIsPublisherActive = ETrue; |
1125 iWidgetForeground = ETrue; |
1127 DoPublishL(); |
1126 DoPublishL(); |
1128 } |
1127 } |
1129 MPX_DEBUG1("CMusicContentPublisher::HandlePublisherNotificationL --->"); |
1128 MPX_DEBUG1("CMusicContentPublisher::HandlePublisherNotificationL --->"); |
1130 } |
1129 } |
1131 |
1130 |