# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1277124050 -10800 # Node ID 04aa446da81c80b303f01a694be326f7db7e1cb4 # Parent 4f2584af5a292f2e9b90caa23c47b3eddd59684a Revision: 201023 Kit: 2010125 diff -r 4f2584af5a29 -r 04aa446da81c fmradio/fmradio/inc/fmradioalfvisualizer.h --- a/fmradio/fmradio/inc/fmradioalfvisualizer.h Wed Jun 09 09:42:10 2010 +0300 +++ b/fmradio/fmradio/inc/fmradioalfvisualizer.h Mon Jun 21 15:40:50 2010 +0300 @@ -347,8 +347,9 @@ void AnimateTemporaryStationInformationVisuals( TFMRadioStationChangeType aChangeType ); /** * Triggers the command to view handling + * @param aCommand command id */ - void TriggerCommandL(); + void TriggerCommandL( TInt aCommand = 0 ); /** * Static call back for the long key press timer. * @param aSelf Pointer to self. diff -r 4f2584af5a29 -r 04aa446da81c fmradio/fmradio/inc/fmradiochannellistcontainer.h --- a/fmradio/fmradio/inc/fmradiochannellistcontainer.h Wed Jun 09 09:42:10 2010 +0300 +++ b/fmradio/fmradio/inc/fmradiochannellistcontainer.h Mon Jun 21 15:40:50 2010 +0300 @@ -220,7 +220,6 @@ CDesCArray* iChannelItemArray; // Index of the most recently listened channel to keep the listbox up-to-date. TInt iLastChIndex; - RPointerArray iControls; // array for list icon bitmaps RPointerArray iBitMaps; TBool iFadeStatus; diff -r 4f2584af5a29 -r 04aa446da81c fmradio/fmradio/inc/fmradioscanlocalstationscontainer.h --- a/fmradio/fmradio/inc/fmradioscanlocalstationscontainer.h Wed Jun 09 09:42:10 2010 +0300 +++ b/fmradio/fmradio/inc/fmradioscanlocalstationscontainer.h Mon Jun 21 15:40:50 2010 +0300 @@ -186,7 +186,6 @@ CDesCArray* iChannelItemArray; // Index of the most recently listened channel to keep the listbox up-to-date. TInt iLastChIndex; - RPointerArray iControls; TBool iFadeStatus; MAknsSkinInstance* iSkin; CRadioEngine& iRadioEngine; //not own diff -r 4f2584af5a29 -r 04aa446da81c fmradio/fmradio/src/fmradioalfbitmapanimation.cpp --- a/fmradio/fmradio/src/fmradioalfbitmapanimation.cpp Wed Jun 09 09:42:10 2010 +0300 +++ b/fmradio/fmradio/src/fmradioalfbitmapanimation.cpp Mon Jun 21 15:40:50 2010 +0300 @@ -207,7 +207,7 @@ bitmapId, bitmapMaskId ); - iFrames.Append( alfImage ); + iFrames.AppendL( alfImage ); } CleanupStack::PopAndDestroy(); //resourceReader } diff -r 4f2584af5a29 -r 04aa446da81c fmradio/fmradio/src/fmradioalfmediaidle.cpp --- a/fmradio/fmradio/src/fmradioalfmediaidle.cpp Wed Jun 09 09:42:10 2010 +0300 +++ b/fmradio/fmradio/src/fmradioalfmediaidle.cpp Mon Jun 21 15:40:50 2010 +0300 @@ -208,7 +208,7 @@ TInt mediaIdleItemTextStyleId = manager.CreatePlatformTextStyleL(); CAlfTextStyle* mediaIdleItemStyle = manager.TextStyle( mediaIdleItemTextStyleId ); mediaIdleItemStyle->SetTextSizeInPixels( KRelativeFontSizeArray[i] * layoutHeight, ETrue ); - iTextStyleIdArray.Append( mediaIdleItemTextStyleId ); + iTextStyleIdArray.AppendL( mediaIdleItemTextStyleId ); } iFontsOrientation = iOrientation; iFontReferenceHeight = layoutHeight; diff -r 4f2584af5a29 -r 04aa446da81c fmradio/fmradio/src/fmradioalfvisualizer.cpp --- a/fmradio/fmradio/src/fmradioalfvisualizer.cpp Wed Jun 09 09:42:10 2010 +0300 +++ b/fmradio/fmradio/src/fmradioalfvisualizer.cpp Mon Jun 21 15:40:50 2010 +0300 @@ -539,16 +539,15 @@ TGestureCode eventCode( aEvent.Code( MGestureEvent::EAxisBoth ) ); FTRACE( FPrint( _L("CFMRadioAlfVisualizer::HandleGestureL(eventCode=%d)"), eventCode ) ); - CFMRadioAppUi* appUi = static_cast( CCoeEnv::Static()->AppUi() ); // handle gestures only if there is no call or tuning ongoing - if ( !appUi->RadioEngine()->IsInCall() && - appUi->RadioState() != CFMRadioAppUi::EFMRadioStateBusySeek ) + if ( !iAppUi->RadioEngine()->IsInCall() && + iAppUi->RadioState() != CFMRadioAppUi::EFMRadioStateBusySeek ) { switch ( eventCode ) { case EGestureTap: { - CAknVolumePopup* volPopup = appUi->ActiveVolumePopup(); + CAknVolumePopup* volPopup = iAppUi->ActiveVolumePopup(); if ( volPopup ) { if ( volPopup->IsVisible() ) @@ -567,11 +566,11 @@ { if ( iDragAxis == EFMRadioDragAxisX ) { - if ( appUi->NumberOfChannelsStored() ) + if ( iAppUi->NumberOfChannelsStored() ) { iRevertGestureDrag = EFalse; } - appUi->HandleCommandL( EFMRadioCmdNextChannel ); + iAppUi->HandleCommandL( EFMRadioCmdNextChannel ); } break; } @@ -579,11 +578,11 @@ { if ( iDragAxis == EFMRadioDragAxisX ) { - if ( appUi->NumberOfChannelsStored() ) + if ( iAppUi->NumberOfChannelsStored() ) { iRevertGestureDrag = EFalse; } - appUi->HandleCommandL( EFMRadioCmdPrevChannel ); + iAppUi->HandleCommandL( EFMRadioCmdPrevChannel ); } break; } @@ -592,7 +591,7 @@ if ( iDragAxis == EFMRadioDragAxisY ) { iRevertGestureDrag = EFalse; - appUi->HandleCommandL( EFMRadioCmdSeekUp ); + iAppUi->HandleCommandL( EFMRadioCmdSeekUp ); } break; } @@ -601,7 +600,7 @@ if ( iDragAxis == EFMRadioDragAxisY ) { iRevertGestureDrag = EFalse; - appUi->HandleCommandL( EFMRadioCmdSeekDown ); + iAppUi->HandleCommandL( EFMRadioCmdSeekDown ); } break; } @@ -699,56 +698,60 @@ { TBool keyHandled = EFalse; - if ( aEvent.IsKeyEvent() && AknLayoutUtils::PenEnabled() ) + if ( !iAppUi->RadioEngine()->IsInCall() ) { - const TKeyEvent& kEvent = aEvent.KeyEvent(); - - if ( kEvent.iCode == EKeyEnter || kEvent.iCode == EKeyOK ) + if ( aEvent.IsKeyEvent() && AknLayoutUtils::PenEnabled() ) { - iAppUi->ActivateLocalViewL( KFMRadioChannelListViewId ); - keyHandled = ETrue; - } - - switch ( kEvent.iScanCode ) - { - case EStdKeyRightArrow: // check arrow keys - case EStdKeyLeftArrow: - case EStdKeyUpArrow: - case EStdKeyDownArrow: + const TKeyEvent& kEvent = aEvent.KeyEvent(); + + if ( kEvent.iCode == EKeyEnter || kEvent.iCode == EKeyOK ) { - iKeyScanCode = kEvent.iScanCode; - - if ( aEvent.Code() == EEventKeyUp ) + TriggerCommandL( EFMRadioCmdChannelList ); + keyHandled = ETrue; + } + + switch ( kEvent.iScanCode ) + { + case EStdKeyRightArrow: // check arrow keys + case EStdKeyLeftArrow: + case EStdKeyUpArrow: + case EStdKeyDownArrow: { - iLongPressTimer->Cancel(); - if ( !iLongKeyTriggered ) + iKeyScanCode = kEvent.iScanCode; + + if ( aEvent.Code() == EEventKeyUp ) + { + iLongPressTimer->Cancel(); + if ( !iLongKeyTriggered ) + { + TriggerCommandL(); + } + } + else if ( aEvent.Code() == EEventKeyDown ) { - TriggerCommandL(); + iLongKeyTriggered = EFalse; + // Start the long key press timer + iLongPressTimer->Cancel(); + iLongPressTimer->Start( KFMRadioRockerLongPressDelay, + 0, + TCallBack( CFMRadioAlfVisualizer::StaticLongPressCallBack, this ) ); + } + keyHandled = ETrue; + break; } - else if ( aEvent.Code() == EEventKeyDown ) + default: { - iLongKeyTriggered = EFalse; - // Start the long key press timer - iLongPressTimer->Cancel(); - iLongPressTimer->Start( KFMRadioRockerLongPressDelay, - 0, - TCallBack( CFMRadioAlfVisualizer::StaticLongPressCallBack, this ) ); - + break; } - keyHandled = ETrue; - break; - } - default: - { - break; } } + if ( aEvent.IsPointerEvent() ) + { + return CGestureControl::OfferEventL( aEvent ); + } } - if ( aEvent.IsPointerEvent() ) - { - return CGestureControl::OfferEventL( aEvent ); - } + return keyHandled; } @@ -1085,7 +1088,7 @@ // Triggers the command to view handling // --------------------------------------------------------------------------- // -void CFMRadioAlfVisualizer::TriggerCommandL() +void CFMRadioAlfVisualizer::TriggerCommandL( TInt aCommand ) { TVwsViewId viewId( KNullUid, KNullUid ); TInt err = iAppUi->GetActiveViewId( viewId ); @@ -1138,6 +1141,10 @@ break; } } + if ( aCommand == EFMRadioCmdChannelList ) + { + commandId = EFMRadioCmdChannelList; + } // send command to view view->ProcessCommandL( commandId ); } diff -r 4f2584af5a29 -r 04aa446da81c fmradio/fmradio/src/fmradioappui.cpp --- a/fmradio/fmradio/src/fmradioappui.cpp Wed Jun 09 09:42:10 2010 +0300 +++ b/fmradio/fmradio/src/fmradioappui.cpp Mon Jun 21 15:40:50 2010 +0300 @@ -1504,6 +1504,30 @@ FTRACE( FPrint( _L("CFMRadioAppUi::HandleWsEventL - event %d "), aEvent.Type() ) ); switch ( aEvent.Type() ) { + case KAknUidValueEndKeyCloseEvent: + { + if ( IsForeground() ) + { + const TUid KPhoneAppUid = {0x100058B3}; // hardcoded value for phone app uid + TApaTaskList taskList( iEikonEnv->WsSession() ); + TApaTask phoneTask = taskList.FindApp( KPhoneAppUid ); + + if ( phoneTask.Exists() ) + { + // Bring phone to foreground + phoneTask.BringToForeground(); + } + else + { + // Phone app should always be there, but this is a backup + // plan, just set radio to background + TApaTask task( iEikonEnv->WsSession() ); + task.SetWgId( iEikonEnv->RootWin().Identifier() ); + task.SendToBackground(); + } + } + break; + } case EEventFocusLost: { // being sent to background, cancel any seek expect local stations scan @@ -1749,10 +1773,12 @@ // Move channel operation moves channel from aIndex to aMovedToNewIndex value if ( EMoveChannels == aOperation ) - { - const CFMRadioPreset* channelinfo = iChannels[ aIndex ]; + { + CFMRadioPreset* channelInfo = iChannels[ aIndex ]; iChannels.Remove( aIndex ); - iChannels.Insert( channelinfo, aMovedToNewIndex ); + CleanupStack::PushL( channelInfo ); + iChannels.InsertL( channelInfo, aMovedToNewIndex ); + CleanupStack::Pop( channelInfo); } // Delete channel deletes channel from list else if ( EDeleteChannel == aOperation ) diff -r 4f2584af5a29 -r 04aa446da81c fmradio/fmradio/src/fmradiochannellistcontainer.cpp --- a/fmradio/fmradio/src/fmradiochannellistcontainer.cpp Wed Jun 09 09:42:10 2010 +0300 +++ b/fmradio/fmradio/src/fmradiochannellistcontainer.cpp Mon Jun 21 15:40:50 2010 +0300 @@ -88,7 +88,6 @@ // Instantiate a listbox for the channel list iChannelList = new ( ELeave ) CAknDoubleNumberStyleListBox(); - iControls.Append( iChannelList ); iChannelList->SetContainerWindowL( *this ); iChannelList->SetListBoxObserver( this ); iChannelList->ConstructL( this, CEikListBox::ELoopScrolling | EAknListBoxSelectionList ); // Looped list @@ -125,8 +124,7 @@ // CFMRadioChannelListContainer::~CFMRadioChannelListContainer() { - iControls.ResetAndDestroy(); - iControls.Close(); + delete iChannelList; iBitMaps.ResetAndDestroy(); iBitMaps.Close(); delete iChannelItemArray; @@ -560,7 +558,7 @@ // TInt CFMRadioChannelListContainer::CountComponentControls() const { - return iControls.Count(); + return 1; } // --------------------------------------------------------- @@ -570,7 +568,22 @@ // CCoeControl* CFMRadioChannelListContainer::ComponentControl( TInt aIndex ) const { - return STATIC_CAST( CCoeControl *,iControls[aIndex] ); + CCoeControl* control = NULL; + + switch ( aIndex ) + { + case 0: + { + control = iChannelList; + break; + } + default: + { + break; + } + } + + return control; } // --------------------------------------------------------- @@ -582,6 +595,12 @@ TEventCode aType ) { TKeyResponse response = EKeyWasNotConsumed; + + if ( iFadeStatus ) + { + // don't handle any keys if the view is faded + return response; + } switch ( aKeyEvent.iCode ) { diff -r 4f2584af5a29 -r 04aa446da81c fmradio/fmradio/src/fmradiochannellistview.cpp --- a/fmradio/fmradio/src/fmradiochannellistview.cpp Wed Jun 09 09:42:10 2010 +0300 +++ b/fmradio/fmradio/src/fmradiochannellistview.cpp Mon Jun 21 15:40:50 2010 +0300 @@ -306,16 +306,19 @@ } case EFMRadioCmdErase: { - TInt selectedIndex = CurrentlySelectedChannel(); - - if ( appUi->EraseChannelL( selectedIndex ) ) + if ( iObserver.Channels().Count() > 0 ) { - if ( iContainer ) + TInt selectedIndex = CurrentlySelectedChannel(); + + if ( appUi->EraseChannelL( selectedIndex ) ) { - iContainer->RemoveChannelL( selectedIndex ); + if ( iContainer ) + { + iContainer->RemoveChannelL( selectedIndex ); + } + // Dim the rename and delete buttons in case the list is now empty + UpdateToolbar(); } - // Dim the rename and delete buttons in case the list is now empty - UpdateToolbar(); } break; } @@ -694,8 +697,10 @@ aMenuPane->SetItemDimmed( EAknCmdHelp, ETrue ); } + TInt channelCount = iObserver.Channels().Count(); + // don't show stylus pop-up menu during move operation - if ( iObserver.Channels().Count() > 1 && !iMoveMode ) + if ( channelCount > 1 && !iMoveMode ) { aMenuPane->SetItemDimmed( EFMRadioCmdMove, EFalse ); } @@ -704,8 +709,9 @@ aMenuPane->SetItemDimmed( EFMRadioCmdMove, ETrue ); } - if ( iMoveMode ) + if ( iMoveMode || channelCount < 1 ) { + // hide rename and erase aMenuPane->SetItemDimmed( EFMRadioCmdRename, ETrue ); aMenuPane->SetItemDimmed( EFMRadioCmdErase, ETrue ); } diff -r 4f2584af5a29 -r 04aa446da81c fmradio/fmradio/src/fmradiomusicstorehandler.cpp --- a/fmradio/fmradio/src/fmradiomusicstorehandler.cpp Wed Jun 09 09:42:10 2010 +0300 +++ b/fmradio/fmradio/src/fmradiomusicstorehandler.cpp Mon Jun 21 15:40:50 2010 +0300 @@ -560,23 +560,33 @@ const TDesC& aArtistName, const TDesC& aAlbumName ) { - HBufC* url = NULL; + HBufC* searchUrl = NULL; // Launching the music store client + _LIT(KReferrerAppParam, "&ReferrerApp=3"); if ( aSongName.Length() || aArtistName.Length() || aAlbumName.Length() ) { CMPXFindInMShop* finder = CMPXFindInMShop::NewL(); //ECom Plugin CleanupStack::PushL( finder ); - url = finder->CreateSearchURLL( aSongName, + searchUrl = finder->CreateSearchURLL( aSongName, aArtistName, aAlbumName, KNullDesC, // Composer - Not used KNullDesC ); // Genre - Not used - + + HBufC* finalUrl = HBufC::NewL( searchUrl->Length() + KReferrerAppParam().Length() ); + + TPtr urlPtr = finalUrl->Des(); + urlPtr.Copy( *searchUrl ); + urlPtr.Append( KReferrerAppParam() ); + + delete searchUrl; + searchUrl = NULL; + CleanupStack::PopAndDestroy( finder ); // finder REComSession::FinalClose(); + return finalUrl; } - - return url; + return searchUrl; } // ----------------------------------------------------------------------------- diff -r 4f2584af5a29 -r 04aa446da81c fmradio/fmradio/src/fmradioscanlocalstationscontainer.cpp --- a/fmradio/fmradio/src/fmradioscanlocalstationscontainer.cpp Wed Jun 09 09:42:10 2010 +0300 +++ b/fmradio/fmradio/src/fmradioscanlocalstationscontainer.cpp Mon Jun 21 15:40:50 2010 +0300 @@ -86,14 +86,13 @@ iSkin = AknsUtils::SkinInstance(); - // Instantiate a listbox for the channel list - iChannelList = new ( ELeave ) CAknSingleNumberStyleListBox(); - iControls.Append( iChannelList ); - iChannelList->SetContainerWindowL( *this ); - iChannelList->SetListBoxObserver( this ); - iChannelList->ConstructL( this, CEikListBox::ELoopScrolling | EAknListBoxSelectionList ); // Looped list - // Create scrollbars - iChannelList->CreateScrollBarFrameL( ETrue ); + // Instantiate a listbox for the channel list + iChannelList = new ( ELeave ) CAknSingleNumberStyleListBox(); + iChannelList->SetContainerWindowL( *this ); + iChannelList->SetListBoxObserver( this ); + iChannelList->ConstructL( this, CEikListBox::ELoopScrolling | EAknListBoxSelectionList ); // Looped list + // Create scrollbars + iChannelList->CreateScrollBarFrameL( ETrue ); CAknIconArray* listIconArray = new ( ELeave ) CAknIconArray( 1 ); CleanupStack::PushL( listIconArray ); @@ -159,8 +158,7 @@ // CFMRadioScanLocalStationsContainer::~CFMRadioScanLocalStationsContainer() { - iControls.ResetAndDestroy(); - iControls.Close(); + delete iChannelList; iBitMaps.ResetAndDestroy(); iBitMaps.Close(); delete iChannelItemArray; @@ -494,7 +492,7 @@ // TInt CFMRadioScanLocalStationsContainer::CountComponentControls() const { - return iControls.Count(); + return 1; } // --------------------------------------------------------- @@ -504,7 +502,22 @@ // CCoeControl* CFMRadioScanLocalStationsContainer::ComponentControl( TInt aIndex ) const { - return STATIC_CAST( CCoeControl*, iControls[aIndex] ); + CCoeControl* control = NULL; + + switch ( aIndex ) + { + case 0: + { + control = iChannelList; + break; + } + default: + { + break; + } + } + + return control; } // --------------------------------------------------------- diff -r 4f2584af5a29 -r 04aa446da81c fmradio/fmradio/src/fmradioscanlocalstationsview.cpp --- a/fmradio/fmradio/src/fmradioscanlocalstationsview.cpp Wed Jun 09 09:42:10 2010 +0300 +++ b/fmradio/fmradio/src/fmradioscanlocalstationsview.cpp Mon Jun 21 15:40:50 2010 +0300 @@ -315,37 +315,36 @@ { TInt err = KErrNone; iFaded = aFaded; - if( iContainer ) + SetToolbarDimmedState( aFaded ); + if ( iContainer ) { if ( aFaded ) // Fade { // In case options menu is open when headset is disconnected StopDisplayingMenuBar(); - SetToolbarDimmedState( ETrue ); iContainer->SetFaded( aFaded ); TRAP( err,Cba()->SetCommandSetL( R_FMRADIO_SOFTKEYS_EXIT ) ); } else { - SetToolbarDimmedState( EFalse ); - iContainer->SetFaded(aFaded); + iContainer->SetFaded( aFaded ); TRAP( err,Cba()->SetCommandSetL( R_AVKON_SOFTKEYS_OPTIONS_BACK ) ); // Update index to be sure it is up-to-date (in case if list was scrolled in idle state) iContainer->UpdateLastListenedChannel( iChIndex ); - + if( iScannedChannels.Count() > 0 ) - { + { TRAP_IGNORE( SetMiddleSoftKeyIconL(); ) - - if ( ( CurrentlyPlayingChannel() == CurrentlySelectedChannel() ) ) - { - SetContextMenu( R_FMRADIO_SCAN_STATIONS_CTX_MENUBAR_SAVE ); - } - else - { - SetContextMenu( R_FMRADIO_SCAN_STATIONS_CTX_MENUBAR ); - } - } + + if ( ( CurrentlyPlayingChannel() == CurrentlySelectedChannel() ) ) + { + SetContextMenu( R_FMRADIO_SCAN_STATIONS_CTX_MENUBAR_SAVE ); + } + else + { + SetContextMenu( R_FMRADIO_SCAN_STATIONS_CTX_MENUBAR ); + } + } } Cba()->DrawDeferred(); } @@ -597,12 +596,19 @@ aMenuPane->SetItemDimmed( EFMRadioCmdDeactivateIhf, ETrue ); aMenuPane->SetItemDimmed( EFMRadioCmdActivateIhf, ETrue ); } - - if ( iScannedChannels.Count() < 2 ) + + TInt scannedChannelCount = iScannedChannels.Count(); + + if ( scannedChannelCount < 2 ) { aMenuPane->DeleteMenuItem( EFMRadioCmdSaveAllChannels ); } + if ( scannedChannelCount < 1) + { + aMenuPane->SetItemDimmed( EFMRadioCmdSaveChannel, ETrue ); + } + // if help is not enabled, disable help option if ( !FeatureManager::FeatureSupported( KFeatureIdHelp ) ) { @@ -956,7 +962,7 @@ if ( freqIndex < ( iScannedChannels.Count() - 1 ) ) { - iScannedChannels.Insert( channel, freqIndex ); + iScannedChannels.InsertL( channel, freqIndex ); } else { @@ -1064,24 +1070,24 @@ // --------------------------------------------------------- // void CFMRadioScanLocalStationsView::DisplayScanningInProgressNoteL() - { - iScanningNote = new (ELeave) CAknWaitDialog(REINTERPRET_CAST(CEikDialog**, &iScanningNote)); - iScanningNote->SetCallback( this ); - - CFMRadioAppUi* appUi = static_cast( iCoeEnv->AppUi() ); - - if ( appUi->IsStartupWizardRunning() ) - { - iScanningNote->PrepareLC( R_FMRADIO_SEARCH_STATIONS_WAIT_CANCEL_NOTE ); - } - else - { - iScanningNote->PrepareLC( R_FMRADIO_SEARCH_STATIONS_WAIT_NOTE ); - } - + { + iScanningNote = new ( ELeave ) CAknWaitDialog( reinterpret_cast( &iScanningNote ) ); + iScanningNote->SetCallback( this ); + + CFMRadioAppUi* appUi = static_cast( iCoeEnv->AppUi() ); + + if ( appUi->IsStartupWizardRunning() ) + { + iScanningNote->PrepareLC( R_FMRADIO_SEARCH_STATIONS_WAIT_CANCEL_NOTE ); + } + else + { + iScanningNote->PrepareLC( R_FMRADIO_SEARCH_STATIONS_WAIT_NOTE ); + } + iScanningNote->RunLD(); - } - + } + // --------------------------------------------------------- // CFMRadioScanLocalStationsContainer::RemoveScanningInProgressNoteL // Remove and destroy the scanning fill note.