235 |
235 |
236 TInt res = iManualQueryDialog->ExecuteLD( R_FMRADIO_MANUAL_TUNING_QUERY ); |
236 TInt res = iManualQueryDialog->ExecuteLD( R_FMRADIO_MANUAL_TUNING_QUERY ); |
237 |
237 |
238 if ( res ) |
238 if ( res ) |
239 { |
239 { |
240 if ( iObserver.Channels()->Count() < KMaxNumberOfChannelListItems ) |
240 if ( iObserver.Channels().Count() < KMaxNumberOfChannelListItems ) |
241 { |
241 { |
242 TInt usefreq = static_cast<TInt>( retFreq * KFMRadioFreqMultiplier ); |
242 TInt usefreq = static_cast<TInt>( retFreq * KFMRadioFreqMultiplier ); |
243 iRadioEngine->Tune( usefreq ); |
243 iRadioEngine->Tune( usefreq ); |
244 TBuf<KPresetNameLength> stationName; |
244 TBuf<KPresetNameLength> stationName; |
245 stationName.SetLength( 0 ); |
245 stationName.SetLength( 0 ); |
248 |
248 |
249 iObserver.UpdateChannelsL( EStoreAllToRepository, 0, 0 ); |
249 iObserver.UpdateChannelsL( EStoreAllToRepository, 0, 0 ); |
250 |
250 |
251 iContainer->AddChannelL( stationName, usefreq, ETrue ); |
251 iContainer->AddChannelL( stationName, usefreq, ETrue ); |
252 |
252 |
253 iRadioEngine->TunePresetL( iObserver.Channels()->Count()-1 ); |
253 iRadioEngine->TunePresetL( iObserver.Channels().Count() - 1 ); |
254 |
254 |
255 TInt index = iRadioEngine->GetPresetIndex(); |
255 TInt index = iRadioEngine->GetPresetIndex(); |
256 |
256 |
257 iContainer->UpdateItemIconL( index, KNowPlayingIconIndexChList ); |
257 iContainer->UpdateItemIconL( index, KNowPlayingIconIndexChList ); |
258 |
258 |
378 |
378 |
379 if ( iContainer ) |
379 if ( iContainer ) |
380 { |
380 { |
381 TBool nowPlaying = EFalse; |
381 TBool nowPlaying = EFalse; |
382 |
382 |
383 CArrayFixFlat<TChannelInformation>* channels = iObserver.Channels(); |
383 RPointerArray<CFMRadioPreset>& channels = iObserver.Channels(); |
384 TInt channelCount = channels->Count(); |
384 TInt channelCount = channels.Count(); |
385 |
385 |
386 for ( TInt channelIndex = 0; channelCount > channelIndex; channelIndex++ ) |
386 for ( TInt channelIndex = 0; channelCount > channelIndex; channelIndex++ ) |
387 { |
387 { |
388 FTRACE( FPrint( _L("CFMRadioChannelListView::InitializeChannelsL inside Channel in use") ) ); |
388 FTRACE( FPrint( _L("CFMRadioChannelListView::InitializeChannelsL inside Channel in use") ) ); |
389 |
389 |
390 iContainer->AddChannelL( channels->At( channelIndex ).iChannelInformation, |
390 iContainer->AddChannelL( channels[ channelIndex ]->PresetName(), |
391 channels->At( channelIndex ).iChannelFrequency, |
391 channels[ channelIndex ]->PresetFrequency(), |
392 nowPlaying ); |
392 nowPlaying ); |
393 |
393 |
394 UpdateMiddleSoftKeyL(); |
394 UpdateMiddleSoftKeyL(); |
395 FTRACE( FPrint( _L("CFMRadioChannelListView::InitializeChannelsL inside Channel in use Channel = %d"), iRadioEngine->GetPresetFrequencyL( channelIndex )) ); |
395 FTRACE( FPrint( _L("CFMRadioChannelListView::InitializeChannelsL inside Channel in use Channel = %d"), iRadioEngine->GetPresetFrequencyL( channelIndex )) ); |
396 } |
396 } |
693 { |
693 { |
694 aMenuPane->SetItemDimmed( EAknCmdHelp, ETrue ); |
694 aMenuPane->SetItemDimmed( EAknCmdHelp, ETrue ); |
695 } |
695 } |
696 |
696 |
697 // don't show stylus pop-up menu during move operation |
697 // don't show stylus pop-up menu during move operation |
698 if ( iObserver.Channels()->Count() > 1 && !iMoveMode ) |
698 if ( iObserver.Channels().Count() > 1 && !iMoveMode ) |
699 { |
699 { |
700 aMenuPane->SetItemDimmed( EFMRadioCmdMove, EFalse ); |
700 aMenuPane->SetItemDimmed( EFMRadioCmdMove, EFalse ); |
701 } |
701 } |
702 else |
702 else |
703 { |
703 { |
759 void CFMRadioChannelListView::UpdateMiddleSoftKeyL() |
759 void CFMRadioChannelListView::UpdateMiddleSoftKeyL() |
760 { |
760 { |
761 |
761 |
762 if ( ( iContainer && |
762 if ( ( iContainer && |
763 ( iContainer->CurrentlySelectedChannel() == iRadioEngine->GetPresetIndex() |
763 ( iContainer->CurrentlySelectedChannel() == iRadioEngine->GetPresetIndex() |
764 || iObserver.Channels()->Count() == 0 ) ) || |
764 || iObserver.Channels().Count() == 0 ) ) || |
765 iMoveMode ) |
765 iMoveMode ) |
766 { |
766 { |
767 SetMiddleSoftKeyLabelL(R_QTN_FMRADIO_NONE, EFMRadioCmdListenCh); |
767 SetMiddleSoftKeyLabelL(R_QTN_FMRADIO_NONE, EFMRadioCmdListenCh); |
768 } |
768 } |
769 else |
769 else |
814 TInt currentPresetIx = iRadioEngine->GetPresetIndex(); |
814 TInt currentPresetIx = iRadioEngine->GetPresetIndex(); |
815 // When we haven't preset name, ps name will save as preset name |
815 // When we haven't preset name, ps name will save as preset name |
816 if ( iRadioEngine->GetRadioMode() == CRadioEngine::ERadioPresetMode && |
816 if ( iRadioEngine->GetRadioMode() == CRadioEngine::ERadioPresetMode && |
817 currentPresetIx != KErrNotFound ) |
817 currentPresetIx != KErrNotFound ) |
818 { |
818 { |
819 TBuf<KPresetNameLength> stationName; |
819 RPointerArray<CFMRadioPreset>& channels = iObserver.Channels(); |
820 stationName.SetLength( 0 ); |
|
821 |
|
822 |
|
823 TInt presetFreq( 0 ); |
|
824 |
|
825 CArrayFixFlat<TChannelInformation>* channels = iObserver.Channels(); |
|
826 |
820 |
827 // this checks that index is not out of bound and cause -21 error during update |
821 // this checks that index is not out of bound and cause -21 error during update |
828 if ( currentPresetIx < channels->Count() ) |
822 if ( currentPresetIx < channels.Count() ) |
829 { |
823 { |
830 stationName = channels->At( currentPresetIx ).iChannelInformation; |
824 const TDesC& stationName = channels[ currentPresetIx ]->PresetName(); |
831 presetFreq = channels->At( currentPresetIx ).iChannelFrequency; |
825 TInt presetFreq = channels[ currentPresetIx ]->PresetFrequency(); |
832 |
826 |
833 if ( stationName.Length() == 0 ) //Set and save PSname only if no name set before |
827 if ( stationName.Length() == 0 ) //Set and save PSname only if no name set before |
834 { |
828 { |
835 TRAP_IGNORE( |
829 TRAP_IGNORE( |
836 { |
830 { |
837 iContainer->UpdateChannelListContentL( currentPresetIx, |
831 iContainer->UpdateChannelListContentL( currentPresetIx, |
838 programmeService, |
832 programmeService, |
839 presetFreq ); |
833 presetFreq ); |
840 |
834 |
841 iRadioEngine->SetPresetNameFrequencyL( currentPresetIx, programmeService, presetFreq ); |
835 iRadioEngine->SetPresetNameFrequencyL( currentPresetIx, programmeService, presetFreq ); |
842 iObserver.Channels()->At( currentPresetIx ).iChannelInformation = programmeService; |
836 channels[ currentPresetIx ]->SetPresetNameL( programmeService ); |
843 } ); |
837 } ) |
844 } |
838 } |
845 } |
839 } |
846 } |
840 } |
847 } |
841 } |
848 } |
842 } |
940 // From MFMRadioRdsObserver, implementation not needed. |
934 // From MFMRadioRdsObserver, implementation not needed. |
941 // ----------------------------------------------------------------------------------------------- |
935 // ----------------------------------------------------------------------------------------------- |
942 // |
936 // |
943 void CFMRadioChannelListView::RdsDataRadioText( const TDesC& /*aRadioText*/ ){} |
937 void CFMRadioChannelListView::RdsDataRadioText( const TDesC& /*aRadioText*/ ){} |
944 |
938 |
|
939 void CFMRadioChannelListView::RdsDataRadioTextPlus( const TInt aRTPlusClass, const TDesC& aRadioText ) |
|
940 { |
|
941 if ( aRTPlusClass == ERTplusProgramHomepage && |
|
942 iRadioEngine->GetRadioMode() == CRadioEngine::ERadioPresetMode ) |
|
943 { |
|
944 TInt currentPresetIx = iRadioEngine->GetPresetIndex(); |
|
945 if ( currentPresetIx < iObserver.Channels().Count() ) |
|
946 { |
|
947 TRAP_IGNORE |
|
948 ( |
|
949 // save permanently |
|
950 iRadioEngine->SaveUrlToPresetL( currentPresetIx, aRadioText ); |
|
951 // save to ui list |
|
952 iObserver.Channels()[ currentPresetIx ]->SetPresetUrlL( aRadioText ); |
|
953 ) |
|
954 } |
|
955 } |
|
956 } |
|
957 |
945 // ----------------------------------------------------------------------------------------------- |
958 // ----------------------------------------------------------------------------------------------- |
946 // CFMRadioChannelListView::RdsAfSearchBegin |
959 // CFMRadioChannelListView::RdsAfSearchBegin |
947 // From MFMRadioRdsObserver, implementation not needed. |
960 // From MFMRadioRdsObserver, implementation not needed. |
948 // ----------------------------------------------------------------------------------------------- |
961 // ----------------------------------------------------------------------------------------------- |
949 // |
962 // |