qtinternetradio/irqsonghistory/src/irqsonghistoryengine.cpp
changeset 17 38bbf2dcd608
parent 16 5723da102db1
equal deleted inserted replaced
16:5723da102db1 17:38bbf2dcd608
     1 /*
       
     2 * Copyright (c) 2009 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:
       
    15 *
       
    16 */
       
    17 #include "irsonghistoryinfo.h"
       
    18 #include "irsonghistorydb.h"
       
    19 #include "irqsonghistoryinfo.h"
       
    20 #include "irqisdsdatastructure.h"
       
    21 #include "irqmetadata.h"
       
    22 #include "irqsonghistoryengine.h"
       
    23 
       
    24 // ---------------------------------------------------------------------------
       
    25 // IRQSongHistoryEngine::openInstance()
       
    26 // Static function to get a singleton instance of IRQSongHistoryEngine
       
    27 // @return IRQSongHistoryEngine *
       
    28 // ---------------------------------------------------------------------------
       
    29 //
       
    30 EXPORT_C IRQSongHistoryEngine* IRQSongHistoryEngine::openInstance()
       
    31 {
       
    32     // Get singleton instance
       
    33     IRQSongHistoryEngine* irqSongHistoryEngine =
       
    34                            reinterpret_cast<IRQSongHistoryEngine*>(Dll::Tls());
       
    35 
       
    36     if (NULL == irqSongHistoryEngine)
       
    37     {
       
    38         TRAPD(error, irqSongHistoryEngine = createInstanceL());
       
    39         if (KErrNone != error)
       
    40         {
       
    41             delete irqSongHistoryEngine;
       
    42             irqSongHistoryEngine = NULL;
       
    43             Dll::SetTls(NULL);
       
    44         }
       
    45     }
       
    46     else
       
    47     {
       
    48         irqSongHistoryEngine->iSingletonInstances++;
       
    49     }
       
    50 
       
    51     return irqSongHistoryEngine;
       
    52 }
       
    53 
       
    54 // ---------------------------------------------------------------------------
       
    55 // IRQSongHistoryEngine::closeInstance()
       
    56 // Close a singleton instance of IRQSongHistoryEngine
       
    57 // ---------------------------------------------------------------------------
       
    58 //
       
    59 EXPORT_C void IRQSongHistoryEngine::closeInstance()
       
    60 {
       
    61     iSingletonInstances--;
       
    62 
       
    63     if (0 == iSingletonInstances)
       
    64     {
       
    65         Dll::SetTls(NULL);
       
    66         delete this;
       
    67     }
       
    68 }
       
    69 
       
    70 // ---------------------------------------------------------------------------
       
    71 // IRQSongHistoryEngine::createInstanceL()
       
    72 // Creates IRQSongHistoryEngine instance
       
    73 // @return IRQSongHistoryEngine*
       
    74 // ---------------------------------------------------------------------------
       
    75 //
       
    76 IRQSongHistoryEngine* IRQSongHistoryEngine::createInstanceL()
       
    77 {
       
    78     IRQSongHistoryEngine* irqSongHistoryEngine = new (ELeave) IRQSongHistoryEngine();
       
    79     irqSongHistoryEngine->constructL();
       
    80     User::LeaveIfError(Dll::SetTls(irqSongHistoryEngine));
       
    81     irqSongHistoryEngine->iSingletonInstances = 1;
       
    82 
       
    83     return irqSongHistoryEngine;
       
    84 }
       
    85 
       
    86 // ---------------------------------------------------------------------------
       
    87 // IRQSongHistoryEngine::constructL()
       
    88 // Two-Phase Constructor.
       
    89 // ---------------------------------------------------------------------------
       
    90 //
       
    91 void IRQSongHistoryEngine::constructL()
       
    92 {
       
    93     iSongHistoryDb = CIRSongHistoryDb::NewL();
       
    94 }
       
    95 
       
    96 // ---------------------------------------------------------------------------
       
    97 // IRQSongHistoryEngine::IRQSongHistoryEngine()
       
    98 // standard C++ Constructor
       
    99 // ---------------------------------------------------------------------------
       
   100 //
       
   101 IRQSongHistoryEngine::IRQSongHistoryEngine()
       
   102 {
       
   103 }
       
   104 
       
   105 // ---------------------------------------------------------------------------
       
   106 // IRQSongHistoryEngine::~IRQSongHistoryEngine()
       
   107 // standard C++ destructor
       
   108 // ---------------------------------------------------------------------------
       
   109 //
       
   110 IRQSongHistoryEngine::~IRQSongHistoryEngine()
       
   111 {
       
   112     delete iSongHistoryDb;
       
   113     iSongHistoryDb = NULL;
       
   114 }
       
   115 
       
   116 // ---------------------------------------------------------------------------
       
   117 // IRQSongHistoryEngine::handleMetaDataReceivedL()
       
   118 // Invoked when channel name or song & artist name are changed.
       
   119 // ---------------------------------------------------------------------------
       
   120 //
       
   121 EXPORT_C void IRQSongHistoryEngine::handleMetaDataReceived(const IRQMetaData& aMetaData,
       
   122         const IRQPreset& aPreset)
       
   123 {
       
   124     TRAPD(error, handleMetaDataReceivedL(aMetaData, aPreset));
       
   125     if (KErrNone != error)
       
   126     {
       
   127         
       
   128     }
       
   129 }
       
   130 
       
   131 EXPORT_C void IRQSongHistoryEngine::handleSongMetaDataReceived(const IRQMetaData& aMetaData,
       
   132         const IRQPreset& aPreset)
       
   133 {
       
   134     TRAPD(error, handleSongMetaDataReceivedL(aMetaData,aPreset));
       
   135     if (KErrNone != error)
       
   136     {        
       
   137     }
       
   138 }
       
   139 
       
   140 EXPORT_C void IRQSongHistoryEngine::handleSongMetaDataReceivedL(const IRQMetaData& aMetaData,
       
   141         const IRQPreset& aPreset)
       
   142 {
       
   143     
       
   144     TPtrC songName(reinterpret_cast<const TUint16*>(aMetaData.getSongName().utf16()), aMetaData.getSongName().length());
       
   145     TPtrC artistName(reinterpret_cast<const TUint16*>(aMetaData.getArtistName().utf16()), aMetaData.getArtistName().length());    
       
   146     TPtrC channelName(reinterpret_cast<const TUint16*>(aPreset.name.utf16()), aPreset.name.length());
       
   147     TPtrC musicFlag(reinterpret_cast<const TUint16*>(aPreset.musicStoreStatus.utf16()), aPreset.musicStoreStatus.length());    
       
   148     TBool bExceededMax = iSongHistoryDb->AddToSongHistoryDb2L(songName,
       
   149                              artistName,
       
   150                              channelName,
       
   151                              musicFlag);                            
       
   152 }
       
   153 
       
   154 // ---------------------------------------------------------------------------
       
   155 // IRQSongHistoryEngine::handleMetaDataReceivedL()
       
   156 // ---------------------------------------------------------------------------
       
   157 //
       
   158 void IRQSongHistoryEngine::handleMetaDataReceivedL(const IRQMetaData& aMetaData,
       
   159         const IRQPreset& aPreset)
       
   160 {
       
   161     // Read Channel properties
       
   162     TPtrC songName(reinterpret_cast<const TUint16*>(aMetaData.getSongName().utf16()), aMetaData.getSongName().length());
       
   163     TPtrC artistName(reinterpret_cast<const TUint16*>(aMetaData.getArtistName().utf16()), aMetaData.getArtistName().length());
       
   164     TPtrC channelUrl(reinterpret_cast<const TUint16*>(aMetaData.getStreamUrl().utf16()), aMetaData.getStreamUrl().length());
       
   165     TPtrC channelName(reinterpret_cast<const TUint16*>(aPreset.name.utf16()), aPreset.name.length());
       
   166     TPtrC channelDesc(reinterpret_cast<const TUint16*>(aPreset.description.utf16()), aPreset.description.length());
       
   167     TPtrC imageUrl(reinterpret_cast<const TUint16*>(aPreset.imgUrl.utf16()), aPreset.imgUrl.length());
       
   168     TPtrC genreName(reinterpret_cast<const TUint16*>(aPreset.genreName.utf16()), aPreset.genreName.length()>KMaxColumnLength ? KMaxColumnLength : aPreset.genreName.length());
       
   169     TPtrC countryName(reinterpret_cast<const TUint16*>(aPreset.countryName.utf16()), aPreset.countryName.length());
       
   170     TPtrC languageName(reinterpret_cast<const TUint16*>(aPreset.languageName.utf16()), aPreset.languageName.length());
       
   171     TPtrC musicFlag(reinterpret_cast<const TUint16*>(aPreset.musicStoreStatus.utf16()), aPreset.musicStoreStatus.length());
       
   172     TUint8 channelType = aPreset.type;
       
   173     TUint16 channelId = aPreset.presetId;
       
   174     TUint16 bitrate = aMetaData.getBitrate();
       
   175 
       
   176     if (channelType == 1)
       
   177     {
       
   178         TInt ret = iSongHistoryDb->GetIdPresentInDbL( channelId );
       
   179         if(ret)
       
   180         {
       
   181             TInt modified = iSongHistoryDb->UpdateSongHistoryDbL( channelId ,
       
   182                        channelUrl ,imageUrl ,genreName, countryName, languageName, musicFlag);   
       
   183             // TODO notify uplayer to change layout?
       
   184         }
       
   185     }
       
   186     else if (channelType != 0)
       
   187     {
       
   188         // the channel type can only be 1 (isds channel) or 0 (user defined channel)
       
   189         channelType = 0;
       
   190     }
       
   191     
       
   192     iSongHistoryDb->SearchAndDeleteRecordL(channelName, channelUrl, channelType, channelId);
       
   193     
       
   194 	RBuf delSongName;
       
   195 	delSongName.CleanupClosePushL();
       
   196 	RBuf delArtistName;
       
   197 	delArtistName.CleanupClosePushL();
       
   198 	RBuf delChannelName;
       
   199 	delChannelName.CleanupClosePushL();
       
   200 	RBuf delChannelUrl;
       
   201 	delChannelUrl.CleanupClosePushL();
       
   202     TBool bExceededMax = iSongHistoryDb->AddToSongHistoryDbL(songName,
       
   203                          artistName,
       
   204                          channelName,
       
   205                          channelUrl,
       
   206                          delSongName,
       
   207                          delArtistName,
       
   208                          delChannelName,
       
   209                          delChannelUrl ,
       
   210                          channelType,
       
   211                          channelId,
       
   212                          bitrate,
       
   213                          channelDesc,
       
   214                          imageUrl,
       
   215                          genreName,
       
   216                          countryName,
       
   217                          languageName,
       
   218                          musicFlag);
       
   219 
       
   220     CleanupStack::PopAndDestroy(4, &delSongName);
       
   221 }
       
   222 
       
   223 // ---------------------------------------------------------------------------
       
   224 // IRQSongHistoryEngine::detectSongHistoryItemChangesL()
       
   225 // To detect any change in the song history items.
       
   226 // ---------------------------------------------------------------------------
       
   227 //
       
   228 IRQSongHistoryEngine::TSongHistoryItemChange IRQSongHistoryEngine::detectSongHistoryItemChangesL(
       
   229         const IRQMetaData& aMetaData, const QString& aChannelName)
       
   230 {
       
   231 	if(aChannelName.length() == 0)
       
   232 	{
       
   233 		return EBLANKENTRIES;
       
   234 	}
       
   235 
       
   236 	RBuf song;
       
   237 	song.CleanupClosePushL();
       
   238 	RBuf artist;
       
   239 	artist.CleanupClosePushL();
       
   240 	RBuf channel;
       
   241 	channel.CleanupClosePushL();
       
   242 	RBuf url;
       
   243 	url.CleanupClosePushL();
       
   244 
       
   245 	iSongHistoryDb->GetLastHistoryItemL(song, artist, channel, url);
       
   246 
       
   247 	TSongHistoryItemChange retval = ENOCHANGE;
       
   248 
       
   249     QString tmpsong = QString::fromUtf16(song.Ptr(), song.Length());
       
   250     QString tmpartist = QString::fromUtf16(artist.Ptr(), artist.Length());
       
   251     QString tmpchannel = QString::fromUtf16(channel.Ptr(), channel.Length());
       
   252     QString tmpurl = QString::fromUtf16(url.Ptr(), url.Length());
       
   253 	if (tmpsong == aMetaData.getSongName() && tmpartist == aMetaData.getArtistName()
       
   254 	       && tmpchannel == aChannelName && tmpurl == aMetaData.getStreamUrl())
       
   255 	{
       
   256 		retval = ENOCHANGE;
       
   257 	}
       
   258 	else
       
   259 	{
       
   260 		retval = ECHANNELCHANGED;
       
   261 	}
       
   262 
       
   263     CleanupStack::PopAndDestroy(4, &song);
       
   264 
       
   265 	return retval;
       
   266 }
       
   267 
       
   268 // ---------------------------------------------------------------------------
       
   269 // IRQSongHistoryEngine::getAllHistory
       
   270 // Invoked when when UI request.
       
   271 // Getting the data from SongHistoryDb.
       
   272 // ---------------------------------------------------------------------------
       
   273 
       
   274 EXPORT_C void IRQSongHistoryEngine::getAllHistory(QList<IRQSongHistoryInfo *>& aSongHistoryArr)
       
   275 {
       
   276     TRAP_IGNORE(getAllHistoryL(aSongHistoryArr));
       
   277 }
       
   278 
       
   279 EXPORT_C void IRQSongHistoryEngine::getAllSongHistory(QList<IRQSongInfo *>& aSongHistoryArr)
       
   280 {
       
   281     TRAP_IGNORE(getAllSongHistoryL(aSongHistoryArr));
       
   282 }
       
   283 
       
   284 // ---------------------------------------------------------------------------
       
   285 // IRQSongHistoryEngine::getAllHistoryL
       
   286 // Invoked when when UI request.
       
   287 // Getting the data from SongHistoryDb.
       
   288 // ---------------------------------------------------------------------------
       
   289 
       
   290 void IRQSongHistoryEngine::getAllHistoryL(QList<IRQSongHistoryInfo *>& aSongHistoryArr)
       
   291 {
       
   292     // clear the array
       
   293     while (!aSongHistoryArr.isEmpty())
       
   294     {
       
   295         delete aSongHistoryArr.takeFirst();
       
   296     }
       
   297 
       
   298     int songCount = iSongHistoryDb->CountSongHistoryDb();
       
   299 
       
   300     if (songCount == 0)
       
   301     {
       
   302         return;
       
   303     }
       
   304 
       
   305     // get song history list
       
   306     RPointerArray<CIRSongHistoryInfo> historyDataArr;
       
   307     for (int arrCount = 0 ; arrCount < songCount ; arrCount++ )
       
   308     {
       
   309         CIRSongHistoryInfo *songHistory = CIRSongHistoryInfo::NewL();
       
   310         CleanupStack::PushL(songHistory);
       
   311         historyDataArr.AppendL(songHistory);
       
   312         CleanupStack::Pop(songHistory);
       
   313     }
       
   314 
       
   315     iSongHistoryDb->GetAllSongHistoryListL(historyDataArr);
       
   316 
       
   317     // create IRQSongHistoryInfo array and set
       
   318     QString songName;
       
   319     QString artist;
       
   320     QString streamUrl;
       
   321     QString channelName;
       
   322     int channelType;
       
   323     int channelId;
       
   324     int bitrate;
       
   325     QString channelDesc;
       
   326     QString imageUrl;
       
   327     QString genreName;
       
   328     QString countryName;
       
   329     QString languageName;
       
   330     QString musicStoreStatus;
       
   331     for (int arrCount = 0 ; arrCount < songCount ; arrCount++ )
       
   332     {
       
   333         songName = QString::fromUtf16(historyDataArr[arrCount]->GetSongInfo().Ptr(),
       
   334                              historyDataArr[arrCount]->GetSongInfo().Length());
       
   335         artist = QString::fromUtf16(historyDataArr[arrCount]->GetArtistInfo().Ptr(),
       
   336                              historyDataArr[arrCount]->GetArtistInfo().Length());
       
   337         streamUrl = QString::fromUtf16(historyDataArr[arrCount]->GetStreamUrl().Ptr(),
       
   338                              historyDataArr[arrCount]->GetStreamUrl().Length());
       
   339         channelName = QString::fromUtf16(historyDataArr[arrCount]->GetChannelName().Ptr(),
       
   340                              historyDataArr[arrCount]->GetChannelName().Length());
       
   341         channelType = historyDataArr[arrCount]->GetChannelType();
       
   342         channelId = historyDataArr[arrCount]->GetChannelId();
       
   343         bitrate = historyDataArr[arrCount]->GetBitrate();
       
   344         channelDesc = QString::fromUtf16(historyDataArr[arrCount]->GetChannelDesc().Ptr(),
       
   345                              historyDataArr[arrCount]->GetChannelDesc().Length());
       
   346         imageUrl = QString::fromUtf16(historyDataArr[arrCount]->GetImageUrl().Ptr(),
       
   347                                      historyDataArr[arrCount]->GetImageUrl().Length());
       
   348         genreName = QString::fromUtf16(historyDataArr[arrCount]->GetGenreName().Ptr(),                
       
   349                                      historyDataArr[arrCount]->GetGenreName().Length());
       
   350         countryName = QString::fromUtf16(historyDataArr[arrCount]->GetCountryName().Ptr(),
       
   351                                      historyDataArr[arrCount]->GetCountryName().Length());
       
   352         languageName = QString::fromUtf16(historyDataArr[arrCount]->GetLanguageName().Ptr(),
       
   353                                      historyDataArr[arrCount]->GetLanguageName().Length());
       
   354         musicStoreStatus = QString::fromUtf16(historyDataArr[arrCount]->GetChannelMusicStatus().Ptr(),
       
   355                              historyDataArr[arrCount]->GetChannelMusicStatus().Length());
       
   356        IRQSongHistoryInfo* irqsongHistory = new IRQSongHistoryInfo();
       
   357        if (NULL == irqsongHistory)
       
   358        {
       
   359            break;
       
   360        }
       
   361        irqsongHistory->setHistoryInfo(artist, songName, streamUrl, channelName, channelDesc 
       
   362                                       , imageUrl, genreName, countryName, languageName, musicStoreStatus, channelType, channelId, bitrate);
       
   363        aSongHistoryArr.append(irqsongHistory);
       
   364     }
       
   365     
       
   366     historyDataArr.ResetAndDestroy();
       
   367 }
       
   368 
       
   369 // ---------------------------------------------------------------------------
       
   370 // IRQSongHistoryEngine::getAllHistoryL
       
   371 // Invoked when when UI request.
       
   372 // Getting the data from SongHistoryDb.
       
   373 // ---------------------------------------------------------------------------
       
   374 
       
   375 void IRQSongHistoryEngine::getAllSongHistoryL(QList<IRQSongInfo *>& aSongHistoryArr)
       
   376 {
       
   377     // clear the array
       
   378     while (!aSongHistoryArr.isEmpty())
       
   379     {
       
   380         delete aSongHistoryArr.takeFirst();
       
   381     }
       
   382 
       
   383     int songCount = iSongHistoryDb->CountSongHistoryDb2();
       
   384 
       
   385     if (songCount == 0)
       
   386     {
       
   387         return;
       
   388     }
       
   389 
       
   390     // get song history list
       
   391     RPointerArray<CIRSongHistoryInfo> historyDataArr;
       
   392     for (int arrCount = 0 ; arrCount < songCount ; arrCount++ )
       
   393     {
       
   394         CIRSongHistoryInfo *songHistory = CIRSongHistoryInfo::NewL();
       
   395         CleanupStack::PushL(songHistory);
       
   396         historyDataArr.AppendL(songHistory);
       
   397         CleanupStack::Pop(songHistory);
       
   398     }
       
   399 
       
   400     iSongHistoryDb->GetAllSongHistoryList2L(historyDataArr);
       
   401 
       
   402     // create IRQSongHistoryInfo array and set
       
   403     QString songName;
       
   404     QString artist;     
       
   405     QString stationName;     
       
   406     QString musicStoreStatus;
       
   407     
       
   408     for (int arrCount = 0; arrCount < songCount; arrCount++)
       
   409     {
       
   410         songName = QString::fromUtf16(
       
   411                 historyDataArr[arrCount]->GetSongInfo().Ptr(),
       
   412                 historyDataArr[arrCount]->GetSongInfo().Length());
       
   413         artist = QString::fromUtf16(
       
   414                 historyDataArr[arrCount]->GetArtistInfo().Ptr(),
       
   415                 historyDataArr[arrCount]->GetArtistInfo().Length());
       
   416         stationName = QString::fromUtf16(
       
   417                 historyDataArr[arrCount]->GetChannelName().Ptr(),
       
   418                 historyDataArr[arrCount]->GetChannelName().Length());
       
   419         musicStoreStatus = QString::fromUtf16(
       
   420                 historyDataArr[arrCount]->GetChannelMusicStatus().Ptr(),
       
   421                 historyDataArr[arrCount]->GetChannelMusicStatus().Length());
       
   422         IRQSongInfo* irqsong = new IRQSongInfo();
       
   423 
       
   424         irqsong->setAllInfo(songName, artist, stationName, musicStoreStatus);
       
   425         aSongHistoryArr.append(irqsong);
       
   426     }
       
   427     
       
   428     historyDataArr.ResetAndDestroy();
       
   429 }
       
   430 // ---------------------------------------------------------------------------
       
   431 // IRQSongHistoryEngine::clearAllHistory
       
   432 // Invoked when when UI request.
       
   433 // Clears the SongHistoryDb.
       
   434 // ---------------------------------------------------------------------------
       
   435 
       
   436  EXPORT_C int IRQSongHistoryEngine::clearAllHistory( )
       
   437  {
       
   438      return iSongHistoryDb->ClearAllSongHistoryFromDb();
       
   439  }
       
   440  
       
   441  EXPORT_C int IRQSongHistoryEngine::clearAllSongHistory( )
       
   442  {
       
   443      return iSongHistoryDb->ClearAllSongHistoryFromDb2();
       
   444  }
       
   445 
       
   446 // ---------------------------------------------------------------------------
       
   447 // IRQSongHistoryEngine::syncHistory
       
   448 // Invoked when when UI request.
       
   449 // Synchronises the Song history DB with the new data in the ISDS.
       
   450 // ---------------------------------------------------------------------------
       
   451 EXPORT_C void IRQSongHistoryEngine::syncHistory(int aChannelId)
       
   452 {
       
   453     TRAPD(err,iSongHistoryDb->SyncSongHistoryDbL(aChannelId));
       
   454     if (err)
       
   455     {
       
   456     }
       
   457 }
       
   458 
       
   459 // ---------------------------------------------------------------------------
       
   460 // IRQSongHistoryEngine::updateSongHistoryDb
       
   461 // Invoked when when UI request.
       
   462 // Synchronises the Song history DB with the new data in the ISDS.
       
   463 // ---------------------------------------------------------------------------
       
   464 EXPORT_C void IRQSongHistoryEngine::updateSongHistoryDb(int aChannelId,
       
   465         const QString& aChannelName,
       
   466         const QString& aChannelUrl,
       
   467         const QString& aImageUrl,
       
   468         const QString& aGenreName,
       
   469         const QString& aCountryName,
       
   470         const QString& aLanguageName,
       
   471         const QString& aMusicFlag)
       
   472 {
       
   473     TInt ret = KErrNone ;
       
   474     TUint16 channelId = aChannelId; // prevent data overflow
       
   475 
       
   476     TRAPD(err,ret = iSongHistoryDb->GetIdPresentInDbL( channelId ));
       
   477 
       
   478     if (err)
       
   479     {
       
   480         return;
       
   481     }
       
   482 
       
   483     if (ret)
       
   484     {
       
   485         TPtrC channelName(reinterpret_cast<const TUint16*>(aChannelName.utf16()));
       
   486         TPtrC channelUrl(reinterpret_cast<const TUint16*>(aChannelUrl.utf16()));
       
   487         TPtrC imageUrl(reinterpret_cast<const TUint16*>(aImageUrl.utf16()));
       
   488         TPtrC genreName(reinterpret_cast<const TUint16*>(aGenreName.utf16()));
       
   489         TPtrC countryName(reinterpret_cast<const TUint16*>(aCountryName.utf16()));
       
   490         TPtrC languageName(reinterpret_cast<const TUint16*>(aLanguageName.utf16()));
       
   491         TPtrC musicFlag(reinterpret_cast<const TUint16*>(aMusicFlag.utf16()));
       
   492         TRAP_IGNORE(iSongHistoryDb->UpdateSongHistoryDbL( channelId ,
       
   493                 channelUrl,
       
   494                 imageUrl,
       
   495                 genreName,
       
   496                 countryName,
       
   497                 languageName,
       
   498                 musicFlag));
       
   499     }
       
   500 }
       
   501 
       
   502 EXPORT_C bool IRQSongHistoryEngine::deleteOneItem(int aIndex)
       
   503 {    
       
   504     int retValue = 0;
       
   505     retValue = iSongHistoryDb->DeleteOneHistory(aIndex);
       
   506     if( KErrNone != retValue )
       
   507     {
       
   508         return false;
       
   509     }
       
   510     
       
   511     return true;
       
   512 }
       
   513 
       
   514 EXPORT_C bool IRQSongHistoryEngine::deleteOneSongHistoryItem(int aIndex)
       
   515 {    
       
   516     int retValue = 0;
       
   517     retValue = iSongHistoryDb->DeleteOneSongHistory(aIndex);
       
   518     if( KErrNone != retValue )
       
   519     {
       
   520         return false;
       
   521     }
       
   522     
       
   523     return true;
       
   524 }