qtinternetradio/irqisdsclient/src/irqisdscientimpl.cpp
changeset 3 ee64f059b8e1
parent 0 09774dfdd46b
equal deleted inserted replaced
2:2e1adbfc62af 3:ee64f059b8e1
    34 #ifdef USER_DEFINED_ISDSURL
    34 #ifdef USER_DEFINED_ISDSURL
    35 static const char* KDefaultIsdsUrl = "http://88.114.146.238/isds";
    35 static const char* KDefaultIsdsUrl = "http://88.114.146.238/isds";
    36 void getIsdsUrlFromConfiguration(QString & aUrl);
    36 void getIsdsUrlFromConfiguration(QString & aUrl);
    37 #endif // USER_DEFINED_ISDSURL
    37 #endif // USER_DEFINED_ISDSURL
    38 
    38 
    39 IRQIsdsClientImpl::IRQIsdsClientImpl(IRQFavoritesDB *aFavPresets) : iISDSClient(NULL), iFavPresets(NULL),
    39 IRQIsdsClientImpl::IRQIsdsClientImpl() : iISDSClient(NULL), iFavPresets(NULL),
    40                                                                     iLogoDownloadEngine(NULL)
    40                                                                     iLogoDownloadEngine(NULL)
    41 {
    41 {
    42     iFavPresets = aFavPresets->getCIRFavoriteDB();
       
    43 #ifdef USER_DEFINED_ISDSURL
    42 #ifdef USER_DEFINED_ISDSURL
    44     QString userDefinedIsdsUrl(KDefaultIsdsUrl);
    43     QString userDefinedIsdsUrl(KDefaultIsdsUrl);
    45     getIsdsUrlFromConfiguration(userDefinedIsdsUrl);
    44     getIsdsUrlFromConfiguration(userDefinedIsdsUrl);
    46     TPtrC irqissbaseurl(reinterpret_cast<const TUint16*>(userDefinedIsdsUrl.utf16()));
    45     TPtrC irqissbaseurl(reinterpret_cast<const TUint16*>(userDefinedIsdsUrl.utf16()));
    47 #else    
    46 #else    
    53         return;
    52         return;
    54     }
    53     }
    55     
    54     
    56     iLogoDownloadEngine
    55     iLogoDownloadEngine
    57             = iISDSClient->GetDataProvider()->GetHttpDataProvider()->GetLogoDownloadEngine();
    56             = iISDSClient->GetDataProvider()->GetHttpDataProvider()->GetLogoDownloadEngine();
    58     iLogoDownloadEngine->SetFavDbInstance(iFavPresets);
       
    59 }
    57 }
    60 
    58 
    61 IRQIsdsClientImpl::~IRQIsdsClientImpl()
    59 IRQIsdsClientImpl::~IRQIsdsClientImpl()
    62 {
    60 {
    63     delete iISDSClient;
    61     delete iISDSClient;
   177 
   175 
   178 //to syncronize presets
   176 //to syncronize presets
   179 //@param int,QString, the preset id and the last modified tag for the preset   
   177 //@param int,QString, the preset id and the last modified tag for the preset   
   180 //
   178 //
   181 int IRQIsdsClientImpl::isdsSyncPresetImpl(int aPresetId,
   179 int IRQIsdsClientImpl::isdsSyncPresetImpl(int aPresetId,
   182         const QString& aIfModifySince)
   180         const QString& aIfModifySince, IRQFavoritesDB *aFavPresets)
   183 {
   181 {
       
   182     iFavPresets = aFavPresets;
   184     TPtrC16 modifySinceDes(
   183     TPtrC16 modifySinceDes(
   185             reinterpret_cast<const TUint16*> (aIfModifySince.utf16()));
   184             reinterpret_cast<const TUint16*> (aIfModifySince.utf16()));
   186     TInt result = 0;
   185     TInt result = 0;
   187     TRAP_IGNORE(result = iISDSClient->SyncPresetL(aPresetId,modifySinceDes));     
   186     TRAP_IGNORE(result = iISDSClient->SyncPresetL(aPresetId,modifySinceDes));     
   188     return result;
   187     return result;
   468 //when we find that the preset to be syc is deleted from isds server, the function 
   467 //when we find that the preset to be syc is deleted from isds server, the function 
   469 //will be called to notify the UI. DISCUSSED FURTHER
   468 //will be called to notify the UI. DISCUSSED FURTHER
   470 //
   469 //
   471 void IRQIsdsClientImpl::IsdsPresetRemovedL(TInt aId)
   470 void IRQIsdsClientImpl::IsdsPresetRemovedL(TInt aId)
   472 {
   471 {
   473     iFavPresets->MakePresetUserDefinedL(aId, 0);
   472     if(iFavPresets)
       
   473     {
       
   474         iFavPresets->makePresetUserDefined(aId, 0);
       
   475     }
   474     emit
   476     emit
   475     syncPresetResultImpl(EIRQIsdsSycPresetRemoved, NULL);
   477     syncPresetResultImpl(EIRQIsdsSycPresetRemoved, NULL);
   476 }
   478 }
   477 
   479 
   478 //when we find that the preset to be syc is changed from isds server, the function 
   480 //when we find that the preset to be syc is changed from isds server, the function 
   479 //will be called to notify the UI.
   481 //will be called to notify the UI.
   480 //
   482 //
   481 void IRQIsdsClientImpl::IsdsPresetChangedL(CIRIsdsPreset& aPreset)
   483 void IRQIsdsClientImpl::IsdsPresetChangedL(CIRIsdsPreset& aPreset)
   482 {
   484 {
   483     iFavPresets->ReplacePresetL(aPreset);
       
   484     IRQPreset* qPreset = new IRQPreset();
   485     IRQPreset* qPreset = new IRQPreset();
   485     IRQUtility::convertCIRIsdsPreset2IRQPrest(aPreset, *qPreset);
   486     IRQUtility::convertCIRIsdsPreset2IRQPrest(aPreset, *qPreset);
   486     qPreset->type = IRQPreset::EIsds;
   487     qPreset->type = IRQPreset::EIsds;
       
   488     if(iFavPresets)
       
   489     {        
       
   490         iFavPresets->replacePreset(*qPreset);
       
   491     }
   487     emit syncPresetResultImpl(EIRQIsdsSycPresetChanged, qPreset);
   492     emit syncPresetResultImpl(EIRQIsdsSycPresetChanged, qPreset);
   488 }
   493 }
   489 
   494 
   490 //when we find that the preset to be syc is changed from isds server, the function 
   495 //when we find that the preset to be syc is changed from isds server, the function 
   491 //will be called to notify the UI.
   496 //will be called to notify the UI.