musichomescreen/musiccontentpublisher/src/musiccontentpublisher.cpp
branchRCL_3
changeset 53 3de6c4cf6b67
child 66 1f1dad4af8f8
equal deleted inserted replaced
52:14979e23cb5e 53:3de6c4cf6b67
       
     1 /*
       
     2 * Copyright (c) 2008-2008 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 "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:  Manages MCP plugins, and content publishing.
       
    15 *
       
    16 */
       
    17 
       
    18 #include <mpxlog.h>                     // MPX_DEBUG
       
    19 #include <LiwServiceHandler.h>
       
    20 #include <LiwVariant.h>
       
    21 #include <LiwGenericParam.h>
       
    22 
       
    23 #include <mcpplugin.h>
       
    24 #include <mcppluginuids.hrh>
       
    25 #include <fbs.h>
       
    26 #include <coemain.h>
       
    27 #include <AknsUtils.h>
       
    28 #include <gdi.h>
       
    29 #include <musichomescreen.rsg>
       
    30 #include <bautils.h>
       
    31 #include <data_caging_path_literals.hrh>
       
    32 #include <s32mem.h>
       
    33 #include <e32hashtab.h>
       
    34 
       
    35 #include "cpglobals.h" //This will be moved to domain API (HSFW)
       
    36 #include "musiccontentpublisher.h"
       
    37 #include "pluginmanager.h"
       
    38 #include "mcpharvesterpublisherobserver.h"
       
    39 
       
    40 _LIT( KExecute,       "execute" );
       
    41 _LIT( KPubData,        "publisher" );
       
    42 
       
    43 
       
    44 _LIT8( KMyActive, "active" );
       
    45 _LIT8( KMyDeActive, "deactive");
       
    46 _LIT8( KMySuspend, "suspend");
       
    47 _LIT8( KMyResume, "resume");
       
    48 _LIT8( KMySelected, "selected");
       
    49 _LIT8( KMyActionMap, "action_map" );
       
    50 _LIT8( KMyItem, "item" );
       
    51 _LIT8( KMyAdd, "Add" );
       
    52 _LIT8( KMyItemId, "item_id" );
       
    53 _LIT8( KMyResultName,"mydata" );
       
    54 _LIT( KMyActionName, "data" );
       
    55 
       
    56 _LIT( KEmpty, "" );
       
    57 _LIT( KLoc, "LOC:");
       
    58 _LIT( KNowPlaying, "LOC:NOW PLAYING" );
       
    59 _LIT( KLastPlayed, "LOC:LAST PLAYED" );
       
    60 _LIT( KMask, "_mask");
       
    61 _LIT( KMWPublisher, "MWPublisher");
       
    62 
       
    63 //for application launcher AHPlugin
       
    64 const TInt KMmUid3AsTInt( 0x101f4cd2 );
       
    65 const TInt KMSGUidAsTInt( 0x10003A39 );
       
    66 _LIT8( KAdditionalData, "additional_data" );
       
    67 _LIT( KLaunchApp, "launch_application" );
       
    68 _LIT( KMessageWithTail, "message_with_tail" );
       
    69 _LIT8( KMessageForMMOpenMusicSuiteWithHide, "mm://root/musicsuite?exit=hide");
       
    70 
       
    71 _LIT( KResourceFile, "z:musichomescreen.rsc");
       
    72 
       
    73 // ======== MEMBER FUNCTIONS ========
       
    74 
       
    75 // ---------------------------------------------------------------------------
       
    76 // Constructor
       
    77 // ---------------------------------------------------------------------------
       
    78 //
       
    79 CMusicContentPublisher::CMusicContentPublisher( MLiwInterface* aCPSInterface )
       
    80     {
       
    81     iCPSInterface = aCPSInterface;
       
    82     iActivePlugin=NULL;
       
    83     iIsPublisherActive = EFalse;
       
    84 
       
    85     }
       
    86 
       
    87 // ---------------------------------------------------------------------------
       
    88 // Symbian 2nd phase constructor can leave.
       
    89 // ---------------------------------------------------------------------------
       
    90 //
       
    91 void CMusicContentPublisher::ConstructL()
       
    92     {
       
    93     MPX_DEBUG1("CMusicContentPublisher::ConstructL <---");
       
    94     //Load the destination translation table.
       
    95     TInt dstl (sizeof(KMCPDestinationInfo)/sizeof(TMCPDestinationItem));
       
    96     for (TInt i = 0; i < dstl; i++)
       
    97         {
       
    98         iDestinationMap.InsertL(KMCPDestinationInfo[i].id, 
       
    99                 KMCPDestinationInfo[i]);
       
   100         }
       
   101     
       
   102     dstl = (sizeof(KMCPImageDestinationInfo)/sizeof(
       
   103             TMCPImageDestinationInfoItem));
       
   104     for (TInt i = 0; i < dstl; i++)
       
   105         {
       
   106         iImageDestinationSizeMap.Insert(KMCPImageDestinationInfo[i].id,
       
   107                 TSize(KMCPImageDestinationInfo[i].sizex,
       
   108                         KMCPImageDestinationInfo[i].sizey));
       
   109         }
       
   110     
       
   111     MPX_DEBUG1("CMusicContentPublisher::ConstructL loading resources");
       
   112     //Load Loc strings
       
   113     RFs fs;
       
   114     User::LeaveIfError(fs.Connect());
       
   115     CleanupClosePushL(fs);  
       
   116     TFileName fileName;
       
   117     TParse* parseObj = new(ELeave) TParse();
       
   118     TInt errInt = parseObj->Set( KResourceFile(),&KDC_APP_RESOURCE_DIR,NULL );
       
   119     if(KErrNone != errInt)
       
   120       {
       
   121       delete parseObj;
       
   122       User::Leave(errInt);
       
   123       }
       
   124     fileName = parseObj->FullName();
       
   125     delete parseObj;
       
   126     BaflUtils::NearestLanguageFile(fs,fileName);
       
   127     if(!BaflUtils::FileExists(fs,fileName))
       
   128         {
       
   129         User::Leave(KErrNotFound);
       
   130         }
       
   131     RResourceFile resourceFile;
       
   132     resourceFile.OpenL(fs,fileName);
       
   133     CleanupClosePushL(resourceFile);
       
   134     resourceFile.ConfirmSignatureL();
       
   135     GetLocalizedStringL(resourceFile, iLastPlayedBuffer, R_MUSICHOMESCREEN_LAST_PLAYED);
       
   136     GetLocalizedStringL(resourceFile, iNowPlayingBuffer, R_MUSICHOMESCREEN_NOW_PLAYING);
       
   137     GetLocalizedStringL(resourceFile, iGoToMusicBuffer, R_MUSICHOMESCREEN_GO_TO_MUSIC);
       
   138     CleanupStack::PopAndDestroy(&resourceFile);
       
   139     CleanupStack::PopAndDestroy(&fs);
       
   140     MPX_DEBUG1("CMusicContentPublisher::ConstructL resources loaded");
       
   141     
       
   142     // connect to the skin server, to receive skin changed event.
       
   143     User::LeaveIfError(iAknsSrvSession.Connect(this));
       
   144     
       
   145     // enable skin.
       
   146     AknsUtils::InitSkinSupportL();
       
   147 
       
   148     MPX_DEBUG1("CMusicContentPublisher::ConstructL subscribing to observer");
       
   149  TPtrC8 dataKey;
       
   150  TPtrC type;
       
   151  TPtrC content;
       
   152  MapEnumToDestinationInfoL(EMusicWidgetImage1, type, dataKey, content); 
       
   153  
       
   154     TUint id = RegisterPublisherL( 
       
   155             KMWPublisher,
       
   156             content, 
       
   157             type, 
       
   158             dataKey );
       
   159         
       
   160     if( id != 0 )
       
   161         {
       
   162     CLiwDefaultMap* filter = CLiwDefaultMap::NewLC();
       
   163 
       
   164     filter->InsertL( KPublisherId, TLiwVariant( KMWPublisher ) );
       
   165     filter->InsertL( KContentId, TLiwVariant( content ) );
       
   166     filter->InsertL( KContentType, TLiwVariant( type ) );
       
   167     filter->InsertL( KOperation, TLiwVariant( KExecute ));
       
   168     
       
   169     
       
   170     iHPObserver = CMCPHarvesterPublisherObserver::NewL(this);
       
   171     iHPObserver->RegisterL(filter);
       
   172     CleanupStack::PopAndDestroy(filter);
       
   173         }
       
   174     MPX_DEBUG1("CMusicContentPublisher::ConstructL subscription to observer done");
       
   175     ResetL();
       
   176     MPX_DEBUG1("CMusicContentPublisher::ConstructL --->");
       
   177     }
       
   178 
       
   179 // ---------------------------------------------------------------------------
       
   180 // Two-phased constructor.
       
   181 // ---------------------------------------------------------------------------
       
   182 //
       
   183 CMusicContentPublisher* CMusicContentPublisher::NewL(  
       
   184         MLiwInterface* aCPSInterface )
       
   185     {
       
   186     CMusicContentPublisher* self = new ( ELeave ) CMusicContentPublisher( 
       
   187             aCPSInterface );
       
   188     CleanupStack::PushL( self );
       
   189     self->ConstructL();
       
   190     CleanupStack::Pop( self );
       
   191     return self;
       
   192     }
       
   193 
       
   194 // ---------------------------------------------------------------------------
       
   195 // Destructor
       
   196 // ---------------------------------------------------------------------------
       
   197 //
       
   198 CMusicContentPublisher::~CMusicContentPublisher()
       
   199     {
       
   200     MPX_DEBUG1("CMusicContentPublisher::~CMusicContentPublisher <---");
       
   201     if(iHPObserver)
       
   202         {
       
   203         MPX_DEBUG1("CMusicContentPublisher::~CMusicContentPublisher deleting observer");
       
   204         delete iHPObserver; 
       
   205         }
       
   206     delete iNowPlayingBuffer;
       
   207     delete iLastPlayedBuffer;
       
   208     delete iGoToMusicBuffer;
       
   209     MPX_DEBUG1("CMusicContentPublisher::~CMusicContentPublisher closing destination maps");
       
   210     iImageDestinationSizeMap.Close();
       
   211     iDestinationMap.Close();
       
   212     MPX_DEBUG1("CMusicContentPublisher::~CMusicContentPublisher resetting bitmap cache");
       
   213     ResetBitmapCache();
       
   214     MPX_DEBUG1("CMusicContentPublisher::~CMusicContentPublisher closing skin server session");
       
   215     iAknsSrvSession.Close();
       
   216     MPX_DEBUG1("CMusicContentPublisher::~CMusicContentPublisher deleting plugin manager");
       
   217     delete iPluginManager;
       
   218     MPX_DEBUG1("CMusicContentPublisher::~CMusicContentPublisher resetting publishing buffers");
       
   219     ResetPublishingBuffers();
       
   220     MPX_DEBUG1("CMusicContentPublisher::~CMusicContentPublisher --->");
       
   221     }
       
   222 
       
   223 // ---------------------------------------------------------------------------
       
   224 // 
       
   225 // ---------------------------------------------------------------------------
       
   226 //
       
   227 void CMusicContentPublisher::InstallGoToMusicL(
       
   228         TMCPTriggerDestination aDestination )
       
   229     {
       
   230     MPX_DEBUG1("CMusicContentPublisher::InstallGoToMusicL <---");
       
   231     CLiwDefaultMap* mapTrigger = CLiwDefaultMap::NewLC();
       
   232     CLiwDefaultMap* mapData = CLiwDefaultMap::NewLC();
       
   233     mapTrigger->InsertL( KPluginUid, TLiwVariant( TUid::Uid( 0x10282E5F ) ) );
       
   234     mapData->InsertL( KType, TLiwVariant( KLaunchApp ) );
       
   235     mapData->InsertL( KLaunchMethod, TLiwVariant( KMessageWithTail ) );
       
   236     mapData->InsertL(KApplicationUid,
       
   237             TLiwVariant(TInt32(KMmUid3AsTInt) ) );
       
   238         mapData->InsertL( KAdditionalData, 
       
   239             TLiwVariant( KMessageForMMOpenMusicSuiteWithHide ) );
       
   240     mapData->InsertL(KMessageUid,
       
   241             TLiwVariant(TInt32(KMSGUidAsTInt) ) );
       
   242     
       
   243     mapTrigger->InsertL( KData, TLiwVariant( mapData ) );
       
   244     
       
   245     PublishActionL( NULL, aDestination, mapTrigger );
       
   246     
       
   247     CleanupStack::PopAndDestroy( mapData );
       
   248     CleanupStack::PopAndDestroy( mapTrigger );
       
   249     MPX_DEBUG1("CMusicContentPublisher::InstallGoToMusicL --->");
       
   250     }
       
   251 
       
   252 // ---------------------------------------------------------------------------
       
   253 // 
       
   254 // ---------------------------------------------------------------------------
       
   255 //
       
   256 void CMusicContentPublisher::InstallEmptyActionL(
       
   257         TMCPTriggerDestination aDestination )
       
   258     {
       
   259     MPX_DEBUG1("CMusicContentPublisher::InstallEmptyActionL <---");
       
   260     CLiwDefaultMap* mapTrigger = CLiwDefaultMap::NewLC();
       
   261     PublishActionL( NULL, aDestination, mapTrigger );
       
   262     CleanupStack::PopAndDestroy( mapTrigger );
       
   263     MPX_DEBUG1("CMusicContentPublisher::InstallEmptyActionL --->");
       
   264     }
       
   265 // ---------------------------------------------------------------------------
       
   266 // 
       
   267 // ---------------------------------------------------------------------------
       
   268 //
       
   269 void CMusicContentPublisher::MapEnumToDestinationInfoL(TInt aEnum,
       
   270         TPtrC& aType, TPtrC8& aDataKey, TPtrC& aContent)
       
   271     {
       
   272     MPX_DEBUG1("CMusicContentPublisher::MapEnumToDestinationInfoL <---");
       
   273     TMCPDestinationItem* tmpdstitemp;
       
   274     tmpdstitemp = iDestinationMap.Find(aEnum);
       
   275     
       
   276     if (tmpdstitemp)
       
   277         {
       
   278         TPtrC type ( reinterpret_cast<const TUint16*>(
       
   279                 tmpdstitemp->type) );
       
   280         TPtrC8 dataKey ( reinterpret_cast<const TUint8*>(
       
   281                 tmpdstitemp->dataKey ) );
       
   282         TPtrC content ( reinterpret_cast<const TUint16*>(
       
   283                 tmpdstitemp->content) );
       
   284         aType.Set(type);
       
   285         aDataKey.Set(dataKey);
       
   286         aContent.Set(content);
       
   287         }
       
   288     else
       
   289         {
       
   290         //API user provided an invalid destination or the destination is not
       
   291         //defined properly.
       
   292         __ASSERT_DEBUG(EFalse,User::Invariant());
       
   293         }
       
   294     MPX_DEBUG1("CMusicContentPublisher::MapEnumToDestinationInfoL --->");
       
   295     }
       
   296 
       
   297 // ----------------------------------------------------------------------------
       
   298 // Get a heap descriptor from the resource file
       
   299 // ----------------------------------------------------------------------------
       
   300 //
       
   301 void CMusicContentPublisher::GetLocalizedStringL(RResourceFile& aResourceFile,
       
   302         HBufC*& aRetBuf, TInt aResourceId )
       
   303    {
       
   304    MPX_DEBUG1("CMusicContentPublisher::GetLocalizedStringL <---");
       
   305    HBufC8* dataBuffer = aResourceFile.AllocReadLC(aResourceId);
       
   306    TResourceReader theReader;
       
   307    theReader.SetBuffer(dataBuffer);
       
   308    aRetBuf = theReader.ReadHBufCL();
       
   309    CleanupStack::PopAndDestroy(dataBuffer);
       
   310    MPX_DEBUG1("CMusicContentPublisher::GetLocalizedStringL --->");
       
   311    }
       
   312 
       
   313 // ----------------------------------------------------------------------------
       
   314 // Publishes buffered data and actions.
       
   315 // ----------------------------------------------------------------------------
       
   316 //
       
   317 void CMusicContentPublisher::DoPublishL()
       
   318     {
       
   319     MPX_DEBUG1("CMusicContentPublisher::DoPublishL <---");
       
   320     THashMapIter<TInt, TMyBufferItem> dataIter( iPublishingDataBuffers );
       
   321     MPX_DEBUG1("CMusicContentPublisher::DoPublish publishing data");
       
   322     
       
   323     TMyBufferItem const* itemptr;
       
   324     itemptr = dataIter.NextValue();
       
   325     while (itemptr)
       
   326         {
       
   327         RMemReadStream rs(itemptr->buf, itemptr->size);
       
   328         CLiwGenericParamList * inParam =
       
   329         CLiwGenericParamList::NewLC(rs);
       
   330         CLiwGenericParamList * outParam = CLiwGenericParamList::NewLC();
       
   331         iCPSInterface->ExecuteCmdL(KAdd, *inParam, *outParam);
       
   332         CleanupStack::PopAndDestroy(outParam);
       
   333         CleanupStack::PopAndDestroy(inParam);
       
   334         itemptr = dataIter.NextValue();
       
   335         }
       
   336         
       
   337     //The order in wich we publish is important, actions should be published after the data contents.
       
   338     THashMapIter<TInt, TMyBufferItem> actionIter( iPublishingActionBuffers );
       
   339     MPX_DEBUG1("CMusicContentPublisher::DoPublish publishing actions");
       
   340     
       
   341     itemptr = NULL;
       
   342     itemptr = actionIter.NextValue();
       
   343     while (itemptr)
       
   344         {
       
   345         RMemReadStream rs(itemptr->buf, itemptr->size);
       
   346         CLiwGenericParamList * inParam = CLiwGenericParamList::NewLC(rs);
       
   347         CLiwGenericParamList * outParam = CLiwGenericParamList::NewLC();
       
   348         iCPSInterface->ExecuteCmdL(KAdd, *inParam, *outParam);
       
   349         CleanupStack::PopAndDestroy(outParam);
       
   350         CleanupStack::PopAndDestroy(inParam);
       
   351         itemptr = actionIter.NextValue();
       
   352         }
       
   353     MPX_DEBUG1("CMusicContentPublisher::CMusicContentPublisher::DoPublishL --->");
       
   354     }
       
   355 
       
   356 // ---------------------------------------------------------------------------
       
   357 // Resets all the graphical elements.
       
   358 // ---------------------------------------------------------------------------
       
   359 //
       
   360 void CMusicContentPublisher::ResetL()
       
   361     {
       
   362     MPX_DEBUG1("CMusicContentPublisher::ResetL <---");
       
   363     //Plugin deletion is handled by the pluginmanager.
       
   364     iActivePlugin = NULL;
       
   365     //Reset The Widget
       
   366     PublishImageL(NULL,EMusicWidgetImage1,KEmpty);
       
   367     InstallGoToMusicL( EMusicWidgetTrigger1 );
       
   368     PublishTextL( NULL,EMusicWidgetText1, KEmpty );
       
   369     PublishImageL(NULL,EMusicWidgetToolbarB1,KEmpty);
       
   370     PublishImageL(NULL,EMusicWidgetToolbarB2,KEmpty);
       
   371     PublishImageL(NULL,EMusicWidgetToolbarB3,KEmpty);
       
   372     InstallEmptyActionL(EMusicWidgetTB1Trigger);
       
   373     InstallEmptyActionL(EMusicWidgetTB2Trigger);
       
   374     InstallEmptyActionL(EMusicWidgetTB3Trigger);
       
   375     PublishTextL( NULL,EMusicWidgetDefaultText, iGoToMusicBuffer->Des() );  
       
   376     InstallGoToMusicL( EMusicWidgetTrigger2 );
       
   377 
       
   378     //Reset the music menu info
       
   379     InstallEmptyActionL(EMusicMenuMusicInfoTrigger);
       
   380     PublishTextL( NULL, EMusicMenuMusicInfoLine1, iLastPlayedBuffer->Des() );
       
   381     PublishTextL( NULL, EMusicMenuMusicInfoLine2, KEmpty );
       
   382     PublishImageL( NULL, EMusicMenuMusicInfoImage1, KEmpty );
       
   383     MPX_DEBUG1("CMusicContentPublisher::ResetL --->");
       
   384     }
       
   385 // ---------------------------------------------------------------------------
       
   386 // 
       
   387 // ---------------------------------------------------------------------------
       
   388 //
       
   389 TSize CMusicContentPublisher::GetImageDestinationSize(
       
   390         TMCPImageDestination aDst)
       
   391     {
       
   392     MPX_DEBUG1("CMusicContentPublisher::GetImageDestinationSize <---");
       
   393     TSize * ret;
       
   394     ret = iImageDestinationSizeMap.Find(aDst);
       
   395     if (ret)
       
   396         {
       
   397         MPX_DEBUG1("CMusicContentPublisher::GetImageDestinationSize --->");
       
   398         return *ret;    
       
   399         }
       
   400     else
       
   401         {
       
   402         MPX_DEBUG1("CMusicContentPublisher::GetImageDestinationSize --->");
       
   403         return TSize(0,0);
       
   404         }
       
   405     }
       
   406 
       
   407 
       
   408 // ---------------------------------------------------------------------------
       
   409 // Destroys the bitmaps saved on the cache.
       
   410 // ---------------------------------------------------------------------------
       
   411 //
       
   412 void CMusicContentPublisher::ResetBitmapCache()
       
   413     {
       
   414     MPX_DEBUG1("CMusicContentPublisher::ResetBitmapCache <---");
       
   415     THashMapIter<TInt, TBmpMsk> iter(iBitmapCache);
       
   416     TBmpMsk const* ptr = iter.NextValue();
       
   417     CFbsBitmap* bmp( NULL );
       
   418     CFbsBitmap* msk( NULL );
       
   419     while ( ptr )
       
   420         {
       
   421         bmp = ptr->bitmap;
       
   422         msk = ptr->mask;
       
   423         delete bmp;
       
   424         bmp = NULL;
       
   425         delete msk;
       
   426         msk = NULL;
       
   427         ptr = iter.NextValue();
       
   428         }
       
   429     iBitmapCache.Close();
       
   430     MPX_DEBUG1("CMusicContentPublisher::ResetBitmapCache --->");
       
   431     }
       
   432     
       
   433 // ---------------------------------------------------------------------------
       
   434 // Destroys the publishing buffers.
       
   435 // ---------------------------------------------------------------------------
       
   436 //
       
   437 void CMusicContentPublisher::ResetPublishingBuffers()
       
   438     {
       
   439     THashMapIter<TInt, TMyBufferItem> dataIter( iPublishingDataBuffers );
       
   440     THashMapIter<TInt, TMyBufferItem> actionIter( iPublishingActionBuffers );
       
   441     
       
   442     TMyBufferItem const* itemptr;
       
   443     itemptr = dataIter.NextValue();
       
   444     while (itemptr)
       
   445         {
       
   446         User::Free(itemptr->buf);
       
   447         dataIter.RemoveCurrent();
       
   448         itemptr = dataIter.NextValue();
       
   449         }
       
   450     iPublishingDataBuffers.Close();
       
   451     itemptr = NULL;
       
   452     itemptr = actionIter.NextValue();
       
   453     while (itemptr)
       
   454         {
       
   455         User::Free(itemptr->buf);
       
   456         actionIter.RemoveCurrent();
       
   457         itemptr = actionIter.NextValue();
       
   458         }
       
   459     iPublishingActionBuffers.Close();
       
   460     }
       
   461 
       
   462 TUint CMusicContentPublisher::RegisterPublisherL( 
       
   463     const TDesC& aPublisherId, 
       
   464     const TDesC& aContentId,
       
   465     const TDesC& aContentType, 
       
   466     const TDesC8& aResultType )
       
   467     {
       
   468     MPX_DEBUG1("CMusicContentPublisher::RegisterPublisherL <---");
       
   469     TUint id( 0 );
       
   470     if( iCPSInterface )
       
   471         {   
       
   472         CLiwGenericParamList* inparam( CLiwGenericParamList::NewLC() );
       
   473         CLiwGenericParamList* outparam( CLiwGenericParamList::NewLC() );
       
   474 
       
   475         TLiwGenericParam type( KType, TLiwVariant( KPubData ));
       
   476         inparam->AppendL( type );
       
   477         CLiwDefaultMap* cpdatamap = CLiwDefaultMap::NewLC();
       
   478         CLiwDefaultMap* datamap = CLiwDefaultMap::NewLC();
       
   479         CLiwDefaultMap* actionmap( NULL );
       
   480 
       
   481         // Create the data map for publisher registry
       
   482         cpdatamap->InsertL( KContentType, TLiwVariant( aContentType ));
       
   483         cpdatamap->InsertL( KContentId, TLiwVariant( aContentId ));
       
   484         cpdatamap->InsertL( KPublisherId, TLiwVariant( aPublisherId ));
       
   485         datamap->InsertL( KMyResultName, TLiwVariant( aResultType ));
       
   486 
       
   487         cpdatamap->InsertL( KDataMap, TLiwVariant(datamap) );
       
   488         
       
   489         // Create the action map for publisher registry
       
   490         actionmap = CLiwDefaultMap::NewLC();
       
   491         actionmap->InsertL(KMyActive, TLiwVariant( KMyActionName ));
       
   492         actionmap->InsertL(KMyDeActive, TLiwVariant( KMyActionName ));
       
   493         actionmap->InsertL(KMySuspend, TLiwVariant( KMyActionName ));
       
   494         actionmap->InsertL(KMyResume, TLiwVariant( KMyActionName ));
       
   495         actionmap->InsertL(KMySelected, TLiwVariant( KMyActionName ));
       
   496  
       
   497         cpdatamap->InsertL( KMyActionMap, TLiwVariant(actionmap));
       
   498         CleanupStack::PopAndDestroy( actionmap );
       
   499         
       
   500         TLiwGenericParam item( KMyItem, TLiwVariant( cpdatamap ));        
       
   501         inparam->AppendL( item );
       
   502         
       
   503         iCPSInterface->ExecuteCmdL( KMyAdd , *inparam, *outparam);
       
   504         id = ExtractItemId(*outparam);
       
   505         
       
   506         CleanupStack::PopAndDestroy( datamap );
       
   507         CleanupStack::PopAndDestroy( cpdatamap );
       
   508         item.Reset();
       
   509         type.Reset();   
       
   510         CleanupStack::PopAndDestroy(outparam);
       
   511         CleanupStack::PopAndDestroy(inparam);
       
   512         }
       
   513     MPX_DEBUG1("CMusicContentPublisher::RegisterPublisherL --->");
       
   514     return id;
       
   515     }
       
   516 
       
   517 TUint CMusicContentPublisher::ExtractItemId( const CLiwGenericParamList& aInParamList )
       
   518     {
       
   519     MPX_DEBUG1("CMusicContentPublisher::ExtractItemId <---");
       
   520     TUint result ( 0 );
       
   521     TInt pos( 0 );
       
   522     aInParamList.FindFirst( pos, KMyItemId );
       
   523     if( pos != KErrNotFound )
       
   524         {
       
   525         // item id present - extract and return
       
   526         aInParamList[pos].Value().Get( result );
       
   527         }
       
   528     MPX_DEBUG1("CMusicContentPublisher::ExtractItemId --->");
       
   529     return result;
       
   530     }
       
   531 
       
   532 // ---------------------------------------------------------------------------
       
   533 // Publishes an image from path to the required destination
       
   534 // ---------------------------------------------------------------------------
       
   535 //
       
   536 void CMusicContentPublisher::PublishImageL( CMCPPlugin* aPlugin,  
       
   537         TMCPImageDestination aDestination, 
       
   538         const TDesC& aImagePath )
       
   539     {
       
   540     MPX_DEBUG1("CMusicContentPublisher::PublishImageL <---");
       
   541     if( iCPSInterface && iActivePlugin == aPlugin )
       
   542         {
       
   543         CLiwGenericParamList * inParam = CLiwGenericParamList::NewLC();
       
   544         CLiwGenericParamList * outParam = CLiwGenericParamList::NewLC();
       
   545         
       
   546         TPtrC8 dataKey;
       
   547         TPtrC type;
       
   548         TPtrC content;
       
   549         MapEnumToDestinationInfoL(aDestination, type, dataKey, content);
       
   550         
       
   551         TLiwGenericParam cptype( KType , TLiwVariant( KCpData ) );
       
   552         inParam->AppendL( cptype );
       
   553         CLiwDefaultMap * cpdatamap = CLiwDefaultMap::NewLC( );
       
   554         CLiwDefaultMap * map = CLiwDefaultMap::NewLC( );
       
   555         
       
   556          
       
   557         map->InsertL(dataKey, TLiwVariant( aImagePath ) );
       
   558         
       
   559         cpdatamap->InsertL( KPublisherId , TLiwVariant( KMWPublisher ) );
       
   560         cpdatamap->InsertL( KContentType , TLiwVariant( type ) );
       
   561         cpdatamap->InsertL( KContentId  , TLiwVariant( content ) );
       
   562         cpdatamap->InsertL( KDataMap  , TLiwVariant( map ) );
       
   563     
       
   564         TLiwGenericParam item( KItem, TLiwVariant( cpdatamap ) ); 
       
   565         inParam->AppendL( item );
       
   566         
       
   567         if ( aDestination >= EMusicMenuMusicInfoImage1 )
       
   568             {
       
   569             iCPSInterface->ExecuteCmdL( KAdd , *inParam, *outParam );
       
   570             }
       
   571         else
       
   572             {
       
   573             if ( iIsPublisherActive )
       
   574                 {
       
   575                 iCPSInterface->ExecuteCmdL( KAdd , *inParam, *outParam );
       
   576                 }
       
   577             TMyBufferItem* ptr;
       
   578             ptr = iPublishingDataBuffers.Find(aDestination);
       
   579             if (ptr) //remove the old one
       
   580                 {
       
   581                 User::Free(ptr->buf);
       
   582                 iPublishingDataBuffers.Remove(aDestination);
       
   583                 }
       
   584             TInt sz = inParam->Size();
       
   585             TMyBufferItem bufferitem;
       
   586             bufferitem.size = inParam->Size();
       
   587             bufferitem.buf = User::AllocL(inParam->Size());
       
   588             RMemWriteStream ws(bufferitem.buf, bufferitem.size);
       
   589             inParam->ExternalizeL(ws);
       
   590             iPublishingDataBuffers.Insert(aDestination, bufferitem);
       
   591             }
       
   592         CleanupStack::PopAndDestroy( map );
       
   593         CleanupStack::PopAndDestroy( cpdatamap );
       
   594         CleanupStack::PopAndDestroy( outParam );
       
   595         CleanupStack::PopAndDestroy( inParam );
       
   596         }   
       
   597     MPX_DEBUG1("CMusicContentPublisher::PublishImageL --->");
       
   598     }
       
   599 
       
   600 // ---------------------------------------------------------------------------
       
   601 // Publishes an image from bitmap handle to the required destination
       
   602 // ---------------------------------------------------------------------------
       
   603 //
       
   604 void CMusicContentPublisher::PublishImageL( CMCPPlugin* aPlugin, 
       
   605         TMCPImageDestination aDestination,
       
   606         TInt aBitmapHandle,
       
   607         TInt aMaskBitmapHandle)
       
   608     {
       
   609     MPX_DEBUG1("CMusicContentPublisher::PublishImageL <---");
       
   610     if( iCPSInterface && iActivePlugin == aPlugin )
       
   611         {
       
   612         CLiwGenericParamList * inParam = CLiwGenericParamList::NewLC();
       
   613         CLiwGenericParamList * outParam = CLiwGenericParamList::NewLC();
       
   614         
       
   615         TPtrC8 dataKey;
       
   616         TPtrC type;
       
   617         TPtrC content;
       
   618         MapEnumToDestinationInfoL(aDestination, type, dataKey, content);
       
   619         
       
   620         TLiwGenericParam cptype( KType , TLiwVariant( KCpData ) );
       
   621         inParam->AppendL( cptype );
       
   622         CLiwDefaultMap * cpdatamap = CLiwDefaultMap::NewLC( );
       
   623         CLiwDefaultMap * map = CLiwDefaultMap::NewLC( );
       
   624         
       
   625          
       
   626         if (aDestination == EMusicMenuMusicInfoImage1)
       
   627             {
       
   628             //Matrix Menu expects a Tint32 (TVariantTypeId::EVariantTypeTInt32)   
       
   629             map->InsertL(dataKey, TLiwVariant( (TInt32)aBitmapHandle ) );
       
   630             }
       
   631         else 
       
   632             {
       
   633             //Homescreen expects a TBool/TInt 
       
   634             //(TVariantTypeId::EVariantTypeTBool)
       
   635             map->InsertL(dataKey, TLiwVariant( aBitmapHandle ) );
       
   636             }
       
   637         
       
   638         if (aMaskBitmapHandle)
       
   639             {
       
   640             HBufC8* maskResult = HBufC8::NewLC( 
       
   641                     dataKey.Length() + KMask().Length() );
       
   642             TPtr8 maskResultPtr = maskResult ->Des();
       
   643             maskResultPtr.Append( dataKey );
       
   644             maskResultPtr.Append( KMask );
       
   645             if (aDestination == EMusicMenuMusicInfoImage1)
       
   646                 {
       
   647                 //Matrix Menu expects a Tint32 (TVariantTypeId::EVariantTypeTInt32)   
       
   648                 map->InsertL(maskResultPtr, TLiwVariant( (TInt32)aMaskBitmapHandle ) );
       
   649                 }
       
   650             else 
       
   651                 {
       
   652                 //Homescreen expects a TBool/TInt 
       
   653                 //(TVariantTypeId::EVariantTypeTBool)
       
   654                 map->InsertL(maskResultPtr, TLiwVariant( aMaskBitmapHandle ) );
       
   655                 }
       
   656             CleanupStack::PopAndDestroy( maskResult );
       
   657             }
       
   658         
       
   659         cpdatamap->InsertL( KPublisherId , TLiwVariant( KMWPublisher ) );
       
   660         cpdatamap->InsertL( KContentType , TLiwVariant( type ) );
       
   661         cpdatamap->InsertL( KContentId  , TLiwVariant( content ) );
       
   662         cpdatamap->InsertL( KDataMap  , TLiwVariant( map ) );
       
   663     
       
   664         TLiwGenericParam item( KItem, TLiwVariant( cpdatamap ) ); 
       
   665         inParam->AppendL( item );
       
   666         
       
   667         if ( aDestination >= EMusicMenuMusicInfoImage1 )
       
   668             {
       
   669             iCPSInterface->ExecuteCmdL( KAdd , *inParam, *outParam );
       
   670             }
       
   671         else
       
   672             {
       
   673             if ( iIsPublisherActive )
       
   674                 {
       
   675                 iCPSInterface->ExecuteCmdL( KAdd , *inParam, *outParam );  	
       
   676                 }
       
   677             TMyBufferItem* ptr;
       
   678             ptr = iPublishingDataBuffers.Find(aDestination);
       
   679             if (ptr) //remove the old one
       
   680                 {
       
   681                 User::Free(ptr->buf);
       
   682                 iPublishingDataBuffers.Remove(aDestination);
       
   683                 }
       
   684             TInt sz = inParam->Size();
       
   685             TMyBufferItem bufferitem;
       
   686             bufferitem.size = inParam->Size();
       
   687             bufferitem.buf = User::AllocL(inParam->Size());
       
   688             RMemWriteStream ws(bufferitem.buf, bufferitem.size);
       
   689             inParam->ExternalizeL(ws);
       
   690             iPublishingDataBuffers.Insert(aDestination, bufferitem);
       
   691             }
       
   692         CleanupStack::PopAndDestroy( map );
       
   693         CleanupStack::PopAndDestroy( cpdatamap );
       
   694         CleanupStack::PopAndDestroy( outParam );
       
   695         CleanupStack::PopAndDestroy( inParam );
       
   696         }
       
   697     MPX_DEBUG1("CMusicContentPublisher::PublishImageL --->");
       
   698     }
       
   699 
       
   700 // ---------------------------------------------------------------------------
       
   701 // Publishes an image from skin id and mif to the required destination
       
   702 // ---------------------------------------------------------------------------
       
   703 //
       
   704 void CMusicContentPublisher::PublishImageL(CMCPPlugin* aPlugin, 
       
   705         TMCPImageDestination aDestination,
       
   706         const TAknsItemID& aID,
       
   707         const TDesC& aFilename,
       
   708         const TInt aFileBitmapId,
       
   709         const TInt aFileMaskId )
       
   710     {
       
   711     MPX_DEBUG1("CMusicContentPublisher::PublishImageL <---");
       
   712     TBmpMsk* bitmapandmask;
       
   713     bitmapandmask = iBitmapCache.Find(aID.iMajor+aID.iMinor);
       
   714     CFbsBitmap* bitmap = NULL;
       
   715     CFbsBitmap* mask = NULL;
       
   716     if (!bitmapandmask)
       
   717         {
       
   718         // Load from skin
       
   719         MAknsSkinInstance* skin = AknsUtils::SkinInstance();
       
   720         AknsUtils::CreateIconL(
       
   721                     skin,
       
   722                     aID,
       
   723                     bitmap,
       
   724                     mask,
       
   725                     aFilename,
       
   726                     aFileBitmapId,
       
   727                     aFileMaskId);
       
   728         AknIconUtils::SetSize(
       
   729                 bitmap,
       
   730                 GetImageDestinationSize(aDestination),
       
   731                 EAspectRatioPreserved );
       
   732         AknIconUtils::SetSize(mask,
       
   733                 GetImageDestinationSize(aDestination),
       
   734                 EAspectRatioPreserved );
       
   735         TBmpMsk bmpAndMsk;
       
   736         bmpAndMsk.bitmap=bitmap;
       
   737         bmpAndMsk.mask=mask;
       
   738         iBitmapCache.Insert(aID.iMajor+aID.iMinor,bmpAndMsk);
       
   739         bitmapandmask = iBitmapCache.Find(aID.iMajor+aID.iMinor);
       
   740         __ASSERT_DEBUG(bitmapandmask,User::Invariant());
       
   741         }
       
   742     bitmap = bitmapandmask->bitmap;
       
   743     mask = bitmapandmask->mask;
       
   744     
       
   745     PublishImageL( aPlugin, aDestination, bitmap->Handle() , mask->Handle()); 
       
   746     MPX_DEBUG1("CMusicContentPublisher::PublishImageL --->");
       
   747     }
       
   748 
       
   749 // ---------------------------------------------------------------------------
       
   750 // Publishes a text from path to the required destination
       
   751 // ---------------------------------------------------------------------------
       
   752 //
       
   753 void CMusicContentPublisher::PublishTextL( CMCPPlugin* aPlugin, 
       
   754         TMCPTextDestination aDestination, 
       
   755         const TDesC& aText )
       
   756     {
       
   757     MPX_DEBUG1("CMusicContentPublisher::PublishTextL <---");
       
   758     if( iCPSInterface && iActivePlugin == aPlugin)
       
   759         {
       
   760         CLiwGenericParamList * inParam = CLiwGenericParamList::NewLC();
       
   761         CLiwGenericParamList * outParam = CLiwGenericParamList::NewLC();
       
   762         
       
   763         TPtrC8 dataKey;
       
   764         TPtrC type;
       
   765         TPtrC content;
       
   766         MapEnumToDestinationInfoL(aDestination, type, dataKey, content);
       
   767         
       
   768         TLiwGenericParam cptype( KType , TLiwVariant( KCpData ) );
       
   769         inParam->AppendL( cptype );
       
   770         CLiwDefaultMap * cpdatamap = CLiwDefaultMap::NewLC( );
       
   771         CLiwDefaultMap * map = CLiwDefaultMap::NewLC( );
       
   772         
       
   773         if (KErrNotFound == aText.Find(KLoc))
       
   774             {
       
   775             map->InsertL( dataKey , TLiwVariant( aText ) );    
       
   776             }
       
   777         else
       
   778             {
       
   779             if ( ! aText.Compare( KNowPlaying ) )
       
   780                 {
       
   781                 map->InsertL( dataKey , TLiwVariant( iNowPlayingBuffer ) );
       
   782                 }
       
   783             else if ( ! aText.Compare( KLastPlayed ) )
       
   784                 {
       
   785                 map->InsertL( dataKey , TLiwVariant( iLastPlayedBuffer ) );
       
   786                 }
       
   787             else
       
   788                 {
       
   789                 map->InsertL( dataKey , TLiwVariant( aText ) );
       
   790                 }
       
   791             }
       
   792         
       
   793         cpdatamap->InsertL( KPublisherId , TLiwVariant( KMWPublisher ) );
       
   794         cpdatamap->InsertL( KContentType , TLiwVariant( type ) );
       
   795         cpdatamap->InsertL( KContentId  , TLiwVariant( content ) );
       
   796         cpdatamap->InsertL( KDataMap  , TLiwVariant( map ) );
       
   797         
       
   798         TLiwGenericParam item( KItem, TLiwVariant( cpdatamap ) ); 
       
   799         inParam->AppendL( item );
       
   800         
       
   801         if ( aDestination >= EMusicMenuMusicInfoLine1 )
       
   802             {
       
   803             if (aText  != KEmpty)
       
   804 			    {
       
   805                 iCPSInterface->ExecuteCmdL( KAdd , *inParam, *outParam );
       
   806 				}
       
   807             else
       
   808 			    {
       
   809                 iCPSInterface->ExecuteCmdL( KDelete , *inParam, *outParam);
       
   810 				}
       
   811             }
       
   812         else
       
   813             {
       
   814             if ( iIsPublisherActive )
       
   815                 {
       
   816                 iCPSInterface->ExecuteCmdL( KAdd , *inParam, *outParam );        	
       
   817                 }
       
   818             TMyBufferItem* ptr;
       
   819             ptr = iPublishingDataBuffers.Find(aDestination);
       
   820             if (ptr) //remove the old one
       
   821                 {
       
   822                 User::Free(ptr->buf);
       
   823                 iPublishingDataBuffers.Remove(aDestination);
       
   824                 }
       
   825             TInt sz = inParam->Size();
       
   826             TMyBufferItem bufferitem;
       
   827             bufferitem.size = inParam->Size();
       
   828             bufferitem.buf = User::AllocL(inParam->Size());
       
   829             RMemWriteStream ws(bufferitem.buf, bufferitem.size);
       
   830             inParam->ExternalizeL(ws);
       
   831             iPublishingDataBuffers.Insert(aDestination, bufferitem);
       
   832             }
       
   833         CleanupStack::PopAndDestroy( map );
       
   834         CleanupStack::PopAndDestroy( cpdatamap );
       
   835         CleanupStack::PopAndDestroy( outParam );
       
   836         CleanupStack::PopAndDestroy( inParam );
       
   837         }  
       
   838     MPX_DEBUG1("CMusicContentPublisher::PublishTextL --->");
       
   839     }
       
   840 
       
   841 // ---------------------------------------------------------------------------
       
   842 // Publishes an action from a trigger map to the required destination
       
   843 // ---------------------------------------------------------------------------
       
   844 //
       
   845 void CMusicContentPublisher::PublishActionL( CMCPPlugin* aPlugin, 
       
   846         TMCPTriggerDestination aDestination,
       
   847         CLiwDefaultMap* aTriggerMap )
       
   848     {
       
   849     MPX_DEBUG1("CMusicContentPublisher::PublishActionL <---");
       
   850      if( iCPSInterface && iActivePlugin == aPlugin)
       
   851         {
       
   852         CLiwGenericParamList * inParam = CLiwGenericParamList::NewLC();
       
   853         CLiwGenericParamList * outParam = CLiwGenericParamList::NewLC();
       
   854         
       
   855         TPtrC8 triggerKey;
       
   856         TPtrC hostType;
       
   857         TPtrC hostContent;
       
   858         
       
   859         MapEnumToDestinationInfoL(aDestination, hostType, triggerKey, 
       
   860                 hostContent);
       
   861         
       
   862         TLiwGenericParam cptype( KType , TLiwVariant( KCpData ) );
       
   863         inParam->AppendL( cptype );
       
   864         
       
   865         CLiwDefaultMap * cpdatamap = CLiwDefaultMap::NewLC( );
       
   866         cpdatamap->InsertL( KPublisherId , TLiwVariant( KMWPublisher ) );
       
   867         cpdatamap->InsertL( KContentType , TLiwVariant( hostType ) );
       
   868         cpdatamap->InsertL( KContentId  , TLiwVariant( hostContent ) );
       
   869         
       
   870         CLiwDefaultMap * actionmap = CLiwDefaultMap::NewLC( );
       
   871         actionmap->InsertL( triggerKey , TLiwVariant( aTriggerMap ) );
       
   872         cpdatamap->InsertL( KActionMap  , TLiwVariant( actionmap ) );
       
   873         
       
   874         TLiwGenericParam item( KItem, TLiwVariant( cpdatamap ) ); 
       
   875         inParam->AppendL( item );
       
   876         
       
   877         if ( aDestination >= EMusicMenuMusicInfoTrigger )
       
   878             {
       
   879             iCPSInterface->ExecuteCmdL( KAdd , *inParam, *outParam );
       
   880             }
       
   881         else
       
   882             {
       
   883             if ( iIsPublisherActive )
       
   884                 {
       
   885             	  iCPSInterface->ExecuteCmdL( KAdd , *inParam, *outParam );
       
   886                 }
       
   887             TMyBufferItem* ptr;
       
   888             ptr = iPublishingActionBuffers.Find(aDestination);
       
   889             if (ptr) //remove the old one
       
   890                 {
       
   891                 User::Free(ptr->buf);
       
   892                 iPublishingActionBuffers.Remove(aDestination);
       
   893                 }
       
   894             TInt sz = inParam->Size();
       
   895             TMyBufferItem bufferitem;
       
   896             bufferitem.size = inParam->Size();
       
   897             bufferitem.buf = User::AllocL(inParam->Size());
       
   898             RMemWriteStream ws(bufferitem.buf, bufferitem.size);
       
   899             inParam->ExternalizeL(ws);
       
   900             iPublishingActionBuffers.Insert(aDestination, bufferitem);
       
   901             }
       
   902         CleanupStack::PopAndDestroy( actionmap );
       
   903         CleanupStack::PopAndDestroy( cpdatamap );
       
   904         CleanupStack::PopAndDestroy( outParam );
       
   905         CleanupStack::PopAndDestroy( inParam );
       
   906         }
       
   907     MPX_DEBUG1("CMusicContentPublisher::PublishActionL --->");
       
   908     }
       
   909 
       
   910 // ---------------------------------------------------------------------------
       
   911 // Called when a plugin becomes active, it deactivates the previous plugin.
       
   912 // ---------------------------------------------------------------------------
       
   913 //
       
   914 void CMusicContentPublisher::BecameActiveL( CMCPPlugin* aPlugin )
       
   915     {
       
   916     MPX_DEBUG1("CMusicContentPublisher::BecameActiveL <---");
       
   917     if ( iActivePlugin != aPlugin )
       
   918         {
       
   919         if ( iActivePlugin )
       
   920             {
       
   921             MPX_DEBUG1("CMusicContentPublisher::BecameActiveL deactivating old plugin");
       
   922             iActivePlugin->Deactivate();
       
   923             MPX_DEBUG1("CMusicContentPublisher::BecameActiveL plugin deactivated");
       
   924             PublishImageL( iActivePlugin, EMusicMenuMusicInfoImage1, KEmpty );
       
   925             }
       
   926         iActivePlugin = aPlugin;
       
   927         }
       
   928     MPX_DEBUG1("CMusicContentPublisher::BecameActiveL --->");
       
   929     }
       
   930 // ---------------------------------------------------------------------------
       
   931 // From CContentHarvesterPlugin
       
   932 // This function updates information in CPS storage
       
   933 // ---------------------------------------------------------------------------
       
   934 //    
       
   935 void CMusicContentPublisher::UpdateL() 
       
   936     {
       
   937     MPX_DEBUG1("CMusicContentPublisher::UpdateL <---");
       
   938     if ( !iPluginManager )
       
   939         {
       
   940         MPX_DEBUG1("CMusicContentPublisher::UpdateL creating the plugin manager");
       
   941         iPluginManager = CPluginManager::NewL(
       
   942                 TUid::Uid( KMCPPluginUid ), 
       
   943                 static_cast<MMCPPluginObserver*>( this ),
       
   944                 this );
       
   945         }
       
   946     MPX_DEBUG1("CMusicContentPublisher::UpdateL --->");
       
   947     }
       
   948 
       
   949 // ---------------------------------------------------------------------------
       
   950 // From MAknsSkinChangeObserver.
       
   951 // Called by the skin server when skin content is changed and the
       
   952 // connected client wants to be informed.
       
   953 // ---------------------------------------------------------------------------
       
   954 // 
       
   955 void CMusicContentPublisher::SkinContentChanged()
       
   956     {
       
   957     MPX_DEBUG1("CMusicContentPublisher::SkinContentChanged <---");
       
   958     ResetBitmapCache();
       
   959     if(iActivePlugin)
       
   960         {
       
   961         iActivePlugin->SkinChanged();
       
   962         }
       
   963     MPX_DEBUG1("CMusicContentPublisher::SkinContentChanged --->");
       
   964     }
       
   965 
       
   966 void CMusicContentPublisher::HandlePublisherNotificationL( const TDesC& /*aContentId*/, const TDesC8& aTrigger )
       
   967     {
       
   968     MPX_DEBUG1("CMusicContentPublisher::HandlePublisherNotificationL <---");
       
   969     if ( aTrigger == KMyActive )
       
   970         {
       
   971         MPX_DEBUG1("CMusicContentPublisher::HandlePublisherNotificationL activate");
       
   972         }
       
   973     else if ( aTrigger ==  KMyDeActive)
       
   974         {
       
   975         MPX_DEBUG1("CMusicContentPublisher::HandlePublisherNotificationL deactivate");
       
   976         iIsPublisherActive = EFalse;
       
   977         }
       
   978     else if ( aTrigger ==  KMySuspend)
       
   979         {
       
   980         MPX_DEBUG1("CMusicContentPublisher::HandlePublisherNotificationL suspend");
       
   981         iIsPublisherActive = EFalse;
       
   982         }
       
   983     else if ( aTrigger ==  KMyResume)
       
   984         {
       
   985         MPX_DEBUG1("CMusicContentPublisher::HandlePublisherNotificationL resume");
       
   986         iIsPublisherActive = ETrue;
       
   987         DoPublishL();
       
   988         }
       
   989     else if ( aTrigger ==  KMySelected)
       
   990         {
       
   991         MPX_DEBUG1("CMusicContentPublisher::HandlePublisherNotificationL select");
       
   992         }
       
   993     MPX_DEBUG1("CMusicContentPublisher::HandlePublisherNotificationL --->");
       
   994     }
       
   995 
       
   996 
       
   997 //  End of File
       
   998