210 AknListBoxLayouts::SetupFormGfxCell( *iGrid, iGrid->ItemDrawer(), 0, |
209 AknListBoxLayouts::SetupFormGfxCell( *iGrid, iGrid->ItemDrawer(), 0, |
211 AknLayoutScalable_Apps::cell_tport_appsw_pane_g1( variety ).LayoutLine(), |
210 AknLayoutScalable_Apps::cell_tport_appsw_pane_g1( variety ).LayoutLine(), |
212 empty, empty ); |
211 empty, empty ); |
213 |
212 |
214 // Setup text layout |
213 // Setup text layout |
215 TRgb textColor; |
|
216 AknsUtils::GetCachedColor( AknsUtils::SkinInstance(), textColor, |
|
217 KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG9 ); |
|
218 |
|
219 TAknLayoutText textLayout; |
214 TAknLayoutText textLayout; |
220 textLayout.LayoutText( |
215 textLayout.LayoutText( |
221 Rect(), |
216 Rect(), |
222 AknLayoutScalable_Apps::cell_tport_appsw_pane_t1( variety ).LayoutLine() ); |
217 AknLayoutScalable_Apps::cell_tport_appsw_pane_t1( variety ).LayoutLine() ); |
223 |
218 |
224 // Because textLayout.BaselineOffset() does not work (missing lib entry), |
219 // Because textLayout.BaselineOffset() does not work (missing lib entry), |
225 // we need to calculate offset ourselves |
220 // we need to calculate offset ourselves |
226 TInt baselineOffset = textLayout.TextRect().iBr.iY - textLayout.TextRect().iTl.iY; |
221 TInt baselineOffset = textLayout.TextRect().iBr.iY - textLayout.TextRect().iTl.iY; |
227 AknListBoxLayouts::SetupFormTextCell( *iGrid, iGrid->ItemDrawer(), 1 /*Column index*/, |
222 AknListBoxLayouts::SetupFormTextCell( *iGrid, iGrid->ItemDrawer(), 1 /*Column index*/, |
228 textLayout.Font() /*Font type*/, |
223 textLayout.Font() /*Font type*/, |
229 textColor.Color16() /*color*/, |
224 NULL /*color*/, |
230 textLayout.TextRect().iTl.iX /*Left margin*/, 0 /*unused*/, |
225 textLayout.TextRect().iTl.iX /*Left margin*/, 0 /*unused*/, |
231 baselineOffset /*Baseline*/, 0 /*Text width*/, |
226 baselineOffset /*Baseline*/, 0 /*Text width*/, |
232 textLayout.Align() /*Text alignment*/, |
227 textLayout.Align() /*Text alignment*/, |
233 TPoint(0,0) /*Start pos*/, |
228 TPoint(0,0) /*Start pos*/, |
234 TPoint(0,0) /*End pos*/); |
229 TPoint(0,0) /*End pos*/); |
|
230 // Text colors |
|
231 TRgb textColor; |
|
232 AknsUtils::GetCachedColor( AknsUtils::SkinInstance(), textColor, |
|
233 KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG6 ); |
|
234 TRgb highlightTextColor; |
|
235 AknsUtils::GetCachedColor( AknsUtils::SkinInstance(), highlightTextColor, |
|
236 KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG11 ); |
|
237 CFormattedCellListBoxData::TColors colors; |
|
238 colors.iText = textColor; |
|
239 colors.iBack = iGrid->ItemDrawer()->BackColor(); |
|
240 colors.iHighlightedText = highlightTextColor; |
|
241 colors.iHighlightedBack = iGrid->ItemDrawer()->HighlightedBackColor(); |
|
242 iGrid->ItemDrawer()->FormattedCellData()->SetSubCellColorsL(1, colors); |
235 |
243 |
236 // Setup grid observers |
244 // Setup grid observers |
237 if ( obs ) |
245 if ( obs ) |
238 { |
246 { |
239 iGrid->SetObserver( obs ); |
247 iGrid->SetObserver( obs ); |
425 |
433 |
426 TSLOG_OUT(); |
434 TSLOG_OUT(); |
427 } |
435 } |
428 |
436 |
429 // -------------------------------------------------------------------------- |
437 // -------------------------------------------------------------------------- |
430 // CTsFastSwapArea::TryCloseAppWithQueryL |
|
431 // -------------------------------------------------------------------------- |
|
432 // |
|
433 void CTsFastSwapArea::TryCloseAppWithQueryL( TInt aIndex ) |
|
434 { |
|
435 if ( aIndex >= 0 && aIndex < iArray.Count() |
|
436 && CanClose( aIndex ) |
|
437 && ConfirmCloseL( aIndex ) ) |
|
438 { |
|
439 TryCloseAppL( aIndex ); |
|
440 } |
|
441 } |
|
442 |
|
443 // -------------------------------------------------------------------------- |
|
444 // CTsFastSwapArea::TryCloseAllL |
438 // CTsFastSwapArea::TryCloseAllL |
445 // -------------------------------------------------------------------------- |
439 // -------------------------------------------------------------------------- |
446 // |
440 // |
447 void CTsFastSwapArea::TryCloseAllL() |
441 void CTsFastSwapArea::TryCloseAllL() |
448 { |
442 { |
730 // |
724 // |
731 void CTsFastSwapArea::HandleSwitchToBackgroundEvent() |
725 void CTsFastSwapArea::HandleSwitchToBackgroundEvent() |
732 { |
726 { |
733 // stop listening for changes in fsw content |
727 // stop listening for changes in fsw content |
734 iFSClient->CancelSubscribe(); |
728 iFSClient->CancelSubscribe(); |
735 // get rid of the close confirmation query if shown |
|
736 delete iConfirmCloseQuery; // this will cause ExecuteLD to return with 0 |
|
737 iConfirmCloseQuery = 0; |
|
738 } |
729 } |
739 |
730 |
740 // ----------------------------------------------------------------------------- |
731 // ----------------------------------------------------------------------------- |
741 // CTsFastSwapArea::HandleSwitchToForegroundEvent |
732 // CTsFastSwapArea::HandleSwitchToForegroundEvent |
742 // ----------------------------------------------------------------------------- |
733 // ----------------------------------------------------------------------------- |
810 if ( aType == EEventKey && aKeyEvent.iCode == EKeyBackspace ) |
801 if ( aType == EEventKey && aKeyEvent.iCode == EKeyBackspace ) |
811 { |
802 { |
812 TInt idx = SelectedIndex(); |
803 TInt idx = SelectedIndex(); |
813 if ( idx >= 0 ) |
804 if ( idx >= 0 ) |
814 { |
805 { |
815 TryCloseAppWithQueryL( idx ); |
806 TryCloseAppL( idx ); |
816 } |
807 } |
817 return EKeyWasConsumed; |
808 return EKeyWasConsumed; |
818 } |
809 } |
819 |
810 |
820 //do not forward the event until item is higlighted |
811 //do not forward the event until item is higlighted |
821 if( aKeyEvent.iScanCode == EStdKeyLeftArrow || |
812 TKeyResponse response = ShowHighlightOnKeyEvent(aKeyEvent, aType); |
822 aKeyEvent.iScanCode == EStdKeyRightArrow ) |
813 if( response == EKeyWasConsumed ) |
823 { |
814 { |
824 if ( !iGrid->IsHighlightVisible() ) |
815 return EKeyWasConsumed; |
825 { |
816 } |
826 if ( aType == EEventKey ) |
|
827 { |
|
828 ShowHighlight(); |
|
829 iConsumeEvent = ETrue; |
|
830 } |
|
831 return EKeyWasConsumed; |
|
832 } |
|
833 else if(iConsumeEvent) |
|
834 { |
|
835 if (aType == EEventKeyUp) |
|
836 { |
|
837 return EKeyWasConsumed; |
|
838 } |
|
839 iConsumeEvent = EFalse; |
|
840 } |
|
841 } |
|
842 |
817 |
843 // pass the event to grid |
818 // pass the event to grid |
844 // do not pass down and up arrow key events |
819 // do not pass down and up arrow key events |
845 if ( aKeyEvent.iScanCode != EStdKeyUpArrow && |
820 if ( aKeyEvent.iScanCode != EStdKeyUpArrow && |
846 aKeyEvent.iScanCode != EStdKeyDownArrow ) |
821 aKeyEvent.iScanCode != EStdKeyDownArrow ) |
873 |
848 |
874 return EKeyWasNotConsumed; |
849 return EKeyWasNotConsumed; |
875 } |
850 } |
876 |
851 |
877 // ----------------------------------------------------------------------------- |
852 // ----------------------------------------------------------------------------- |
|
853 // CTsFastSwapArea::CatchKeyEvent |
|
854 // ----------------------------------------------------------------------------- |
|
855 // |
|
856 TKeyResponse CTsFastSwapArea::ShowHighlightOnKeyEvent( |
|
857 const TKeyEvent& aKeyEvent, TEventCode aType) |
|
858 { |
|
859 TKeyResponse retVal(EKeyWasNotConsumed); |
|
860 |
|
861 if (aKeyEvent.iScanCode == EStdKeyLeftArrow || |
|
862 aKeyEvent.iScanCode == EStdKeyRightArrow) |
|
863 { |
|
864 if (!iGrid->IsHighlightVisible()) |
|
865 { |
|
866 if (aType == EEventKey) |
|
867 { |
|
868 ShowHighlight(); |
|
869 iConsumeEvent = ETrue; |
|
870 } |
|
871 retVal = EKeyWasConsumed; |
|
872 } |
|
873 else if (iConsumeEvent) |
|
874 { |
|
875 if (aType == EEventKeyUp) |
|
876 { |
|
877 retVal = EKeyWasConsumed; |
|
878 } |
|
879 else |
|
880 { |
|
881 iConsumeEvent = EFalse; |
|
882 } |
|
883 } |
|
884 } |
|
885 return retVal; |
|
886 } |
|
887 |
|
888 |
|
889 // ----------------------------------------------------------------------------- |
878 // CTsFastSwapArea::HandlePointerEventL |
890 // CTsFastSwapArea::HandlePointerEventL |
879 // ----------------------------------------------------------------------------- |
891 // ----------------------------------------------------------------------------- |
880 // |
892 // |
881 void CTsFastSwapArea::HandlePointerEventL( const TPointerEvent& aPointerEvent ) |
893 void CTsFastSwapArea::HandlePointerEventL( const TPointerEvent& aPointerEvent ) |
882 { |
894 { |
884 iGrid->SetTactileFeedbackSupport(ETrue); |
896 iGrid->SetTactileFeedbackSupport(ETrue); |
885 if(aPointerEvent.iType == TPointerEvent::EButton1Down) |
897 if(aPointerEvent.iType == TPointerEvent::EButton1Down) |
886 { |
898 { |
887 iTapEvent = aPointerEvent; |
899 iTapEvent = aPointerEvent; |
888 } |
900 } |
889 } |
|
890 |
|
891 // ----------------------------------------------------------------------------- |
|
892 // CTsFastSwapArea::ConfirmCloseL |
|
893 // ----------------------------------------------------------------------------- |
|
894 // |
|
895 TBool CTsFastSwapArea::ConfirmCloseL( TInt aIndex ) |
|
896 { |
|
897 HBufC* msg = StringLoader::LoadLC( R_TS_FSW_CONFIRM_CLOSE, |
|
898 iArray[aIndex]->AppName() ); |
|
899 iConfirmCloseQuery = CAknQueryDialog::NewL( |
|
900 CAknQueryDialog::EConfirmationTone ); |
|
901 iConfirmCloseQuery->SetPromptL( *msg ); |
|
902 CleanupStack::PopAndDestroy( msg ); |
|
903 TBool ok = iConfirmCloseQuery->ExecuteLD( |
|
904 R_TS_FSW_CONFIRM_CLOSE_QUERY ); |
|
905 iConfirmCloseQuery = 0; |
|
906 return ok; |
|
907 } |
901 } |
908 |
902 |
909 // ----------------------------------------------------------------------------- |
903 // ----------------------------------------------------------------------------- |
910 // CTsFastSwapArea::SelectedIndex |
904 // CTsFastSwapArea::SelectedIndex |
911 // ----------------------------------------------------------------------------- |
905 // ----------------------------------------------------------------------------- |