# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1272374772 -10800 # Node ID 79311d8563545b4874a65bf009386cf1d2633ca3 # Parent d05a55b217df4d10ce457023cc8f38e61a3d715e Revision: 201015 Kit: 201017 diff -r d05a55b217df -r 79311d856354 idlehomescreen/data/qhd_tch/root_2001f482/conf/root2001f482.confml Binary file idlehomescreen/data/qhd_tch/root_2001f482/conf/root2001f482.confml has changed diff -r d05a55b217df -r 79311d856354 idlehomescreen/data/qhd_tch/root_2001f482/conf/root2001f482.gcfml --- a/idlehomescreen/data/qhd_tch/root_2001f482/conf/root2001f482.gcfml Wed Apr 14 15:47:59 2010 +0300 +++ b/idlehomescreen/data/qhd_tch/root_2001f482/conf/root2001f482.gcfml Tue Apr 27 16:26:12 2010 +0300 @@ -1,4 +1,5 @@ + @@ -15,36 +16,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -54,3 +25,4 @@ + \ No newline at end of file diff -r d05a55b217df -r 79311d856354 idlehomescreen/data/qhd_tch/view_2001f48b/conf/view2001f48b.confml Binary file idlehomescreen/data/qhd_tch/view_2001f48b/conf/view2001f48b.confml has changed diff -r d05a55b217df -r 79311d856354 idlehomescreen/data/qhd_tch/view_2001f48b/conf/view2001f48b.gcfml --- a/idlehomescreen/data/qhd_tch/view_2001f48b/conf/view2001f48b.gcfml Wed Apr 14 15:47:59 2010 +0300 +++ b/idlehomescreen/data/qhd_tch/view_2001f48b/conf/view2001f48b.gcfml Tue Apr 27 16:26:12 2010 +0300 @@ -1,15 +1,13 @@ + - - - @@ -20,6 +18,8 @@ + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + @@ -82,6 +67,14 @@ + + + + + + + + @@ -96,6 +89,14 @@ + + + + + + + + @@ -110,6 +111,14 @@ + + + + + + + + @@ -124,6 +133,14 @@ + + + + + + + + @@ -137,3 +154,4 @@ + \ No newline at end of file diff -r d05a55b217df -r 79311d856354 idlehomescreen/data/qhd_tch/view_2001f48b/conf/view2001f48bmanifest.confml Binary file idlehomescreen/data/qhd_tch/view_2001f48b/conf/view2001f48bmanifest.confml has changed diff -r d05a55b217df -r 79311d856354 idlehomescreen/data/qhd_tch/view_2001f48b/conf/view2001f48bmanifest.gcfml --- a/idlehomescreen/data/qhd_tch/view_2001f48b/conf/view2001f48bmanifest.gcfml Wed Apr 14 15:47:59 2010 +0300 +++ b/idlehomescreen/data/qhd_tch/view_2001f48b/conf/view2001f48bmanifest.gcfml Tue Apr 27 16:26:12 2010 +0300 @@ -1,4 +1,5 @@ + @@ -56,3 +57,4 @@ + \ No newline at end of file diff -r d05a55b217df -r 79311d856354 idlehomescreen/data/qhd_tch/view_2001f48b/conf/view2001f48bxuikon.gcfml --- a/idlehomescreen/data/qhd_tch/view_2001f48b/conf/view2001f48bxuikon.gcfml Wed Apr 14 15:47:59 2010 +0300 +++ b/idlehomescreen/data/qhd_tch/view_2001f48b/conf/view2001f48bxuikon.gcfml Tue Apr 27 16:26:12 2010 +0300 @@ -1,4 +1,5 @@ + + \ No newline at end of file diff -r d05a55b217df -r 79311d856354 idlehomescreen/data/qhd_tch/view_200286e4/conf/view200286e4.confml Binary file idlehomescreen/data/qhd_tch/view_200286e4/conf/view200286e4.confml has changed diff -r d05a55b217df -r 79311d856354 idlehomescreen/data/qhd_tch/view_200286e4/conf/view200286e4.gcfml --- a/idlehomescreen/data/qhd_tch/view_200286e4/conf/view200286e4.gcfml Wed Apr 14 15:47:59 2010 +0300 +++ b/idlehomescreen/data/qhd_tch/view_200286e4/conf/view200286e4.gcfml Tue Apr 27 16:26:12 2010 +0300 @@ -1,15 +1,13 @@ + - - - + - @@ -20,6 +18,8 @@ + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + @@ -82,6 +67,14 @@ + + + + + + + + @@ -96,6 +89,14 @@ + + + + + + + + @@ -110,6 +111,14 @@ + + + + + + + + @@ -124,6 +133,14 @@ + + + + + + + + @@ -137,3 +154,4 @@ + \ No newline at end of file diff -r d05a55b217df -r 79311d856354 idlehomescreen/data/qhd_tch/view_200286e4/conf/view200286e4manifest.confml Binary file idlehomescreen/data/qhd_tch/view_200286e4/conf/view200286e4manifest.confml has changed diff -r d05a55b217df -r 79311d856354 idlehomescreen/data/qhd_tch/view_200286e4/conf/view200286e4manifest.gcfml --- a/idlehomescreen/data/qhd_tch/view_200286e4/conf/view200286e4manifest.gcfml Wed Apr 14 15:47:59 2010 +0300 +++ b/idlehomescreen/data/qhd_tch/view_200286e4/conf/view200286e4manifest.gcfml Tue Apr 27 16:26:12 2010 +0300 @@ -1,4 +1,5 @@ + @@ -56,3 +57,4 @@ + \ No newline at end of file diff -r d05a55b217df -r 79311d856354 idlehomescreen/data/qhd_tch/view_200286e4/conf/view200286e4xuikon.gcfml --- a/idlehomescreen/data/qhd_tch/view_200286e4/conf/view200286e4xuikon.gcfml Wed Apr 14 15:47:59 2010 +0300 +++ b/idlehomescreen/data/qhd_tch/view_200286e4/conf/view200286e4xuikon.gcfml Tue Apr 27 16:26:12 2010 +0300 @@ -1,4 +1,5 @@ + + \ No newline at end of file diff -r d05a55b217df -r 79311d856354 idlehomescreen/data/qhd_tch/view_200286e5/conf/view200286e5.confml Binary file idlehomescreen/data/qhd_tch/view_200286e5/conf/view200286e5.confml has changed diff -r d05a55b217df -r 79311d856354 idlehomescreen/data/qhd_tch/view_200286e5/conf/view200286e5.gcfml --- a/idlehomescreen/data/qhd_tch/view_200286e5/conf/view200286e5.gcfml Wed Apr 14 15:47:59 2010 +0300 +++ b/idlehomescreen/data/qhd_tch/view_200286e5/conf/view200286e5.gcfml Tue Apr 27 16:26:12 2010 +0300 @@ -1,15 +1,13 @@ + - - - @@ -20,6 +18,8 @@ + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + @@ -82,6 +67,14 @@ + + + + + + + + @@ -96,6 +89,14 @@ + + + + + + + + @@ -110,6 +111,14 @@ + + + + + + + + @@ -124,6 +133,14 @@ + + + + + + + + @@ -137,3 +154,4 @@ + \ No newline at end of file diff -r d05a55b217df -r 79311d856354 idlehomescreen/data/qhd_tch/view_200286e5/conf/view200286e5manifest.confml Binary file idlehomescreen/data/qhd_tch/view_200286e5/conf/view200286e5manifest.confml has changed diff -r d05a55b217df -r 79311d856354 idlehomescreen/data/qhd_tch/view_200286e5/conf/view200286e5manifest.gcfml --- a/idlehomescreen/data/qhd_tch/view_200286e5/conf/view200286e5manifest.gcfml Wed Apr 14 15:47:59 2010 +0300 +++ b/idlehomescreen/data/qhd_tch/view_200286e5/conf/view200286e5manifest.gcfml Tue Apr 27 16:26:12 2010 +0300 @@ -1,4 +1,5 @@ + @@ -56,3 +57,4 @@ + \ No newline at end of file diff -r d05a55b217df -r 79311d856354 idlehomescreen/data/qhd_tch/view_200286e5/conf/view200286e5xuikon.gcfml --- a/idlehomescreen/data/qhd_tch/view_200286e5/conf/view200286e5xuikon.gcfml Wed Apr 14 15:47:59 2010 +0300 +++ b/idlehomescreen/data/qhd_tch/view_200286e5/conf/view200286e5xuikon.gcfml Tue Apr 27 16:26:12 2010 +0300 @@ -1,4 +1,5 @@ + + \ No newline at end of file diff -r d05a55b217df -r 79311d856354 idlehomescreen/inc/xnviewmanager.h --- a/idlehomescreen/inc/xnviewmanager.h Wed Apr 14 15:47:59 2010 +0300 +++ b/idlehomescreen/inc/xnviewmanager.h Tue Apr 27 16:26:12 2010 +0300 @@ -202,7 +202,9 @@ CXnOomSysHandler& OomSysHandler() const; void UpdatePageManagementInformationL(); - + + void OrientationChanged(); + private: // new functions @@ -344,6 +346,11 @@ * Own. */ CPeriodic* iStabilityTimer; + + /** + * Flag for current orientation. + */ + TBool iIsLandscapeOrientation; private: // Friend classes diff -r d05a55b217df -r 79311d856354 idlehomescreen/loc/activeidle3.loc --- a/idlehomescreen/loc/activeidle3.loc Wed Apr 14 15:47:59 2010 +0300 +++ b/idlehomescreen/loc/activeidle3.loc Tue Apr 27 16:26:12 2010 +0300 @@ -298,6 +298,13 @@ // #define qtn_hs_corrupted_image_note "Unable to select. Image corrupted or format not supported." +// d: Shown when user select too large image file as a wallpaper +// l: popup_note_window +// w: +// r: TB9.2 +// +#define qtn_hs_too_big_image_note "Unable to select. Image size is too large." + // d: Show when default configuration is loaded (critical error case) // l: list_single_pane_t1_cp2 // w: diff -r d05a55b217df -r 79311d856354 idlehomescreen/nativeuicontroller/inc/ainativerenderer.h --- a/idlehomescreen/nativeuicontroller/inc/ainativerenderer.h Wed Apr 14 15:47:59 2010 +0300 +++ b/idlehomescreen/nativeuicontroller/inc/ainativerenderer.h Tue Apr 27 16:26:12 2010 +0300 @@ -23,8 +23,8 @@ #include // User includes -#include "aidevicestatuscontentmodel.h" -#include "aiprofileplugincontentmodel.h" +#include +#include // Forward declarations class CHsContentPublisher; diff -r d05a55b217df -r 79311d856354 idlehomescreen/nativeuicontroller/src/ainativeuimodel.cpp --- a/idlehomescreen/nativeuicontroller/src/ainativeuimodel.cpp Wed Apr 14 15:47:59 2010 +0300 +++ b/idlehomescreen/nativeuicontroller/src/ainativeuimodel.cpp Tue Apr 27 16:26:12 2010 +0300 @@ -17,7 +17,7 @@ #include "ainativeuimodel.h" -#include "aidevicestatuscontentmodel.h" +#include namespace AiNativeUiController { diff -r d05a55b217df -r 79311d856354 idlehomescreen/nativeuicontroller/src/aistatuspanetouchui.cpp --- a/idlehomescreen/nativeuicontroller/src/aistatuspanetouchui.cpp Wed Apr 14 15:47:59 2010 +0300 +++ b/idlehomescreen/nativeuicontroller/src/aistatuspanetouchui.cpp Tue Apr 27 16:26:12 2010 +0300 @@ -27,18 +27,18 @@ #ifdef RD_TACTILE_FEEDBACK #include #endif +#include +#include +#include +#include // User includes -#include -#include #include "aistrcnv.h" #include "aistatuspanetouchui.h" #include "aistatuspanel.h" #include "ainativeuiplugins.h" #include "aifweventhandler.h" #include "aiconsts.h" -#include "aidevicestatuscontentmodel.h" -#include using namespace AiNativeUiController; diff -r d05a55b217df -r 79311d856354 idlehomescreen/nativeuicontroller/src/nativeuicontroller.cpp --- a/idlehomescreen/nativeuicontroller/src/nativeuicontroller.cpp Wed Apr 14 15:47:59 2010 +0300 +++ b/idlehomescreen/nativeuicontroller/src/nativeuicontroller.cpp Tue Apr 27 16:26:12 2010 +0300 @@ -26,7 +26,8 @@ #include #include #include -#include +#include +#include // User includes #include @@ -38,7 +39,6 @@ #include "appui.h" #include "aiutility.h" #include "aistrparser.h" -#include "aidevicestatuscontentmodel.h" #include "aistatuspanel.h" #include "ainativerenderer.h" #include "aititlepanerenderer.h" diff -r d05a55b217df -r 79311d856354 idlehomescreen/widgetmanager/inc/wmconfiguration.h --- a/idlehomescreen/widgetmanager/inc/wmconfiguration.h Wed Apr 14 15:47:59 2010 +0300 +++ b/idlehomescreen/widgetmanager/inc/wmconfiguration.h Tue Apr 27 16:26:12 2010 +0300 @@ -144,7 +144,7 @@ TUid FetchWidgetUidFromRegistryL( const TDesC& aBundleId ); /** sets operator icon to button if not already defined */ - void SetOperatorIcon( TUid aUid ); + void SetOperatorIconL( TUid aUid ); private: diff -r d05a55b217df -r 79311d856354 idlehomescreen/widgetmanager/inc/wmdetailsdlg.h --- a/idlehomescreen/widgetmanager/inc/wmdetailsdlg.h Wed Apr 14 15:47:59 2010 +0300 +++ b/idlehomescreen/widgetmanager/inc/wmdetailsdlg.h Tue Apr 27 16:26:12 2010 +0300 @@ -27,6 +27,7 @@ class CAknMarqueeControl; class CEikRichTextEditor; class CAknsBasicBackgroundControlContext; +class CWmImageConverter; // CLASS DECLARATIONS /** @@ -42,9 +43,10 @@ static CWmDetailsDlg* NewL( const TDesC& aName, const TDesC& aDescription, - TBool aCanBeAdded, - const CFbsBitmap* aLogoBmp, - const CFbsBitmap* aLogoMask ); + TBool aCanBeAdded, + const TDesC& aIconStr, + const CFbsBitmap& aDefaultIcon, + const CFbsBitmap& aDefaultIconMask ); /** Destructor. */ ~CWmDetailsDlg(); @@ -108,8 +110,9 @@ void ConstructL( const TDesC& aName, const TDesC& aDescription, - const CFbsBitmap* aLogoBmp, - const CFbsBitmap* aLogoMask ); + const TDesC& aIconStr, + const CFbsBitmap& aDefaultIcon, + const CFbsBitmap& aDefaultIconMask ); private: @@ -157,6 +160,11 @@ * ETrue if widget name needs to be scrolled. */ TBool iNeedToScroll; + + /** + * the image converter utility + */ + CWmImageConverter* iImageConverter; }; #endif ___WMDETAILSDLG_H__ diff -r d05a55b217df -r 79311d856354 idlehomescreen/widgetmanager/inc/wmimageconverter.h --- a/idlehomescreen/widgetmanager/inc/wmimageconverter.h Wed Apr 14 15:47:59 2010 +0300 +++ b/idlehomescreen/widgetmanager/inc/wmimageconverter.h Tue Apr 27 16:26:12 2010 +0300 @@ -27,47 +27,23 @@ // Forward declarations class CFbsBitmap; -class CBitmapScaler; -class CImageDecoder; class TAknsItemID; class CWmUnitTest; class MSvgError; // Class declaration /** - * MConverterObserver - * To notify when image is converted - */ -NONSHARABLE_CLASS( MConverterObserver ) - { - public: - virtual void NotifyCompletion( TInt aError ) = 0; - }; - -// Class declaration -/** * CWmImageConverter * Image converter */ -NONSHARABLE_CLASS ( CWmImageConverter ) : public CActive, - public MAknIconFileProvider +NONSHARABLE_CLASS ( CWmImageConverter ) : public MAknIconFileProvider { - /** states for this converter */ - enum TState - { - EIdle = 0, - EDecoding, - EScalingBitmap, - EScalingMask, - EFailed - }; - public: //contructors/destructors /** * Two-phased constructor. * @param aObserver observer */ - static CWmImageConverter* NewL( MConverterObserver* aObserver ); + static CWmImageConverter* NewL(); /** Destructor */ ~CWmImageConverter(); @@ -77,9 +53,10 @@ /** * Parses icon string and prepares logo image. * - * @param aWidth wanted widht - * @param aHeight wanted height + * @param aIconSize wanted size * @param aIconStr str containing logo icon + * @param aBitmap bitmap to create. Empty if fails + * @param aMask mask to create. Empty if fails * Supported values: * - skin( ):mif( ) * - mif( ) @@ -88,91 +65,35 @@ * * @return Error code */ - TInt HandleIconString( TInt aWidth, TInt aHeight, const TDesC& aIconStr ); - - /** - * Returns converted bitmap. Caller takes ownership - * - * @return CFbsBitmap - */ - CFbsBitmap* Bitmap(); + TInt HandleIconString( + const TSize& aIconSize, + const TDesC& aIconStr, + CFbsBitmap*& aBitmap, + CFbsBitmap*& aMask ); - /** - * Returns converted mask. Caller takes ownership + /** + * Parses icon string and resizes given bitmaps if needed. + * Errors are ignored and previos size image will be used. * - * @return CFbsBitmap - */ - CFbsBitmap* Mask(); - - /** - * sets the size for decoding - * @param aSize the logo size - */ - void SetLogoSize( const TSize& aSize ); - - /** supported image conversion methods */ - enum TConversionMethod - { - EUnrecognized, // we could not recognise the icon string - EUidIcon, // App.UID-coded icon - ESvgIcon, // Icon from SVG-file - ESkinIcon, // Icon from SKIN id - EMifIcon, // Icon from MIF file, known graphic index - ESkinAndMifIcon, // Icon from SKIN and MIF combination - EImageIcon, // Icon from image file (jpeg or png) - }; - - /** - * The type of currently converted image. - * This method can be used to check if correct conversion was used. - * @return conversion method used for current image - */ - TConversionMethod ConversionMethod(); - - /** - * Image convertion status - * - * @return ETrue if processing image, false otherwise. - */ - TBool IsProcessing(); - -protected: // implementation of CActive - /** - * Implements cancellation of an outstanding request. - * - * @see CActive::DoCancel - */ - void DoCancel(); + * @param aIconSize wanted size + * @param aIconStr icon string to find out what to resize + * @param aBitmap bitmap to resize + * @param aMask mask to resize + */ + void UpdateImageSize( + const TSize& aSize, + const TDesC& aIconStr, + CFbsBitmap& aBitmap, + CFbsBitmap& aMask ); - /** - * Handles an active object's request completion event. - * - * @see CActive::RunL - */ - void RunL(); - - /** - * RunError - * - * @see CActive::RunError - */ - TInt RunError(TInt aError); - private: CWmImageConverter(); - void ConstructL( MConverterObserver* aObserver ); - void CheckSvgErrorL( MSvgError* aError ); - void HandleIconStringL( TInt aWidth, TInt aHeight, - const TDesC& aIconStr ); + void ConstructL(); private: + void CheckSvgErrorL( MSvgError* aError ); + void HandleIconStringL( const TSize& aIconSize, const TDesC& aIconStr ); - TBool DoesScaleBitmapUseFallBack( CFbsBitmap* aSrcBitmap ); - void ScaleBitmapL( const TSize& aSize, - CFbsBitmap* aTrgBitmap, - CFbsBitmap* aSrcBitmap ); - void ScaleBitmap( TInt aWidth, TInt aHeight ); - void ScaleMask( TInt aWidth, TInt aHeight ); void CreateIconFromUidL( const TUid& aUid ); void CreateIconFromSvgL( const TDesC& aFileName ); void CreateIconFromOtherL( const TDesC& aFileName ); @@ -190,6 +111,7 @@ // helpers TInt ParseNextUint( TLex& aLex, TUint& aValue ); + void CopyBitmapL( CFbsBitmap& aTrgBitmap, CFbsBitmap& aSrcBitmap ); private: // from MAknIconFileProvider @@ -201,11 +123,6 @@ private: /** - * Converter observer (not owned) - */ - MConverterObserver* iObserver; - - /** * decoded image */ CFbsBitmap* iBitmap; @@ -214,22 +131,7 @@ * decoded image mask */ CFbsBitmap* iMask; - - /** - * decoder from ICL API - */ - CImageDecoder* iImageDecoder; - - /** - * bitmap scaler - */ - CBitmapScaler* iScaler; - - /** - * internal state - */ - TState iState; - + /** * File name to convert */ @@ -239,22 +141,11 @@ * size to convert */ TSize iSize; - - /** - * is scaling needed - */ - TBool iScaleNeeded; - + /** * File handle */ RFs iFs; - - /** - * Conversion method for current image - */ - TConversionMethod iConversionMethod; - }; #endif // #ifndef WMIMAGECONVERTER_H diff -r d05a55b217df -r 79311d856354 idlehomescreen/widgetmanager/inc/wmlistbox.h --- a/idlehomescreen/widgetmanager/inc/wmlistbox.h Wed Apr 14 15:47:59 2010 +0300 +++ b/idlehomescreen/widgetmanager/inc/wmlistbox.h Tue Apr 27 16:26:12 2010 +0300 @@ -70,22 +70,11 @@ const CFbsBitmap* DefaultLogoMask(); /** - * re-size bitmaps to size provided by layout - */ - void ResizeDefaultBitmaps(); - - /** * sets item height according to layout */ void UpdateItemHeight(); - - /** - * Responds to skin changed event. - */ - void HandleSkinChanged(); public: - /** * from CFormattedCellListBoxItemDrawer: * draws a single list box item @@ -106,9 +95,8 @@ /** 2nd phase constructor */ void ConstructL(); - + private: // data members - /** * the plugin root (not owned) */ @@ -137,7 +125,6 @@ }; - // CLASS DECLARATIONS /** * CWmListBox @@ -269,11 +256,6 @@ void HandleLayoutChanged(); /** - * Responds to skin changed. - */ - void HandleSkinChanged(); - - /** * Returns size of logo * * @return Size of logo rect diff -r d05a55b217df -r 79311d856354 idlehomescreen/widgetmanager/inc/wmportalbutton.h --- a/idlehomescreen/widgetmanager/inc/wmportalbutton.h Wed Apr 14 15:47:59 2010 +0300 +++ b/idlehomescreen/widgetmanager/inc/wmportalbutton.h Tue Apr 27 16:26:12 2010 +0300 @@ -22,7 +22,6 @@ #include // CAknButton #include //MAknServerAppExitObserver -#include "wmimageconverter.h" #include "wmcommon.h" // FORWARD DECLARATIONS @@ -31,6 +30,7 @@ class CWmConfiguration; class CWmProcessMonitor; class CBrowserLauncher; +class CWmImageConverter; /** * Portal button ( ovi, operator ) class for Wm @@ -38,7 +38,6 @@ * @class CWmPortalButton wmportalbutton.h */ NONSHARABLE_CLASS( CWmPortalButton ) : public CAknButton, - public MConverterObserver, public MCoeControlObserver, public MAknServerAppExitObserver { @@ -77,11 +76,6 @@ */ void ExecuteL(); -protected: // from MConverterObserver - - /** image conversin completed */ - void NotifyCompletion( TInt aError ); - protected: // from MCoeControlObserver /** Observes the button's own activity */ diff -r d05a55b217df -r 79311d856354 idlehomescreen/widgetmanager/inc/wmwidgetdata.h --- a/idlehomescreen/widgetmanager/inc/wmwidgetdata.h Wed Apr 14 15:47:59 2010 +0300 +++ b/idlehomescreen/widgetmanager/inc/wmwidgetdata.h Tue Apr 27 16:26:12 2010 +0300 @@ -27,7 +27,6 @@ #include #include -#include "wmimageconverter.h" // FORWARD DECLARATIONS class CDictionaryFileStore; @@ -37,6 +36,7 @@ class CWmPersistentWidgetOrder; class RWidgetRegistryClientSession; class CWmResourceLoader; +class CWmImageConverter; // CLASS DECLARATION /** @@ -46,7 +46,6 @@ */ NONSHARABLE_CLASS( CWmWidgetData ) : public CBase - , public MConverterObserver { public: // types @@ -147,7 +146,7 @@ /** * Init logo re-creation */ - void ReCreateLogo( const TSize& aSize ); + void UpdateLogo( const TSize& aSize, TBool aReCreateLogo ); /** * returns widget description @@ -231,11 +230,6 @@ /** stop uninstallation animation */ void StopUninstallAnimation(); -protected: // from MConverterObserver - - /** image conversin completed */ - void NotifyCompletion( TInt aError ); - private: // new functions /** uninstall animation related*/ @@ -254,16 +248,12 @@ /** Logo icon string handling */ void HandleIconString( const TDesC& aIconStr ); void FireDataChanged(); - static TInt TimeoutTick( TAny* aPtr ); private: // data members /* reference to resource loader */ CWmResourceLoader& iWmResourceLoader; - /* the image converter utility */ - CWmImageConverter* iImageConverter; - /* observes this widget representation (NOT OWNED) */ MWmWidgetDataObserver* iObserver; @@ -302,30 +292,15 @@ /** timer for updating animation */ CPeriodic* iAnimationTimer; - - /** timer for canceling image convertion */ - CPeriodic* iTimeoutTimer; - + /* uninstall animation index */ TInt iAnimationIndex; /** uninstallation switch */ TBool iAsyncUninstalling; - - /** logo changed switch */ - TBool iFireLogoChanged; - - /** - * ActiveSchedulerWait used to wait while logo image - * is being prepaired. - */ - CActiveSchedulerWait* iWait; - - /** - * Holds widget name. Used for restoring widget name - * if error has occurred during uninstallation. - */ - HBufC* iWidgetName; + + /* the image converter utility */ + CWmImageConverter* iImageConverter; }; diff -r d05a55b217df -r 79311d856354 idlehomescreen/widgetmanager/src/wmconfiguration.cpp --- a/idlehomescreen/widgetmanager/src/wmconfiguration.cpp Wed Apr 14 15:47:59 2010 +0300 +++ b/idlehomescreen/widgetmanager/src/wmconfiguration.cpp Tue Apr 27 16:26:12 2010 +0300 @@ -282,19 +282,19 @@ { iOperatorAppType = ES60; iOperatorAppIdUid = StringToUid( appId ); - SetOperatorIcon( iOperatorAppIdUid ); + SetOperatorIconL( iOperatorAppIdUid ); } else if ( !type.Compare( KOpAppTypeCwrt ) ) { iOperatorAppType = ECwrt; iOperatorAppIdUid = FetchWidgetUidFromRegistryL( appId ); - SetOperatorIcon( iOperatorAppIdUid ); + SetOperatorIconL( iOperatorAppIdUid ); } else if ( !type.Compare( KOpAppTypeWrt ) ) { iOperatorAppType = EWrt; iOperatorAppIdUid = FetchWidgetUidFromRegistryL( appId ); - SetOperatorIcon( iOperatorAppIdUid ); + SetOperatorIconL( iOperatorAppIdUid ); } else if ( !type.Compare( KOpAppTypeJava ) ) { @@ -307,7 +307,7 @@ { iOperatorAppType = EQt; iOperatorAppIdUid = StringToUid( appId ); - SetOperatorIcon( iOperatorAppIdUid ); + SetOperatorIconL( iOperatorAppIdUid ); } } CleanupStack::PopAndDestroy( applicationInfo ); @@ -318,15 +318,15 @@ // CWmConfiguration::SetOperatorIcon // --------------------------------------------------------- // -void CWmConfiguration::SetOperatorIcon( TUid aUid ) +void CWmConfiguration::SetOperatorIconL( TUid aUid ) { if ( iOperatorButtonIcon && !iOperatorButtonIcon->Des().Length() ) { delete iOperatorButtonIcon; iOperatorButtonIcon = NULL; - TRAP_IGNORE( iOperatorButtonIcon = HBufC::NewL( - KMaxUidName + KOperatorIcon().Length() ) ); + iOperatorButtonIcon = HBufC::NewL( + KMaxUidName + KOperatorIcon().Length() ); iOperatorButtonIcon->Des().Format( KOperatorIcon(), aUid ); } diff -r d05a55b217df -r 79311d856354 idlehomescreen/widgetmanager/src/wmdetailsdlg.cpp --- a/idlehomescreen/widgetmanager/src/wmdetailsdlg.cpp Wed Apr 14 15:47:59 2010 +0300 +++ b/idlehomescreen/widgetmanager/src/wmdetailsdlg.cpp Tue Apr 27 16:26:12 2010 +0300 @@ -30,8 +30,10 @@ #include #include #include + #include "widgetmanager.hrh" #include "wmdetailsdlg.h" +#include "wmimageconverter.h" // CONSTANTS @@ -47,12 +49,18 @@ const TDesC& aName, const TDesC& aDescription, TBool aCanBeAdded, - const CFbsBitmap* aLogoBmp, - const CFbsBitmap* aLogoMask ) + const TDesC& aIconStr, + const CFbsBitmap& aDefaultIcon, + const CFbsBitmap& aDefaultIconMask ) { CWmDetailsDlg* self = new ( ELeave ) CWmDetailsDlg( aCanBeAdded ); CleanupStack::PushL( self ); - self->ConstructL( aName, aDescription, aLogoBmp, aLogoMask ); + self->ConstructL( + aName, + aDescription, + aIconStr, + aDefaultIcon, + aDefaultIconMask ); CleanupStack::Pop( self ); return self; } @@ -61,7 +69,7 @@ // CWmDetailsDlg::CWmDetailsDlg // --------------------------------------------------------- // -CWmDetailsDlg::CWmDetailsDlg( TBool aCanBeAdded ) +CWmDetailsDlg::CWmDetailsDlg( TBool aCanBeAdded ) : CAknDialog(), iCanBeAdded( aCanBeAdded ), iNeedToScroll( EFalse ) @@ -85,6 +93,7 @@ delete iLogoBmp; delete iLogoMask; delete iBgContext; + delete iImageConverter; } // ----------------------------------------------------------------------------- @@ -110,13 +119,10 @@ void CWmDetailsDlg::ConstructL( const TDesC& aName, const TDesC& aDescription, - const CFbsBitmap* aLogoBmp, - const CFbsBitmap* aLogoMask ) + const TDesC& aIconStr, + const CFbsBitmap& aDefaultIcon, + const CFbsBitmap& aDefaultIconMask ) { - if ( !aLogoBmp ) - { - User::Leave( KErrArgument ); - } CAknDialog::ConstructL( R_AVKON_DIALOG_EMPTY_MENUBAR ); @@ -125,21 +131,61 @@ iName = aName.AllocL(); iDescription = aDescription.AllocL(); - - // create bitmap and duplicate handle - iLogoBmp = new ( ELeave ) CFbsBitmap; - TSize newSize = TSize( aLogoBmp->SizeInPixels().iWidth , - aLogoBmp->SizeInPixels().iHeight ); - User::LeaveIfError( iLogoBmp->Create( newSize, aLogoBmp->DisplayMode() ) ); - User::LeaveIfError( iLogoBmp->Duplicate( aLogoBmp->Handle() ) ); + + iImageConverter = CWmImageConverter::NewL(); - if ( aLogoMask ) + // Main window + TRect mainPane; + AknLayoutUtils::LayoutMetricsRect( + AknLayoutUtils::EApplicationWindow, mainPane ); + + // Dialog + TAknLayoutRect dlgWindowRect; + TAknWindowLineLayout dlgWindow = AknLayoutScalable_Apps + ::popup_wgtman_window().LayoutLine(); + dlgWindowRect.LayoutRect( mainPane, dlgWindow ); + + // Heading + TAknLayoutRect layoutRect; + TAknWindowLineLayout headingPane = AknLayoutScalable_Apps + ::wgtman_heading_pane().LayoutLine(); + layoutRect.LayoutRect( dlgWindowRect.Rect(), headingPane ); + + // Icon + TAknLayoutRect iconRect; + TAknWindowLineLayout icongrapichs = AknLayoutScalable_Apps + ::wgtman_heading_pane_g1().LayoutLine(); + iconRect.LayoutRect( layoutRect.Rect(), icongrapichs ); + + iImageConverter->HandleIconString( + iconRect.Rect().Size(), + aIconStr, + iLogoBmp, + iLogoMask ); + + // if icon creation fails use defaults + if ( !iLogoBmp || !iLogoMask ) { - iLogoMask = new ( ELeave ) CFbsBitmap; - newSize = TSize( aLogoMask->SizeInPixels().iWidth , - aLogoMask->SizeInPixels().iHeight ); - User::LeaveIfError( iLogoMask->Create( newSize, aLogoMask->DisplayMode() ) ); - User::LeaveIfError( iLogoMask->Duplicate( aLogoMask->Handle() ) ); + delete iLogoBmp; iLogoBmp = NULL; + delete iLogoMask; iLogoMask = NULL; + + iLogoBmp = new ( ELeave ) CFbsBitmap; + iLogoMask = new ( ELeave ) CFbsBitmap; + + TSize size = iconRect.Rect().Size(); + User::LeaveIfError( + iLogoBmp->Create( size, aDefaultIcon.DisplayMode() ) ); + User::LeaveIfError( + iLogoMask->Create( size, aDefaultIconMask.DisplayMode() ) ); + + iLogoBmp->Duplicate( aDefaultIcon.Handle() ); + iLogoMask->Duplicate( aDefaultIconMask.Handle() ); + + // Resize default icons only when they are really needed + AknIconUtils::SetSize( + iLogoBmp, size, EAspectRatioPreserved ); + AknIconUtils::SetSize( + iLogoMask, size, EAspectRatioPreserved ); } iEikonEnv->AddWindowShadow( static_cast(this) ); @@ -312,7 +358,10 @@ layoutRect.LayoutRect( rect, contentPane ); AknLayoutUtils::LayoutControl( iRtEditor, layoutRect.Rect(), rtePane ); CEikScrollBarFrame* sbFrame = iRtEditor->ScrollBarFrame(); - if ( sbFrame && sbFrame->VScrollBarVisibility() != CEikScrollBarFrame::EOff ) + if ( sbFrame && + sbFrame->ScrollBarVisibility( + CEikScrollBar::EVertical ) != CEikScrollBarFrame::EOff && + sbFrame->VerticalScrollBar()->IsVisible() ) { CEikScrollBar* scrollBar = sbFrame->VerticalScrollBar(); TAknWindowLineLayout scrollPane = AknLayoutScalable_Apps @@ -415,12 +464,17 @@ ::wgtman_heading_pane().LayoutLine(); layoutRect.LayoutRect( rect, headingPane ); + TAknLayoutRect logoLayout; + logoLayout.LayoutRect( layoutRect.Rect(),AknLayoutScalable_Apps + ::wgtman_heading_pane_g1().LayoutLine() ); + if( iLogoBmp && iLogoMask ) { - TAknLayoutRect logoLayout; - logoLayout.LayoutRect( layoutRect.Rect(),AknLayoutScalable_Apps - ::wgtman_heading_pane_g1().LayoutLine() ); - logoLayout.DrawImage( gc, iLogoBmp, iLogoMask ); + gc.DrawBitmapMasked( logoLayout.Rect(), + iLogoBmp, + TRect(TPoint(0, 0), iLogoBmp->SizeInPixels()), + iLogoMask, + EFalse ); } AknsUtils::GetCachedColor( @@ -523,14 +577,7 @@ void CWmDetailsDlg::FocusChanged( TDrawNow aDrawNow ) { CCoeControl::FocusChanged( aDrawNow ); - if ( IsFocused() ) - { - StartMarquee(); - } - else - { - StopMarquee(); - } + ( IsFocused() ? StartMarquee() : StopMarquee() ); } diff -r d05a55b217df -r 79311d856354 idlehomescreen/widgetmanager/src/wmimageconverter.cpp --- a/idlehomescreen/widgetmanager/src/wmimageconverter.cpp Wed Apr 14 15:47:59 2010 +0300 +++ b/idlehomescreen/widgetmanager/src/wmimageconverter.cpp Tue Apr 27 16:26:12 2010 +0300 @@ -44,12 +44,12 @@ // CWmImageConverter::NewL // --------------------------------------------------------- // -CWmImageConverter* CWmImageConverter::NewL( MConverterObserver* aObserver ) +CWmImageConverter* CWmImageConverter::NewL() { CWmImageConverter* self = new(ELeave) CWmImageConverter(); CleanupStack::PushL( self ); - self->ConstructL( aObserver ); + self->ConstructL(); CleanupStack::Pop(self); return self; } @@ -59,26 +59,19 @@ // --------------------------------------------------------- // CWmImageConverter::CWmImageConverter() - : CActive( EPriorityStandard ) { - iState = EIdle; iBitmap = NULL; iMask = NULL; - iObserver = NULL; - iConversionMethod = EUnrecognized; - CActiveScheduler::Add( this ); } // --------------------------------------------------------- // CWmImageConverter::ConstructL // --------------------------------------------------------- // -void CWmImageConverter::ConstructL( MConverterObserver* aObserver ) +void CWmImageConverter::ConstructL() { User::LeaveIfError( iFs.Connect() ); iFs.ShareProtected(); - iScaler = CBitmapScaler::NewL(); - iObserver = aObserver; } // --------------------------------------------------------- @@ -87,8 +80,6 @@ // CWmImageConverter::~CWmImageConverter() { - Cancel(); - delete iImageDecoder; iFs.Close(); if ( iBitmap ) { @@ -100,7 +91,6 @@ delete iMask; iMask = NULL; } - delete iScaler; } // --------------------------------------------------------- @@ -108,14 +98,26 @@ // --------------------------------------------------------- // TInt CWmImageConverter::HandleIconString( - TInt aWidth, TInt aHeight, - const TDesC& aIconStr ) + const TSize& aIconSize, + const TDesC& aIconStr, + CFbsBitmap*& aBitmap, + CFbsBitmap*& aMask ) { + delete aBitmap; aBitmap = NULL; + delete aMask; aMask = NULL; + TInt err( KErrNone ); - TRAP( err, HandleIconStringL( aWidth, aHeight, aIconStr ); ); - if ( KErrNone != err ) + TRAP( err, HandleIconStringL( aIconSize, aIconStr ); ); + if ( err == KErrNone && iBitmap && iMask ) { - iState = EFailed; + // ownership transferred + aBitmap = iBitmap; + iBitmap = NULL; + aMask = iMask; + iMask = NULL; + } + else + { if ( iBitmap ) { delete iBitmap; @@ -127,6 +129,7 @@ iMask = NULL; } } + return err; } @@ -135,11 +138,9 @@ // --------------------------------------------------------- // void CWmImageConverter::HandleIconStringL( - TInt aWidth, TInt aHeight, + const TSize& aIconSize, const TDesC& aIconStr ) { - iConversionMethod = EUnrecognized; - iState = EDecoding; if ( aIconStr.Length() ) { TAknsItemID skinItemId; @@ -149,36 +150,26 @@ TInt maskId( KErrNotFound ); TUid appUid; iFilename = KNullDesC; - iScaleNeeded = EFalse; - iSize.SetSize( aWidth, aHeight ); + iSize = aIconSize; if ( ResolveSkinIdAndMifId( aIconStr, skinItemId, bitmapId, maskId, iFilename ) ) { - if ( bitmapId >= 0 && skinItemId.iMajor > 0 ) - iConversionMethod = ESkinAndMifIcon; - else if ( bitmapId >= 0 ) - iConversionMethod = EMifIcon; - else - iConversionMethod = ESkinIcon; CreateSkinOrMifIconL( skinItemId, bitmapId, maskId, iFilename ); } else if ( ResolveUid( aIconStr, appUid ) ) { - iConversionMethod = EUidIcon; CreateIconFromUidL( appUid ); } else if ( EndsWith( aIconStr, KSvgExt ) ) { // filename_with_full_path.svg - iConversionMethod = ESvgIcon; CreateIconFromSvgL( aIconStr ); } else if ( BaflUtils::FileExists( iFs, aIconStr ) ) { // filename_with_full_path.png/jpg - iConversionMethod = EImageIcon; CreateIconFromOtherL( aIconStr ); } else @@ -201,7 +192,6 @@ CFbsBitmap* bitmap = NULL; CFbsBitmap* mask = NULL; - if ( aUid.iUid >= KWidgetUidLowerBound && aUid.iUid < KWidgetUidUpperBound ) { @@ -232,34 +222,20 @@ User::LeaveIfError( lsSession.GetAppIcon( aUid, size, *maskedBmp ) ); // handle bitmap - iBitmap = new ( ELeave ) CFbsBitmap; - User::LeaveIfError( iBitmap->Create( - maskedBmp->SizeInPixels(), - maskedBmp->DisplayMode() ) ); - - // scale bitmap - ScaleBitmapL( iSize, iBitmap, maskedBmp ); - + iBitmap = new ( ELeave ) CFbsBitmap; + CopyBitmapL( *iBitmap, *maskedBmp ); + // handle mask if ( maskedBmp->Mask() ) { iMask = new ( ELeave ) CFbsBitmap; - User::LeaveIfError( iMask->Create( - maskedBmp->Mask()->SizeInPixels(), - maskedBmp->Mask()->DisplayMode() ) ); - - // scale mask - ScaleBitmapL( iSize, iMask, maskedBmp->Mask() ); + CopyBitmapL( *iMask, *maskedBmp->Mask() ); } // cleanup CleanupStack::PopAndDestroy( maskedBmp ); CleanupStack::PopAndDestroy( sizeArray ); CleanupStack::PopAndDestroy( &lsSession ); - - // notify - iState = EIdle; - iObserver->NotifyCompletion( KErrNone ); } else if ( aUid.iUid != KNullUid.iUid ) { @@ -286,20 +262,14 @@ iBitmap = bitmap; iMask = mask; - - err = AknIconUtils::SetSize( iBitmap , iSize, EAspectRatioNotPreserved ); + err = AknIconUtils::SetSize( iBitmap , iSize, EAspectRatioPreserved ); if ( KErrNone == err ) { - err = AknIconUtils::SetSize( iMask , iSize, EAspectRatioNotPreserved ); + err = AknIconUtils::SetSize( iMask , iSize, EAspectRatioPreserved ); } - - // notify observer - iState = EIdle; - iObserver->NotifyCompletion( err ); } else { - iState = EIdle; User::Leave( KErrArgument ); } } @@ -363,8 +333,152 @@ iBitmap = bitmap; iMask = mask; - iState = EIdle; - iObserver->NotifyCompletion( KErrNone ); + } + +// --------------------------------------------------------- +// CWmImageConverter::CreateIconFromOtherL +// --------------------------------------------------------- +// +void CWmImageConverter::CreateIconFromOtherL( const TDesC& aFileName ) + { + if (iBitmap) {delete iBitmap; iBitmap = NULL;} + if (iMask) {delete iMask; iMask = NULL;} + + iFilename.Copy( aFileName ); + + // create the decoder + CImageDecoder* imageDecoder = CImageDecoder::FileNewL( + iFs, iFilename, CImageDecoder::EOptionAlwaysThread ); + CleanupStack::PushL( imageDecoder ); + + TSize size = imageDecoder->FrameInfo().iOverallSizeInPixels; + + // create the destination bitmap + iBitmap = new (ELeave) CFbsBitmap(); + User::LeaveIfError( iBitmap->Create( + size, imageDecoder->FrameInfo().iFrameDisplayMode ) ); + + iMask = new (ELeave) CFbsBitmap(); + User::LeaveIfError( iMask->Create( size, EGray256 ) ); + + // start conversion to bitmap + TRequestStatus status; + imageDecoder->Convert( &status, *iBitmap, *iMask ); + User::WaitForRequest( status ); + if( status.Int() == KErrUnderflow ) + { + imageDecoder->ContinueConvert( &status ); + User::WaitForRequest( status ); + } + User::LeaveIfError( status.Int() ); + CleanupStack::PopAndDestroy( imageDecoder ); + } + +// --------------------------------------------------------------------------- +// CWmImageConverter::CreateSkinOrMifIconL +// --------------------------------------------------------------------------- +// +void CWmImageConverter::CreateSkinOrMifIconL( + const TAknsItemID& aItemId, TInt aBitmapId, + TInt aMaskId, const TDesC& aFileName ) + { + iFilename = aFileName; + CFbsBitmap* bitmap = NULL; + CFbsBitmap* mask = NULL; + + // Load from skin + MAknsSkinInstance* skin = AknsUtils::SkinInstance(); + if ( skin && aItemId.iMajor != 0 && aItemId.iMinor != 0 ) + { + TInt err( KErrNone ); + CAknsMaskedBitmapItemData* itemData = NULL; + TRAP( err, itemData = + static_cast( + skin->CreateUncachedItemDataL( aItemId, EAknsITMaskedBitmap ) ); ); + if( itemData && KErrNone == err ) + { + CleanupStack::PushL( itemData ); + // Detach bitmaps + bitmap = itemData->Bitmap(); + itemData->SetBitmap( NULL ); + mask = itemData->Mask(); + itemData->SetMask( NULL ); + CleanupStack::PopAndDestroy( itemData ); + } + else + { + // look in imagetable + CAknsImageTableItemData* iconData = NULL; + TRAP( err, iconData = static_cast( + skin->CreateUncachedItemDataL( aItemId, EAknsITImageTable ) ); ); + if( iconData && KErrNone == err ) + { + CleanupStack::PushL( iconData ); + if( iconData->NumberOfImages() ) + { + TAknsItemID iconIId; + iconIId.Set( iconData->ImageIID(0) ); + TRAP( err, AknsUtils::CreateIconL( + skin, iconIId, bitmap, mask, KNullDesC, -1, -1 ); ); + } + CleanupStack::PopAndDestroy( iconData ); + } + } + + if ( KErrNone == err && bitmap ) + { + TInt err = AknIconUtils::SetSize( + bitmap, + iSize, + EAspectRatioPreserved ); + if ( KErrNone == err ) + { + if ( mask ) + { + err = AknIconUtils::SetSize( + mask, + iSize, + EAspectRatioPreserved ); + } + iBitmap = bitmap; + iMask = mask; + return; + } + else + { + if ( bitmap ) { delete bitmap; bitmap = NULL; } + if ( mask ){ delete mask; mask = NULL; } + } + } + } + + if( aBitmapId != KErrNotFound && !bitmap && + aFileName.Length() && BaflUtils::FileExists( iFs, aFileName ) ) + { + if ( aMaskId != KErrNotFound ) + { + // Create icon from Mif filename , bitmap id and mask id + AknIconUtils::CreateIconL( + bitmap, mask, *this, aBitmapId, aMaskId ); + } + else + { + bitmap = AknIconUtils::CreateIconL( *this, aBitmapId ); + } + } + else + { + User::Leave( KErrArgument ); + } + + iBitmap = bitmap; + iMask = mask; + + TInt err = AknIconUtils::SetSize( iBitmap , iSize, EAspectRatioPreserved ); + if ( KErrNone == err && iMask ) + { + err = AknIconUtils::SetSize( iMask , iSize, EAspectRatioPreserved ); + } } // --------------------------------------------------------- @@ -380,263 +494,6 @@ } // --------------------------------------------------------- -// CWmImageConverter::CreateIconFromOtherL -// --------------------------------------------------------- -// -void CWmImageConverter::CreateIconFromOtherL( const TDesC& aFileName ) - { - if ( IsActive() ) - { - User::Leave( KErrNotReady ); - } - - if ( iImageDecoder ) delete iImageDecoder; iImageDecoder = NULL; - if (iBitmap) {delete iBitmap; iBitmap = NULL;} - if (iMask) {delete iMask; iMask = NULL;} - - iFilename.Copy( aFileName ); - - // create the decoder - iImageDecoder = CImageDecoder::FileNewL( iFs, iFilename ); - - TSize size = iImageDecoder->FrameInfo().iOverallSizeInPixels; - - // create the destination bitmap - iBitmap = new (ELeave) CFbsBitmap(); - iBitmap->Create( size, - iImageDecoder->FrameInfo().iFrameDisplayMode ); - - iMask = new (ELeave) CFbsBitmap(); - iMask->Create( size, EGray256 ); - - if ( size != iSize ) - { - iScaleNeeded = ETrue; - } - - // start conversion to bitmap - iImageDecoder->Convert( &iStatus, *iBitmap, *iMask ); - SetActive(); - } - -// --------------------------------------------------------- -// CWmImageConverter::DoCancel -// --------------------------------------------------------- -// -void CWmImageConverter::DoCancel() - { - if( iState == EDecoding && - iConversionMethod == EImageIcon ) - { - iImageDecoder->Cancel(); - iState = EIdle; - if ( iObserver ) - { - iObserver->NotifyCompletion( KErrCancel ); - } - } - else if( iState == EScalingBitmap || - iState == EScalingMask ) - { - iScaler->Cancel(); - iState = EIdle; - if ( iObserver ) - { - iObserver->NotifyCompletion( KErrCancel ); - } - } - else - { - // State is EIdle, do nothing - } - iScaleNeeded = EFalse; - } - -// --------------------------------------------------------- -// CWmImageConverter::RunL -// --------------------------------------------------------- -// -void CWmImageConverter::RunL() - { - switch( iState ) - { - case EDecoding: - { - if( iStatus.Int() == KErrNone ) - { - if ( iScaleNeeded ) - { - ScaleBitmap( iSize.iWidth, iSize.iHeight ); - } - else - { - iState = EIdle; - if ( iObserver ) - { - iObserver->NotifyCompletion( KErrNone ); - } - } - break; - } - else if( iStatus.Int() == KErrUnderflow ) - { - iImageDecoder->ContinueConvert( &iStatus ); - SetActive(); - break; - } - else if ( iStatus.Int() == KErrCorrupt ) - { - iState = EIdle; - iScaleNeeded = EFalse; - if ( iBitmap ) - { - delete iBitmap; - iBitmap = NULL; - } - if ( iMask ) - { - delete iMask; - iMask = NULL; - } - if ( iObserver ) - { - iObserver->NotifyCompletion( KErrCorrupt ); - } - break; - } - else - { - // Unknown error - iState = EIdle; - iScaleNeeded = EFalse; - if ( iBitmap ) - { - delete iBitmap; - iBitmap = NULL; - } - if ( iMask ) - { - delete iMask; - iMask = NULL; - } - if ( iObserver ) - { - iObserver->NotifyCompletion( iStatus.Int() ); - } - break; - } - } - case EScalingBitmap: - { - if( iStatus.Int() == KErrNone && iMask ) - { - ScaleMask( iSize.iWidth, iSize.iHeight ); - } - else - { - iState = EIdle; - iScaleNeeded = EFalse; - if ( iObserver ) - { - iObserver->NotifyCompletion( iStatus.Int() ); - } - } - break; - } - case EScalingMask: - { - iState = EIdle; - iScaleNeeded = EFalse; - if ( iObserver ) - { - iObserver->NotifyCompletion( iStatus.Int() ); - } - break; - } - default: - break; - } - } - -// --------------------------------------------------------- -// CWmImageConverter::RunError -// --------------------------------------------------------- -// -TInt CWmImageConverter::RunError(TInt /*aError*/) - { - // Our RunL does not contain any method calls that would leave, so this method - // should never be called. - iScaleNeeded = EFalse; - return KErrNone; - } - -// --------------------------------------------------------- -// CWmImageConverter::ScaleBitmap -// --------------------------------------------------------- -// -void CWmImageConverter::ScaleBitmap( TInt aWidth, TInt aHeight ) - { - if ( !IsActive() && - iBitmap && - ( iState == EDecoding || iState == EIdle ) ) - { - iState = EScalingBitmap; - // the maintain aspect ratio is by default set to true - iScaler->Scale( &iStatus, *iBitmap, TSize( aWidth,aHeight ), EFalse ); - SetActive(); - } - } - -// --------------------------------------------------------- -// CWmImageConverter::ScaleMask -// --------------------------------------------------------- -// -void CWmImageConverter::ScaleMask( TInt aWidth, TInt aHeight ) - { - if ( !IsActive() && - iState == EScalingBitmap && - iMask ) - { - iState = EScalingMask; - // the maintain aspect ratio is by default set to true - iScaler->Scale( &iStatus, *iMask, TSize(aWidth,aHeight), EFalse ); - SetActive(); - } - } - -// --------------------------------------------------------- -// CWmImageConverter::Bitmap -// --------------------------------------------------------- -// -CFbsBitmap* CWmImageConverter::Bitmap() - { - CFbsBitmap* bitmap = NULL; - if (iState == EIdle && - iBitmap ) - { - bitmap = iBitmap; // ownership taken - iBitmap = NULL; - } - return bitmap; - } - -// --------------------------------------------------------- -// CWmImageConverter::Mask -// --------------------------------------------------------- -// -CFbsBitmap* CWmImageConverter::Mask() - { - CFbsBitmap* mask = NULL; - if (iState == EIdle && - iMask ) - { - mask = iMask; // ownership taken - iMask = NULL; - } - return mask; - } - -// --------------------------------------------------------- // CWmImageConverter::EndsWith // --------------------------------------------------------- // @@ -774,115 +631,6 @@ } // --------------------------------------------------------------------------- -// CWmImageConverter::CreateSkinOrMifIconL -// --------------------------------------------------------------------------- -// -void CWmImageConverter::CreateSkinOrMifIconL( - const TAknsItemID& aItemId, TInt aBitmapId, - TInt aMaskId, const TDesC& aFileName ) - { - iFilename = aFileName; - CFbsBitmap* bitmap = NULL; - CFbsBitmap* mask = NULL; - - // Load from skin - MAknsSkinInstance* skin = AknsUtils::SkinInstance(); - if ( skin && aItemId.iMajor != 0 && aItemId.iMinor != 0 ) - { - TInt err( KErrNone ); - CAknsMaskedBitmapItemData* itemData = NULL; - TRAP( err, itemData = - static_cast( - skin->CreateUncachedItemDataL( aItemId, EAknsITMaskedBitmap ) ); ); - if( itemData && KErrNone == err ) - { - CleanupStack::PushL( itemData ); - // Detach bitmaps - bitmap = itemData->Bitmap(); - itemData->SetBitmap( NULL ); - mask = itemData->Mask(); - itemData->SetMask( NULL ); - CleanupStack::PopAndDestroy( itemData ); - } - else - { - // look in imagetable - CAknsImageTableItemData* iconData = NULL; - TRAP( err, iconData = static_cast( - skin->CreateUncachedItemDataL( aItemId, EAknsITImageTable ) ); ); - if( iconData && KErrNone == err ) - { - CleanupStack::PushL( iconData ); - if( iconData->NumberOfImages() ) - { - TAknsItemID iconIId; - iconIId.Set( iconData->ImageIID(0) ); - TRAP( err, AknsUtils::CreateIconL( - skin, iconIId, bitmap, mask, KNullDesC, -1, -1 ); ); - } - CleanupStack::PopAndDestroy( iconData ); - } - } - - if ( KErrNone == err && bitmap ) - { - TInt err = AknIconUtils::SetSize( bitmap , iSize, EAspectRatioNotPreserved ); - if ( KErrNone == err ) - { - if ( mask ) - { - err = AknIconUtils::SetSize( mask , iSize, EAspectRatioNotPreserved ); - } - iBitmap = bitmap; - iMask = mask; - iState = EIdle; - // notify observer - iObserver->NotifyCompletion( KErrNone ); - return; - } - else - { - if ( bitmap ) { delete bitmap; bitmap = NULL; } - if ( mask ){ delete mask; mask = NULL; } - } - } - } - - if( aBitmapId != KErrNotFound && !bitmap && - aFileName.Length() && BaflUtils::FileExists( iFs, aFileName ) ) - { - if ( aMaskId != KErrNotFound ) - { - // Create icon from Mif filename , bitmap id and mask id - AknIconUtils::CreateIconL( - bitmap, mask, *this, aBitmapId, aMaskId ); - } - else - { - bitmap = AknIconUtils::CreateIconL( *this, aBitmapId ); - } - } - else - { - iState = EIdle; - User::Leave( KErrArgument ); - } - - iBitmap = bitmap; - iMask = mask; - - TInt err = AknIconUtils::SetSize( iBitmap , iSize, EAspectRatioNotPreserved ); - if ( KErrNone == err && iMask ) - { - err = AknIconUtils::SetSize( iMask , iSize, EAspectRatioNotPreserved ); - } - - iState = EIdle; - // notify observer - iObserver->NotifyCompletion( err ); - } - -// --------------------------------------------------------------------------- // CWmImageConverter::ParseNextUint() // --------------------------------------------------------------------------- // @@ -909,24 +657,6 @@ } // --------------------------------------------------------------------------- -// CWmImageConverter::SetLogoSize() -// --------------------------------------------------------------------------- -// -void CWmImageConverter::SetLogoSize( const TSize& aSize ) - { - iSize = aSize; - } - -// --------------------------------------------------------------------------- -// CWmImageConverter::ConversionMethod() -// --------------------------------------------------------------------------- -// -CWmImageConverter::TConversionMethod CWmImageConverter::ConversionMethod() - { - return iConversionMethod; - } - -// --------------------------------------------------------------------------- // CWmImageConverter::RetrieveIconFileHandleL // --------------------------------------------------------------------------- // @@ -937,293 +667,33 @@ EFileRead | EFileShareReadersOnly ); if ( KErrNone != err ) { - iState = EIdle; User::Leave( err ); } } // --------------------------------------------------------------------------- -// CWmImageConverter::DoesScaleBitmapUseFallBack -// --------------------------------------------------------------------------- -// -TBool CWmImageConverter::DoesScaleBitmapUseFallBack( CFbsBitmap* aSrcBitmap ) - { - if ( !aSrcBitmap ) - { - return EFalse; - } - - TDisplayMode displayMode = aSrcBitmap->DisplayMode(); - TBool fallbackOnly = EFalse; - - switch ( displayMode ) - { - case EGray2: - case EGray4: - case EGray16: - case EColor16: - case EColor16M: - case ERgb: - case EColor16MA: - fallbackOnly = ETrue; - break; - case EGray256: - case EColor4K: - case EColor64K: - case EColor256: - case EColor16MU: - // These are the supported modes - break; - default: - fallbackOnly = ETrue; - } - - return fallbackOnly; - } - - -// --------------------------------------------------------------------------- -// CWmImageConverter::ScaleBitmapL +// CWmImageConverter::CopyBitmapL // --------------------------------------------------------------------------- // -void CWmImageConverter::ScaleBitmapL( - const TSize& aSize, - CFbsBitmap* aTrgBitmap, - CFbsBitmap* aSrcBitmap ) +void CWmImageConverter::CopyBitmapL( + CFbsBitmap& aTrgBitmap, + CFbsBitmap& aSrcBitmap ) { - if ( !aSrcBitmap ) User::Leave( KErrArgument ); - if ( !aTrgBitmap ) User::Leave( KErrArgument ); - if ( aSrcBitmap->DisplayMode() != aTrgBitmap->DisplayMode() ) - { - User::Leave( KErrArgument ); - } - - // make target to correct size - if ( aTrgBitmap->SizeInPixels() != aSize ) - { - aTrgBitmap->Resize( aSize ); - } - - TRect targetRect( aSize ); - - // calculate aspect ratio - TInt srcHeight = aSrcBitmap->SizeInPixels().iHeight; - TInt srcWidth = aSrcBitmap->SizeInPixels().iWidth; - TReal scaleRatio( 1 ); //no scale as defaul - - //If any dimension is 0, then we do not bother to scale - if ( targetRect.Width() > 0 && targetRect.Height() > 0 ) - { - TReal xRatio = ( ( TReal )srcWidth / ( TReal )targetRect.Width() ); - TReal yRatio = ( ( TReal )srcHeight / ( TReal )targetRect.Height() ); - //Find out appropriate scaling factor - xRatio > yRatio ? ( scaleRatio = xRatio ) : ( scaleRatio = yRatio ); - } - - //Scale the size for target bitmap - targetRect.SetHeight( srcHeight / scaleRatio ); - targetRect.SetWidth( srcWidth / scaleRatio ); - - TSize trgBitmapSize = aTrgBitmap->SizeInPixels(); + TSize size( aSrcBitmap.SizeInPixels() ); + TDisplayMode displayMode( aSrcBitmap.DisplayMode() ); + User::LeaveIfError( aTrgBitmap.Create( size, displayMode ) ); - // calculate the valid drawing area - TRect drawRect = targetRect; - drawRect.Intersection( TRect( TPoint( 0, 0 ), trgBitmapSize ) ); - - if( drawRect.IsEmpty() || - aSrcBitmap->SizeInPixels().iHeight <= 0 || - aSrcBitmap->SizeInPixels().iWidth <= 0 ) - { - User::Leave( KErrArgument ); - } - - TSize srcSize = aSrcBitmap->SizeInPixels(); - - TBool srcTemporary = EFalse; - if ( aSrcBitmap->IsRomBitmap() ) - { - srcTemporary = ETrue; - } - - TDisplayMode displayMode = aSrcBitmap->DisplayMode(); - TBool fallbackOnly = DoesScaleBitmapUseFallBack( aSrcBitmap ); - - if ( fallbackOnly ) - { - CFbsBitmapDevice* dev = CFbsBitmapDevice::NewL( aTrgBitmap ); - CleanupStack::PushL( dev ); - CFbsBitGc* gc = NULL; - User::LeaveIfError( dev->CreateContext( gc ) ); - CleanupStack::PushL( gc ); - - // write alpha information if it exists - if ( aSrcBitmap->DisplayMode() == EColor16MA ) - { - gc->SetDrawMode( CGraphicsContext::EDrawModeWriteAlpha ); - } - - // targetRect is used because DrawBitmap handles clipping automatically - gc->DrawBitmap( targetRect, aSrcBitmap ); - CleanupStack::PopAndDestroy( 2 ); // dev, gc - return; - } - - // Heap lock for FBServ large chunk to prevent background - // compression of aSrcBitmap after if IsCompressedInRAM returns EFalse - aSrcBitmap->LockHeapLC( ETrue ); // fbsheaplock - TBool fbsHeapLock = ETrue; - if ( aSrcBitmap->IsCompressedInRAM() ) - { - srcTemporary = ETrue; - } - - CFbsBitmap* realSource = aSrcBitmap; - if ( srcTemporary ) - { - CleanupStack::PopAndDestroy(); // fbsheaplock - fbsHeapLock = EFalse; - - realSource = new ( ELeave ) CFbsBitmap(); - CleanupStack::PushL( realSource ); - User::LeaveIfError( - realSource->Create( srcSize, aSrcBitmap->DisplayMode() ) ); - CFbsBitmapDevice* dev = CFbsBitmapDevice::NewL( realSource ); - CleanupStack::PushL( dev ); - CFbsBitGc* gc = NULL; - User::LeaveIfError( dev->CreateContext( gc ) ); - CleanupStack::PushL( gc ); - gc->BitBlt( TPoint( 0, 0 ), aSrcBitmap ); - CleanupStack::PopAndDestroy( 2 ); // dev, gc - } - - if ( !fbsHeapLock ) - { - // Heap lock for FBServ large chunk is only needed with large bitmaps. - if ( realSource->IsLargeBitmap() || aTrgBitmap->IsLargeBitmap() ) - { - aTrgBitmap->LockHeapLC( ETrue ); // fbsheaplock - } - else - { - CleanupStack::PushL( ( TAny* )NULL ); - } - } - - TUint32* srcAddress = realSource->DataAddress(); - TUint32* trgAddress = aTrgBitmap->DataAddress(); - - const TInt xSkip = ( srcSize.iWidth << 8 ) / targetRect.Width(); - const TInt ySkip = ( srcSize.iHeight << 8 ) / targetRect.Height(); - - const TInt drawWidth = drawRect.Width(); - const TInt drawHeight = drawRect.Height(); - - TRect offsetRect( targetRect.iTl, drawRect.iTl ); - const TInt yPosOffset = ySkip * offsetRect.Height(); - const TInt xPosOffset = xSkip * offsetRect.Width(); - - if ( ( displayMode == EGray256 ) || ( displayMode == EColor256 ) ) - { - TInt srcScanLen8 = CFbsBitmap::ScanLineLength( - srcSize.iWidth, displayMode ); - TInt trgScanLen8 = CFbsBitmap::ScanLineLength( - trgBitmapSize.iWidth, displayMode ); - - TUint8* trgAddress8 = reinterpret_cast< TUint8* >( trgAddress ); - - TInt yPos = yPosOffset; - // skip left and top margins in the beginning - trgAddress8 += trgScanLen8 * drawRect.iTl.iY + drawRect.iTl.iX; - - for ( TInt y = 0; y < drawHeight; y++ ) - { - TUint8* srcAddress8 = reinterpret_cast< TUint8* >( srcAddress ) + - ( srcScanLen8 * ( yPos >> 8 ) ); - - TInt xPos = xPosOffset; - for ( TInt x = 0; x < drawWidth; x++ ) - { - *( trgAddress8++ ) = srcAddress8[xPos >> 8]; - xPos += xSkip; - } - - yPos += ySkip; - - trgAddress8 += trgScanLen8 - drawWidth; - } - } - else if ( displayMode == EColor4K || displayMode == EColor64K ) - { - TInt srcScanLen16 = CFbsBitmap::ScanLineLength( - srcSize.iWidth, displayMode ) /2; - TInt trgScanLen16 = CFbsBitmap::ScanLineLength( - trgBitmapSize.iWidth, displayMode ) /2; - - TUint16* trgAddress16 = reinterpret_cast< TUint16* >( trgAddress ); - - TInt yPos = yPosOffset; - // skip left and top margins in the beginning - trgAddress16 += trgScanLen16 * drawRect.iTl.iY + drawRect.iTl.iX; - - for ( TInt y = 0; y < drawHeight; y++ ) - { - TUint16* srcAddress16 = reinterpret_cast< TUint16* >( srcAddress ) + - ( srcScanLen16 * ( yPos >> 8 ) ); - - TInt xPos = xPosOffset; - for ( TInt x = 0; x < drawWidth; x++ ) - { - *( trgAddress16++ ) = srcAddress16[xPos >> 8]; - xPos += xSkip; - } - - yPos += ySkip; - - trgAddress16 += trgScanLen16 - drawWidth; - } - } - else if ( displayMode == EColor16MU ) - { - TInt srcScanLen32 = CFbsBitmap::ScanLineLength( - srcSize.iWidth, displayMode ) /4; - TInt trgScanLen32 = CFbsBitmap::ScanLineLength( - trgBitmapSize.iWidth, displayMode ) /4; - - TUint32* trgAddress32 = reinterpret_cast< TUint32* >( trgAddress ); - - TInt yPos = yPosOffset; - // skip left and top margins in the beginning - trgAddress32 += trgScanLen32 * drawRect.iTl.iY + drawRect.iTl.iX; - - for ( TInt y = 0; y < drawHeight; y++ ) - { - TUint32* srcAddress32 = reinterpret_cast< TUint32* >( srcAddress ) + - ( srcScanLen32 * ( yPos >> 8 ) ); - - TInt xPos = xPosOffset; - for ( TInt x = 0; x < drawWidth; x++ ) - { - *( trgAddress32++ ) = srcAddress32[xPos >> 8]; - xPos += xSkip; - } - - yPos += ySkip; - - trgAddress32 += trgScanLen32 - drawWidth; - } - } - else - { - User::Leave( KErrUnknown ); - } - - CleanupStack::PopAndDestroy(); // fbsheaplock - - if ( srcTemporary ) - { - CleanupStack::PopAndDestroy(); // realSource - } - } + HBufC8* scanLine = HBufC8::NewL( aSrcBitmap.ScanLineLength( + size.iWidth, displayMode ) ); + TPtr8 scanPtr( scanLine->Des() ); + TPoint pp; + for( pp.iY = 0; pp.iY < size.iHeight; ++pp.iY ) + { + aSrcBitmap.GetScanLine( scanPtr, pp, size.iWidth, displayMode ); + aTrgBitmap.SetScanLine( scanPtr, pp.iY ); + } + delete scanLine; + } // --------------------------------------------------------------------------- // CWmImageConverter::Finished @@ -1235,13 +705,47 @@ } // --------------------------------------------------------------------------- -// CWmImageConverter::IsProcessing +// CWmImageConverter::UpdateImageSize // --------------------------------------------------------------------------- // -TBool CWmImageConverter::IsProcessing() +void CWmImageConverter::UpdateImageSize( + const TSize& aSize, + const TDesC& aIconStr, + CFbsBitmap& aBitmap, + CFbsBitmap& aMask ) { - return ( ( ( iState != EIdle && iState != EFailed ) || - IsActive() ) ? ETrue : EFalse ); + if ( aIconStr.Length() && iSize != aSize ) + { + TAknsItemID skinItemId; + skinItemId.iMajor = 0; + skinItemId.iMinor = 0; + TInt bitmapId( KErrNotFound ); + TInt maskId( KErrNotFound ); + TUid appUid; + iFilename = KNullDesC; + iSize = aSize; + + if ( ResolveSkinIdAndMifId( + aIconStr, skinItemId, bitmapId, maskId, iFilename ) ) + { + AknIconUtils::SetSize( &aBitmap, iSize ); + AknIconUtils::SetSize( &aMask, iSize ); + } + else if ( ResolveUid( aIconStr, appUid ) ) + { + if ( appUid.iUid >= KWidgetUidLowerBound && + appUid.iUid < KWidgetUidUpperBound ) + { + //WRT. No resize needed here + return; + } + else if ( appUid.iUid != KNullUid.iUid ) + { + AknIconUtils::SetSize( &aBitmap, iSize ); + AknIconUtils::SetSize( &aMask, iSize ); + } + } + } } // End of file diff -r d05a55b217df -r 79311d856354 idlehomescreen/widgetmanager/src/wmlistbox.cpp --- a/idlehomescreen/widgetmanager/src/wmlistbox.cpp Wed Apr 14 15:47:59 2010 +0300 +++ b/idlehomescreen/widgetmanager/src/wmlistbox.cpp Tue Apr 27 16:26:12 2010 +0300 @@ -146,28 +146,6 @@ } // --------------------------------------------------------- -// CWmListItemDrawer::ResizeDefaultBitmaps -// --------------------------------------------------------- -// -void CWmListItemDrawer::ResizeDefaultBitmaps() - { - TAknWindowLineLayout logoPane = - AknLayoutScalable_Apps::listrow_wgtman_pane_g1().LayoutLine(); - - TAknLayoutRect layoutRect; - TRect rect = TRect( ItemCellSize() ); - layoutRect.LayoutRect( rect, logoPane ); - - // RESIZE DEFAULT LOGO BITMAPS ACCORDING TO LAYOUT - TSize size = layoutRect.Rect().Size(); - AknIconUtils::SetSize( - iDefaultLogoImage, size, EAspectRatioPreserved ); - AknIconUtils::SetSize( - iDefaultLogoImageMask, size, EAspectRatioPreserved ); - } - - -// --------------------------------------------------------- // CWmListItemDrawer::UpdateItemHeight // --------------------------------------------------------- // @@ -182,7 +160,7 @@ ::listrow_wgtman_pane().LayoutLine(); TAknLayoutRect listRowPaneRect; listRowPaneRect.LayoutRect( listPaneRect.Rect(), listRowPane ); - iListBox->View()->SetItemHeight( listRowPaneRect.Rect().Height() ); + TRAP_IGNORE( iListBox->SetItemHeightL( listRowPaneRect.Rect().Height() ); ); iListBox->View()->ItemDrawer()->SetItemCellSize( listRowPaneRect.Rect().Size() ); } @@ -221,21 +199,38 @@ KAknsIIDQsnFrList, KAknsIIDQsnFrListCenter ); } - // DRAW LOGO CFbsBitmap* bitmap = const_cast(wData.LogoImage()); CFbsBitmap* mask = const_cast(wData.LogoImageMask()); TAknLayoutRect logoLayout; logoLayout.LayoutRect( itemRect, AknLayoutScalable_Apps::listrow_wgtman_pane_g1().LayoutLine() ); - - if ( !bitmap && !wData.IsPrepairingLogo() ) + if ( ( !bitmap || !mask ) && iDefaultLogoImage && iDefaultLogoImageMask ) { - logoLayout.DrawImage( gc, iDefaultLogoImage, iDefaultLogoImageMask ); + // real logo missing use default + TSize size = logoLayout.Rect().Size(); + if ( iDefaultLogoImage->SizeInPixels() != size ) + { + // Resize default icons only when they are really needed + AknIconUtils::SetSize( + iDefaultLogoImage, size, EAspectRatioPreserved ); + AknIconUtils::SetSize( + iDefaultLogoImageMask, size, EAspectRatioPreserved ); + } + + gc.DrawBitmapMasked( logoLayout.Rect(), + iDefaultLogoImage, + TRect(TPoint(0, 0), iDefaultLogoImage->SizeInPixels()), + iDefaultLogoImageMask, + EFalse ); } else if( bitmap && mask ) { - logoLayout.DrawImage( gc, bitmap, mask ); + gc.DrawBitmapMasked( logoLayout.Rect(), + bitmap, + TRect(TPoint(0, 0), bitmap->SizeInPixels()), + mask, + ETrue ); } // DRAW NAME @@ -302,15 +297,6 @@ } // --------------------------------------------------------- -// CWmListItemDrawer::HandleSkinChanged -// --------------------------------------------------------- -// -void CWmListItemDrawer::HandleSkinChanged() - { - ResizeDefaultBitmaps(); - } - -// --------------------------------------------------------- // CWmListBox::NewL // --------------------------------------------------------- // @@ -491,21 +477,7 @@ iLogoSize = LogoSize(); for ( TInt i=0; iReCreateLogo( iLogoSize ); - } - } - -// --------------------------------------------------------- -// CWmListBox::HandleSkinChanged -// --------------------------------------------------------- -// -void CWmListBox::HandleSkinChanged() - { - CWmListItemDrawer* itemDrawer = - static_cast ( iItemDrawer ); - if ( itemDrawer ) - { - itemDrawer->HandleSkinChanged(); + iVisibleWidgetArray[i]->UpdateLogo( iLogoSize, EFalse ); } } @@ -592,7 +564,6 @@ if ( itemDrawer ) { itemDrawer->UpdateItemHeight(); - itemDrawer->ResizeDefaultBitmaps(); } } diff -r d05a55b217df -r 79311d856354 idlehomescreen/widgetmanager/src/wmmaincontainer.cpp --- a/idlehomescreen/widgetmanager/src/wmmaincontainer.cpp Wed Apr 14 15:47:59 2010 +0300 +++ b/idlehomescreen/widgetmanager/src/wmmaincontainer.cpp Tue Apr 27 16:26:12 2010 +0300 @@ -485,7 +485,7 @@ { // widget list -> left -> ovi button (landscape mirrored) if ( aType == EEventKey ) - SetFocusToPortalButton( 0 ); + SetFocusToPortalButton( OperatorButtonHigherPriority ( 0 ) ); keyResponse = EKeyWasConsumed; } } @@ -532,8 +532,19 @@ keyResponse = EKeyWasConsumed; } else if ( !iLandscape && iMirrored && + aKeyEvent.iScanCode == EStdKeyRightArrow && + iConfiguration->PortalButtonCount() > 1 && + iConfiguration->PortalButtonsMirrored() ) + { + // right portal -> left -> left portal (portrait mirrored) + if ( aType == EEventKey ) + SetFocusToPortalButton( 1 ); + keyResponse = EKeyWasConsumed; + } + else if ( !iLandscape && iMirrored && aKeyEvent.iScanCode == EStdKeyLeftArrow && - iConfiguration->PortalButtonCount() > 1 ) + iConfiguration->PortalButtonCount() > 1 && + !iConfiguration->PortalButtonsMirrored() ) { // right portal -> left -> left portal (portrait mirrored) if ( aType == EEventKey ) @@ -621,8 +632,19 @@ keyResponse = EKeyWasConsumed; } else if ( !iLandscape && iMirrored && + aKeyEvent.iScanCode == EStdKeyLeftArrow && + iConfiguration->PortalButtonCount() > 1 && + iConfiguration->PortalButtonsMirrored() ) + { + // left portal -> right -> right portal (portrait mirrored) + if ( aType == EEventKey ) + SetFocusToPortalButton( 0 ); + keyResponse = EKeyWasConsumed; + } + else if ( !iLandscape && iMirrored && aKeyEvent.iScanCode == EStdKeyRightArrow && - iConfiguration->PortalButtonCount() > 1 ) + iConfiguration->PortalButtonCount() > 1 && + !iConfiguration->PortalButtonsMirrored() ) { // left portal -> right -> right portal (portrait mirrored) if ( aType == EEventKey ) @@ -929,6 +951,17 @@ // void CWmMainContainer::StartLoadingWidgetsL() { + if ( iFindbox && iFindPaneIsVisible ) + { + iFindbox->ResetL(); + iFindbox->SetSearchTextL( KNullDesC ); + CAknFilteredTextListBoxModel* m = + static_cast ( iWidgetsList->Model() ); + if ( m && m->Filter() ) + { + m->Filter()->ResetFilteringL(); + } + } if ( !iWidgetLoader ) { // create the widget loader AO @@ -955,11 +988,6 @@ // notify widgetlist iWidgetsList->HandleLayoutChanged(); } - else if ( KAknsMessageSkinChange == aType ) - { - // notify widgetlist , colored add icon need to be updated - iWidgetsList->HandleSkinChanged(); - } } @@ -1435,12 +1463,7 @@ { CWmWidgetData* data = iWidgetsList->WidgetData(); if ( data ) - { - const CFbsBitmap* logo = ( data->LogoImage() ) ? - data->LogoImage() : iWidgetsList->DefaultLogo(); - const CFbsBitmap* mask = ( data->LogoImageMask() ) ? - data->LogoImageMask() : iWidgetsList->DefaultMask(); - + { // Find out if HS is full TBool hsFull = ETrue; MHsContentController& controller = iWmPlugin.ContentController(); @@ -1455,8 +1478,11 @@ data->Name(), data->Description(), !hsFull, - logo, mask ); - + data->HsContentInfo().IconPath(), + *iWidgetsList->DefaultLogo(), + *iWidgetsList->DefaultMask() + ); + if ( dlg && dlg->ExecuteLD() == ECbaAddToHs ) { AddWidgetToHomeScreenL(); diff -r d05a55b217df -r 79311d856354 idlehomescreen/widgetmanager/src/wmportalbutton.cpp --- a/idlehomescreen/widgetmanager/src/wmportalbutton.cpp Wed Apr 14 15:47:59 2010 +0300 +++ b/idlehomescreen/widgetmanager/src/wmportalbutton.cpp Tue Apr 27 16:26:12 2010 +0300 @@ -35,6 +35,7 @@ #include #include +#include "wmimageconverter.h" #include "wmportalbutton.h" #include "wmcommon.h" #include "wmplugin.h" @@ -139,10 +140,13 @@ KAknsIIDQsnFrButtonCenterInactive ); // start image converter for the icon - iImageConverter = CWmImageConverter::NewL( this ); + iImageConverter = CWmImageConverter::NewL(); TSize iconsize( LayoutIconSize() ); iImageConverter->HandleIconString( - iconsize.iWidth, iconsize.iHeight, aIcon ); + iconsize, + aIcon, + iButtonIcon, + iButtonIconMask ); // observe our own press events SetObserver( this ); @@ -351,11 +355,12 @@ // resize icon if ( iButtonIcon && iButtonIconMask ) { - TSize size = LayoutIconSize(); - AknIconUtils::SetSize( - iButtonIcon, size, EAspectRatioPreserved ); - AknIconUtils::SetSize( - iButtonIconMask, size, EAspectRatioPreserved ); + iImageConverter->UpdateImageSize( + LayoutIconSize(), + iWmMainContainer->Configuration().PortalButtonIcon( + iPortalButtonIndex ), + *iButtonIcon, + *iButtonIconMask ); } TBool landscape = Layout_Meta_Data::IsLandscapeOrientation(); @@ -364,43 +369,6 @@ } // --------------------------------------------------------- -// CWmPortalButton::NotifyCompletion -// --------------------------------------------------------- -// -void CWmPortalButton::NotifyCompletion( TInt aError ) - { - if ( KErrNone == aError ) - { - // take ownership of icon - delete iButtonIcon; - iButtonIcon = NULL; - iButtonIcon = iImageConverter->Bitmap(); - delete iButtonIconMask; - iButtonIconMask = NULL; - iButtonIconMask = iImageConverter->Mask(); - if ( iButtonIcon && iButtonIconMask ) - { - TSize size = LayoutIconSize(); - if ( iButtonIcon->SizeInPixels() != size ) - { - AknIconUtils::SetSize( - iButtonIcon, size, EAspectRatioPreserved ); - } - if ( iButtonIconMask->SizeInPixels() != size ) - { - AknIconUtils::SetSize( - iButtonIconMask, size, EAspectRatioPreserved ); - } - DrawDeferred(); - } - } - else - { - // no image available. Do nothing. - } - } - -// --------------------------------------------------------- // CWmPortalButton::Draw // --------------------------------------------------------- // @@ -468,7 +436,13 @@ imageLayout.LayoutRect( rect, AknLayoutScalable_Apps ::wgtman_btn_pane_g1( variety ).LayoutLine() ); } - imageLayout.DrawImage( gc, iButtonIcon, iButtonIconMask ); + + gc.DrawBitmapMasked( + imageLayout.Rect(), + iButtonIcon, + TRect(TPoint( 0, 0 ), iButtonIcon->SizeInPixels() ), + iButtonIconMask, + EFalse ); } // draw text if portrait diff -r d05a55b217df -r 79311d856354 idlehomescreen/widgetmanager/src/wmwidgetdata.cpp --- a/idlehomescreen/widgetmanager/src/wmwidgetdata.cpp Wed Apr 14 15:47:59 2010 +0300 +++ b/idlehomescreen/widgetmanager/src/wmwidgetdata.cpp Tue Apr 27 16:26:12 2010 +0300 @@ -36,6 +36,7 @@ #include "wmpersistentwidgetorder.h" #include "wmresourceloader.h" #include "wmcommon.h" +#include "wmimageconverter.h" // --------------------------------------------------------- // CWmWidgetData::NewL @@ -87,32 +88,26 @@ iPublisherUid = KNullUid; iLogoSize = aLogoSize; iAnimationTimer = NULL; - iTimeoutTimer = NULL; iAnimationIndex = 0; iAsyncUninstalling = EFalse; - iFireLogoChanged = EFalse; iMdcaPoint = NULL; - iWidgetName = NULL; } // --------------------------------------------------------- // CWmWidgetData::ConstructL // --------------------------------------------------------- // -void CWmWidgetData::ConstructL( +void CWmWidgetData::ConstructL( CHsContentInfo* aHsContentInfo, RWidgetRegistryClientSession* aRegistryClientSession ) { // start decoding the icon - iImageConverter = CWmImageConverter::NewL( this ); - iWait = new (ELeave) CActiveSchedulerWait(); + iImageConverter = CWmImageConverter::NewL(); iAnimationTimer = CPeriodic::NewL( CActive::EPriorityStandard ); - iTimeoutTimer = CPeriodic::NewL( CActive::EPriorityStandard ); InitL( aHsContentInfo, aRegistryClientSession ); // start logo handling - iImageConverter->SetLogoSize( iLogoSize ); HandleIconString( HsContentInfo().IconPath() ); } @@ -154,19 +149,6 @@ // CWmWidgetData::~CWmWidgetData() { - if ( iTimeoutTimer && - iTimeoutTimer->IsActive() ) - { - iTimeoutTimer->Cancel(); - } - delete iTimeoutTimer; - - delete iWidgetName; - if ( iWait && iWait->IsStarted() ) - { - iWait->AsyncStop(); - } - delete iWait; SetObserver( NULL ); DestroyAnimData(); delete iAnimationTimer; @@ -243,37 +225,6 @@ } // --------------------------------------------------------- -// CWmWidgetData::NotifyCompletion -// --------------------------------------------------------- -// -void CWmWidgetData::NotifyCompletion( TInt aError ) - { - delete iLogoImage; - iLogoImage = NULL; - delete iLogoImageMask; - iLogoImageMask = NULL; - if ( KErrNone != aError ) - { - // no image available. Do nothing. - } - else - { - iLogoImage = iImageConverter->Bitmap(); - iLogoImageMask = iImageConverter->Mask(); - - if ( iWait && iWait->IsStarted() ) - { - iWait->AsyncStop(); - } - if ( iFireLogoChanged ) - { - iFireLogoChanged = EFalse; - FireDataChanged(); - } - } - } - -// --------------------------------------------------------- // CWmWidgetData::HandleIconString // --------------------------------------------------------- // @@ -305,27 +256,17 @@ { size = iLogoSize; } - TInt err = iImageConverter->HandleIconString( - size.iWidth, size.iHeight, *iconStr ); + + iImageConverter->HandleIconString( + size, + *iconStr, + iLogoImage, + iLogoImageMask ); delete iconStr; iconStr = NULL; - // handle result - if ( KErrNone == err && iWait && - IsPrepairingLogo() && iTimeoutTimer ) - { - iTimeoutTimer->Cancel(); - const TInt tickInterval = 200000; - iTimeoutTimer->Start( - tickInterval,tickInterval,TCallBack(TimeoutTick, this)); - iWait->Start(); - } - else if ( KErrNone != err && iFireLogoChanged ) - { - FireDataChanged(); // draw default icon - iFireLogoChanged = EFalse; - } + FireDataChanged(); // draw default icon } // --------------------------------------------------------- @@ -447,21 +388,25 @@ // CWmWidgetData::ReCreateLogo // --------------------------------------------------------- // -void CWmWidgetData::ReCreateLogo( const TSize& aSize ) - { - delete iLogoImage; - iLogoImage = NULL; - delete iLogoImageMask; - iLogoImageMask = NULL; - - if ( iWait && iWait->IsStarted() ) +void CWmWidgetData::UpdateLogo( const TSize& aSize, TBool aReCreateLogo ) + { + iLogoSize = aSize; + if ( aReCreateLogo ) { - iWait->AsyncStop(); + delete iLogoImage; + iLogoImage = NULL; + delete iLogoImageMask; + iLogoImageMask = NULL; + HandleIconString( HsContentInfo().IconPath() ); } - - iFireLogoChanged = ETrue; - iLogoSize = aSize; - HandleIconString( HsContentInfo().IconPath() ); + else + { + iImageConverter->UpdateImageSize( + iLogoSize, + HsContentInfo().IconPath(), + *iLogoImage, + *iLogoImageMask ); + } } // --------------------------------------------------------- @@ -500,27 +445,13 @@ { // re-convert image // change event will be fired later when bitmap is ready - ReCreateLogo( iLogoSize ); + UpdateLogo( iLogoSize, ETrue ); } return !( sameAppearance && sameLogo ); } // --------------------------------------------------------- -// CWmWidgetData::IsPrepairingLogo -// --------------------------------------------------------- -// -TBool CWmWidgetData::IsPrepairingLogo() - { - TBool prepairing( EFalse ); - if ( !iLogoImage ) - { - prepairing = iImageConverter->IsProcessing(); - } - return prepairing; - } - -// --------------------------------------------------------- // CWmWidgetData::VisualizeUninstall // --------------------------------------------------------- // @@ -606,21 +537,6 @@ } // --------------------------------------------------------- -// CWmWidgetData::TimeoutTick -// --------------------------------------------------------- -// -TInt CWmWidgetData::TimeoutTick( TAny* aPtr ) - { - CWmWidgetData* self = static_cast< CWmWidgetData* >( aPtr ); - self->iTimeoutTimer->Cancel(); - if ( self->iWait && self->iWait->IsStarted() ) - { - self->iWait->AsyncStop(); - } - return 1; - } - -// --------------------------------------------------------- // CWmWidgetData::AnimationBitmap // --------------------------------------------------------- // diff -r d05a55b217df -r 79311d856354 idlehomescreen/widgetmanager/tsrc/wmunittest/conf/ui_wmunittest.cfg --- a/idlehomescreen/widgetmanager/tsrc/wmunittest/conf/ui_wmunittest.cfg Wed Apr 14 15:47:59 2010 +0300 +++ b/idlehomescreen/widgetmanager/tsrc/wmunittest/conf/ui_wmunittest.cfg Tue Apr 27 16:26:12 2010 +0300 @@ -603,7 +603,6 @@ create wmunittest test test HeapSet test ImageConverterCreate -test ImageConverterConversionMethod EUnrecognized test ImageConverterDelete test HeapCheck delete test @@ -615,36 +614,21 @@ create wmunittest test test HeapSet test ImageConverterCreate -test ImageConverterConvert "foo bar" -test ImageConverterWaitResult FAIL -test ImageConverterConvert "*************" -test ImageConverterWaitResult FAIL -test ImageConverterConvert "uid skin mif logo icon jpg jpeg icon" -test ImageConverterWaitResult FAIL -test ImageConverterConvert "girl.jpg" -test ImageConverterWaitResult FAIL -test ImageConverterConvert "dirty_hack.exe" -test ImageConverterWaitResult FAIL -test ImageConverterConvert "c:/testframework/wmunittest/wmlogo/logo.jpg" -test ImageConverterWaitResult FAIL -test ImageConverterConvert "skin[0x10005a26 0x1000]" -test ImageConverterWaitResult FAIL -test ImageConverterConvert "skin(0x10005a26)" -test ImageConverterWaitResult FAIL -test ImageConverterConvert "mif(c:\testframework\wmunittest\wmlogo\logo.mif)" -test ImageConverterWaitResult FAIL -test ImageConverterConvert "mif(c:\testframework\wmunittest\wmlogo\logo.mif XXX YYY)" -test ImageConverterWaitResult FAIL -test ImageConverterConvert "mif ( 16384 16385)" -test ImageConverterWaitResult FAIL -test ImageConverterConvert "skin( 0x100056c6 0x86 ):mif ( c:\testframework\wmunittest\wmlogo\logo.mif )" -test ImageConverterWaitResult FAIL -test ImageConverterConvert " uid(0x10005901)" -test ImageConverterWaitResult FAIL -test ImageConverterConvert "uidaan(0x10005901)" -test ImageConverterWaitResult FAIL -test ImageConverterConvert "uid (%%%)" -test ImageConverterWaitResult FAIL +test ImageConverterConvert "foo bar" FAIL +test ImageConverterConvert "*************" FAIL +test ImageConverterConvert "uid skin mif logo icon jpg jpeg icon" FAIL +test ImageConverterConvert "girl.jpg" FAIL +test ImageConverterConvert "dirty_hack.exe" FAIL +test ImageConverterConvert "c:/testframework/wmunittest/wmlogo/logo.jpg" FAIL +test ImageConverterConvert "skin[0x10005a26 0x1000]" FAIL +test ImageConverterConvert "skin(0x10005a26)" FAIL +test ImageConverterConvert "mif(c:\testframework\wmunittest\wmlogo\logo.mif)" FAIL +test ImageConverterConvert "mif(c:\testframework\wmunittest\wmlogo\logo.mif XXX YYY)" FAIL +test ImageConverterConvert "mif ( 16384 16385)" FAIL +test ImageConverterConvert "skin( 0x100056c6 0x86 ):mif ( c:\testframework\wmunittest\wmlogo\logo.mif )" FAIL +test ImageConverterConvert " uid(0x10005901)" FAIL +test ImageConverterConvert "uidaan(0x10005901)" FAIL +test ImageConverterConvert "uid (%%%)" FAIL test ImageConverterDelete test HeapCheck delete test @@ -662,9 +646,7 @@ create wmunittest test test HeapSet test ImageConverterCreate -test ImageConverterConvert "skin(270501603 4145)" -test ImageConverterWaitResult OK -test ImageConverterConversionMethod ESkinIcon +test ImageConverterConvert "skin(270501603 4145)" OK test ImageConverterDelete test HeapCheck delete test @@ -676,9 +658,7 @@ create wmunittest test test HeapSet test ImageConverterCreate -test ImageConverterConvert "skin(0x101F86E3 0x100d)" -test ImageConverterWaitResult OK -test ImageConverterConversionMethod ESkinIcon +test ImageConverterConvert "skin(0x101F86E3 0x100d)" OK test ImageConverterDelete test HeapCheck delete test @@ -690,9 +670,7 @@ create wmunittest test test HeapSet test ImageConverterCreate -test ImageConverterConvert "skin ( 270501603 4145 ) " -test ImageConverterWaitResult OK -test ImageConverterConversionMethod ESkinIcon +test ImageConverterConvert "skin ( 270501603 4145 ) " OK test ImageConverterDelete test HeapCheck delete test @@ -705,8 +683,7 @@ create wmunittest test test HeapSet test ImageConverterCreate -test ImageConverterConvert "skin(0 0)" -test ImageConverterWaitResult FAIL +test ImageConverterConvert "skin(0 0)" FAIL test ImageConverterDelete test HeapCheck delete test @@ -718,9 +695,7 @@ create wmunittest test test HeapSet test ImageConverterCreate -test ImageConverterConvert "skin(270501603 4145):mif(c:\testframework\wmunittest\wmlogo\logo.mif 16384 16385)" -test ImageConverterWaitResult OK -test ImageConverterConversionMethod ESkinAndMifIcon +test ImageConverterConvert "skin(270501603 4145):mif(c:\testframework\wmunittest\wmlogo\logo.mif 16384 16385)" OK test ImageConverterDelete test HeapCheck delete test @@ -732,9 +707,7 @@ create wmunittest test test HeapSet test ImageConverterCreate -test ImageConverterConvert "skin(0x101F86E3 0x1031):mif(c:\testframework\wmunittest\wmlogo\logo.mif 0x4000 0x4001)" -test ImageConverterWaitResult OK -test ImageConverterConversionMethod ESkinAndMifIcon +test ImageConverterConvert "skin(0x101F86E3 0x1031):mif(c:\testframework\wmunittest\wmlogo\logo.mif 0x4000 0x4001)" OK test ImageConverterDelete test HeapCheck delete test @@ -746,9 +719,7 @@ create wmunittest test test HeapSet test ImageConverterCreate -test ImageConverterConvert "skin ( 0x101F86E3 0x1031 ) :mif ( c:\testframework\wmunittest\wmlogo\logo.mif 0x4000 0x4001 ) " -test ImageConverterWaitResult OK -test ImageConverterConversionMethod ESkinAndMifIcon +test ImageConverterConvert "skin ( 0x101F86E3 0x1031 ) :mif ( c:\testframework\wmunittest\wmlogo\logo.mif 0x4000 0x4001 ) " OK test ImageConverterDelete test HeapCheck delete test @@ -760,9 +731,7 @@ create wmunittest test test HeapSet test ImageConverterCreate -test ImageConverterConvert "mif(c:\testframework\wmunittest\wmlogo\logo.mif 16384 16385)" -test ImageConverterWaitResult OK -test ImageConverterConversionMethod EMifIcon +test ImageConverterConvert "mif(c:\testframework\wmunittest\wmlogo\logo.mif 16384 16385)" OK test ImageConverterDelete test HeapCheck delete test @@ -774,9 +743,7 @@ create wmunittest test test HeapSet test ImageConverterCreate -test ImageConverterConvert "mif(c:\testframework\wmunittest\wmlogo\logo.mif 16384)" -test ImageConverterWaitResult OK -test ImageConverterConversionMethod EMifIcon +test ImageConverterConvert "mif(c:\testframework\wmunittest\wmlogo\logo.mif 16384)" OK test ImageConverterDelete test HeapCheck delete test @@ -788,9 +755,7 @@ create wmunittest test test HeapSet test ImageConverterCreate -test ImageConverterConvert "mif(c:\testframework\wmunittest\wmlogo\logo.mif 0x4000 0x4001)" -test ImageConverterWaitResult OK -test ImageConverterConversionMethod EMifIcon +test ImageConverterConvert "mif(c:\testframework\wmunittest\wmlogo\logo.mif 0x4000 0x4001)" OK test ImageConverterDelete test HeapCheck delete test @@ -802,9 +767,7 @@ create wmunittest test test HeapSet test ImageConverterCreate -test ImageConverterConvert "mif ( c:\testframework\wmunittest\wmlogo\logo.mif 16384 16385 ) " -test ImageConverterWaitResult OK -test ImageConverterConversionMethod EMifIcon +test ImageConverterConvert "mif ( c:\testframework\wmunittest\wmlogo\logo.mif 16384 16385 ) " OK test ImageConverterDelete test HeapCheck delete test @@ -817,8 +780,7 @@ create wmunittest test test HeapSet test ImageConverterCreate -test ImageConverterConvert "mif(c:\blabla.mif 16384 16385)" -test ImageConverterWaitResult FAIL +test ImageConverterConvert "mif(c:\blabla.mif 16384 16385)" FAIL test ImageConverterDelete test HeapCheck delete test @@ -830,8 +792,7 @@ create wmunittest test test HeapSet test ImageConverterCreate -test ImageConverterConvert "mif(c:\testframework\wmunittest\wmlogo\logo.mif 1 2)" -test ImageConverterWaitResult FAIL +test ImageConverterConvert "mif(c:\testframework\wmunittest\wmlogo\logo.mif 1 2)" FAIL test ImageConverterDelete test HeapCheck delete test @@ -843,9 +804,7 @@ create wmunittest test test HeapSet test ImageConverterCreate -test ImageConverterConvert "uid(268458241)" -test ImageConverterWaitResult OK -test ImageConverterConversionMethod EUidIcon +test ImageConverterConvert "uid(268458241)" OK test ImageConverterDelete test HeapCheck delete test @@ -857,9 +816,7 @@ create wmunittest test test HeapSet test ImageConverterCreate -test ImageConverterConvert "uid(0x10005901)" -test ImageConverterWaitResult OK -test ImageConverterConversionMethod EUidIcon +test ImageConverterConvert "uid(0x10005901)" OK test ImageConverterDelete test HeapCheck delete test @@ -871,9 +828,7 @@ create wmunittest test test HeapSet test ImageConverterCreate -test ImageConverterConvert "uid ( 0x10005901 ) " -test ImageConverterWaitResult OK -test ImageConverterConversionMethod EUidIcon +test ImageConverterConvert "uid ( 0x10005901 ) " OK test ImageConverterDelete test HeapCheck delete test @@ -885,8 +840,7 @@ create wmunittest test test HeapSet test ImageConverterCreate -test ImageConverterConvert "uid(0x0)" -test ImageConverterWaitResult FAIL +test ImageConverterConvert "uid(0x0)" FAIL test ImageConverterDelete test HeapCheck delete test @@ -899,9 +853,7 @@ test HeapSet test InstallWrtWidget "c:\testframework\wmunittest\wmlogo\test.wgz" test ImageConverterCreate -test ImageConverterConvert "uid(0x2000DAD2)" -test ImageConverterWaitResult OK -test ImageConverterConversionMethod EUidIcon +test ImageConverterConvert "uid(0x2000DAD2)" OK test ImageConverterDelete test UninstallWrtWidget "0x2000DAD2" test HeapCheck @@ -914,9 +866,7 @@ create wmunittest test test HeapSet test ImageConverterCreate -test ImageConverterConvert "c:\testframework\wmunittest\wmlogo\logo.svg" -test ImageConverterWaitResult OK -test ImageConverterConversionMethod ESvgIcon +test ImageConverterConvert "c:\testframework\wmunittest\wmlogo\logo.svg" OK test ImageConverterDelete test HeapCheck delete test @@ -928,9 +878,7 @@ create wmunittest test test HeapSet test ImageConverterCreate -test ImageConverterConvert "c:\testframework\wmunittest\wmlogo\logocorrupt.svg" -test ImageConverterWaitResult FAIL -test ImageConverterConversionMethod ESvgIcon +test ImageConverterConvert "c:\testframework\wmunittest\wmlogo\logocorrupt.svg" FAIL test ImageConverterDelete test HeapCheck delete test @@ -942,9 +890,7 @@ create wmunittest test test HeapSet test ImageConverterCreate -test ImageConverterConvert "c:\testframework\wmunittest\wmlogo\logo.png" -test ImageConverterWaitResult OK -test ImageConverterConversionMethod EImageIcon +test ImageConverterConvert "c:\testframework\wmunittest\wmlogo\logo.png" OK test ImageConverterDelete test HeapCheck delete test @@ -956,8 +902,7 @@ create wmunittest test test HeapSet test ImageConverterCreate -test ImageConverterConvert "c:\testframework\wmunittest\wmlogo\logocorrupt.png" -test ImageConverterWaitResult FAIL +test ImageConverterConvert "c:\testframework\wmunittest\wmlogo\logocorrupt.png" FAIL test ImageConverterDelete test HeapCheck delete test @@ -969,9 +914,7 @@ create wmunittest test test HeapSet test ImageConverterCreate -test ImageConverterConvert "c:\testframework\wmunittest\wmlogo\logo.jpg" -test ImageConverterWaitResult OK -test ImageConverterConversionMethod EImageIcon +test ImageConverterConvert "c:\testframework\wmunittest\wmlogo\logo.jpg" OK test ImageConverterDelete test HeapCheck delete test @@ -983,80 +926,12 @@ create wmunittest test test HeapSet test ImageConverterCreate -test ImageConverterConvert "c:\testframework\wmunittest\wmlogo\logocorrupt.jpg" -test ImageConverterWaitResult FAIL -test ImageConverterDelete -test HeapCheck -delete test -[Endtest] - - - -// Tests image converter cancel when idle -[Test] -title Image converter cancel (idle) -create wmunittest test -test HeapSet -test ImageConverterCreate -test CancelConvert -test ImageConverterDelete -test HeapCheck -delete test -[Endtest] - -// Tests image converter cancel (mif conversion) -[Test] -title Image converter cancel (mif) -create wmunittest test -test HeapSet -test ImageConverterCreate -test ImageConverterConvert "mif(c:\testframework\wmunittest\wmlogo\logo.mif 16384 16385)" -test CancelConvert +test ImageConverterConvert "c:\testframework\wmunittest\wmlogo\logocorrupt.jpg" FAIL test ImageConverterDelete test HeapCheck delete test [Endtest] -// Tests image converter cancel (uid conversion) -[Test] -title Image converter cancel (uid) -create wmunittest test -test HeapSet -test ImageConverterCreate -test ImageConverterConvert "uid(268458241)" -test CancelConvert -test ImageConverterDelete -test HeapCheck -delete test -[Endtest] - -// Tests image converter cancel (svg conversion) -[Test] -title Image converter cancel (svg) -create wmunittest test -test HeapSet -test ImageConverterCreate -test ImageConverterConvert "c:\testframework\wmunittest\wmlogo\logo.svg" -test CancelConvert -test ImageConverterDelete -test HeapCheck -delete test -[Endtest] - -// Tests image converter cancel (jpg conversion) -[Test] -title Image converter cancel (jpg) -create wmunittest test -test HeapSet -test ImageConverterCreate -test ImageConverterConvert "c:\testframework\wmunittest\wmlogo\logo.jpg" -test CancelConvert -test ImageConverterDelete -test HeapCheck -delete test -[Endtest] - - //------------------------------------------------------------------------------- // Misc Test cases //------------------------------------------------------------------------------- diff -r d05a55b217df -r 79311d856354 idlehomescreen/widgetmanager/tsrc/wmunittest/inc/wmunittest.h --- a/idlehomescreen/widgetmanager/tsrc/wmunittest/inc/wmunittest.h Wed Apr 14 15:47:59 2010 +0300 +++ b/idlehomescreen/widgetmanager/tsrc/wmunittest/inc/wmunittest.h Tue Apr 27 16:26:12 2010 +0300 @@ -26,7 +26,6 @@ #include // RFs #include "wmwidgetorderdata.h" -#include "wmimageconverter.h" // MConverterObserver #include #include "wminstaller.h" @@ -67,7 +66,6 @@ * test class for STIF Test Framework TestScripter. */ NONSHARABLE_CLASS(CWmUnitTest) : public CScriptBase, - public MConverterObserver, public MHsContentController { public: // Constructors and destructor @@ -89,16 +87,13 @@ /** From CScriptBase Runs a script line. */ virtual TInt RunMethodL( CStifItemParser& aItem ); - public: // from MConverterObserver - - virtual void NotifyCompletion( TInt aError ); - public: // from MHsContentController TInt WidgetListL( CHsContentInfoArray& aArray ); TInt WidgetListL( CHsContentInfo& aInfo, CHsContentInfoArray& aArray ); TInt ViewListL( CHsContentInfoArray& aArray ); + TInt ViewListL( CHsContentInfo& aInfo, CHsContentInfoArray& aArray ); TInt AppListL( CHsContentInfoArray& aArray ); TInt AddWidgetL( CHsContentInfo& aInfo ); TInt RemoveWidgetL( CHsContentInfo& aInfo ); @@ -165,12 +160,6 @@ TInt ImageConverterDeleteL( CStifItemParser& aItem ); // calls image converter's main conversion method TInt ImageConverterConvertL( CStifItemParser& aItem ); - // checks image converter callback and checks its result - TInt ImageConverterWaitResultL( CStifItemParser& aItem ); - // gets and checks the conversion method from image converter - TInt ImageConverterConversionMethodL( CStifItemParser& aItem ); - // cancel ongoing convert - TInt CancelConvertL( CStifItemParser& aItem ); // TESTING UNISTALL TInt UninstallL( CStifItemParser& aItem ); diff -r d05a55b217df -r 79311d856354 idlehomescreen/widgetmanager/tsrc/wmunittest/src/wmunittest_all.cpp --- a/idlehomescreen/widgetmanager/tsrc/wmunittest/src/wmunittest_all.cpp Wed Apr 14 15:47:59 2010 +0300 +++ b/idlehomescreen/widgetmanager/tsrc/wmunittest/src/wmunittest_all.cpp Tue Apr 27 16:26:12 2010 +0300 @@ -75,9 +75,6 @@ ENTRY( "ImageConverterCreate", CWmUnitTest::ImageConverterCreateL ), ENTRY( "ImageConverterDelete", CWmUnitTest::ImageConverterDeleteL ), ENTRY( "ImageConverterConvert", CWmUnitTest::ImageConverterConvertL ), - ENTRY( "ImageConverterWaitResult", CWmUnitTest::ImageConverterWaitResultL ), - ENTRY( "ImageConverterConversionMethod", CWmUnitTest::ImageConverterConversionMethodL ), - ENTRY( "CancelConvert", CWmUnitTest::CancelConvertL ), // uninstall ENTRY( "Uninstall", CWmUnitTest::UninstallL ), diff -r d05a55b217df -r 79311d856354 idlehomescreen/widgetmanager/tsrc/wmunittest/src/wmunittest_converter.cpp --- a/idlehomescreen/widgetmanager/tsrc/wmunittest/src/wmunittest_converter.cpp Wed Apr 14 15:47:59 2010 +0300 +++ b/idlehomescreen/widgetmanager/tsrc/wmunittest/src/wmunittest_converter.cpp Tue Apr 27 16:26:12 2010 +0300 @@ -36,7 +36,7 @@ if ( iImageConverter != 0 ) User::Leave( KErrArgument ); TInt ret = KErrNone; _CLEANUPCHECK_BEGIN - iImageConverter = CWmImageConverter::NewL( this ); + iImageConverter = CWmImageConverter::NewL(); _CLEANUPCHECK_END _RETURN("ImageConverterCreateL End", ret); } @@ -64,101 +64,24 @@ TInt ret = KErrNone; iConversionReady = EFalse; TPtrC inputStr; - + aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing ); User::LeaveIfError( aItem.GetNextString( inputStr ) ); if ( inputStr.Length() == 0 ) User::Leave( KErrArgument ); - TInt err = iImageConverter->HandleIconString( 40, 40, inputStr ); - if ( err != KErrNone ) + TInt expectedResult; + User::LeaveIfError( aItem.GetNextInt( expectedResult ) ); + + CFbsBitmap* bitmap = NULL; + CFbsBitmap* mask = NULL; + TInt err = iImageConverter->HandleIconString( + TSize (40, 40), inputStr, bitmap, mask ); + if ( err != KErrNone && expectedResult == -1 ) { - _LOG("ImageConverterConvertL:HandleIconString returns Error!!!"); - iConversionReady = ETrue; - iConversionError = err; + err = KErrNone; } _RETURN("ImageConverterConvertL End", ret ); } -// ----------------------------------------------------------------------------- -// CWmUnitTest::ImageConverterWaitResultL -// ----------------------------------------------------------------------------- -// -TInt CWmUnitTest::ImageConverterWaitResultL( CStifItemParser& aItem ) - { - if ( iImageConverter == 0 ) User::Leave( KErrArgument ); - TInt ret = KErrNone; - TInt expectedResult; - - User::LeaveIfError( aItem.GetNextInt( expectedResult ) ); - - iWaiting = EFalse; - if ( !iConversionReady ) - { - iWaiting = ETrue; - CActiveScheduler::Start(); - iWaiting = EFalse; - } - - // check conversion error - if ( expectedResult == KErrNone && iConversionError != KErrNone ) - { - _LOG("ImageConverterWaitResultL: expected ok, returns error"); - ret = iConversionError; - } - else if ( expectedResult != KErrNone && iConversionError == KErrNone ) - { - _LOG("ImageConverterWaitResultL: expected error, returns ok"); - ret = KErrGeneral; - } - - _RETURN("ImageConverterWaitResultL End", ret); - } - -// ----------------------------------------------------------------------------- -// CWmUnitTest::NotifyCompletion -// ----------------------------------------------------------------------------- -// -void CWmUnitTest::NotifyCompletion( TInt aError ) - { - if ( !iConversionReady ) - { - iConversionReady = ETrue; - iConversionError = aError; - if ( iWaiting ) - { - CActiveScheduler::Stop(); - } - } - } - -// ----------------------------------------------------------------------------- -// CWmUnitTest::ImageConverterConversionMethodL -// ----------------------------------------------------------------------------- -// -TInt CWmUnitTest::ImageConverterConversionMethodL( CStifItemParser& aItem ) - { - if ( iImageConverter == 0 ) User::Leave( KErrArgument ); - TInt ret = KErrNone; - TInt conversionMethod; - - User::LeaveIfError( aItem.GetNextInt( conversionMethod ) ); - - // check conversion method - if ( conversionMethod != iImageConverter->ConversionMethod() ) - ret = KErrGeneral; - - _RETURN("ImageConverterConversionMethodL End", ret); - } - -// ----------------------------------------------------------------------------- -// CWmUnitTest::CancelConvertL -// ----------------------------------------------------------------------------- -// -TInt CWmUnitTest::CancelConvertL( CStifItemParser& /*aItem*/ ) - { - if ( iImageConverter == 0 ) User::Leave( KErrArgument ); - iImageConverter->Cancel(); - _RETURN("CancelConvertL End", KErrNone); - } // End of File diff -r d05a55b217df -r 79311d856354 idlehomescreen/widgetmanager/tsrc/wmunittest/src/wmunittest_plugin.cpp --- a/idlehomescreen/widgetmanager/tsrc/wmunittest/src/wmunittest_plugin.cpp Wed Apr 14 15:47:59 2010 +0300 +++ b/idlehomescreen/widgetmanager/tsrc/wmunittest/src/wmunittest_plugin.cpp Tue Apr 27 16:26:12 2010 +0300 @@ -135,6 +135,11 @@ return KErrNone; } +TInt CWmUnitTest::ViewListL( CHsContentInfo& aInfo, CHsContentInfoArray& aArray ) + { + return KErrNone; + } + TInt CWmUnitTest::AppListL( CHsContentInfoArray& /*aArray*/ ) { return KErrNone; diff -r d05a55b217df -r 79311d856354 idlehomescreen/xmluirendering/uiengine/inc/xneditor.h --- a/idlehomescreen/xmluirendering/uiengine/inc/xneditor.h Wed Apr 14 15:47:59 2010 +0300 +++ b/idlehomescreen/xmluirendering/uiengine/inc/xneditor.h Tue Apr 27 16:26:12 2010 +0300 @@ -204,7 +204,9 @@ TInt WidgetListL( CHsContentInfo& aInfo, CHsContentInfoArray& aArray ); TInt ViewListL( CHsContentInfoArray& aArray ); - + + TInt ViewListL( CHsContentInfo& aInfo, CHsContentInfoArray& aArray ); + TInt AppListL( CHsContentInfoArray& aArray ); TInt AddWidgetL( CHsContentInfo& aInfo ); @@ -303,7 +305,12 @@ * Retrieves publishers from CPS and them with the HSPS's template plugins */ void CpsWidgetPluginsL( RPointerArray< CHsContentInfo >& aWidgets ); - + + /** + * Checks whether the view is full + */ + TBool IsViewFull( CXnViewData& aViewData ); + private: // from MXnViewObserver diff -r d05a55b217df -r 79311d856354 idlehomescreen/xmluirendering/uiengine/inc/xneffectmanager.h --- a/idlehomescreen/xmluirendering/uiengine/inc/xneffectmanager.h Wed Apr 14 15:47:59 2010 +0300 +++ b/idlehomescreen/xmluirendering/uiengine/inc/xneffectmanager.h Tue Apr 27 16:26:12 2010 +0300 @@ -43,6 +43,14 @@ #define KGfxControlActionAppear 3 #define KGfxControlActionDisappear 4 +#define KGfxControlActionAppearPrt 3 +#define KGfxControlActionDisappearPrt 5 +#define KGfxControlActionAppearLsc 6 +#define KGfxControlActionDisappearLsc 7 + +#define KGfxControlActionBgImgToImgAppear 3 +#define KGfxControlActionBgAnimToImgAppear 5 + // Full screen effect ids #define KGfxContextOpenWallpaperView 1007 #define KGfxContextCloseWallpaperView 1008 diff -r d05a55b217df -r 79311d856354 idlehomescreen/xmluirendering/uiengine/inc/xnwallpaperview.h --- a/idlehomescreen/xmluirendering/uiengine/inc/xnwallpaperview.h Wed Apr 14 15:47:59 2010 +0300 +++ b/idlehomescreen/xmluirendering/uiengine/inc/xnwallpaperview.h Tue Apr 27 16:26:12 2010 +0300 @@ -33,22 +33,11 @@ class TVwsViewId; class CPeriodic; class CXnSpBgCleaner; +class CAknWaitDialog; // Constants const TUid KWallpaperViewUid = { 0x200286DB }; -/** -* Data structure to be used with timer callback. -* -* @since S60 v5.0 -*/ -NONSHARABLE_STRUCT( TXnWallpaperViewData ) - { - TBool iMultiple; - TUid iAppUid; - TUid iViewUid; - }; - // CLASS DECLARATION /** @@ -59,6 +48,13 @@ */ NONSHARABLE_CLASS( CXnWallpaperView ) : public CAknView { + /** View states */ + enum TViewState + { + EIdle, + EImageSelection, + EViewDeactivation + }; public: /** @@ -103,8 +99,16 @@ /** * Callback function to be used with CPeriodic. */ - static TInt TimerCallbackL( TAny *aPtr ); + static TInt TimerCallback( TAny *aPtr ); + void DoHandleCallBackL(); + /** + * Show error dialog + * + * @param aResourceId Resource id to string to be displayed. + */ + static void ShowErrorDialogL( const TInt aResourceId ); + private: // data /** @@ -126,9 +130,19 @@ CXnAppUiAdapter& iAppUi; /** - * Data structure, that is transferred to TimerCallback. + * Switch for multiple image selection. + */ + TBool iMultiple; + + /** + * Previous view id */ - TXnWallpaperViewData iData; + TVwsViewId iPreviousViewUid; + + /** + * States of wallpaperview + */ + TViewState iViewState; /** * Periodic timer. @@ -146,7 +160,12 @@ * Own. */ CXnSpBgCleaner* iXnSpBgCleaner; - + + /** + * Wait dialog. + * Own. + */ + CAknWaitDialog* iWaitDialog; }; #endif // CXNWALLPAPERVIEW_H diff -r d05a55b217df -r 79311d856354 idlehomescreen/xmluirendering/uiengine/src/xnbackgroundmanager.cpp --- a/idlehomescreen/xmluirendering/uiengine/src/xnbackgroundmanager.cpp Wed Apr 14 15:47:59 2010 +0300 +++ b/idlehomescreen/xmluirendering/uiengine/src/xnbackgroundmanager.cpp Tue Apr 27 16:26:12 2010 +0300 @@ -780,14 +780,15 @@ // Add new to the cache if( aFileName != KNullDesC ) { - if( CacheWallpaperL( aFileName, viewData ) == KErrNone ) + err = CacheWallpaperL( aFileName, viewData ); + + if( err == KErrNone ) { SaveWallpaperL(); // to HSPS } else { - // image is corrupted or format is not supported - return KErrCACorruptContent; + return err; } } // WallpaperImage changed back to default. Update view data. @@ -832,13 +833,13 @@ { iBgImagePath = aFileName.AllocL(); - TBool err( KErrNone ); + err = KErrNone; TRAP( err, iSkinSrv.AddWallpaperL( aFileName, iRect.Size() ) ); - if( err ) + if( err != KErrNone ) { - // image is corrupted or format is not supported - return KErrCACorruptContent; + return err; } + TRAP( err, iBgImage = iSkinSrv.WallpaperImageL( aFileName ) ); if( err ) { diff -r d05a55b217df -r 79311d856354 idlehomescreen/xmluirendering/uiengine/src/xneditor.cpp --- a/idlehomescreen/xmluirendering/uiengine/src/xneditor.cpp Wed Apr 14 15:47:59 2010 +0300 +++ b/idlehomescreen/xmluirendering/uiengine/src/xneditor.cpp Tue Apr 27 16:26:12 2010 +0300 @@ -95,6 +95,7 @@ // ====================== LOCAL FUNTION PROTOTYPES ============================ static void DeletePluginInfos( TAny* aObject ); static void DeleteItemMaps( TAny* aObject ); +static void DeleteContentInfo( TAny* aObject ); static TPtrC ParseWidgetName( const CHsContentInfo& aContentInfo ); static void SetPropertyL( CXnNode& aNode, const TDesC8& aAttribute, @@ -131,6 +132,16 @@ } // --------------------------------------------------------------------------- +// DeleteContentInfo +// --------------------------------------------------------------------------- +// +static void DeleteContentInfo( TAny* aObject ) + { + reinterpret_cast* >( + aObject )->ResetAndDestroy(); + } + +// --------------------------------------------------------------------------- // ParseWidgetName // --------------------------------------------------------------------------- // @@ -324,21 +335,7 @@ // TBool CXnEditor::IsCurrentViewFull() { - TBool viewFull = ETrue; - - RPointerArray< CXnPluginData >& plugins( - iViewManager.ActiveViewData().PluginData() ); - - for ( TInt i = 0; i < plugins.Count(); i++ ) - { - if ( !plugins[i]->Occupied() ) - { - viewFull = EFalse; - break; - } - } - - return viewFull; + return IsViewFull( iViewManager.ActiveViewData() ); } // ----------------------------------------------------------------------------- @@ -419,14 +416,6 @@ if ( plugin->PublisherName() == aInfo.PublisherId() ) { - if ( plugin->Removable() ) - { - // To enable widget remove - aInfo.SetPluginIdL( plugin->PluginId() ); - - retval |= ECanBeRemoved; - } - widgetCount++; } } @@ -468,14 +457,6 @@ if ( plugin->PluginUid().CompareF( aInfo.Uid() ) == 0 ) { - if ( plugin->Removable() ) - { - // To enable widget remove - aInfo.SetPluginIdL( plugin->PluginId() ); - - retval |= ECanBeRemoved; - } - widgetCount++; } } @@ -498,40 +479,17 @@ { RPointerArray< CHsContentInfo >& list( aContentInfoArray.Array() ); - RPointerArray< CXnPluginData >& views( - iViewManager.ActiveAppData().PluginData() ); - - TInt viewAmount( iViewManager.ViewAmount() ); - - const TInt KMaxViewAmount( 6 ); + TBool canBeAdded( EFalse ); + CXnRootData& appData( iViewManager.ActiveAppData() ); + if ( appData.PluginData().Count() < appData.MaxPages() ) + { + canBeAdded = ETrue; + } for ( TInt i = 0; i < list.Count(); i++ ) { - CHsContentInfo* info( list[i] ); - - info->SetCanBeAdded( EFalse ); - info->SetCanBeRemoved( EFalse ); - - for ( TInt j = 0 ; j < views.Count(); j++ ) - { - CXnPluginData* view( views[j] ); - - if ( view->PluginUid().CompareF( info->Uid() ) == 0 ) - { - // To enable view remove - info->SetPluginIdL( view->PluginId() ); - // Last view cannot be removed - if ( views.Count() > 1 ) - { - info->SetCanBeRemoved( ETrue ); - } - } - } - - if ( viewAmount < KMaxViewAmount ) - { - info->SetCanBeAdded( ETrue ); - } + CHsContentInfo* info( list[i] ); + info->SetCanBeAdded( canBeAdded ); } } @@ -1718,7 +1676,7 @@ { // Get installed widget content infos RPointerArray< CHsContentInfo > array; - CleanupClosePushL( array ); + CleanupStack::PushL( TCleanupItem( DeleteContentInfo, &array ) ); // get installed widgets and template configurations from HSPS HspsWidgetPluginsL( array ); @@ -1765,6 +1723,56 @@ // from MHsContentController // ----------------------------------------------------------------------------- // +TInt CXnEditor::ViewListL( CHsContentInfo& aInfo, CHsContentInfoArray& aArray ) + { + TInt err( KErrNone ); + + if ( aInfo.Type() == KApplication ) + { + if ( aInfo.Uid().CompareF( iViewManager.ActiveAppData().PluginUid() ) == 0 ) + { + // Get list of views in active application configuration + CXnRootData& appData( iViewManager.ActiveAppData() ); + RPointerArray< CXnPluginData >& views( appData.PluginData() ); + + // Get installed view content infos + RPointerArray< CHsContentInfo > array; + CleanupStack::PushL( TCleanupItem( DeleteContentInfo, &array ) ); + HspsViewPluginsL( array ); + + // Create content info for each found view + for ( TInt i = 0; i < views.Count(); i++ ) + { + CHsContentInfo* info = CreateContentInfoLC( *views[i], array ); + if ( info ) + { + CXnViewData* view = static_cast < CXnViewData* >( views[ i ] ); + info->SetIsFull( IsViewFull( *view ) ); + aArray.Array().AppendL( info ); + CleanupStack::Pop( info ); + } + } + CleanupStack::PopAndDestroy(); // array + } + else + { + // Invalid application configuration + err = KErrArgument; + } + } + else + { + // Invalid argument + err = KErrArgument; + } + + return err; + } + +// ----------------------------------------------------------------------------- +// from MHsContentController +// ----------------------------------------------------------------------------- +// TInt CXnEditor::AppListL( CHsContentInfoArray& aArray ) { RPointerArray< CHsContentInfo >& array( aArray.Array() ); @@ -1950,23 +1958,7 @@ aInfo.SetTypeL( view->PluginInfo().Type() ); aInfo.SetDescriptionL( view->PluginInfo().Description() ); aInfo.SetIconPathL( view->PluginInfo().LogoIcon() ); - - // Check if there is empty space - RPointerArray< CXnNode > nodes; - viewData.PluginNodesL( nodes ); - TBool isFull( ETrue ); - for ( TInt i = 0; i < nodes.Count(); i++ ) - { - CXnNode* node( nodes[i] ); - CXnPluginData* plugin = viewData.Plugin( node ); - - if ( plugin && !plugin->Occupied() ) - { - isFull = EFalse; - break; - } - } - aInfo.SetIsFull( isFull ); + aInfo.SetIsFull( IsViewFull( viewData ) ); } else { @@ -2036,6 +2028,7 @@ contentInfo = info->CloneL(); CleanupStack::PushL( contentInfo ); contentInfo->SetPluginIdL( aPlugin.PluginId() ); + contentInfo->SetCanBeRemoved( aPlugin.Removable() ); } } } @@ -2043,6 +2036,31 @@ } // ----------------------------------------------------------------------------- +// CXnEditor::IsViewFull +// ----------------------------------------------------------------------------- +// +TBool CXnEditor::IsViewFull( CXnViewData& aViewData ) + { + TBool isFull( ETrue ); + + RPointerArray< CXnPluginData >& plugins( + aViewData.PluginData() ); + + for ( TInt i = 0; i < plugins.Count(); i++ ) + { + CXnPluginData* plugin = plugins[ i ]; + + if ( !plugin->Occupied() ) + { + isFull = EFalse; + break; + } + } + + return isFull; + } + +// ----------------------------------------------------------------------------- // CXnBackgroundManager::OOMSysHandler // ----------------------------------------------------------------------------- // diff -r d05a55b217df -r 79311d856354 idlehomescreen/xmluirendering/uiengine/src/xnnodeimpl.cpp --- a/idlehomescreen/xmluirendering/uiengine/src/xnnodeimpl.cpp Wed Apr 14 15:47:59 2010 +0300 +++ b/idlehomescreen/xmluirendering/uiengine/src/xnnodeimpl.cpp Tue Apr 27 16:26:12 2010 +0300 @@ -892,197 +892,197 @@ TInt level( XnDirtyLevel::ENone ); EnableStatePropertyL( - aNode, aPseudoClass, CXnNode::WidthL, + aNode, aPseudoClass, &CXnNode::WidthL, aLayoutPropertyCache->iWidth, aLayoutPropertyCache->iWidths, level ); EnableStatePropertyL( - aNode, aPseudoClass, CXnNode::HeightL, + aNode, aPseudoClass, &CXnNode::HeightL, aLayoutPropertyCache->iHeight, aLayoutPropertyCache->iHeights, level ); EnableStatePropertyL( - aNode, aPseudoClass, CXnNode::MarginLeftL, + aNode, aPseudoClass, &CXnNode::MarginLeftL, aLayoutPropertyCache->iMarginLeft, aLayoutPropertyCache->iMarginLefts, level ); EnableStatePropertyL( - aNode, aPseudoClass, CXnNode::MarginRightL, + aNode, aPseudoClass, &CXnNode::MarginRightL, aLayoutPropertyCache->iMarginRight, aLayoutPropertyCache->iMarginRights, level ); EnableStatePropertyL( - aNode, aPseudoClass, CXnNode::BorderLeftL, + aNode, aPseudoClass, &CXnNode::BorderLeftL, aLayoutPropertyCache->iBorderLeft, aLayoutPropertyCache->iBorderLefts, level ); EnableStatePropertyL( - aNode, aPseudoClass, CXnNode::BorderRightL, + aNode, aPseudoClass, &CXnNode::BorderRightL, aLayoutPropertyCache->iBorderRight, aLayoutPropertyCache->iBorderRights, level ); EnableStatePropertyL( - aNode, aPseudoClass, CXnNode::PaddingLeftL, + aNode, aPseudoClass, &CXnNode::PaddingLeftL, aLayoutPropertyCache->iPaddingLeft, aLayoutPropertyCache->iPaddingLefts, level ); EnableStatePropertyL( - aNode, aPseudoClass, CXnNode::PaddingRightL, + aNode, aPseudoClass, &CXnNode::PaddingRightL, aLayoutPropertyCache->iPaddingRight, aLayoutPropertyCache->iPaddingRights, level ); EnableStatePropertyL( - aNode, aPseudoClass, CXnNode::MarginTopL, + aNode, aPseudoClass, &CXnNode::MarginTopL, aLayoutPropertyCache->iMarginTop, aLayoutPropertyCache->iMarginTops, level ); EnableStatePropertyL( - aNode, aPseudoClass, CXnNode::MarginBottomL, + aNode, aPseudoClass, &CXnNode::MarginBottomL, aLayoutPropertyCache->iMarginBottom, aLayoutPropertyCache->iMarginBottoms, level ); EnableStatePropertyL( - aNode, aPseudoClass, CXnNode::BorderTopL, + aNode, aPseudoClass, &CXnNode::BorderTopL, aLayoutPropertyCache->iBorderTop, aLayoutPropertyCache->iBorderTops, level ); EnableStatePropertyL( - aNode, aPseudoClass, CXnNode::BorderBottomL, + aNode, aPseudoClass, &CXnNode::BorderBottomL, aLayoutPropertyCache->iBorderBottom, aLayoutPropertyCache->iBorderBottoms, level ); EnableStatePropertyL( - aNode, aPseudoClass, CXnNode::PaddingTopL, + aNode, aPseudoClass, &CXnNode::PaddingTopL, aLayoutPropertyCache->iPaddingTop, aLayoutPropertyCache->iPaddingTops, level ); EnableStatePropertyL( - aNode, aPseudoClass, CXnNode::PaddingBottomL, + aNode, aPseudoClass, &CXnNode::PaddingBottomL, aLayoutPropertyCache->iPaddingBottom, aLayoutPropertyCache->iPaddingBottoms, level ); EnableStatePropertyL( - aNode, aPseudoClass, CXnNode::BorderWidthL, + aNode, aPseudoClass, &CXnNode::BorderWidthL, aLayoutPropertyCache->iBorderWidth, aLayoutPropertyCache->iBorderWidths, level ); EnableStatePropertyL( - aNode, aPseudoClass, CXnNode::BlockProgressionL, + aNode, aPseudoClass, &CXnNode::BlockProgressionL, aLayoutPropertyCache->iBlockProgression, aLayoutPropertyCache->iBlockProgressions, level ); EnableStatePropertyL( - aNode, aPseudoClass, CXnNode::DirectionL, + aNode, aPseudoClass, &CXnNode::DirectionL, aLayoutPropertyCache->iDirection, aLayoutPropertyCache->iDirections, level ); EnableStatePropertyL( - aNode, aPseudoClass, CXnNode::PositionL, + aNode, aPseudoClass, &CXnNode::PositionL, aLayoutPropertyCache->iPosition, aLayoutPropertyCache->iPositions, level ); EnableStatePropertyL( - aNode, aPseudoClass, CXnNode::MaxHeightL, + aNode, aPseudoClass, &CXnNode::MaxHeightL, aLayoutPropertyCache->iMaxHeight, aLayoutPropertyCache->iMaxHeights, level ); EnableStatePropertyL( - aNode, aPseudoClass, CXnNode::MinHeightL, + aNode, aPseudoClass, &CXnNode::MinHeightL, aLayoutPropertyCache->iMinHeight, aLayoutPropertyCache->iMinHeights, level ); EnableStatePropertyL( - aNode, aPseudoClass, CXnNode::MaxWidthL, + aNode, aPseudoClass, &CXnNode::MaxWidthL, aLayoutPropertyCache->iMaxWidth, aLayoutPropertyCache->iMaxWidths, level ); EnableStatePropertyL( - aNode, aPseudoClass, CXnNode::MinWidthL, + aNode, aPseudoClass, &CXnNode::MinWidthL, aLayoutPropertyCache->iMinWidth, aLayoutPropertyCache->iMinWidths, level ); EnableStatePropertyL( - aNode, aPseudoClass, CXnNode::DisplayL, + aNode, aPseudoClass, &CXnNode::DisplayL, aLayoutPropertyCache->iDisplay, aLayoutPropertyCache->iDisplays, level, ETrue ); EnableStatePropertyL( - aNode, aPseudoClass, CXnNode::VisibilityL, + aNode, aPseudoClass, &CXnNode::VisibilityL, aLayoutPropertyCache->iVisibility, aLayoutPropertyCache->iVisibilities, level ); EnableStatePropertyL( - aNode, aPseudoClass, CXnNode::LeftL, + aNode, aPseudoClass, &CXnNode::LeftL, aLayoutPropertyCache->iLeft, aLayoutPropertyCache->iLefts, level ); EnableStatePropertyL( - aNode, aPseudoClass, CXnNode::RightL, + aNode, aPseudoClass, &CXnNode::RightL, aLayoutPropertyCache->iRight, aLayoutPropertyCache->iRights, level ); EnableStatePropertyL( - aNode, aPseudoClass, CXnNode::TopL, + aNode, aPseudoClass, &CXnNode::TopL, aLayoutPropertyCache->iTop, aLayoutPropertyCache->iTops, level ); EnableStatePropertyL( - aNode, aPseudoClass, CXnNode::BottomL, + aNode, aPseudoClass, &CXnNode::BottomL, aLayoutPropertyCache->iBottom, aLayoutPropertyCache->iBottoms, level ); EnableStatePropertyL( - aNode, aPseudoClass, CXnNode::BorderLeftStyleL, + aNode, aPseudoClass, &CXnNode::BorderLeftStyleL, aLayoutPropertyCache->iBorderLeftStyle, aLayoutPropertyCache->iBorderLeftStyles, level ); EnableStatePropertyL( - aNode, aPseudoClass, CXnNode::BorderRightStyleL, + aNode, aPseudoClass, &CXnNode::BorderRightStyleL, aLayoutPropertyCache->iBorderRightStyle, aLayoutPropertyCache->iBorderRightStyles, level ); EnableStatePropertyL( - aNode, aPseudoClass, CXnNode::BorderTopStyleL, + aNode, aPseudoClass, &CXnNode::BorderTopStyleL, aLayoutPropertyCache->iBorderTopStyle, aLayoutPropertyCache->iBorderTopStyles, level ); EnableStatePropertyL( - aNode, aPseudoClass, CXnNode::BorderBottomStyleL, + aNode, aPseudoClass, &CXnNode::BorderBottomStyleL, aLayoutPropertyCache->iBorderBottomStyle, aLayoutPropertyCache->iBorderBottomStyles, level ); EnableStatePropertyL( - aNode, aPseudoClass, CXnNode::BorderStyleL, + aNode, aPseudoClass, &CXnNode::BorderStyleL, aLayoutPropertyCache->iBorderStyle, aLayoutPropertyCache->iBorderStyles, level ); EnableStatePropertyL( - aNode, aPseudoClass, CXnNode::DisplayPriorityL, + aNode, aPseudoClass, &CXnNode::DisplayPriorityL, aLayoutPropertyCache->iDisplayPriority, aLayoutPropertyCache->iDisplayPriorities, level ); EnableStatePropertyL( - aNode, aPseudoClass, CXnNode::NavIndexL, + aNode, aPseudoClass, &CXnNode::NavIndexL, aLayoutPropertyCache->iNavIndex, aLayoutPropertyCache->iNavIndexes, level ); EnableStatePropertyL( - aNode, aPseudoClass, CXnNode::ZIndexL, + aNode, aPseudoClass, &CXnNode::ZIndexL, aLayoutPropertyCache->iZIndex, aLayoutPropertyCache->iZIndexes, level ); EnableStatePropertyL( - aNode, aPseudoClass, CXnNode::BackgroundColorL, + aNode, aPseudoClass, &CXnNode::BackgroundColorL, aLayoutPropertyCache->iBackgroundColor, aLayoutPropertyCache->iBackgroundColors, level ); EnableStatePropertyL( - aNode, aPseudoClass, CXnNode::BackgroundImageL, + aNode, aPseudoClass, &CXnNode::BackgroundImageL, aLayoutPropertyCache->iBackgroundImage, aLayoutPropertyCache->iBackgroundImages, level, ETrue ); EnableStatePropertyL( - aNode, aPseudoClass, CXnNode::FocusBackgroundL, + aNode, aPseudoClass, &CXnNode::FocusBackgroundL, aLayoutPropertyCache->iFocusBackground, aLayoutPropertyCache->iFocusBackgrounds, level ); @@ -1107,197 +1107,197 @@ TInt level( XnDirtyLevel::ENone ); DisableStatePropertyL( - aNode, aPseudoClass, CXnNode::WidthL, + aNode, aPseudoClass, &CXnNode::WidthL, aLayoutPropertyCache->iWidth, aLayoutPropertyCache->iWidths, aStates, level ); DisableStatePropertyL( - aNode, aPseudoClass, CXnNode::HeightL, + aNode, aPseudoClass, &CXnNode::HeightL, aLayoutPropertyCache->iHeight, aLayoutPropertyCache->iHeights, aStates, level ); DisableStatePropertyL( - aNode, aPseudoClass, CXnNode::MarginLeftL, + aNode, aPseudoClass, &CXnNode::MarginLeftL, aLayoutPropertyCache->iMarginLeft, aLayoutPropertyCache->iMarginLefts, aStates, level ); DisableStatePropertyL( - aNode, aPseudoClass, CXnNode::MarginRightL, + aNode, aPseudoClass, &CXnNode::MarginRightL, aLayoutPropertyCache->iMarginRight, aLayoutPropertyCache->iMarginRights, aStates, level ); DisableStatePropertyL( - aNode, aPseudoClass, CXnNode::BorderLeftL, + aNode, aPseudoClass, &CXnNode::BorderLeftL, aLayoutPropertyCache->iBorderLeft, aLayoutPropertyCache->iBorderLefts, aStates, level ); DisableStatePropertyL( - aNode, aPseudoClass, CXnNode::BorderRightL, + aNode, aPseudoClass, &CXnNode::BorderRightL, aLayoutPropertyCache->iBorderRight, aLayoutPropertyCache->iBorderRights, aStates, level ); DisableStatePropertyL( - aNode, aPseudoClass, CXnNode::PaddingLeftL, + aNode, aPseudoClass, &CXnNode::PaddingLeftL, aLayoutPropertyCache->iPaddingLeft, aLayoutPropertyCache->iPaddingLefts, aStates, level ); DisableStatePropertyL( - aNode, aPseudoClass, CXnNode::PaddingRightL, + aNode, aPseudoClass, &CXnNode::PaddingRightL, aLayoutPropertyCache->iPaddingRight, aLayoutPropertyCache->iPaddingRights, aStates, level ); DisableStatePropertyL( - aNode, aPseudoClass, CXnNode::MarginTopL, + aNode, aPseudoClass, &CXnNode::MarginTopL, aLayoutPropertyCache->iMarginTop, aLayoutPropertyCache->iMarginTops, aStates, level ); DisableStatePropertyL( - aNode, aPseudoClass, CXnNode::MarginBottomL, + aNode, aPseudoClass, &CXnNode::MarginBottomL, aLayoutPropertyCache->iMarginBottom, aLayoutPropertyCache->iMarginBottoms, aStates, level ); DisableStatePropertyL( - aNode, aPseudoClass, CXnNode::BorderTopL, + aNode, aPseudoClass, &CXnNode::BorderTopL, aLayoutPropertyCache->iBorderTop, aLayoutPropertyCache->iBorderTops, aStates, level ); DisableStatePropertyL( - aNode, aPseudoClass, CXnNode::BorderBottomL, + aNode, aPseudoClass, &CXnNode::BorderBottomL, aLayoutPropertyCache->iBorderBottom, aLayoutPropertyCache->iBorderBottoms, aStates, level ); DisableStatePropertyL( - aNode, aPseudoClass, CXnNode::PaddingTopL, + aNode, aPseudoClass, &CXnNode::PaddingTopL, aLayoutPropertyCache->iPaddingTop, aLayoutPropertyCache->iPaddingTops, aStates, level ); DisableStatePropertyL( - aNode, aPseudoClass, CXnNode::PaddingBottomL, + aNode, aPseudoClass, &CXnNode::PaddingBottomL, aLayoutPropertyCache->iPaddingBottom, aLayoutPropertyCache->iPaddingBottoms, aStates, level ); DisableStatePropertyL( - aNode, aPseudoClass, CXnNode::BorderWidthL, + aNode, aPseudoClass, &CXnNode::BorderWidthL, aLayoutPropertyCache->iBorderWidth, aLayoutPropertyCache->iBorderWidths, aStates, level ); DisableStatePropertyL( - aNode, aPseudoClass, CXnNode::BlockProgressionL, + aNode, aPseudoClass, &CXnNode::BlockProgressionL, aLayoutPropertyCache->iBlockProgression, aLayoutPropertyCache->iBlockProgressions, aStates, level ); DisableStatePropertyL( - aNode, aPseudoClass, CXnNode::DirectionL, + aNode, aPseudoClass, &CXnNode::DirectionL, aLayoutPropertyCache->iDirection, aLayoutPropertyCache->iDirections, aStates, level ); DisableStatePropertyL( - aNode, aPseudoClass, CXnNode::PositionL, + aNode, aPseudoClass, &CXnNode::PositionL, aLayoutPropertyCache->iPosition, aLayoutPropertyCache->iPositions, aStates, level ); DisableStatePropertyL( - aNode, aPseudoClass, CXnNode::MaxHeightL, + aNode, aPseudoClass, &CXnNode::MaxHeightL, aLayoutPropertyCache->iMaxHeight, aLayoutPropertyCache->iMaxHeights, aStates, level ); DisableStatePropertyL( - aNode, aPseudoClass, CXnNode::MinHeightL, + aNode, aPseudoClass, &CXnNode::MinHeightL, aLayoutPropertyCache->iMinHeight, aLayoutPropertyCache->iMinHeights, aStates, level ); DisableStatePropertyL( - aNode, aPseudoClass, CXnNode::MaxWidthL, + aNode, aPseudoClass, &CXnNode::MaxWidthL, aLayoutPropertyCache->iMaxWidth, aLayoutPropertyCache->iMaxWidths, aStates, level ); DisableStatePropertyL( - aNode, aPseudoClass, CXnNode::MinWidthL, + aNode, aPseudoClass, &CXnNode::MinWidthL, aLayoutPropertyCache->iMinWidth, aLayoutPropertyCache->iMinWidths, aStates, level ); DisableStatePropertyL( - aNode, aPseudoClass, CXnNode::DisplayL, + aNode, aPseudoClass, &CXnNode::DisplayL, aLayoutPropertyCache->iDisplay, aLayoutPropertyCache->iDisplays, aStates, level, ETrue ); DisableStatePropertyL( - aNode, aPseudoClass, CXnNode::VisibilityL, + aNode, aPseudoClass, &CXnNode::VisibilityL, aLayoutPropertyCache->iVisibility, aLayoutPropertyCache->iVisibilities, aStates, level ); DisableStatePropertyL( - aNode, aPseudoClass, CXnNode::LeftL, + aNode, aPseudoClass, &CXnNode::LeftL, aLayoutPropertyCache->iLeft, aLayoutPropertyCache->iLefts, aStates, level ); DisableStatePropertyL( - aNode, aPseudoClass, CXnNode::RightL, + aNode, aPseudoClass, &CXnNode::RightL, aLayoutPropertyCache->iRight, aLayoutPropertyCache->iRights, aStates, level ); DisableStatePropertyL( - aNode, aPseudoClass, CXnNode::TopL, + aNode, aPseudoClass, &CXnNode::TopL, aLayoutPropertyCache->iTop, aLayoutPropertyCache->iTops, aStates, level ); DisableStatePropertyL( - aNode, aPseudoClass, CXnNode::BottomL, + aNode, aPseudoClass, &CXnNode::BottomL, aLayoutPropertyCache->iBottom, aLayoutPropertyCache->iBottoms, aStates, level ); DisableStatePropertyL( - aNode, aPseudoClass, CXnNode::BorderLeftStyleL, + aNode, aPseudoClass, &CXnNode::BorderLeftStyleL, aLayoutPropertyCache->iBorderLeftStyle, aLayoutPropertyCache->iBorderLeftStyles, aStates, level ); DisableStatePropertyL( - aNode, aPseudoClass, CXnNode::BorderRightStyleL, + aNode, aPseudoClass, &CXnNode::BorderRightStyleL, aLayoutPropertyCache->iBorderRightStyle, aLayoutPropertyCache->iBorderRightStyles, aStates, level ); DisableStatePropertyL( - aNode, aPseudoClass, CXnNode::BorderTopStyleL, + aNode, aPseudoClass, &CXnNode::BorderTopStyleL, aLayoutPropertyCache->iBorderTopStyle, aLayoutPropertyCache->iBorderTopStyles, aStates, level ); DisableStatePropertyL( - aNode, aPseudoClass, CXnNode::BorderBottomStyleL, + aNode, aPseudoClass, &CXnNode::BorderBottomStyleL, aLayoutPropertyCache->iBorderBottomStyle, aLayoutPropertyCache->iBorderBottomStyles, aStates, level ); DisableStatePropertyL( - aNode, aPseudoClass, CXnNode::BorderStyleL, + aNode, aPseudoClass, &CXnNode::BorderStyleL, aLayoutPropertyCache->iBorderStyle, aLayoutPropertyCache->iBorderStyles, aStates, level ); DisableStatePropertyL( - aNode, aPseudoClass, CXnNode::DisplayPriorityL, + aNode, aPseudoClass, &CXnNode::DisplayPriorityL, aLayoutPropertyCache->iDisplayPriority, aLayoutPropertyCache->iDisplayPriorities, aStates, level ); DisableStatePropertyL( - aNode, aPseudoClass, CXnNode::NavIndexL, + aNode, aPseudoClass, &CXnNode::NavIndexL, aLayoutPropertyCache->iNavIndex, aLayoutPropertyCache->iNavIndexes, aStates, level ); DisableStatePropertyL( - aNode, aPseudoClass, CXnNode::ZIndexL, + aNode, aPseudoClass, &CXnNode::ZIndexL, aLayoutPropertyCache->iZIndex, aLayoutPropertyCache->iZIndexes, aStates, level ); DisableStatePropertyL( - aNode, aPseudoClass, CXnNode::BackgroundColorL, + aNode, aPseudoClass, &CXnNode::BackgroundColorL, aLayoutPropertyCache->iBackgroundColor, aLayoutPropertyCache->iBackgroundColors, aStates, level ); DisableStatePropertyL( - aNode, aPseudoClass, CXnNode::BackgroundImageL, + aNode, aPseudoClass, &CXnNode::BackgroundImageL, aLayoutPropertyCache->iBackgroundImage, aLayoutPropertyCache->iBackgroundImages, aStates, level, ETrue ); DisableStatePropertyL( - aNode, aPseudoClass, CXnNode::FocusBackgroundL, + aNode, aPseudoClass, &CXnNode::FocusBackgroundL, aLayoutPropertyCache->iFocusBackground, aLayoutPropertyCache->iFocusBackgrounds, aStates, level ); diff -r d05a55b217df -r 79311d856354 idlehomescreen/xmluirendering/uiengine/src/xnuiengineimpl.cpp --- a/idlehomescreen/xmluirendering/uiengine/src/xnuiengineimpl.cpp Wed Apr 14 15:47:59 2010 +0300 +++ b/idlehomescreen/xmluirendering/uiengine/src/xnuiengineimpl.cpp Tue Apr 27 16:26:12 2010 +0300 @@ -9117,6 +9117,8 @@ RootNode()->SetDirtyL(); ReportScreenDeviceChangeL(); + + iViewManager.OrientationChanged(); if ( !iControlAdapterList ) { diff -r d05a55b217df -r 79311d856354 idlehomescreen/xmluirendering/uiengine/src/xnviewmanager.cpp --- a/idlehomescreen/xmluirendering/uiengine/src/xnviewmanager.cpp Wed Apr 14 15:47:59 2010 +0300 +++ b/idlehomescreen/xmluirendering/uiengine/src/xnviewmanager.cpp Tue Apr 27 16:26:12 2010 +0300 @@ -27,6 +27,7 @@ #include #include #include +#include // User includes #include "xnapplication.h" @@ -325,6 +326,8 @@ iComposer = CXnComposer::NewL( *iHspsWrapper ); + iIsLandscapeOrientation = Layout_Meta_Data::IsLandscapeOrientation(); + DoRobustnessCheckL(); } @@ -866,7 +869,6 @@ if ( next.Load() == KErrNoMemory ) { next.ShowOutOfMemError(); - return; } } @@ -885,21 +887,42 @@ TInt ret( GfxTransEffect::BeginGroup() ); - CCoeControl* bg( &iAppUiAdapter.ViewAdapter().BgManager() ); + CFbsBitmap* currentBg( ActiveViewData().WallpaperImage() ); + CFbsBitmap* nextBg( next.WallpaperImage() ); - GfxTransEffect::Begin( bg, KGfxControlActionAppear ); - - GfxTransEffect::SetDemarcation( bg, bg->Position() ); - GfxTransEffect::End( bg ); + if ( currentBg || nextBg ) + { + CCoeControl* bg( &iAppUiAdapter.ViewAdapter().BgManager() ); + + if ( !currentBg && nextBg ) + { + GfxTransEffect::Begin( bg, KGfxControlActionBgAnimToImgAppear ); + } + else + { + GfxTransEffect::Begin( bg, KGfxControlActionBgImgToImgAppear ); + } + + GfxTransEffect::SetDemarcation( bg, bg->Position() ); + GfxTransEffect::End( bg ); + } - GfxTransEffect::Begin( thisView, KGfxControlActionDisappear ); + if ( iIsLandscapeOrientation ) + { + GfxTransEffect::Begin( thisView, KGfxControlActionDisappearLsc ); + GfxTransEffect::Begin( nextView, KGfxControlActionAppearLsc ); + } + else + { + GfxTransEffect::Begin( thisView, KGfxControlActionDisappearPrt ); + GfxTransEffect::Begin( nextView, KGfxControlActionAppearPrt ); + } - iAppUiAdapter.ViewAdapter().ActivateContainerL( next ); + TRAP_IGNORE( iAppUiAdapter.ViewAdapter().ActivateContainerL( next ) ); GfxTransEffect::SetDemarcation( thisView, thisView->Position() ); GfxTransEffect::End( thisView ); - - GfxTransEffect::Begin( nextView, KGfxControlActionAppear ); + GfxTransEffect::SetDemarcation( nextView, nextView->Position() ); GfxTransEffect::End( nextView ); @@ -924,7 +947,6 @@ if ( prev.Load() == KErrNoMemory ) { prev.ShowOutOfMemError(); - return; } } @@ -942,23 +964,43 @@ GfxTransEffect::Register( prevView, KGfxContextActivatePrevView ); TInt ret( GfxTransEffect::BeginGroup() ); - - CCoeControl* bg( &iAppUiAdapter.ViewAdapter().BgManager() ); + + CFbsBitmap* currentBg( ActiveViewData().WallpaperImage() ); + CFbsBitmap* prevBg( prev.WallpaperImage() ); - GfxTransEffect::Begin( bg, KGfxControlActionAppear ); - - GfxTransEffect::SetDemarcation( bg, bg->Position() ); - GfxTransEffect::End( bg ); + if ( currentBg || prevBg ) + { + CCoeControl* bg( &iAppUiAdapter.ViewAdapter().BgManager() ); + + if ( !currentBg && prevBg ) + { + GfxTransEffect::Begin( bg, KGfxControlActionBgAnimToImgAppear ); + } + else + { + GfxTransEffect::Begin( bg, KGfxControlActionBgImgToImgAppear ); + } + + GfxTransEffect::SetDemarcation( bg, bg->Position() ); + GfxTransEffect::End( bg ); + } - GfxTransEffect::Begin( thisView, KGfxControlActionDisappear ); + if ( iIsLandscapeOrientation ) + { + GfxTransEffect::Begin( thisView, KGfxControlActionDisappearLsc ); + GfxTransEffect::Begin( prevView, KGfxControlActionAppearLsc ); + } + else + { + GfxTransEffect::Begin( thisView, KGfxControlActionDisappearPrt ); + GfxTransEffect::Begin( prevView, KGfxControlActionAppearPrt ); + } - iAppUiAdapter.ViewAdapter().ActivateContainerL( prev ); + TRAP_IGNORE( iAppUiAdapter.ViewAdapter().ActivateContainerL( prev ) ); GfxTransEffect::SetDemarcation( thisView, thisView->Position() ); GfxTransEffect::End( thisView ); - - GfxTransEffect::Begin( prevView, KGfxControlActionAppear ); - + GfxTransEffect::SetDemarcation( prevView, prevView->Position() ); GfxTransEffect::End( prevView ); @@ -1772,4 +1814,12 @@ } } +// ----------------------------------------------------------------------------- +// CXnViewManager::OrientationChanged +// ----------------------------------------------------------------------------- +void CXnViewManager::OrientationChanged() + { + iIsLandscapeOrientation = Layout_Meta_Data::IsLandscapeOrientation(); + } + // End of file diff -r d05a55b217df -r 79311d856354 idlehomescreen/xmluirendering/uiengine/src/xnwallpaperview.cpp --- a/idlehomescreen/xmluirendering/uiengine/src/xnwallpaperview.cpp Wed Apr 14 15:47:59 2010 +0300 +++ b/idlehomescreen/xmluirendering/uiengine/src/xnwallpaperview.cpp Tue Apr 27 16:26:12 2010 +0300 @@ -17,6 +17,7 @@ // System includes #include +#include #include #include #include @@ -25,6 +26,7 @@ #include #include #include +#include #include // User includes @@ -46,6 +48,8 @@ _LIT8( KMulti, "multi" ); const TInt KFileArrayGranularity( 6 ); +const TInt KShortDelay = 1000; +const TInt KLongDelay = 1000 * 1000; // ============================ MEMBER FUNCTIONS =============================== @@ -78,6 +82,7 @@ BaseConstructL( R_WALLPAPER_VIEW ); iTimer = CPeriodic::NewL( CActive::EPriorityIdle ); + iViewState = EIdle; } // ----------------------------------------------------------------------------- @@ -98,7 +103,12 @@ // ----------------------------------------------------------------------------- // CXnWallpaperView::~CXnWallpaperView() - { + { + if ( iWaitDialog ) + { + TRAP_IGNORE( iWaitDialog->ProcessFinishedL(); ); + } + CCoeEnv::Static()->DeleteResourceFile( iResourceOffset ); delete iContainer; @@ -161,20 +171,17 @@ iContainer->DrawNow(); } - iData.iAppUid = aPrevViewId.iAppUid; - iData.iViewUid = aPrevViewId.iViewUid; - iData.iMultiple = EFalse; - - if ( aCustomMessage == KMulti ) - { - iData.iMultiple = ETrue; - } + iPreviousViewUid = aPrevViewId; + iMultiple = ( (aCustomMessage == KMulti) ? ETrue : EFalse ); + + iAppUi.EffectManager()->UiRendered(); + + iWaitDialog = NULL; + iViewState = EImageSelection; // Run image selection dialog asynchronously iTimer->Cancel(); - iTimer->Start( 0, 1000, TCallBack( TimerCallbackL, this ) ); - - iAppUi.EffectManager()->UiRendered(); + iTimer->Start( KShortDelay, KLongDelay, TCallBack( TimerCallback, this ) ); } // ----------------------------------------------------------------------------- @@ -183,6 +190,13 @@ // void CXnWallpaperView::DoDeactivate() { + iTimer->Cancel(); // cancel timer + + if ( iWaitDialog ) + { + TRAP_IGNORE( iWaitDialog->ProcessFinishedL(); ); + } + if ( iContainer ) { iAppUi.RemoveFromStack( iContainer ); @@ -196,7 +210,8 @@ delete iXnSpBgCleaner; iXnSpBgCleaner = NULL; } - + + iViewState = EIdle; iAppUi.EffectManager()->UiRendered(); } @@ -204,54 +219,122 @@ // CXnWallpaperView::TimerCallback // ----------------------------------------------------------------------------- // -TInt CXnWallpaperView::TimerCallbackL( TAny *aPtr ) +TInt CXnWallpaperView::TimerCallback( TAny *aPtr ) { CXnWallpaperView* self = reinterpret_cast< CXnWallpaperView* >( aPtr ); - self->iTimer->Cancel(); - - CDesCArrayFlat* files = - new (ELeave) CDesCArrayFlat( KFileArrayGranularity ); - CleanupStack::PushL( files ); - - TInt err( KErrNone ); - TBool selected( EFalse ); - - TXnWallpaperViewData& data( self->iData ); - - CXnBackgroundManager& bg( self->iAppUi.ViewAdapter().BgManager() ); - - TRAPD( fetch, selected = MGFetch::RunL( *files, EImageFile, data.iMultiple ) ); - - if ( fetch == KErrNone && selected && files->MdcaCount() > 0 ) + TRAPD( err, self->DoHandleCallBackL(); ); + if ( KErrNone != err ) { - // set wallpaper - if( files->MdcaCount() == 1 ) - { - err = bg.AddWallpaperL( files->MdcaPoint( 0 ) ); - } + // activate default view in case of any error + TVwsViewId defaultView; + if ( self->iAppUi.GetDefaultViewId( defaultView ) != KErrNone ) + { + // use default if we got wrong viewid as previous view + defaultView.iAppUid = self->iAppUi.Application()->AppDllUid(); + defaultView.iViewUid = TUid::Uid( 1 ); + } + // try activating default view + TRAP_IGNORE( self->iAppUi.ActivateViewL( defaultView ); ); } - - CleanupStack::PopAndDestroy( files ); - - if ( err == KErrCACorruptContent ) - { - //load message text - HBufC* msg = StringLoader::LoadLC( R_QTN_HS_CORRUPTED_IMAGE_NOTE ); - //ensure that dialog will not disappear immediatelly - by const. param - CAknErrorNote* dialog = new (ELeave) CAknErrorNote( true ); - CleanupStack::PushL( dialog ); - //show dialog to user and destroy it - dialog->ExecuteLD( *msg ); - CleanupStack::Pop( dialog ); - CleanupStack::PopAndDestroy( msg ); - } - - self->iAppUi.EffectManager()->BeginFullscreenEffectL( - KGfxContextCloseWallpaperView, self->iAppUi.ViewManager().ActiveViewData() ); - - self->iAppUi.ActivateViewL( TVwsViewId( data.iAppUid, data.iViewUid ) ); - return KErrNone; } +// ----------------------------------------------------------------------------- +// CXnWallpaperView::DoHandleCallBackL +// ----------------------------------------------------------------------------- +// +void CXnWallpaperView::DoHandleCallBackL() + { + iTimer->Cancel(); + + if ( iViewState == EImageSelection ) + { + CDesCArrayFlat* files = + new (ELeave) CDesCArrayFlat( KFileArrayGranularity ); + CleanupStack::PushL( files ); + + TInt err( KErrNone ); + TBool selected( EFalse ); + + CXnBackgroundManager& bg( iAppUi.ViewAdapter().BgManager() ); + + selected = MGFetch::RunL( *files, EImageFile, iMultiple ); + + if ( selected && files->MdcaCount() > 0 ) + { + // set wallpaper + if( files->MdcaCount() == 1 ) + { + TFileName fileName( files->MdcaPoint( 0 ) ); + RFs& fs = CEikonEnv::Static()->FsSession(); + if ( BaflUtils::FileExists( fs, fileName ) ) + { + // if wallpaper adding will take more than 1,5 sec waitdlg will appear + iWaitDialog = new( ELeave ) CAknWaitDialog( + reinterpret_cast( &iWaitDialog ), EFalse ); + iWaitDialog->ExecuteLD( R_CHANGE_WALLPAPER_WAIT_DIALOG ); + + // add wallpaper + err = bg.AddWallpaperL( fileName ); + + // notify waitdlg we're done. + iWaitDialog->ProcessFinishedL(); + // ProcessFinishedL() will NULL iWaitDialog + } + } + } + + CleanupStack::PopAndDestroy( files ); + + if( err == KErrTooBig || err == KErrNoMemory ) + { + ShowErrorDialogL( R_QTN_HS_TOO_BIG_IMAGE_NOTE ); + } + else if( err == KErrCancel || err == KErrCouldNotConnect ) + { + // Ignore these. + } + else if( err != KErrNone ) + { + ShowErrorDialogL( R_QTN_HS_CORRUPTED_IMAGE_NOTE ); + } + + // restart timer to deactivate view. View activation fails if + // any dialog was shown just before calling iAppUi.ActivateViewL + // specially when theme effects are on. + iViewState = EViewDeactivation; + iTimer->Start( KLongDelay, KLongDelay, TCallBack( TimerCallback, this ) ); + } + else if ( iViewState == EViewDeactivation ) + { + iAppUi.EffectManager()->BeginFullscreenEffectL( + KGfxContextCloseWallpaperView, + iAppUi.ViewManager().ActiveViewData() ); + iAppUi.ActivateViewL( iPreviousViewUid ); + } + else + { + iViewState = EIdle; + User::Leave( KErrUnknown ); + } + } + +// ----------------------------------------------------------------------------- +// CXnWallpaperView::ShowErrorDialogL +// ----------------------------------------------------------------------------- +// +void CXnWallpaperView::ShowErrorDialogL( const TInt aResourceId ) + { + //load message text + HBufC* msg = StringLoader::LoadLC( aResourceId ); + //ensure that dialog will not disappear immediatelly - by const. param + CAknErrorNote* dialog = new (ELeave) CAknErrorNote( true ); + CleanupStack::PushL( dialog ); + //show dialog to user and destroy it + dialog->ExecuteLD( *msg ); + CleanupStack::Pop( dialog ); + CleanupStack::PopAndDestroy( msg ); + } + + // End of File diff -r d05a55b217df -r 79311d856354 idlehomescreen/xmluirendering/uiengine/src/xnwallpaperview.rss --- a/idlehomescreen/xmluirendering/uiengine/src/xnwallpaperview.rss Wed Apr 14 15:47:59 2010 +0300 +++ b/idlehomescreen/xmluirendering/uiengine/src/xnwallpaperview.rss Tue Apr 27 16:26:12 2010 +0300 @@ -54,4 +54,39 @@ buf = qtn_hs_corrupted_image_note; } +// ---------------------------------------------------- +// r_qtn_hs_too_big_image_note +// +// ---------------------------------------------------- +// +RESOURCE TBUF r_qtn_hs_too_big_image_note + { + buf = qtn_hs_too_big_image_note; + } + +// ---------------------------------------------------- +// r_change_wallpaper_wait_dialog +// +// ---------------------------------------------------- +// +RESOURCE DIALOG r_change_wallpaper_wait_dialog + { + flags = EAknWaitNoteFlags; + buttons = R_AVKON_SOFTKEYS_EMPTY; + items = + { + DLG_LINE + { + type = EAknCtNote; + id = EGeneralNote; + control= AVKON_NOTE + { + layout = EWaitLayout; + singular_label = qtn_gen_note_processing; + animation = R_QGN_GRAF_WAIT_BAR_ANIM; + }; + } + }; + } + // End of file diff -r d05a55b217df -r 79311d856354 idlehomescreen/xmluirendering/uiengine/src/xnwidgetextensionadapter.cpp --- a/idlehomescreen/xmluirendering/uiengine/src/xnwidgetextensionadapter.cpp Wed Apr 14 15:47:59 2010 +0300 +++ b/idlehomescreen/xmluirendering/uiengine/src/xnwidgetextensionadapter.cpp Tue Apr 27 16:26:12 2010 +0300 @@ -21,6 +21,7 @@ #include #include #include +#include // User includes #include "xnwidgetextensionadapter.h" @@ -708,6 +709,11 @@ DrawableWindow()->FadeBehind( ETrue ); } } + + else if( iPopup && aType == KAknSplitInputDisabled ) + { + HidePopupL(); + } } // End of File diff -r d05a55b217df -r 79311d856354 menufw/hierarchynavigator/hnmetadatamodel/inc/hnmdvaluetext.h --- a/menufw/hierarchynavigator/hnmetadatamodel/inc/hnmdvaluetext.h Wed Apr 14 15:47:59 2010 +0300 +++ b/menufw/hierarchynavigator/hnmetadatamodel/inc/hnmdvaluetext.h Tue Apr 27 16:26:12 2010 +0300 @@ -29,7 +29,6 @@ struct THnMdCommonPointers; class CDesC16Array; class CDesC8Array; -class CArrayFix; // CLASS DECLARATION diff -r d05a55b217df -r 79311d856354 menufw/menufwui/matrixmenu/inc/mmappui.h --- a/menufw/menufwui/matrixmenu/inc/mmappui.h Wed Apr 14 15:47:59 2010 +0300 +++ b/menufw/menufwui/matrixmenu/inc/mmappui.h Tue Apr 27 16:26:12 2010 +0300 @@ -71,35 +71,35 @@ */ NONSHARABLE_CLASS(CMmAppUi) : public CAknAppUi, public MHnControllerInterface, - public MAknToolbarObserver, + public MAknToolbarObserver, public MMmWidgetObserver, public MMmActionRequest, public MAknsSkinChangeObserver - { + { public: - /** - * 2nd phase constructor. - * - * @since S60 v5.0 - */ - void ConstructL(); + /** + * 2nd phase constructor. + * + * @since S60 v5.0 + */ + void ConstructL(); - /** - * C++ default constructor. This needs to be public due to - * the way the framework constructs the AppUi. - * - * @since S60 v5.0 - */ - CMmAppUi(); + /** + * C++ default constructor. This needs to be public due to + * the way the framework constructs the AppUi. + * + * @since S60 v5.0 + */ + CMmAppUi(); - /** - * Virtual Destructor. - * - * @since S60 v5.0 - */ - ~CMmAppUi(); + /** + * Virtual Destructor. + * + * @since S60 v5.0 + */ + ~CMmAppUi(); // from base class CEikAppUi @@ -124,9 +124,9 @@ * @param aDocumentName Not used by this app. * @param aTail Command line tail. */ - TBool ProcessCommandParametersL( TApaCommand aCommand, - TFileName& aDocumentName, - const TDesC8& aTail ); + TBool ProcessCommandParametersL( TApaCommand aCommand, + TFileName& aDocumentName, + const TDesC8& aTail ); /** * From CAknAppUi. @@ -138,7 +138,7 @@ */ void ProcessCommandL(TInt aCommand); - /** + /** * From CEikAppUi. * Takes care of Command Line tail handling. * @@ -146,9 +146,9 @@ * @param aUid UID of the message. * @param aParams Message params. */ - void ProcessMessageL( TUid aUid, const TDesC8& aParams ); + void ProcessMessageL( TUid aUid, const TDesC8& aParams ); - /** + /** * From MCoeMessageObserver. * Handles window server messages. * @@ -163,7 +163,7 @@ TUid aMessageUid, const TDesC8& aMessageParameters ); - /** + /** * From MEikMenuObserver (CEikAppUi). * Handles dynamic menu pane initialization. * @@ -339,6 +339,17 @@ void SkinPackageChanged( const TAknsSkinStatusPackageChangeReason aReason ); + /** + * From MMmDragAndDropObserver. + * Method is invoked on the observer, when the move item event is needed. + * + * @since S60 v5.0 + * @param aRecipientId Index of item on which the move event invokes. + * @param aEventParameters Event parameters. + */ + void HandleTriggerMoveItemL( const TInt aRecipientId, + CLiwGenericParamList* aEventParameters ); + private: /** @@ -379,29 +390,29 @@ }; /** - * Indicates if edit mode is on. - * - * @since S60 v5.0 - * @return Returns edit mode status. - */ + * Indicates if edit mode is on. + * + * @since S60 v5.0 + * @return Returns edit mode status. + */ TBool IsEditMode(); /** - * Adjusts highlight when entering or leaving edit mode. - * - * @since S60 v5.0 - * @param aOriginalHighlight Highlight that would normally be set - * @return A modified value of highlight - */ + * Adjusts highlight when entering or leaving edit mode. + * + * @since S60 v5.0 + * @param aOriginalHighlight Highlight that would normally be set + * @return A modified value of highlight + */ TInt AdjustEditModeHighlightL( TInt aOriginalHighlight ); /** - * Manages the container lookup. - * - * @since S60 v5.0 - * @return Pointer to the container to be loaded, of NULL - * if a new container should be created. - */ + * Manages the container lookup. + * + * @since S60 v5.0 + * @return Pointer to the container to be loaded, of NULL + * if a new container should be created. + */ CMmWidgetContainer* GetAppropriateContainerToLoadL(); /** @@ -426,16 +437,16 @@ // from base class CEikAppUi - /** - * From CEikAppUi. - * Takes care of command handling. - * - * @since S60 v5.0 - * @param aCommand Command to be handled. - */ - void HandleCommandL( TInt aCommand ); + /** + * From CEikAppUi. + * Takes care of command handling. + * + * @since S60 v5.0 + * @param aCommand Command to be handled. + */ + void HandleCommandL( TInt aCommand ); - /** + /** * From CEikAppUi. * Handles Window Server events. * @@ -445,18 +456,18 @@ */ void HandleWsEventL( const TWsEvent& aEvent, CCoeControl* aDestination ); - /** + /** * Indicates if root (main) view is displayed. * * @since S60 v5.0 * @return ETrue if root displayed, EFalse otherwise. */ - TBool IsRootdisplayedL(); + TBool IsRootdisplayedL(); - /** - * Handles pen down events for an item. - * - * @since S60 v5.0 + /** + * Handles pen down events for an item. + * + * @since S60 v5.0 * @param aIndex Item index. */ void HandleHighlightItemPenDownL( TInt aIndex ); @@ -513,12 +524,12 @@ */ void InsertL(); - /** + /** * Handles the "Back" softkey event. * * @since S60 v5.0 */ - void HandleBackCommandL(); + void HandleBackCommandL(); /** * Refreshes toolbar. @@ -732,7 +743,7 @@ * @since S60 v5.0 */ void StartLayoutSwitchFullScreen( TInt aKastorEffect - = AknTransEffect::ELayoutSwitchStart); + = AknTransEffect::ELayoutSwitchStart); /** * Ends fullscreen @@ -932,7 +943,7 @@ */ CMMExtensionManager* iMmExtManager; - /** + /** * Screen state. */ TBool iScreenOn; @@ -1000,11 +1011,11 @@ */ TBool iHasFocus; - /** + /** * ETrue if Matrix is hidden from TS which is used on startup. */ - TBool isHiddenFromFS; - + TBool isHiddenFromFS; + /** * Own. * Popup menu displayed after long tap. diff -r d05a55b217df -r 79311d856354 menufw/menufwui/matrixmenu/src/mmappui.cpp --- a/menufw/menufwui/matrixmenu/src/mmappui.cpp Wed Apr 14 15:47:59 2010 +0300 +++ b/menufw/menufwui/matrixmenu/src/mmappui.cpp Tue Apr 27 16:26:12 2010 +0300 @@ -12,8 +12,8 @@ * Contributors: * * Description: Application UI class -* Version : %version: MM_176.1.28.1.67 % << Don't touch! Updated by Synergy at check-out. -* Version : %version: MM_176.1.28.1.67 % << Don't touch! Updated by Synergy at check-out. +* Version : %version: MM_176.1.28.1.69 % << Don't touch! Updated by Synergy at check-out. +* Version : %version: MM_176.1.28.1.69 % << Don't touch! Updated by Synergy at check-out. * */ @@ -93,7 +93,7 @@ iEikonEnv->SetSystem( ETrue ); TInt appUiFlags = AknLayoutUtils::PenEnabled() ? - EAknEnableSkin | EAknSingleClickCompatible : + EAknEnableSkin | EAknSingleClickCompatible : EAknEnableSkin | EAknEnableMSK; BaseConstructL( appUiFlags ); //hide Menu from TS at startup @@ -213,11 +213,17 @@ iIsKastorEffectStarted = ETrue; TInt lastItemIndex = iCurrentContainer->NumberOfItems() - 1; - if ( lastItemIndex >= 0 && iCurrentContainer->ItemIsFullyVisible( lastItemIndex ) && - !iCurrentContainer->IsHighlightVisible() ) - { - iCurrentContainer->SetManualHighlightL( lastItemIndex, EFalse ); - } + if ( lastItemIndex >= 0 && iCurrentContainer->ItemIsFullyVisible( lastItemIndex ) + && !iCurrentContainer->IsHighlightVisible() ) + { + iCurrentContainer->SetManualHighlightL( lastItemIndex, EFalse ); + } +/* else if( !iCurrentContainer->IsHighlightVisible() + && iCurrentContainer->Widget()->TopItemIndex() > -1) + { + iCurrentContainer->SetManualHighlightL( + iCurrentContainer->Widget()->TopItemIndex(), EFalse ); + } */ iCurrentContainer->SetRect( ClientRect() ); iDummyContainer->SetRect( ClientRect() ); @@ -301,9 +307,9 @@ } if ( iCurrentContainer ) - { - iCurrentContainer->EndLongTapL(); - } + { + iCurrentContainer->EndLongTapL(); + } } // --------------------------------------------------------------------------- @@ -322,18 +328,18 @@ if( !aParams.Compare( KNullDesC8 ) ) { if ( !iAppkeyHandler->IsActive() ) - { + { //make dummy container visible when returning //to menu by AppKey - iDummyContainer->MakeVisible( ETrue ); + iDummyContainer->MakeVisible( ETrue ); RefreshUiPanesL( ETrue ); iCurrentContainer->MakeVisible( EFalse ); iDummyContainer->DrawNow(); CleanupForExitL( EExitKeyApplication ); - User::LeaveIfError( iCoeEnv->WsSession().SetWindowGroupOrdinalPosition( - CEikonEnv::Static()->RootWin().Identifier(), 0 ) ); - iAppkeyHandler->StartL(); - } + User::LeaveIfError( iCoeEnv->WsSession().SetWindowGroupOrdinalPosition( + CEikonEnv::Static()->RootWin().Identifier(), 0 ) ); + iAppkeyHandler->StartL(); + } } // first refresh model, show afterwords @@ -627,61 +633,61 @@ // --------------------------------------------------------------------------- // TInt CMmAppUi::GetKastorEffectL( CHnItemModel* aItemModel ) - { - TInt effect( AknTransEffect::ENone ); + { + TInt effect( AknTransEffect::ENone ); if ((IsEditMode() || iEditModeStatus == ETransitionFromEditMode) && !AknLayoutUtils::PenEnabled()) { return effect; } - switch( aItemModel->GetItemType() ) - { - case EItemTypeApplication: - { - if( !IsEditMode() && !aItemModel->IsDrmExpired() ) - { - if( aItemModel->IsRunning() ) - { - effect = AknTransEffect::EApplicationStartSwitchRect; - } - else - { - effect = AknTransEffect::EApplicationStartRect; - } - } - break; - } - case EItemTypeSuite: - { - if( !IsEditMode() ) - { - effect = EMenuOpenFolderEffect; - iIsKastorEffectStarted = ETrue; - } - break; - } - case EItemTypeParentFolder: - { + switch( aItemModel->GetItemType() ) + { + case EItemTypeApplication: + { + if( !IsEditMode() && !aItemModel->IsDrmExpired() ) + { + if( aItemModel->IsRunning() ) + { + effect = AknTransEffect::EApplicationStartSwitchRect; + } + else + { + effect = AknTransEffect::EApplicationStartRect; + } + } + break; + } + case EItemTypeSuite: + { + if( !IsEditMode() ) + { + effect = EMenuOpenFolderEffect; + iIsKastorEffectStarted = ETrue; + } + break; + } + case EItemTypeParentFolder: + { effect = EMenuCloseFolderEffect; iIsKastorEffectStarted = ETrue; - break; - } - case EItemTypeFolder: - { - if (!(IsEditMode() && aItemModel->IsDeleteLocked())) + break; + } + case EItemTypeFolder: + { + if (!(IsEditMode() && aItemModel->IsDeleteLocked())) { effect = EMenuOpenFolderEffect; iIsKastorEffectStarted = ETrue; } - break; - } - case EItemTypeUnknown: - default: - { - effect = AknTransEffect::ENone; - break; - } - } + break; + } + case EItemTypeUnknown: + default: + { + effect = AknTransEffect::ENone; + break; + } + } return effect; } @@ -961,7 +967,7 @@ IsEditMode() && !Layout_Meta_Data::IsPenEnabled() ) { DEBUG(("_Mm_:CMmAppUi::HandleKeyPressedL - enter in edit mode")); - HandleCommandL( EAknSoftkeyOk ); + HandleCommandL( EAknSoftkeyOk ); resp = EKeyWasConsumed; } @@ -1070,29 +1076,29 @@ void CMmAppUi::HandleDragStopL( TInt aModelItemIndex ) { MMPERF(("CMmAppUi::HandleDragStopL - START")); - if ( IsEditMode() ) + if( IsEditMode() ) { TInt itemId = iCurrentSuiteModel->IdByIndex( aModelItemIndex ); TMcsItemType typeCurr = iCurrentSuiteModel->GetItemType( aModelItemIndex ); TBool isOverFolder = ( AknLayoutUtils::PenEnabled() && ( typeCurr == EItemTypeParentFolder || typeCurr == EItemTypeFolder ) ); - TBool isDeleteLocked = (itemId != KErrNotFound) ? - iCurrentSuiteModel->GetItemModel( itemId )->IsDeleteLocked(): - EFalse; + TBool isDeleteLocked = (itemId != KErrNotFound) + ? iCurrentSuiteModel->GetItemModel( itemId )->IsDeleteLocked() + : EFalse; - TBuf8< KMaxLength > beforeCustomId; + TBuf8 beforeCustomId; beforeCustomId.Num( KErrNotFound ); - if ( aModelItemIndex + 1 < iCurrentContainer->NumberOfItems() ) + if( aModelItemIndex + 1 < iCurrentContainer->NumberOfItems() ) { beforeCustomId.Num( iCurrentSuiteModel->GetItemModel( iCurrentSuiteModel->IdByIndex( aModelItemIndex + 1 ) )->CustomId() ); } - TBuf8< KMaxLength > draggedCustomId; + TBuf8 draggedCustomId; draggedCustomId.Num( KErrNotFound ); CHnItemModel* draggedModel = iCurrentSuiteModel->GetItemModel( iIdDragged ); - if (draggedModel) + if( draggedModel ) { draggedCustomId.Num( iCurrentSuiteModel->GetItemModel( iIdDragged )->CustomId() ); } @@ -1116,11 +1122,13 @@ tempKeys->ToGenericParamListL( *eventParameters ); CleanupStack::PopAndDestroy( tempKeys ); - if ( iIdDragged != itemId - && isOverFolder && !isDeleteLocked) + TBool allowMoveInto = iCurrentContainer->AllowMove(); + + if( iIdDragged != itemId && isOverFolder && !isDeleteLocked + && allowMoveInto ) { iCurrentSuiteModel->RemoveItemL( iIdDragged ); - if ( iItemDragged < aModelItemIndex ) + if( iItemDragged < aModelItemIndex ) { // indices of all items after iItemDragged have been // decreased when the dragged item got removed from the @@ -1136,30 +1144,30 @@ iHNInterface->TriggerHnEventL( KKeyIdMoveInto, itemId, eventParameters ); iMakeHightlightedItemFullyVisible = ETrue; } - else if ( iIdDragged == itemId ) + else if( iIdDragged == itemId ) { iCurrentContainer->CancelDragL( ETrue ); - TBool result = iHNInterface->TriggerHnEventL( KKeyIdMove, itemId, eventParameters ); + iCurrentContainer->SetTriggerMoveItemL( itemId, eventParameters ); // fix for: edit->move, then LSK->Up->LSK->LSK FAST... (short options show up) - if ( result != KErrNone && !AknLayoutUtils::PenEnabled() ) - { - CLiwGenericParamList* paramList = CLiwGenericParamList::NewLC(); - TLiwGenericParam command(KHnRequest, TLiwVariant( KEvaluateMdModel)); - paramList->AppendL(command); - HandleRequestL(*paramList); - CleanupStack::PopAndDestroy(paramList); - } + if( !AknLayoutUtils::PenEnabled() ) + { + CLiwGenericParamList* paramList = CLiwGenericParamList::NewLC(); + TLiwGenericParam command(KHnRequest, TLiwVariant( KEvaluateMdModel)); + paramList->AppendL( command ); + HandleRequestL( *paramList ); + CleanupStack::PopAndDestroy( paramList ); + } } else { iCurrentContainer->CancelDragL( ETrue ); - if (!AknLayoutUtils::PenEnabled()) + if( !AknLayoutUtils::PenEnabled() ) { CLiwGenericParamList* paramList = CLiwGenericParamList::NewLC(); TLiwGenericParam command(KHnRequest, TLiwVariant( KEvaluateMdModel)); - paramList->AppendL(command); - HandleRequestL(*paramList); - CleanupStack::PopAndDestroy(paramList); + paramList->AppendL( command ); + HandleRequestL( *paramList ); + CleanupStack::PopAndDestroy( paramList ); } } @@ -1213,9 +1221,9 @@ HandleHighlightItemSingleClickedL( iCurrentContainer->Widget()->CurrentItemIndex() ); } else if ( aEventType == MEikListBoxObserver::EEventPanningStarted ) - { - iKeyClickLocked = ETrue; - } + { + iKeyClickLocked = ETrue; + } DEBUG(("_Mm_:CMmAppUi::HandleListBoxEventL OUT")); } @@ -1225,13 +1233,13 @@ // --------------------------------------------------------------------------- // void CMmAppUi::HandleLongTapEventL( const TPoint& aPenEventLocation ) - { + { TBool popupMenuDisplayed(EFalse); - if (iPopupMenu) - { - delete iPopupMenu; - iPopupMenu = NULL; - } + if (iPopupMenu) + { + delete iPopupMenu; + iPopupMenu = NULL; + } iPopupMenu = CAknStylusPopUpMenu::NewL(this,aPenEventLocation); if ( AknLayoutUtils::LayoutMirrored() ) @@ -1246,71 +1254,71 @@ } if( iCurrentSuiteModel == iHNInterface->GetLastSuiteModelL() - && iCurrentContainer->IsHighlightVisible() - && iCurrentContainer->GetSuiteModelL()->GetItemModelsCount() > 1 ) - { - MMPERF(("CMmAppUi::DynInitMenuPaneL - START")); - //fill the main menu structure, look for cascade menus - //reset the helper hash map - iCascadeMenuMap.Close(); + && iCurrentContainer->IsHighlightVisible() + && iCurrentContainer->GetSuiteModelL()->GetItemModelsCount() > 1 ) + { + MMPERF(("CMmAppUi::DynInitMenuPaneL - START")); + //fill the main menu structure, look for cascade menus + //reset the helper hash map + iCascadeMenuMap.Close(); - MHnMenuItemModelIterator* menuIterator = - iCurrentSuiteModel->GetMenuStructureL( - iCurrentSuiteModel->IdByIndex( - iCurrentContainer->GetHighlight() ) ); + MHnMenuItemModelIterator* menuIterator = + iCurrentSuiteModel->GetMenuStructureL( + iCurrentSuiteModel->IdByIndex( + iCurrentContainer->GetHighlight() ) ); - // check if there is a menu structure available - // for the specified item - if ( menuIterator ) - { - //create item sorting helper objects - RArray positionArray; - CleanupClosePushL( positionArray ); - RHashMap menuItemMap; - CleanupClosePushL( menuItemMap ); + // check if there is a menu structure available + // for the specified item + if ( menuIterator ) + { + //create item sorting helper objects + RArray positionArray; + CleanupClosePushL( positionArray ); + RHashMap menuItemMap; + CleanupClosePushL( menuItemMap ); while ( menuIterator->HasNextSpecific() ) { CHnMenuItemModel* childItem = menuIterator->GetNextSpecific(); - CEikMenuPaneItem::SData childData; - childData.iCommandId = childItem->Command(); - childData.iText = childItem->NameL(). - Left( CEikMenuPaneItem::SData::ENominalTextLength ); - childData.iFlags = 0; - childData.iCascadeId = 0; + CEikMenuPaneItem::SData childData; + childData.iCommandId = childItem->Command(); + childData.iText = childItem->NameL(). + Left( CEikMenuPaneItem::SData::ENominalTextLength ); + childData.iFlags = 0; + childData.iCascadeId = 0; - positionArray.AppendL( childItem->Position() ); - menuItemMap.InsertL( childItem->Position(), childData ); + positionArray.AppendL( childItem->Position() ); + menuItemMap.InsertL( childItem->Position(), childData ); } - positionArray.Sort(); + positionArray.Sort(); - //add items in correct order - for ( TInt i = 0; i < positionArray.Count(); ++i ) - { - iPopupMenu-> - AddMenuItemL( - menuItemMap.FindL( positionArray[i] ).iText, - menuItemMap.FindL( positionArray[i] ).iCommandId ); - } + //add items in correct order + for ( TInt i = 0; i < positionArray.Count(); ++i ) + { + iPopupMenu-> + AddMenuItemL( + menuItemMap.FindL( positionArray[i] ).iText, + menuItemMap.FindL( positionArray[i] ).iCommandId ); + } - if (positionArray.Count()>0) - { - iPopupMenu->ShowMenu(); - popupMenuDisplayed = ETrue; - } - CleanupStack::PopAndDestroy( &menuItemMap ); - CleanupStack::PopAndDestroy( &positionArray ); - } - MMPERF(("CMmAppUi::DynInitMenuPaneL - STOP")); - } + if (positionArray.Count()>0) + { + iPopupMenu->ShowMenu(); + popupMenuDisplayed = ETrue; + } + CleanupStack::PopAndDestroy( &menuItemMap ); + CleanupStack::PopAndDestroy( &positionArray ); + } + MMPERF(("CMmAppUi::DynInitMenuPaneL - STOP")); + } - if ( !popupMenuDisplayed && iCurrentContainer ) - { - iCurrentContainer->EndLongTapL( ETrue ); - HandleHighlightItemSingleClickedL( - iCurrentContainer->Widget()->CurrentItemIndex() ); - } + if ( !popupMenuDisplayed && iCurrentContainer ) + { + iCurrentContainer->EndLongTapL( ETrue ); + HandleHighlightItemSingleClickedL( + iCurrentContainer->Widget()->CurrentItemIndex() ); + } } // --------------------------------------------------------------------------- @@ -1320,7 +1328,7 @@ void CMmAppUi::HandleHighlightItemDoubleClickedL( TInt aIndex ) { if ( iKeyClickLocked ) - return; + return; if ( iCurrentSuiteModel->WidgetType() == EListWidget && iCurrentContainer->GetPreviousHighlight() == aIndex ) @@ -1439,9 +1447,9 @@ RefreshCbaL(); iGarbage.ResetAndDestroy(); ResetContainerMap(); - iCurrentSuiteModel = NULL; - iCurrentContainer = NULL; - } + iCurrentSuiteModel = NULL; + iCurrentContainer = NULL; + } TRAPD( err, iHNInterface->LoadSuitesFromUriL( aMessage ) ); @@ -1476,23 +1484,23 @@ { TInt itemId( KErrNotFound ); TBool suiteModelHasItems = iCurrentContainer->GetSuiteModelL()->GetItemModelsCount() > 1; - TBool highlightVisible = iCurrentContainer->IsHighlightVisible(); - if ( !highlightVisible && suiteModelHasItems ) - { + TBool highlightVisible = iCurrentContainer->IsHighlightVisible(); + if ( !highlightVisible && suiteModelHasItems ) + { // if there is no highlight, but there are items, show menuitems for logically // current suite highlight fetched from suite model. - TInt suiteHighlight = iCurrentSuiteModel->GetSuiteHighlight(); - ASSERT( suiteHighlight != KErrNotFound ); - itemId = iCurrentSuiteModel->IdByIndex( suiteHighlight ); - ignoreItemSpecific = ETrue; - } - else - { - TBool idByContainer = highlightVisible && suiteModelHasItems; - itemId = idByContainer ? - iCurrentSuiteModel->IdByIndex( iCurrentContainer->GetHighlight() ) : - iCurrentSuiteModel->IdByIndex( KErrNotFound ); - } + TInt suiteHighlight = iCurrentSuiteModel->GetSuiteHighlight(); + ASSERT( suiteHighlight != KErrNotFound ); + itemId = iCurrentSuiteModel->IdByIndex( suiteHighlight ); + ignoreItemSpecific = ETrue; + } + else + { + TBool idByContainer = highlightVisible && suiteModelHasItems; + itemId = idByContainer ? + iCurrentSuiteModel->IdByIndex( iCurrentContainer->GetHighlight() ) : + iCurrentSuiteModel->IdByIndex( KErrNotFound ); + } menuIterator = iCurrentSuiteModel->GetMenuStructureL( itemId ); } @@ -1524,42 +1532,42 @@ { CHnMenuItemModel* menuItem = menuIterator->GetNext(); if ( (menuItem->MenuItemType() == CHnMenuItemModel::EItemApplication) || !ignoreItemSpecific ) - { - CEikMenuPaneItem::SData menuData; - menuData.iCommandId = menuItem->Command(); - menuData.iText = menuItem->NameL(). - Left( CEikMenuPaneItem::SData::ENominalTextLength ); - menuData.iFlags = 0; + { + CEikMenuPaneItem::SData menuData; + menuData.iCommandId = menuItem->Command(); + menuData.iText = menuItem->NameL(). + Left( CEikMenuPaneItem::SData::ENominalTextLength ); + menuData.iFlags = 0; - //check for children - MHnMenuItemModelIterator* childIterator = - menuItem->GetMenuStructure(); - if ( childIterator->HasNext() ) - { - //this is a cascade item - //one menu item can contain only one cascade menu - //check if there are available cascade menu containers - TInt freeResource = GetNextCascadeMenuResourceId(); - if ( freeResource != KErrNotFound ) - { - //error checking - if( !iCascadeMenuMap.Insert( freeResource, - childIterator ) ) - { - //add item only if there is an - //available resource - menuData.iCascadeId = freeResource; - } - } - } - else - { - //normal entry - menuData.iCascadeId = 0; - } - positionArray.AppendL( menuItem->Position() ); - menuItemMap.InsertL( menuItem->Position(), menuData ); - } + //check for children + MHnMenuItemModelIterator* childIterator = + menuItem->GetMenuStructure(); + if ( childIterator->HasNext() ) + { + //this is a cascade item + //one menu item can contain only one cascade menu + //check if there are available cascade menu containers + TInt freeResource = GetNextCascadeMenuResourceId(); + if ( freeResource != KErrNotFound ) + { + //error checking + if( !iCascadeMenuMap.Insert( freeResource, + childIterator ) ) + { + //add item only if there is an + //available resource + menuData.iCascadeId = freeResource; + } + } + } + else + { + //normal entry + menuData.iCascadeId = 0; + } + positionArray.AppendL( menuItem->Position() ); + menuItemMap.InsertL( menuItem->Position(), menuData ); + } } aMenuPane->Reset(); @@ -1803,10 +1811,10 @@ // grid and list views but no highlight should be visible // after opening a folder. TBool highlightVisibleBefore = - iCurrentContainer && - aWidgetContainer && - iCurrentContainer->IsHighlightVisible() && - iCurrentContainer->WidgetType() != aWidgetContainer->WidgetType(); + iCurrentContainer && + aWidgetContainer && + iCurrentContainer->IsHighlightVisible() && + iCurrentContainer->WidgetType() != aWidgetContainer->WidgetType(); HandleWidgetChangeRefreshL( aWidgetContainer ); @@ -2034,8 +2042,8 @@ // --------------------------------------------------------------------------- // void CMmAppUi::SetEditModeL( TBool aIsEditMode ) - { - MMPERF(("CMmAppUi::SetEditModeL %d - START",aIsEditMode)); + { + MMPERF(("CMmAppUi::SetEditModeL %d - START",aIsEditMode)); if ( IsEditMode() != aIsEditMode && iCurrentSuiteModel ) { @@ -2046,20 +2054,20 @@ iCurrentContainer->StopMovingL(); if ( aIsEditMode ) - { - iEditModeStatus = ETransitionToEditMode; - } + { + iEditModeStatus = ETransitionToEditMode; + } else - { - if ( iEditModeStatus == ETransitionToEditMode ) - { - iEditModeStatus = EFastTransitionFromEditMode; - } - else - { - iEditModeStatus = ETransitionFromEditMode; - } - } + { + if ( iEditModeStatus == ETransitionToEditMode ) + { + iEditModeStatus = EFastTransitionFromEditMode; + } + else + { + iEditModeStatus = ETransitionFromEditMode; + } + } HandleHighlightOffsetL( aIsEditMode ? EOffsetNext : EOffsetPrevious ); iCurrentSuiteModel->SetSuiteHighlightL( @@ -2109,7 +2117,7 @@ TEventCode type = static_cast< TEventCode >( aEvent.Type() ); if ( ( type == EEventFocusLost || type == KAknFullOrPartialForegroundLost ) - && iCurrentContainer ) + && iCurrentContainer ) { iCurrentContainer->CacheWidgetPosition(); } @@ -2131,8 +2139,8 @@ HandleFocusGainedL(); } else if ( type == EEventFocusLost ) - { - HandleFocusLostL(); + { + HandleFocusLostL(); } else if ( type == KAknFullOrPartialForegroundGained ) { @@ -2235,8 +2243,8 @@ } break; case ESuiteItemsUpdated: - { - ClearTransitionFromEditModeFlag(); + { + ClearTransitionFromEditModeFlag(); iCurrentContainer->DrawView(); } break; @@ -2258,13 +2266,13 @@ // --------------------------------------------------------------------------- // void CMmAppUi::ClearTransitionFromEditModeFlag() - { - if ( iEditModeStatus == ETransitionFromEditMode || - iEditModeStatus == EFastTransitionFromEditMode ) - { - iEditModeStatus = ENoEditMode; - } - } + { + if ( iEditModeStatus == ETransitionFromEditMode || + iEditModeStatus == EFastTransitionFromEditMode ) + { + iEditModeStatus = ENoEditMode; + } + } // --------------------------------------------------------------------------- // @@ -2373,7 +2381,7 @@ ShowSuiteL(); iGarbage.ResetAndDestroy(); - if ( iEditModeStatus == ETransitionToEditMode ) + if ( iEditModeStatus == ETransitionToEditMode ) { iEditModeStatus = EEditMode; } @@ -2500,8 +2508,8 @@ DEBUG(("\t_Mm_:Top item index reset")); iCurrentContainer->ResetWidgetPosition(); iCurrentContainer->Widget()->UpdateScrollBarsL(); - iCurrentContainer->MakeVisible( ETrue ); - iCurrentContainer->DrawNow(); + iCurrentContainer->MakeVisible( ETrue ); + iCurrentContainer->DrawNow(); } } @@ -2516,7 +2524,7 @@ { TInt appToShowUid(0); TInt idleid(0); - if (aExitType == EExitToIdle) + if (aExitType == EExitToIdle || aExitType == EExitToPhone) { User::LeaveIfError(RProperty::Get(KPSUidAiInformation, KActiveIdleUid, appToShowUid)); @@ -2655,37 +2663,37 @@ { DEBUG(("_Mm_:CMmAppUi::SetMiddleSoftKeyL - IN")); if ( iCurrentSuiteModel && !AknLayoutUtils::PenEnabled() && !IsEditMode() ) - { - DEBUG(("\t_Mm_:suite highlight: %d", - iCurrentSuiteModel->GetSuiteHighlight())); + { + DEBUG(("\t_Mm_:suite highlight: %d", + iCurrentSuiteModel->GetSuiteHighlight())); - TBool idByContainer = iCurrentContainer->IsHighlightVisible() && - iCurrentContainer->GetSuiteModelL()->GetItemModelsCount() > 1; - TInt itemId = idByContainer ? - iCurrentSuiteModel->IdByIndex( iCurrentContainer->GetHighlight() ) : - iCurrentSuiteModel->IdByIndex( KErrNotFound ); - CHnItemModel* itemModel = iCurrentSuiteModel->GetItemModel( itemId ); + TBool idByContainer = iCurrentContainer->IsHighlightVisible() && + iCurrentContainer->GetSuiteModelL()->GetItemModelsCount() > 1; + TInt itemId = idByContainer ? + iCurrentSuiteModel->IdByIndex( iCurrentContainer->GetHighlight() ) : + iCurrentSuiteModel->IdByIndex( KErrNotFound ); + CHnItemModel* itemModel = iCurrentSuiteModel->GetItemModel( itemId ); - CHnButtonModel* mskModel = NULL; + CHnButtonModel* mskModel = NULL; - if ( itemModel ) - { - mskModel = itemModel->GetMiddleSoftKey(); - } + if ( itemModel ) + { + mskModel = itemModel->GetMiddleSoftKey(); + } - if ( mskModel ) - { - TInt event = (mskModel->GetEventId() == KErrNotFound) ? - KKeyIdSelect : mskModel->GetEventId(); - Cba()->SetCommandL( CEikButtonGroupContainer::EMiddleSoftkeyPosition, - event, mskModel->GetButtonText()); - } - else - { - // reset to default - RefreshCbaL(); - } - } + if ( mskModel ) + { + TInt event = (mskModel->GetEventId() == KErrNotFound) ? + KKeyIdSelect : mskModel->GetEventId(); + Cba()->SetCommandL( CEikButtonGroupContainer::EMiddleSoftkeyPosition, + event, mskModel->GetButtonText()); + } + else + { + // reset to default + RefreshCbaL(); + } + } DEBUG(("_Mm_:CMmAppUi::SetMiddleSoftKeyL - OUT")); } @@ -2825,6 +2833,16 @@ // // --------------------------------------------------------------------------- // +void CMmAppUi::HandleTriggerMoveItemL( const TInt aRecipientId, + CLiwGenericParamList* aEventParameters) + { + iHNInterface->TriggerHnEventL( KKeyIdMove, aRecipientId, aEventParameters); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// void CMmAppUi::RefreshIconsL() { iSkinChangeNeeded = EFalse; @@ -2896,133 +2914,133 @@ // --------------------------------------------------------------------------- // void CMmAppUi::HandleFocusGainedL() - { - DEBUG(("_Mm_:CMmAppUi::HandleWsEventL " - "- EEventFocusGained")); + { + DEBUG(("_Mm_:CMmAppUi::HandleWsEventL " + "- EEventFocusGained")); - iHasFocus = ETrue; + iHasFocus = ETrue; // Tricky: lack of iCurrentSuiteModel indicates that suite evaluation is in // progress - do not call HandlePresentationChangeL if evalution has not // finished. - if ( iCurrentContainer && !iCurrentContainer->IsVisible() && - iCurrentSuiteModel ) - { - HandlePresentationChangeL( iCurrentContainer ); - } + if ( iCurrentContainer && !iCurrentContainer->IsVisible() && + iCurrentSuiteModel ) + { + HandlePresentationChangeL( iCurrentContainer ); + } - if ( iCurrentSuiteModel && iCurrentContainer ) - { - iDummyContainer->MakeVisible( EFalse ); - iCurrentContainer->MakeVisible( ETrue ); - iCurrentContainer->DrawNow(); - } - if( IsForeground() ) - { - RefreshUiPanesL(); - } - if ( iCurrentContainer ) - { - iCurrentContainer->SetHasFocusL( ETrue ); - } - if ( iCurrentSuiteModel ) + if ( iCurrentSuiteModel && iCurrentContainer ) + { + iDummyContainer->MakeVisible( EFalse ); + iCurrentContainer->MakeVisible( ETrue ); + iCurrentContainer->DrawNow(); + } + if( IsForeground() ) + { + RefreshUiPanesL(); + } + if ( iCurrentContainer ) + { + iCurrentContainer->SetHasFocusL( ETrue ); + } + if ( iCurrentSuiteModel ) { iCurrentSuiteModel->SetVisibleL( ETrue ); } - } + } // --------------------------------------------------------------------------- // // --------------------------------------------------------------------------- // void CMmAppUi::HandleFocusLostL() - { - DEBUG(("_Mm_:CMmAppUi::HandleWsEventL " - "- EEventFocusLost")); + { + DEBUG(("_Mm_:CMmAppUi::HandleWsEventL " + "- EEventFocusLost")); - iHasFocus = EFalse; + iHasFocus = EFalse; - if( iCurrentContainer ) - { - //This is needed in case some popup is displayed - //while touching item in grid. Highlight - //should be reset to normal then. - if( AknLayoutUtils::PenEnabled() ) - { - if( iCurrentContainer->WidgetType() == EGridWidget && !IsEditMode() ) - { - iCurrentContainer->Widget()->View()->ItemDrawer()-> - SetFlags( CListItemDrawer::EDisableHighlight ); - } - iCurrentContainer->Widget()->View()-> - ItemDrawer()->ClearFlags( CListItemDrawer::EPressedDownState ); - iCurrentContainer->Widget()->View()->DrawItem( - iCurrentContainer->Widget()->CurrentItemIndex() ) ; - } - if( IsEditMode() && iCurrentContainer->IsDraggable() ) - { - HandleDragStopL( iCurrentContainer->GetHighlight() ); - iCurrentContainer->DrawNow(); - } - iCurrentContainer->SetHasFocusL( EFalse ); - } - if ( iCurrentSuiteModel ) - { - iCurrentSuiteModel->SetVisibleL( EFalse ); - } + if( iCurrentContainer ) + { + //This is needed in case some popup is displayed + //while touching item in grid. Highlight + //should be reset to normal then. + if( AknLayoutUtils::PenEnabled() ) + { + if( iCurrentContainer->WidgetType() == EGridWidget && !IsEditMode() ) + { + iCurrentContainer->Widget()->View()->ItemDrawer()-> + SetFlags( CListItemDrawer::EDisableHighlight ); + } + iCurrentContainer->Widget()->View()-> + ItemDrawer()->ClearFlags( CListItemDrawer::EPressedDownState ); + iCurrentContainer->Widget()->View()->DrawItem( + iCurrentContainer->Widget()->CurrentItemIndex() ) ; + } + if( IsEditMode() && iCurrentContainer->IsDraggable() ) + { + HandleDragStopL( iCurrentContainer->GetHighlight() ); + iCurrentContainer->DrawNow(); + } + iCurrentContainer->SetHasFocusL( EFalse ); + } + if ( iCurrentSuiteModel ) + { + iCurrentSuiteModel->SetVisibleL( EFalse ); + } - } + } // --------------------------------------------------------------------------- // // --------------------------------------------------------------------------- // void CMmAppUi::HandleFullOrPartialForegroundGainedL() - { - DEBUG(("_Mm_:CMmAppUi::HandleWsEventL " - "- KAknFullOrPartialForegroundGained")); + { + DEBUG(("_Mm_:CMmAppUi::HandleWsEventL " + "- KAknFullOrPartialForegroundGained")); //show Menu in TS when launched for the first time if( isHiddenFromFS ) { HideApplicationFromFSW( EFalse ); isHiddenFromFS = EFalse; } - - if (iCurrentContainer && iCurrentSuiteModel ) - { - iCurrentContainer->HandleForegroundGainedL(); - iDummyContainer->MakeVisible( EFalse ); - iCurrentContainer->MakeVisible( ETrue ); - RefreshUiPanesL(); - } - if (iSkinChangeNeeded && !iSkinChangeInProgress) - { - MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance(); - if (skinInstance && !skinInstance->IsUpdateInProgress()) - { - RefreshIconsL(); - } - } - } + if (iCurrentContainer && iCurrentSuiteModel ) + { + iCurrentContainer->HandleForegroundGainedL(); + iDummyContainer->MakeVisible( EFalse ); + iCurrentContainer->MakeVisible( ETrue ); + RefreshUiPanesL(); + } + if (iSkinChangeNeeded && !iSkinChangeInProgress) + { + MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance(); + if (skinInstance && !skinInstance->IsUpdateInProgress()) + { + RefreshIconsL(); + + } + } + } // --------------------------------------------------------------------------- // // --------------------------------------------------------------------------- // void CMmAppUi::HandleFullOrPartialForegroundLostL() - { - DEBUG(("_Mm_:CMmAppUi::HandleWsEventL " - "- KAknFullOrPartialForegroundLost")); - if ( iCurrentContainer ) - { - iCurrentContainer->HandleBackgroundGainedL(); - if ( IsRootdisplayedL() ) - { - iCurrentContainer->RestoreWidgetPosition(); - iCurrentContainer->CacheWidgetPosition(); - } - } - } + { + DEBUG(("_Mm_:CMmAppUi::HandleWsEventL " + "- KAknFullOrPartialForegroundLost")); + if ( iCurrentContainer ) + { + iCurrentContainer->HandleBackgroundGainedL(); + if ( IsRootdisplayedL() ) + { + iCurrentContainer->RestoreWidgetPosition(); + iCurrentContainer->CacheWidgetPosition(); + } + } + } // End of File diff -r d05a55b217df -r 79311d856354 menufw/menufwui/mmwidgets/bwins/mmwidgetsu.def --- a/menufw/menufwui/mmwidgets/bwins/mmwidgetsu.def Wed Apr 14 15:47:59 2010 +0300 +++ b/menufw/menufwui/mmwidgets/bwins/mmwidgetsu.def Tue Apr 27 16:26:12 2010 +0300 @@ -37,4 +37,6 @@ ?CacheWidgetPosition@CMmWidgetContainer@@QAEXXZ @ 36 NONAME ; void CMmWidgetContainer::CacheWidgetPosition(void) ?SetIsFaded@CMmWidgetContainer@@QAEXH@Z @ 37 NONAME ; void CMmWidgetContainer::SetIsFaded(int) ?CancelDragL@CMmWidgetContainer@@QAEXH@Z @ 38 NONAME ; void CMmWidgetContainer::CancelDragL(int) + ?AllowMove@CMmWidgetContainer@@QBEHXZ @ 39 NONAME ; int CMmWidgetContainer::AllowMove(void) const + ?SetTriggerMoveItemL@CMmWidgetContainer@@QAEXHPAVCLiwGenericParamList@@@Z @ 40 NONAME ; void CMmWidgetContainer::SetTriggerMoveItemL(int, class CLiwGenericParamList *) diff -r d05a55b217df -r 79311d856354 menufw/menufwui/mmwidgets/eabi/mmwidgetsu.def --- a/menufw/menufwui/mmwidgets/eabi/mmwidgetsu.def Wed Apr 14 15:47:59 2010 +0300 +++ b/menufw/menufwui/mmwidgets/eabi/mmwidgetsu.def Tue Apr 27 16:26:12 2010 +0300 @@ -38,4 +38,6 @@ _ZN19CMmListBoxContainer20SetDefaultHighlightLEi @ 37 NONAME _ZThn52_N18CMmWidgetContainer23HandleBackgroundGainedLEv @ 38 NONAME _ZThn52_N18CMmWidgetContainer23HandleForegroundGainedLEv @ 39 NONAME + _ZN18CMmWidgetContainer19SetTriggerMoveItemLEiP20CLiwGenericParamList @ 40 NONAME + _ZNK18CMmWidgetContainer9AllowMoveEv @ 41 NONAME diff -r d05a55b217df -r 79311d856354 menufw/menufwui/mmwidgets/inc/mmdraganddropobserver.h --- a/menufw/menufwui/mmwidgets/inc/mmdraganddropobserver.h Wed Apr 14 15:47:59 2010 +0300 +++ b/menufw/menufwui/mmwidgets/inc/mmdraganddropobserver.h Tue Apr 27 16:26:12 2010 +0300 @@ -24,7 +24,7 @@ * Whenever a drag begins HandleDragStartL() is invoked. * When the highlight changes during drag, HandleDragOverL() is invoked. * When item is dropped, HandleDragStopL() is invoked. - * The set of the three methods fully notifies the observer about the state + * The set of the three methods fully notifies the observer about the state * of the drag. * * @code @@ -52,7 +52,7 @@ * @param aModelItemIndex Index of item that the dragged item hovers over. */ virtual void HandleDragOverL( TInt aModelItemIndex ) = 0; - + /** * Method is invoked on the observer, when the item is dropped. * @@ -60,7 +60,7 @@ * @param aModelItemIndex Index of item on which the draging stops. */ virtual void HandleDragStopL( TInt aModelItemIndex ) = 0; - + /** * Method is invoked on the observer, when the dragged item index changes. * @@ -68,7 +68,17 @@ * @param aModelItemIndex Index of item on which the draging stops. */ virtual void HandleDraggedIndexUpdatedL( TInt aModelItemIndex ) = 0; - + + /** + * Method is invoked on the observer, when the move item event is needed. + * + * @since S60 v5.0 + * @param aRecipientId Index of item on which the move event invokes. + * @param aEventParameters Event parameters. + */ + virtual void HandleTriggerMoveItemL( const TInt aRecipientId, + CLiwGenericParamList* aEventParameters) = 0; + }; - + #endif // M_MMDRAGANDDROPOBSERVER_H diff -r d05a55b217df -r 79311d856354 menufw/menufwui/mmwidgets/inc/mmdraweranimator.h --- a/menufw/menufwui/mmwidgets/inc/mmdraweranimator.h Wed Apr 14 15:47:59 2010 +0300 +++ b/menufw/menufwui/mmwidgets/inc/mmdraweranimator.h Tue Apr 27 16:26:12 2010 +0300 @@ -22,11 +22,12 @@ #include #include + #ifdef RD_UI_TRANSITION_EFFECTS_LIST #include #include #include -#endif +#endif class CMmListBoxItemDrawer; class TMmFloatingItem; @@ -56,11 +57,11 @@ */ NONSHARABLE_CLASS( CMmDrawerAnimator ) : public CActive { - + public: /** * Two-phased constructor. - * + * * @since S60 v5.0 * @param aDrawer Item drawer used to draw item. */ @@ -68,15 +69,15 @@ /** * Two-phased constructor. - * + * * @since S60 v5.0 * @param aDrawer Item drawer used to draw item. */ static CMmDrawerAnimator* NewLC( CMmListBoxItemDrawer& aDrawer ); - + /** * Destructor. - * + * * @since S60 v5.0 */ virtual ~CMmDrawerAnimator(); @@ -90,9 +91,9 @@ * @since S60 v5.0 */ void AnimateDragItemTransitionL( ); - + /** - * Animates an item with index aItemFrom into position + * Animates an item with index aItemFrom into position * indexed by aItemTo. * * @since S60 v5.0 @@ -117,14 +118,14 @@ * @return Is system ready so new animation can proceed. */ TBool IsReadyForNewAnimation(); - + /** * Cancel currently running or pending animations. * * @since S60 v5.0 */ void CancelAnimationsL(); - + /** * Triggers animation. * This methods sets the Activeobject into active state @@ -134,41 +135,39 @@ * @return Error code */ TInt Trigger(); - - /** - * Marks next redraw to be cancelled. - * - * @return Indicates if redraw occured due to cancel. - */ - TBool CancelNextRedrawL(); - + /** * Make the next animation redraw the whole screen; */ void SetNextRedrawToWholeScreen(); - + /** * Indicates that draweranimator is in garbage. - * This is used when suite model has been destroyed so there isn't - * anything to draw, therefore any animator attempts should be + * This is used when suite model has been destroyed so there isn't + * anything to draw, therefore any animator attempts should be * dropped. */ void PrepareForGarbage(); - + + /** + * Calls move event. + */ + void TriggerMoveItemL(); + private: - + /** * Default constructor. - * + * * @since S60 v3.0 * @param aDrawer Object used to draw items in widgets. */ CMmDrawerAnimator( CMmListBoxItemDrawer& aDrawer ); - + /** * 2nd phase constructor. * - * @since S60 v3.0 + * @since S60 v3.0 */ void ConstructL(); @@ -196,10 +195,10 @@ * @return Error code for error handling. */ TInt RunError( TInt aError ); - + /** * Adjusts rect to non touch. - * + * * @since S60 v3.0 * @param aRefreshRect Refresh rect. * @return Adjusted rect. @@ -207,67 +206,67 @@ TRect AdjustRefreshRectToNonTouch( const TRect& aRefreshRect ); private: // Data - + /** * Timer - */ + */ RTimer iTimer; - + /** * Associated item drawer. - */ + */ CMmListBoxItemDrawer& iDrawer; - + /** * Number of animation frames - */ + */ TInt iAnimateFrames; /** * Delay between redrawing. - */ + */ TTimeIntervalMicroSeconds iDelay; - + /** * Last redraw time - */ + */ TTime iLastRedrawTime; - + /** * Effects api. - */ + */ MAknListBoxTfx *iTransTfx; - + /** * Effects api. - */ + */ MAknListBoxTfxInternal *iTransTfxInternal; - + /** * Highlight noted when last redraw occured. */ TInt iLastNotedHighlight; - + /** * Top item index noted when last redraw occured. */ TInt iLastNotedTopItem; - + /** * Vertical offset noted when last redraw occured. */ TInt iLastNotedVerticalOffset; - + /** * Holds the previous animation refresh rectangle. */ TRect iPreviousRefreshRect; - + /** * Holds the number of frames to animate. */ const TInt iUsualAnimationFramesCount; - + /** * Holds the previous animation refresh rectangle. */ diff -r d05a55b217df -r 79311d856354 menufw/menufwui/mmwidgets/inc/mmlistboxitemdrawer.h --- a/menufw/menufwui/mmwidgets/inc/mmlistboxitemdrawer.h Wed Apr 14 15:47:59 2010 +0300 +++ b/menufw/menufwui/mmwidgets/inc/mmlistboxitemdrawer.h Tue Apr 27 16:26:12 2010 +0300 @@ -12,7 +12,7 @@ * Contributors: * * Description: CMmListBoxItemDrawer -* Version : %version: MM_38.1.16 % << Don't touch! Updated by Synergy at check-out. +* Version : %version: MM_38.1.17 % << Don't touch! Updated by Synergy at check-out. * */ @@ -238,6 +238,14 @@ void SetRedrawItemBackground( TBool aRedraw ); /** + * Sets condition if separator line should be drawn. + * + * @since S60 v3.0 + * @param aRedraw Should separator line be drawn. + */ + void SetDrawSeparatorLines( TBool aDraw ); + + /** * Checks if item background redrawing is enabled. * * @since S60 v3.0 @@ -470,12 +478,12 @@ void SetHighlightShown( TBool aDrawn ); /** - * Draws background and separator lines. + * Draws background. * * @since S60 v3.0 * @param aItemTextRect Item rectangle. */ - void DrawBackgroundAndSeparatorLines( const TRect& aItemTextRect ) const; + void DrawBackground( const TRect& aItemTextRect ) const; protected: /** @@ -800,6 +808,11 @@ TBool iRedrawBackground; /** + * Draw separators flag. + */ + TBool iDrawSeparatorLines; + + /** * Ratio of zooming animation. */ TReal iIconAnimationZoomRatio; diff -r d05a55b217df -r 79311d856354 menufw/menufwui/mmwidgets/inc/mmlistboxview.h --- a/menufw/menufwui/mmwidgets/inc/mmlistboxview.h Wed Apr 14 15:47:59 2010 +0300 +++ b/menufw/menufwui/mmwidgets/inc/mmlistboxview.h Tue Apr 27 16:26:12 2010 +0300 @@ -12,7 +12,7 @@ * Contributors: * * Description: -* Version : %version: MM_12.1.6 % << Don't touch! Updated by Synergy at check-out. +* Version : %version: MM_12.1.7 % << Don't touch! Updated by Synergy at check-out. * */ @@ -210,6 +210,13 @@ */ void DisableScrollToItem( TBool aDisable ); + /** + * Gets number of items in model. + * + * @return + */ + TInt ModelItemsCount(); + private: /** diff -r d05a55b217df -r 79311d856354 menufw/menufwui/mmwidgets/inc/mmwidgetcontainer.h --- a/menufw/menufwui/mmwidgets/inc/mmwidgetcontainer.h Wed Apr 14 15:47:59 2010 +0300 +++ b/menufw/menufwui/mmwidgets/inc/mmwidgetcontainer.h Tue Apr 27 16:26:12 2010 +0300 @@ -30,6 +30,7 @@ #include #include #include +#include #include "hnsuiteobserver.h" #include "mmvisibilityobserver.h" @@ -62,7 +63,7 @@ * @ingroup group_mmwidgets */ class TMmWidgetPosition - { + { public: /** * Default constructor. @@ -71,34 +72,34 @@ TMmWidgetPosition(); public: // data - /** - * The vertical item offset cache. - */ - TInt iVerticalItemOffset; + /** + * The vertical item offset cache. + */ + TInt iVerticalItemOffset; - /** - * The top item index cache. - */ - TInt iTopItemIndex; + /** + * The top item index cache. + */ + TInt iTopItemIndex; - /** - * Tells if the cached values are valid. - */ - TBool iValid; + /** + * Tells if the cached values are valid. + */ + TBool iValid; - /** - * The mode (portrait/landscape) for which the cache is valid. - */ - TBool iLandscape; + /** + * The mode (portrait/landscape) for which the cache is valid. + */ + TBool iLandscape; - /** - * Id from model (not index) of the currently highlighted item. - * It should only be set if the currently highlighted item is - * visible (fully or partially), otherwise it must remain - * initialized to KErrNotFound. - */ - TInt iHighlightedItemId; - }; + /** + * Id from model (not index) of the currently highlighted item. + * It should only be set if the currently highlighted item is + * visible (fully or partially), otherwise it must remain + * initialized to KErrNotFound. + */ + TInt iHighlightedItemId; + }; /** * Interface for widget containers. @@ -114,7 +115,7 @@ public MMmVisibilityObserver, public MEikListBoxObserver, public MAknLongTapDetectorCallBack - { + { public: /** @@ -142,13 +143,13 @@ public: // Highlight related methods - /** - * Sets the default highlight. - * + /** + * Sets the default highlight. + * * @since S60 v3.0 * @param aRedraw Is highlight to redraw. */ - virtual void SetDefaultHighlightL( TBool aRedraw = ETrue ) = 0; + virtual void SetDefaultHighlightL( TBool aRedraw = ETrue ) = 0; /** * Sets the highlight. @@ -157,7 +158,7 @@ * @param aItemIndex Index to set the highlight at. * @param aRedraw Is highlight to redraw. */ - IMPORT_C virtual void SetManualHighlightL(TInt aItemIndex, TBool aRedraw = ETrue ); + IMPORT_C virtual void SetManualHighlightL(TInt aItemIndex, TBool aRedraw = ETrue ); /** * Gets the highlight from the widget. @@ -165,7 +166,7 @@ * @since S60 v3.0 * @return Current Highlight in the widget. */ - IMPORT_C virtual TInt GetHighlight(); + IMPORT_C virtual TInt GetHighlight(); /** * Gets the highlight from the widget. @@ -173,7 +174,7 @@ * @since S60 v3.0 * @return Previous Highlight in the widget. */ - IMPORT_C virtual TInt GetPreviousHighlight(); + IMPORT_C virtual TInt GetPreviousHighlight(); /** * Set highlight visibility. @@ -181,22 +182,22 @@ * @since S60 v3.0 * @param aVisible Visibility status. */ - IMPORT_C virtual void SetHighlightVisibilityL( TBool aVisible ); - + IMPORT_C virtual void SetHighlightVisibilityL( TBool aVisible ); + /** * Set highlight visibility. * * @since S60 v3.0 * @return Visibility status. */ - IMPORT_C virtual TBool IsHighlightVisible(); + IMPORT_C virtual TBool IsHighlightVisible(); /** * Handle item addition. * * @since S60 v3.0 */ - IMPORT_C virtual void HandleItemAdditionL(); + IMPORT_C virtual void HandleItemAdditionL(); /** @@ -204,14 +205,14 @@ * * @since S60 v3.0 */ - IMPORT_C virtual void HandleItemRemovalL(); + IMPORT_C virtual void HandleItemRemovalL(); /** * Handle item removal. * * @since S60 v3.0 */ - IMPORT_C CHnSuiteModel* GetSuiteModelL(); + IMPORT_C CHnSuiteModel* GetSuiteModelL(); /** * Retrieve type of widget. @@ -219,40 +220,40 @@ * @since S60 v3.0 * @return Type of widget. */ - IMPORT_C virtual THnSuiteWidgetType WidgetType(); + IMPORT_C virtual THnSuiteWidgetType WidgetType(); - /** - * Removes all LIW objects owned by this object. + /** + * Removes all LIW objects owned by this object. * * LIW objects owned by non-LIW objects that are owned by * this object are also removed. - */ - virtual void RemoveLiwObjects(); + */ + virtual void RemoveLiwObjects(); - /** - * Sets the long tap observer. + /** + * Sets the long tap observer. * * @param aObserver Observer to receive long tap events. - */ - IMPORT_C virtual void SetLongTapObserver( MMmLongTapObserver* aObserver ); + */ + IMPORT_C virtual void SetLongTapObserver( MMmLongTapObserver* aObserver ); - /** - * Informs the container that long tap event is finished (e.g. because - * a command from the context menu has been issued). - * - * @param aStopTimer ETrue when the highlight timer should be stopped. - */ - IMPORT_C virtual void EndLongTapL( TBool aStopTimer = ETrue ); + /** + * Informs the container that long tap event is finished (e.g. because + * a command from the context menu has been issued). + * + * @param aStopTimer ETrue when the highlight timer should be stopped. + */ + IMPORT_C virtual void EndLongTapL( TBool aStopTimer = ETrue ); public: - /** - * Sets suite model. - * - * @since S60 v3.0 - * @param aModel Suite model. - */ - virtual void SetSuiteModelL( CHnSuiteModel* aModel ); + /** + * Sets suite model. + * + * @since S60 v3.0 + * @param aModel Suite model. + */ + virtual void SetSuiteModelL( CHnSuiteModel* aModel ); /** * Gets Multimedia Menu model. @@ -260,7 +261,7 @@ * @since S60 v3.0 * @return Model. */ - virtual CMmListBoxModel* GetMmModel() = 0; + virtual CMmListBoxModel* GetMmModel() = 0; /** * Sets widget observer. @@ -268,7 +269,7 @@ * @since S60 v3.0 * @param aObserver Widget observer. */ - IMPORT_C virtual void SetObserver( MMmWidgetObserver* aObserver); + IMPORT_C virtual void SetObserver( MMmWidgetObserver* aObserver); /** * Gets item rectangle according to item index. @@ -277,7 +278,7 @@ * @param aItemIndex Item index. * @return Item rectangle. */ - IMPORT_C TRect GetItemRectL( TInt aItemIndex ); + IMPORT_C TRect GetItemRectL( TInt aItemIndex ); /** * Sets empty text visible when model has no items. @@ -285,7 +286,7 @@ * @since S60 v3.0 * @param aText Text to be shown when view is empty. */ - virtual void SetEmptyTextL(const TDesC& aText) = 0 ; + virtual void SetEmptyTextL(const TDesC& aText) = 0 ; /** * Sets flag. @@ -293,7 +294,7 @@ * @since S60 v3.0 * @param Flag Flag. */ - virtual void SetFlag(TInt Flag); + virtual void SetFlag(TInt Flag); /** * Gets widget. @@ -301,7 +302,7 @@ * @since S60 v3.0 * @return Widget. */ - virtual CEikListBox* Widget(); + virtual CEikListBox* Widget(); /** * Sets background context for item drawer and view. @@ -309,8 +310,8 @@ * @since S60 v3.0 * @param aBgContext Background context. */ - virtual void SetItemDrawerAndViewBgContext( - CAknsBasicBackgroundControlContext * aBgContext ) =0; + virtual void SetItemDrawerAndViewBgContext( + CAknsBasicBackgroundControlContext * aBgContext ) =0; /** * Sets edit mode so UI is aware. @@ -318,7 +319,7 @@ * @since S60 v3.0 * @param aIsEditMode Is edit mode. */ - virtual void SetEditModeL( TBool aIsEditMode ); + virtual void SetEditModeL( TBool aIsEditMode ); /** * Tells if UI is aware of edit mode. @@ -326,32 +327,32 @@ * @since S60 v5.0 * @return Edit mode status. */ - virtual TBool IsEditMode() const; + virtual TBool IsEditMode() const; /** * Sets up widget layout (needed for grid). * * @since S60 v3.0 */ - virtual void SetupWidgetLayoutL() =0; + virtual void SetupWidgetLayoutL() =0; /** * Constructor. */ - CMmWidgetContainer(); + CMmWidgetContainer(); /** * Destructor. */ ~CMmWidgetContainer(); - + /** * Enables/disables animation during long tap. * Tactile feedback is also enabled and disabled with the animation. * Changes made with this method will be effective on the next long * tap, i.e. it is not possible to stop an already started animation * by using this method. - * + * * @param aEnable ETrue - enable, EFalse - disable long tap animation * and long tap tactile feedback */ @@ -404,7 +405,7 @@ * @param aPointerEvent Pointer event. */ void HandlePointerEventsInEditModeL(const TPointerEvent& aPointerEvent, - TBool aAbortAnimations ); + TBool aAbortAnimations ); /** * Set draggable. @@ -655,14 +656,38 @@ * if marquee animation can be enabled. */ IMPORT_C void SetIsFaded( TBool aIsFaded ); - + /** * Determines if long tap is in progress. - * + * * @return ETrue if long tap is in progress. */ TBool LongTapInProgress() const; + /** + * Determines if folder can be moved to another one. + */ + IMPORT_C TBool AllowMove() const; + + /** + * Sets allow move param. + * @param aAllowMove. ETrue if move item is allowed. + */ + void SetAllowMove( TBool aAllowMove ); + + /** + * Sets parameters for move event. + * @param aRecipientId Item id to be moved. + * @param aEventParameters Event parameters. + */ + IMPORT_C void SetTriggerMoveItemL( const TInt aRecipientId, + CLiwGenericParamList* aEventParameters ); + + /** + * Calls move event. + */ + void TriggerMoveItemL(); + public: // from MMmVisibilityObserver /** @@ -703,7 +728,7 @@ * * @since S60 v3.0 */ - void ConstructL(); + void ConstructL(); /** * Sets highlight locally. @@ -712,9 +737,9 @@ * @since S60 v3.0 * @param aItemIndex Index of the item. */ - void SetHighlightL(TInt aItemIndex); + void SetHighlightL(TInt aItemIndex); - /** + /** * Checks whether given point collides with specific item's re-order area. * * This function gets called during drag-and-drop operations to @@ -755,13 +780,13 @@ private: - /** - * Called when the number of items in widget model changed. - * @since S60 v5.0 - * - * @param aChange Type of change - */ - void HandleNumberOfItemsChangedL( TItemsChangeType aChange ); + /** + * Called when the number of items in widget model changed. + * @since S60 v5.0 + * + * @param aChange Type of change + */ + void HandleNumberOfItemsChangedL( TItemsChangeType aChange ); /** * Manages zooming of folder. @@ -769,7 +794,7 @@ * @since S60 v3.0 * @param aDraggedItemOverIcons Is dragged over icons flag. */ - void ManageFolderZoomingL( TBool aDraggedItemOverIcons ); + void ManageFolderZoomingL( TBool aDraggedItemOverIcons ); /** * Cancels gragging of item if relevant( Edit Mode is activated ) @@ -807,7 +832,7 @@ * @return Distance between two points in pixels. */ TInt DeltaSquare( const TPoint aTapPoint, - const TPoint aPos ); + const TPoint aPos ); /** * Checks, whether given item is a folder or root folder. @@ -817,17 +842,17 @@ TBool IsFolderL( TInt aItemIndex ); /** - * Checks, whether given item has IsDeleteLockedL flag set. - * @param aItemIndex Item index to check. - * @returns IsDeleteLockedL flag - */ - TBool IsDeleteLockedL( TInt aItemIndex ); + * Checks, whether given item has IsDeleteLockedL flag set. + * @param aItemIndex Item index to check. + * @returns IsDeleteLockedL flag + */ + TBool IsDeleteLockedL( TInt aItemIndex ); - /** - * Gets column count in current view. - * @returns Column count in current view. - */ - virtual TInt ColumnsInCurrentView(); + /** + * Gets column count in current view. + * @returns Column count in current view. + */ + virtual TInt ColumnsInCurrentView(); /** * Gets row count in current view. @@ -835,35 +860,35 @@ */ virtual TInt RowsInCurrentView(); - /** - * Scrolls the view move mode non-touch so that move indicators are visible. - */ - void ScrollViewIfNeededL(); + /** + * Scrolls the view move mode non-touch so that move indicators are visible. + */ + void ScrollViewIfNeededL(); /** * Scrolls the view in pixels. * @param aPixels THe number of pixels to scroll. If negative, the view is scrolled down. */ - void ScrollInPixelsL( TInt aPixels ); + void ScrollInPixelsL( TInt aPixels ); /** * Sets up the scrolling effect movement type. * @param aDown True if scrolling is downwards. */ - void SetupScrollingEffectsL( TBool aDown ); + void SetupScrollingEffectsL( TBool aDown ); protected: - /** - * Own. - */ - CEikListBox* iWidget; + /** + * Own. + */ + CEikListBox* iWidget; /** * Key event observer. */ - MMmKeyEventObserver* iKeyEventObserver; + MMmKeyEventObserver* iKeyEventObserver; /** * Drag and drop observer. @@ -888,24 +913,24 @@ protected: - /** - * Current Highlight. - */ - TInt iCurrentHighlight; + /** + * Current Highlight. + */ + TInt iCurrentHighlight; /** * Has drag occurred. */ TBool iDragOccured; - /** - * Processed display elelments for better performance. - */ + /** + * Processed display elelments for better performance. + */ CMmPostEvaluationProcessor* iPostProcessor; - /** - * Set when long tap is in progress (stylus popup displayed over container) - */ + /** + * Set when long tap is in progress (stylus popup displayed over container) + */ TBool iLongTapInProgress; private: @@ -915,51 +940,51 @@ * Background context. * Own. */ - CAknsBasicBackgroundControlContext* iBgContext; + CAknsBasicBackgroundControlContext* iBgContext; /** * Last drag point. */ - TPoint iLastDragPoint; + TPoint iLastDragPoint; /** * First tap point. */ - TPoint iTapPoint; + TPoint iTapPoint; /** * First tap point. */ - TPoint iItemRelativeTapPoint; + TPoint iItemRelativeTapPoint; - /** + /** * Last drag highlight. */ - TInt iLastDragHighlight; + TInt iLastDragHighlight; /** * Dragged item index. */ - TBool iDraggedIndex; + TBool iDraggedIndex; /** * Edit mode status. */ - TBool iIsEditMode; + TBool iIsEditMode; - /** + /** * Destination of item index. */ - TInt iItemIndexDestination; + TInt iItemIndexDestination; - /** + /** * Previous Highlight. */ - TInt iPreviousHighlight; + TInt iPreviousHighlight; - /** - * The current rect of the widget control. - */ + /** + * The current rect of the widget control. + */ TRect iWidgetRect; /** @@ -969,9 +994,9 @@ */ TBool iAllowLongPress; - /** - * Cache for widget position. - */ + /** + * Cache for widget position. + */ TMmWidgetPosition iWidgetPositionCache; /** @@ -1000,7 +1025,7 @@ * Observer to notify about long tap events. */ MMmLongTapObserver* iLongTapObserver; - + /** * Stores previously set highlight visibility. * ETrue - hightlight visible, EFalse - highlight disabled. @@ -1011,6 +1036,21 @@ */ TBool iPreviousHighlightVisibility; - }; + /** + * Defines if move item is allowed. + */ + TBool iAllowMove; + + /** + * Defines item id to be moved. + */ + TInt iRecipientId; + + /** + * Event parameters for move item. + */ + CLiwGenericParamList *iEventParameters; + + }; #endif // MMMWIDGETCONTAINER_H diff -r d05a55b217df -r 79311d856354 menufw/menufwui/mmwidgets/inc/mmwidgetsconstants.h --- a/menufw/menufwui/mmwidgets/inc/mmwidgetsconstants.h Wed Apr 14 15:47:59 2010 +0300 +++ b/menufw/menufwui/mmwidgets/inc/mmwidgetsconstants.h Tue Apr 27 16:26:12 2010 +0300 @@ -12,7 +12,7 @@ * Contributors: * * Description: Constants for the matrixmenu -* Version : %version: 33.1.12 % << Don't touch! Updated by Synergy at check-out. +* Version : %version: 33.1.13 % << Don't touch! Updated by Synergy at check-out. * */ @@ -27,256 +27,256 @@ * Grid constants' namespace. */ namespace MmGrid - { - /** - * X component of the 4x3 layout. - */ - const TInt K4By3LayoutX = 4; + { + /** + * X component of the 4x3 layout. + */ + const TInt K4By3LayoutX = 4; - /** - * Y component of the 4x3 layout. - */ - const TInt K4By3LayoutY = 3; + /** + * Y component of the 4x3 layout. + */ + const TInt K4By3LayoutY = 3; - /** - * X component of the 3x4 layout. - */ + /** + * X component of the 3x4 layout. + */ - const TInt K3By4LayoutX = 3; + const TInt K3By4LayoutX = 3; - /** - * Y component of the 3x4 layout. - */ - const TInt K3By4LayoutY = 4; + /** + * Y component of the 3x4 layout. + */ + const TInt K3By4LayoutY = 4; - /** - * X component of the 4x5 layout. - */ - const TInt K4By5LayoutX = 4; + /** + * X component of the 4x5 layout. + */ + const TInt K4By5LayoutX = 4; - /** - * Y component of the 5x4 layout. - */ - const TInt K4By5LayoutY = 5; + /** + * Y component of the 5x4 layout. + */ + const TInt K4By5LayoutY = 5; - /** - * X component of the 5x4 layout. - */ - const TInt K5By4LayoutX = 5; + /** + * X component of the 5x4 layout. + */ + const TInt K5By4LayoutX = 5; - /** - * Y component of the 5x4 layout. - */ - const TInt K5By4LayoutY = 4; + /** + * Y component of the 5x4 layout. + */ + const TInt K5By4LayoutY = 4; - /** - * Below this value, default highlight in 3x4 grid - * is set up on the first item. Otherwize, on the default - * highlight. - */ - const TInt K3By4Threshold(5); + /** + * Below this value, default highlight in 3x4 grid + * is set up on the first item. Otherwize, on the default + * highlight. + */ + const TInt K3By4Threshold(5); - /** - * Below this value, default highlight in 4x3 grid - * is set up on the first item. Otherwize, on the default - * highlight. - */ - const TInt K4By3Threshold(6); + /** + * Below this value, default highlight in 4x3 grid + * is set up on the first item. Otherwize, on the default + * highlight. + */ + const TInt K4By3Threshold(6); - /** - * Below this value, default highlight in 5x4 grid - * is set up on the first item. Otherwize, on the default - * highlight. - */ - const TInt K5By4Threshold(8); + /** + * Below this value, default highlight in 5x4 grid + * is set up on the first item. Otherwize, on the default + * highlight. + */ + const TInt K5By4Threshold(8); - /** - * Below this value, default highlight in 4x5 grid - * is set up on the first item. Otherwize, on the default - * highlight. - */ - const TInt K4By5Threshold(10); + /** + * Below this value, default highlight in 4x5 grid + * is set up on the first item. Otherwize, on the default + * highlight. + */ + const TInt K4By5Threshold(10); - /** - * Default highlight in 3x4 grid. - */ - const TInt K3By4DefaultHighlight(4); + /** + * Default highlight in 3x4 grid. + */ + const TInt K3By4DefaultHighlight(4); - /** - * Default highlight in 4x3 grid. - */ - const TInt K4By3DefaultHighlight(5); + /** + * Default highlight in 4x3 grid. + */ + const TInt K4By3DefaultHighlight(5); - /** - * Default highlight in 5x4 grid. - */ - const TInt K5By4DefaultHighlight(7); + /** + * Default highlight in 5x4 grid. + */ + const TInt K5By4DefaultHighlight(7); - /** - * Default highlight in 4x5 grid. - */ - const TInt K4By5DefaultHighlight(8); + /** + * Default highlight in 4x5 grid. + */ + const TInt K4By5DefaultHighlight(8); - /** - * Number of rows in portrait/non-zoom mode; - */ - const TInt KRowsPortraitZoomNormal(4); + /** + * Number of rows in portrait/non-zoom mode; + */ + const TInt KRowsPortraitZoomNormal(4); - /** - * Number of columns in landscape/non-zoom mode; - */ - const TInt KColsPortraitZoomNormal(3); + /** + * Number of columns in landscape/non-zoom mode; + */ + const TInt KColsPortraitZoomNormal(3); - /** - * Number of rows in portrait/non-zoom mode; - */ - const TInt KRowsLandscapeZoomNormal(3); + /** + * Number of rows in portrait/non-zoom mode; + */ + const TInt KRowsLandscapeZoomNormal(3); - /** - * Number of columns in landscape/non-zoom mode; - */ - const TInt KColsLandscapeZoomNormal(4); - + /** + * Number of columns in landscape/non-zoom mode; + */ + const TInt KColsLandscapeZoomNormal(4); + /** * Focus based scrolling item threshold for grid. */ const TReal KFocusScrollingThreshold( 0.27 ); - } + } /** * Listbox constants' namespace. */ namespace MmListBox - { - /** - * Threshold value, determinign if a partial should - * be shown in a list. - */ - const TInt KPartialItemShowThreshold (0); + { + /** + * Threshold value, determinign if a partial should + * be shown in a list. + */ + const TInt KPartialItemShowThreshold( 0 ); - /** - * Default highlight in 4x5 grid. - */ - const TInt KCols(1); - + /** + * Default highlight in 4x5 grid. + */ + const TInt KCols( 1 ); + /** * Focus based scrolling item threshold for list. */ const TReal KFocusScrollingThreshold( 0.55 ); - } + } /** * Drag and drop related constants. */ namespace MmEffects - { - /** - * Threshold for items shift. - */ - const TReal KShiftRatio(0.25); + { + /** + * Threshold for items shift. + */ + const TReal KShiftRatio( 0.25 ); - /** - * Drag and drop speed limit. - */ - const TInt KDragSpeedIgnoreThreshold(15 * 15); + /** + * Drag and drop speed limit. + */ + const TInt KDragSpeedIgnoreThreshold( 15 * 15 ); - /** - * Number of frames to animate. - */ - const TInt KMaximumAnimationFramesCount( 6 ); + /** + * Number of frames to animate. + */ + const TInt KMaximumAnimationFramesCount( 6 ); - /** - * Number of frames to animate. - */ - const TInt KUsualAnimationFramesCount( 3 ); + /** + * Number of frames to animate. + */ + const TInt KUsualAnimationFramesCount( 3 ); - /** - * Number of frames to animate on non-touch devices. - */ - const TInt KUsualAnimationFramesCountNonTouch( 2 ); + /** + * Number of frames to animate on non-touch devices. + */ + const TInt KUsualAnimationFramesCountNonTouch( 2 ); - /** - * No animation frames count. - */ - const TInt KNoAnimationFramesCount( 1 ); + /** + * No animation frames count. + */ + const TInt KNoAnimationFramesCount( 1 ); - /** - * Delay between redrawing frames. - */ - const TInt KAnimationFrameDelay( 40000 ); + /** + * Delay between redrawing frames. + */ + const TInt KAnimationFrameDelay( 35000 ); - /** - * Text alpha during drag. - */ - const TInt KDragTextAlpha( 50 ); + /** + * Text alpha during drag. + */ + const TInt KDragTextAlpha( 50 ); - /** - * Value of drag ignore. - */ - const TInt KDragIgnoreRectValue(200); + /** + * Value of drag ignore. + */ + const TInt KDragIgnoreRectValue( 200 ); - /** - * Time between two butto repeat events. - */ - const TInt KDragRepeatRespawn(2); + /** + * Time between two butto repeat events. + */ + const TInt KDragRepeatRespawn( 2 ); - /** - * Determines the speed of focus-based scrolling in edit mode. - */ - const TInt KEditModeScrollingDelayFactor = 4000; - } + /** + * Determines the speed of focus-based scrolling in edit mode. + */ + const TInt KEditModeScrollingDelayFactor = 4000; + } /** * Templates' related constants. */ namespace MmTemplateContants - { - /** - * If a custom (non LCT) template is used, this is - * its default scrollbar width. - */ - const TInt KCustomTemplateScrolbarWidth (25); + { + /** + * If a custom (non LCT) template is used, this is + * its default scrollbar width. + */ + const TInt KCustomTemplateScrolbarWidth (25); - const TInt KTemplateChildTextLength (64); + const TInt KTemplateChildTextLength (64); - const TInt KSubCellsCount (6); + const TInt KSubCellsCount (6); - const TInt KItemSubCellsText (300); + const TInt KItemSubCellsText (300); - const TInt KMoveIndicatorStartingPos ( 32 ); + const TInt KMoveIndicatorStartingPos ( 32 ); - } + } /** * Shortcut constants. */ namespace MmShortcutConstants - { - /** - * Possible scancodes when interpreting shortcut key. - */ - const TInt KScanCodes[] = { '1','2','3','4','5','6','7','8','9', + { + /** + * Possible scancodes when interpreting shortcut key. + */ + const TInt KScanCodes[] = { '1','2','3','4','5','6','7','8','9', #ifndef __WINS__ '*', #else EStdKeyNkpAsterisk, #endif - '0', EStdKeyHash }; + '0', EStdKeyHash }; - /** - * Number of available scancodes. - */ - const TInt KScanCodeCount = 12; - } + /** + * Number of available scancodes. + */ + const TInt KScanCodeCount = 12; + } namespace MmMarqueeConstants - { - const TInt KTextTrimmingThreshold (80); - const TInt KClippingBufLength (80); - const TInt KLoops (1); - const TInt KScrollAmount (6); - const TInt KScrollDelay (1000000); - } + { + const TInt KTextTrimmingThreshold (80); + const TInt KClippingBufLength (80); + const TInt KLoops (1); + const TInt KScrollAmount (6); + const TInt KScrollDelay (1000000); + } /** * Matrix Template Library panic notice. */ @@ -306,7 +306,7 @@ _LIT8( KImageVisual8, "imagevisual" ); _LIT8( KImagePath8, "imagepath" ); _LIT8( KGridLayout8, "gridlayout" ); -_LIT8( KEnabled8, "enabled" ); +_LIT8( KEnabled8, "enabled" ); _LIT8( KRow8, "row" ); _LIT8( KCol8, "col" ); _LIT8( KPositionX8, "positionx" ); @@ -373,18 +373,18 @@ _LIT8( KUiaccelAagridCellImagePaneG38, "uiaccel_aagrid_cell_image_pane_g3" ); _LIT8( KUiaccelAagridCellImagePaneG48, "uiaccel_aagrid_cell_image_pane_g4" ); -_LIT8( KCellHcAppsPane8, "cell_hc_apps_pane" ); +_LIT8( KCellHcAppsPane8, "cell_hc_apps_pane" ); _LIT8( KCellHcAppsPaneT18, "cell_hc_apps_pane_t1" ); _LIT8( KCellHcAppsPaneG18, "cell_hc_apps_pane_g1" ); _LIT8( KCellHcAppsPaneG28, "cell_hc_apps_pane_g2" ); _LIT8( KCellHcAppsPaneG38, "cell_hc_apps_pane_g3" ); -_LIT8( KCellAppPane8, "cell_app_pane" ); +_LIT8( KCellAppPane8, "cell_app_pane" ); _LIT8( KCellAppsPaneG18, "cell_app_pane_g1" ); _LIT8( KCellAppsPaneT18, "cell_app_pane_t1" ); _LIT8( KCellAppsPaneG28, "cell_app_pane_g2" ); -_LIT8( KListSingleHcAppsPane8, "list_single_hc_apps_pane" ); +_LIT8( KListSingleHcAppsPane8, "list_single_hc_apps_pane" ); _LIT8( KListSingleHcAppsPaneT18, "list_single_hc_apps_pane_t1" ); _LIT8( KListSingleHcAppsPaneG18, "list_single_hc_apps_pane_g1" ); _LIT8( KListSingleHcAppsPaneG28, "list_single_hc_apps_pane_g2" ); @@ -443,7 +443,7 @@ /** * The minimal drag vector y-length that can trigger kinetic scrolling. * This is just a rough estimation of the actual trigger value used by AVKON, - * but it is sufficient for our purposes. + * but it is sufficient for our purposes. */ const TInt KDragTreshold = 18; diff -r d05a55b217df -r 79311d856354 menufw/menufwui/mmwidgets/src/mmdraweranimator.cpp --- a/menufw/menufwui/mmwidgets/src/mmdraweranimator.cpp Wed Apr 14 15:47:59 2010 +0300 +++ b/menufw/menufwui/mmwidgets/src/mmdraweranimator.cpp Tue Apr 27 16:26:12 2010 +0300 @@ -1,20 +1,20 @@ /* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* Version : %version: MM_41 % << Don't touch! Updated by Synergy at check-out. -* -*/ + * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * Version : %version: MM_41 % << Don't touch! Updated by Synergy at check-out. + * + */ #include @@ -23,31 +23,31 @@ #include "mmfloatingitem.h" #include "mmwidgetcontainer.h" - // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- -// -CMmDrawerAnimator::CMmDrawerAnimator(CMmListBoxItemDrawer& aDrawer) : - CActive( AknLayoutUtils::PenEnabled() ? - EPriorityRealTime : - EPriorityAbsoluteRealTime8 ), iDrawer(aDrawer), +// +CMmDrawerAnimator::CMmDrawerAnimator( CMmListBoxItemDrawer& aDrawer ) : + CActive( AknLayoutUtils::PenEnabled() + ? EPriorityAbsoluteVeryLow + : EPriorityAbsoluteRealTime8 ), iDrawer( aDrawer ), iLastNotedHighlight( KErrNotFound ), iLastNotedTopItem( KErrNotFound ), iLastNotedVerticalOffset( 0 ), - iUsualAnimationFramesCount( AknLayoutUtils::PenEnabled() ? - MmEffects::KUsualAnimationFramesCount : - MmEffects::KUsualAnimationFramesCountNonTouch ) + iUsualAnimationFramesCount( AknLayoutUtils::PenEnabled() + ? MmEffects::KUsualAnimationFramesCount + : MmEffects::KUsualAnimationFramesCountNonTouch ), + iPreparedForGarbage( EFalse ) { } // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- -// -CMmDrawerAnimator* CMmDrawerAnimator::NewLC(CMmListBoxItemDrawer& aDrawer) +// +CMmDrawerAnimator* CMmDrawerAnimator::NewLC( CMmListBoxItemDrawer& aDrawer ) { - CMmDrawerAnimator* self = new ( ELeave ) CMmDrawerAnimator(aDrawer); - CleanupStack::PushL(self); + CMmDrawerAnimator* self = new ( ELeave ) CMmDrawerAnimator( aDrawer ); + CleanupStack::PushL( self ); self->ConstructL(); return self; } @@ -55,10 +55,10 @@ // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- -// -CMmDrawerAnimator* CMmDrawerAnimator::NewL(CMmListBoxItemDrawer& aDrawer) +// +CMmDrawerAnimator* CMmDrawerAnimator::NewL( CMmListBoxItemDrawer& aDrawer ) { - CMmDrawerAnimator* self = CMmDrawerAnimator::NewLC(aDrawer); + CMmDrawerAnimator* self = CMmDrawerAnimator::NewLC( aDrawer ); CleanupStack::Pop( self ); return self; } @@ -66,18 +66,17 @@ // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- -// +// void CMmDrawerAnimator::ConstructL() { User::LeaveIfError( iTimer.CreateLocal() ); // Initialize timer - CActiveScheduler::Add( this); // Add to scheduler - iPreparedForGarbage = EFalse; + CActiveScheduler::Add( this ); // Add to scheduler } // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- -// +// CMmDrawerAnimator::~CMmDrawerAnimator() { Cancel(); // Cancel any request, if outstanding @@ -88,141 +87,129 @@ // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- -// +// void CMmDrawerAnimator::DoCancel() { iTimer.Cancel(); + if( iDrawer.GetFloatingItemCount() == 0 ) + { + TRAP_IGNORE(TriggerMoveItemL()); + } } // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- -// -TBool CMmDrawerAnimator::CancelNextRedrawL() - { - RunL(); - TTime currentTime; - currentTime.HomeTime(); - return (currentTime.MicroSecondsFrom(iLastRedrawTime) - <= MmEffects::KAnimationFrameDelay); - } -// ----------------------------------------------------------------------------- // -// ----------------------------------------------------------------------------- -// void CMmDrawerAnimator::RunL() - { - if ( iPreparedForGarbage ) - { - return; - } - - TTime currentTime; - currentTime.HomeTime(); - - if (currentTime.MicroSecondsFrom(iLastRedrawTime) - >= MmEffects::KAnimationFrameDelay && iDrawer.GetFloatingItemCount() > 0) - { - Cancel(); - - TRect refreshRect; - for(int i=0; i< iDrawer.GetFloatingItemCount(); i++) - { - TMmFloatingItem& current = iDrawer.GetFloatingItemAtIndex(i); - TSize itemSize = iDrawer.GetItemSize(current.GetDrawnItemIndex(), EFalse); + { + if( iPreparedForGarbage ) + { + return; + } + + if( iDrawer.GetFloatingItemCount() > 0 ) + { + TRect refreshRect; + for( int i = 0; i < iDrawer.GetFloatingItemCount(); i++ ) + { + TMmFloatingItem& current = iDrawer.GetFloatingItemAtIndex( i ); + TSize itemSize = iDrawer.GetItemSize(current.GetDrawnItemIndex(), EFalse); + + TRect beforeRect( current.GetItemPosition(), itemSize ); + current.MakeStep(); + TRect afterRect( current.GetItemPosition(), itemSize ); - TRect beforeRect(current.GetItemPosition(), itemSize); - current.MakeStep(); - TRect afterRect(current.GetItemPosition(), itemSize); - - if (current.GetFloatingItemType() == EDrag ) - { - TInt dragTrail = iDrawer.GetFloatingItemIndex( EPostDragRefreshItem ); - if (dragTrail != KErrNotFound) - { - refreshRect = (refreshRect == TRect(0,0,0,0)) ? beforeRect : refreshRect; - refreshRect.BoundingRect( afterRect ); - } - } - else - { - refreshRect = (refreshRect == TRect(0,0,0,0)) ? beforeRect : refreshRect; - refreshRect.BoundingRect( beforeRect ); - refreshRect.BoundingRect( afterRect ); - } - } - const TInt highlightedItemIndex = iDrawer.Widget()->View()->CurrentItemIndex(); - if ( iLastNotedHighlight != highlightedItemIndex ) - { + if( current.GetFloatingItemType() == EDrag ) + { + TInt dragTrail = iDrawer.GetFloatingItemIndex( EPostDragRefreshItem ); + if( dragTrail != KErrNotFound ) + { + refreshRect = ( refreshRect == TRect() ) ? beforeRect : refreshRect; + refreshRect.BoundingRect( afterRect ); + static_cast ( iDrawer.Widget()->Parent() )-> + SetAllowMove( EFalse ); + } + } + else + { + refreshRect = (refreshRect == TRect() ) ? beforeRect : refreshRect; + refreshRect.BoundingRect( beforeRect ); + refreshRect.BoundingRect( afterRect ); + } + } + const TInt highlightedItemIndex = iDrawer.Widget()->View()->CurrentItemIndex(); + if( iLastNotedHighlight != highlightedItemIndex ) + { TRect highlightedItemRect( iDrawer.Widget()->View()->ItemPos( highlightedItemIndex ), - iDrawer.Widget()->View()->ItemSize( highlightedItemIndex ) ); + iDrawer.Widget()->View()->ItemSize( highlightedItemIndex ) ); refreshRect.BoundingRect( highlightedItemRect ); iLastNotedHighlight = highlightedItemIndex; - } + } + + + TInt currentVerticalOffset = static_cast( + iDrawer.Widget()->Parent() )->VerticalItemOffset(); - - TInt currentVerticalOffset = static_cast( - iDrawer.Widget()->Parent() )->VerticalItemOffset(); + if( iLastNotedTopItem != iDrawer.Widget()->TopItemIndex() + || iLastNotedVerticalOffset != currentVerticalOffset ) + { + iDrawer.Widget()->DrawNow(); + iLastNotedTopItem = iDrawer.Widget()->TopItemIndex(); + iLastNotedVerticalOffset = currentVerticalOffset; + } + else + { + if( refreshRect != TRect() ) + { + TRect prev( iPreviousRefreshRect ); + iPreviousRefreshRect = refreshRect; + refreshRect.BoundingRect( prev ); + + // expand rect if non-touch + refreshRect = TRect( AdjustRefreshRectToNonTouch( refreshRect ) ); + + // never draw on the outside of widget's view rectangle + refreshRect.Intersection( iDrawer.Widget()->View()->ViewRect() ); - if (iLastNotedTopItem != iDrawer.Widget()->TopItemIndex() || - iLastNotedVerticalOffset != currentVerticalOffset ) - { - iDrawer.Widget()->DrawNow(); - iLastNotedTopItem = iDrawer.Widget()->TopItemIndex(); - iLastNotedVerticalOffset = currentVerticalOffset; - } - else - { - if ( refreshRect != TRect(0,0,0,0)) - { - TRect prev(iPreviousRefreshRect); - iPreviousRefreshRect = refreshRect; - refreshRect.BoundingRect(prev); - - // expand rect if non-touch - refreshRect = TRect( AdjustRefreshRectToNonTouch( refreshRect ) ); - - // never draw on the outside of widget's view rectangle - refreshRect.Intersection( iDrawer.Widget()->View()->ViewRect() ); - - iDrawer.Widget()->View()->Draw( &refreshRect ); - } - } + iDrawer.Widget()->View()->Draw( &refreshRect ); + } + } + + iLastRedrawTime.HomeTime(); + + } - - iLastRedrawTime.HomeTime(); - - } - - if (iDrawer.GetFloatingItemCount() > 0) - { - Trigger(); - } - else - { - Cancel(); - + if( iDrawer.GetFloatingItemCount() > 0 ) + { + Trigger(); + } + else + { + TriggerMoveItemL(); + Cancel(); + #ifdef RD_UI_TRANSITION_EFFECTS_LIST - if ( iTransTfx && iTransTfxInternal->EffectsDisabled() ) - { - iTransTfx->EnableEffects( ETrue ); - - if ( iTransTfx ) - { - iTransTfxInternal->Remove( MAknListBoxTfxInternal::EListEverything ); - iDrawer.Widget()->DrawNow(); - iTransTfxInternal->Draw( iDrawer.Widget()->Rect() ); - } - } + if( iTransTfx && iTransTfxInternal->EffectsDisabled() ) + { + iTransTfx->EnableEffects( ETrue ); + + if( iTransTfx ) + { + iTransTfxInternal->Remove( MAknListBoxTfxInternal::EListEverything ); + iDrawer.Widget()->DrawNow(); + iTransTfxInternal->Draw( iDrawer.Widget()->Rect() ); + } + } #endif - } + } } // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- -// +// TRect CMmDrawerAnimator::AdjustRefreshRectToNonTouch( const TRect& aRefreshRect ) { TRect rect( aRefreshRect ); @@ -231,13 +218,10 @@ TRect indicatorRect( iDrawer.GetIndicatorRect() ); TSize itemSize( iDrawer.GetItemSize( iDrawer.Widget()->CurrentItemIndex(), ETrue ) ); - + TInt horizontalMargin( ( indicatorRect.Width() - itemSize.iWidth ) / 2 ); TInt verticalMargin( ( indicatorRect.Height() - itemSize.iHeight ) / 2 ); - rect.iBr.iX += horizontalMargin; - rect.iBr.iY += verticalMargin; - rect.iTl.iX -= horizontalMargin; - rect.iTl.iY -= verticalMargin; + rect.Grow(horizontalMargin, verticalMargin); } return rect; } @@ -245,35 +229,34 @@ // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- -// +// TInt CMmDrawerAnimator::Trigger() { - if ( iPreparedForGarbage ) - { - return KErrCancel; - } - - if (!IsActive() && iDrawer.GetFloatingItemCount() > 0 ) + if( iPreparedForGarbage ) + { + return KErrCancel; + } + + if( !IsActive() && iDrawer.GetFloatingItemCount() > 0 ) { #ifdef RD_UI_TRANSITION_EFFECTS_LIST - iTransTfx = CAknListLoader::TfxApi( iDrawer.Gc() ); - iTransTfxInternal = CAknListLoader::TfxApiInternal( - iDrawer.Gc() ); - - if ( iTransTfx && !iTransTfxInternal->EffectsDisabled() ) - { - iTransTfx->EnableEffects( EFalse ); - - if ( iTransTfxInternal ) - { - iTransTfxInternal->Remove( MAknListBoxTfxInternal::EListEverything ); - iTransTfxInternal->Draw( iDrawer.Widget()->Rect() ); - } - } + iTransTfx = CAknListLoader::TfxApi( iDrawer.Gc() ); + iTransTfxInternal = CAknListLoader::TfxApiInternal( iDrawer.Gc() ); + + if( iTransTfx && !iTransTfxInternal->EffectsDisabled() ) + { + iTransTfx->EnableEffects( EFalse ); + + if( iTransTfxInternal ) + { + iTransTfxInternal->Remove( MAknListBoxTfxInternal::EListEverything ); + iTransTfxInternal->Draw( iDrawer.Widget()->Rect() ); + } + } #endif - - iTimer.After(iStatus, TTimeIntervalMicroSeconds32( - MmEffects::KAnimationFrameDelay ) ); + + iTimer.After( iStatus, TTimeIntervalMicroSeconds32( + MmEffects::KAnimationFrameDelay ) ); SetActive(); } return KErrNone; @@ -282,8 +265,8 @@ // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- -// -TInt CMmDrawerAnimator::RunError(TInt aError) +// +TInt CMmDrawerAnimator::RunError( TInt aError ) { return aError; } @@ -291,39 +274,39 @@ // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- -// -void CMmDrawerAnimator::AnimateDragItemTransitionL( ) - { - if (KErrNotFound != iDrawer.GetFloatingItemIndex(EDrag)) +// +void CMmDrawerAnimator::AnimateDragItemTransitionL() + { + if( KErrNotFound != iDrawer.GetFloatingItemIndex( EDrag ) ) { TMmFloatingItem floatingItem( - iDrawer.GetFloatingItemL(EDrag).GetDrawnItemIndex(), - iDrawer.GetFloatingItemL(EDrag).GetItemPosition(), + iDrawer.GetFloatingItemL( EDrag ).GetDrawnItemIndex(), + iDrawer.GetFloatingItemL( EDrag ).GetItemPosition(), EDragTransition, iUsualAnimationFramesCount, - iDrawer.Widget()->View()); + iDrawer.Widget()->View() ); TPoint pointEnd = iDrawer.Widget()->View()->ItemPos( floatingItem.GetDrawnItemIndex() ); floatingItem.SetPositionStep( pointEnd - floatingItem.GetItemPosition() ); iDrawer.AddFloatingItemL( floatingItem, 0 ); - iDrawer.RemoveFloatingItem( iDrawer.GetFloatingItemIndex(EDrag) ); + iDrawer.RemoveFloatingItem( iDrawer.GetFloatingItemIndex( EDrag ) ); } } - + // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- // TBool CMmDrawerAnimator::IsReadyForNewAnimation() { - if ( iPreparedForGarbage ) - { - return EFalse; - } - - for(int i=0; i< iDrawer.GetFloatingItemCount(); i++) + if( iPreparedForGarbage ) { - TMmFloatingItemType type - = iDrawer.GetFloatingItemAtIndex(i).GetFloatingItemType(); - if ( type != EDrag && type != EZoomTransition ) + return EFalse; + } + + for( int i = 0; i < iDrawer.GetFloatingItemCount(); i++ ) + { + TMmFloatingItemType type = + iDrawer.GetFloatingItemAtIndex( i ).GetFloatingItemType(); + if( type != EDrag && type != EZoomTransition ) { return EFalse; } @@ -337,32 +320,32 @@ // void CMmDrawerAnimator::CancelAnimationsL() { - for(int i=0; i< iDrawer.GetFloatingItemCount(); i++) + for( int i = 0; i < iDrawer.GetFloatingItemCount(); i++ ) { - TMmFloatingItem& current = iDrawer.GetFloatingItemAtIndex(i); - if (current.GetFloatingItemType() != EDrag) + TMmFloatingItem& current = iDrawer.GetFloatingItemAtIndex( i ); + if( current.GetFloatingItemType() != EDrag ) { current.InvalidateFloatingItem(); } } } - // ----------------------------------------------------------------------------- - // - // ----------------------------------------------------------------------------- - // +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// void CMmDrawerAnimator::AnimateItemSwapL( TInt aItemFrom, TInt aItemTo ) { - TMmFloatingItem floatingItem( aItemTo, - iDrawer.Widget()->View()->ItemPos( aItemFrom ), + TMmFloatingItem floatingItem( aItemTo, + iDrawer.Widget()->View()->ItemPos( aItemFrom ), ESwapTransition, iUsualAnimationFramesCount, iDrawer.Widget()->View() ); - - for(int i=0; i< iDrawer.GetFloatingItemCount(); i++) + + for( int i = 0; i < iDrawer.GetFloatingItemCount(); i++ ) { - TMmFloatingItem& current = iDrawer.GetFloatingItemAtIndex(i); + TMmFloatingItem& current = iDrawer.GetFloatingItemAtIndex( i ); - if (current.GetFloatingItemType() == EZoomTransition + if( current.GetFloatingItemType() == EZoomTransition && current.GetDrawnItemIndex() == aItemFrom ) { current.InvalidateFloatingItem(); @@ -371,15 +354,15 @@ } } - floatingItem.SetPositionStep( iDrawer.Widget()->View()->ItemPos(aItemTo)- - iDrawer.Widget()->View()->ItemPos(aItemFrom) ); - iDrawer.AddFloatingItemL(floatingItem); + floatingItem.SetPositionStep( iDrawer.Widget()->View()->ItemPos(aItemTo) + - iDrawer.Widget()->View()->ItemPos(aItemFrom) ); + iDrawer.AddFloatingItemL( floatingItem ); } // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- -// +// void CMmDrawerAnimator::AnimateItemZoomL( TInt aItemIndex, TBool aZoomIn ) { TMmFloatingItem floatingItem( aItemIndex, @@ -392,24 +375,26 @@ (aZoomIn) ? KZoomStateZoomRatio : KNormalStateZoomRatio ); TInt animationFound = EFalse; - for(int i=0; i< iDrawer.GetFloatingItemCount(); i++) + for( int i = 0; i < iDrawer.GetFloatingItemCount(); i++ ) { - TMmFloatingItem& current = iDrawer.GetFloatingItemAtIndex(i); - if (current.GetFloatingItemType() == EZoomTransition && - current.GetDrawnItemIndex() == aItemIndex ) + TMmFloatingItem& current = iDrawer.GetFloatingItemAtIndex( i ); + if( current.GetFloatingItemType() == EZoomTransition + && current.GetDrawnItemIndex() == aItemIndex ) { current.InvalidateFloatingItem(); floatingItem.SetSizeStep( current.GetCurrentZoomRatio(), (aZoomIn) ? KZoomStateZoomRatio : KNormalStateZoomRatio); animationFound = ETrue; + static_cast ( iDrawer.Widget()->Parent() )-> + SetAllowMove( EFalse ); break; } } - - if ( (aZoomIn != EFalse || animationFound != EFalse) ) + + if( ( aZoomIn != EFalse || animationFound != EFalse ) ) { // This covers the situation, when a zoom out animation is requested - // whilst no zoom in occured earlier. In this case the request is + // whilst no zoom in occured earlier. In this case the request is // neglected. iDrawer.AddFloatingItemL( floatingItem ); } @@ -418,20 +403,30 @@ // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- -// +// void CMmDrawerAnimator::SetNextRedrawToWholeScreen() - { - iPreviousRefreshRect = iDrawer.Widget()->View()->ViewRect(); - } + { + iPreviousRefreshRect = iDrawer.Widget()->View()->ViewRect(); + } // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- -// +// void CMmDrawerAnimator::PrepareForGarbage() - { -// Cancel any outstanding requests - Cancel(); - iPreparedForGarbage = ETrue; - } + { + // Cancel any outstanding requests + Cancel(); + iPreparedForGarbage = ETrue; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void CMmDrawerAnimator::TriggerMoveItemL() + { + static_cast ( iDrawer.Widget()->Parent() )-> + TriggerMoveItemL(); + } //End of file diff -r d05a55b217df -r 79311d856354 menufw/menufwui/mmwidgets/src/mmgrid.cpp --- a/menufw/menufwui/mmwidgets/src/mmgrid.cpp Wed Apr 14 15:47:59 2010 +0300 +++ b/menufw/menufwui/mmwidgets/src/mmgrid.cpp Tue Apr 27 16:26:12 2010 +0300 @@ -12,7 +12,7 @@ * Contributors: * * Description: -* Version : %version: MM_102 % << Don't touch! Updated by Synergy at check-out. +* Version : %version: MM_103 % << Don't touch! Updated by Synergy at check-out. * */ @@ -486,12 +486,6 @@ { HandlePointerEventInNormalModeL( aPointerEvent ); } - - if ( iMmDrawer->GetFloatingItemCount() > 0 && - iMmDrawer->GetAnimator()->IsActive() ) - { - iMmDrawer->GetAnimator()->CancelNextRedrawL(); - } } // ----------------------------------------------------------------------------- diff -r d05a55b217df -r 79311d856354 menufw/menufwui/mmwidgets/src/mmgridview.cpp --- a/menufw/menufwui/mmwidgets/src/mmgridview.cpp Wed Apr 14 15:47:59 2010 +0300 +++ b/menufw/menufwui/mmwidgets/src/mmgridview.cpp Tue Apr 27 16:26:12 2010 +0300 @@ -243,7 +243,7 @@ if ( !itemDrawer->IsEditMode() ) { - itemDrawer->DrawBackgroundAndSeparatorLines(ViewRect()); + itemDrawer->DrawBackground(ViewRect()); itemDrawer->SetRedrawItemBackground( EFalse ); CAknGridView::Draw( aClipRect ); itemDrawer->SetRedrawItemBackground( ETrue ); diff -r d05a55b217df -r 79311d856354 menufw/menufwui/mmwidgets/src/mmlistbox.cpp --- a/menufw/menufwui/mmwidgets/src/mmlistbox.cpp Wed Apr 14 15:47:59 2010 +0300 +++ b/menufw/menufwui/mmwidgets/src/mmlistbox.cpp Tue Apr 27 16:26:12 2010 +0300 @@ -48,18 +48,18 @@ // ----------------------------------------------------------------------------- // CMmListBox::CMmListBox() : AKNDOUBLELISTBOXNAME(R_LIST_PANE_LINES_AB_COLUMN) - { - // No implementation required - } + { + // No implementation required + } // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- // CMmListBox::~CMmListBox() - { - delete iRedrawTimer; - } + { + delete iRedrawTimer; + } // ----------------------------------------------------------------------------- // @@ -67,30 +67,30 @@ // CMmListBox* CMmListBox::NewLC( const CCoeControl* aParent, TInt aFlags, CMmTemplateLibrary* aTemplateLibrary ) - { - CMmListBox* self = new (ELeave)CMmListBox(); - CleanupStack::PushL(self); - self->ConstructL( aParent, aFlags, aTemplateLibrary ); - return self; - } + { + CMmListBox* self = new (ELeave)CMmListBox(); + CleanupStack::PushL(self); + self->ConstructL( aParent, aFlags, aTemplateLibrary ); + return self; + } // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- // void CMmListBox::SetListFlag( TInt aFlag ) - { - iListBoxFlags = iListBoxFlags | aFlag; - } + { + iListBoxFlags = iListBoxFlags | aFlag; + } // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- // void CMmListBox::ClearListFlag( TInt aFlag ) - { - iListBoxFlags = iListBoxFlags & !aFlag; - } + { + iListBoxFlags = iListBoxFlags & !aFlag; + } // ----------------------------------------------------------------------------- // @@ -98,11 +98,11 @@ // CMmListBox* CMmListBox::NewL( const CCoeControl* aParent, TInt aFlags, CMmTemplateLibrary* aTemplateLibrary ) - { - CMmListBox* self = CMmListBox::NewLC( aParent, aFlags, aTemplateLibrary ); - CleanupStack::Pop( self ); - return self; - } + { + CMmListBox* self = CMmListBox::NewLC( aParent, aFlags, aTemplateLibrary ); + CleanupStack::Pop( self ); + return self; + } // ----------------------------------------------------------------------------- // @@ -110,9 +110,9 @@ // void CMmListBox::ConstructL( const CCoeControl* aParent, TInt aFlags, CMmTemplateLibrary* aTemplateLibrary ) - { - iDisableChildComponentDrawing = EFalse; - iModel = iMmModel = CMmListBoxModel::NewL(); + { + iDisableChildComponentDrawing = EFalse; + iModel = iMmModel = CMmListBoxModel::NewL(); CreateItemDrawerL( aTemplateLibrary ); EnableExtendedDrawingL(); @@ -121,7 +121,7 @@ CEikListBox::ConstructL(aParent,aFlags); iMmDrawer->SetView( this ); iRedrawTimer = CPeriodic::NewL( EPriorityRealTime ); - } + } // ----------------------------------------------------------------------------- // Clearing ELeftDownInViewRect flag before invoking the base class @@ -148,14 +148,14 @@ iListBoxFlags &= ~ELeftDownInViewRect; } } - + TInt itemUnderPointerIndex = KErrNotFound; if ( aPointerEvent.iType == TPointerEvent::EButton1Up || aPointerEvent.iType == TPointerEvent::EButton1Down ) { TBool highlightWasVisible = parent->IsHighlightVisible(); CEikFormattedCellListBoxTypedef::HandlePointerEventL( aPointerEvent ); - // Tricky: Do not allow the base class implementation of HandlePointerEventL + // Tricky: Do not allow the base class implementation of HandlePointerEventL // to remove the highlight on EButton1Up event when context menu // is displayed for an item if ( aPointerEvent.iType == TPointerEvent::EButton1Up && @@ -237,50 +237,50 @@ TInt CMmListBox::ScrollIfNeeded( const TPointerEvent& aPointerEvent ) { TInt nextScrollDelay = 0; - - TBool readyForScrolling = - iMmDrawer->GetAnimator()->IsReadyForNewAnimation() - && iMmDrawer->GetFloatingItemCount() != 0; - - if ( IsPointerInTopScrollingThreshold( aPointerEvent ) ) - { - // scroll up by one row - TInt newCurrentItemIndex = CurrentItemIndex() - 1; + + TBool readyForScrolling = + iMmDrawer->GetAnimator()->IsReadyForNewAnimation() + && iMmDrawer->GetFloatingItemCount() != 0; - if ( newCurrentItemIndex >= 0 ) - { - nextScrollDelay = MmEffects::KEditModeScrollingDelayFactor * - Max( 1, aPointerEvent.iPosition.iY - Rect().iTl.iY ); - if (readyForScrolling) - { - View()->VScrollTo( View()->CalcNewTopItemIndexSoItemIsVisible( + if ( IsPointerInTopScrollingThreshold( aPointerEvent ) ) + { + // scroll up by one row + TInt newCurrentItemIndex = CurrentItemIndex() - 1; + + if ( newCurrentItemIndex >= 0 ) + { + nextScrollDelay = MmEffects::KEditModeScrollingDelayFactor * + Max( 1, aPointerEvent.iPosition.iY - Rect().iTl.iY ); + if (readyForScrolling) + { + View()->VScrollTo( View()->CalcNewTopItemIndexSoItemIsVisible( newCurrentItemIndex ) ); View()->SetCurrentItemIndex( newCurrentItemIndex ); UpdateScrollBarThumbs(); - } - } - } - else if ( IsPointerInBottomScrollingThreshold( aPointerEvent) ) - { - // scroll down by one row - TInt lastItemIndex = iModel->NumberOfItems() - 1; - TInt newCurrentItemIndex = CurrentItemIndex() + 1; - - - if ( newCurrentItemIndex <= lastItemIndex ) - { - nextScrollDelay = MmEffects::KEditModeScrollingDelayFactor * - Max( 1, Rect().iBr.iY - aPointerEvent.iPosition.iY ); + } + } + } + else if ( IsPointerInBottomScrollingThreshold( aPointerEvent) ) + { + // scroll down by one row + TInt lastItemIndex = iModel->NumberOfItems() - 1; + TInt newCurrentItemIndex = CurrentItemIndex() + 1; + - if (readyForScrolling) - { - View()->VScrollTo( View()->CalcNewTopItemIndexSoItemIsVisible( - newCurrentItemIndex ) ); - View()->SetCurrentItemIndex( newCurrentItemIndex ); + if ( newCurrentItemIndex <= lastItemIndex ) + { + nextScrollDelay = MmEffects::KEditModeScrollingDelayFactor * + Max( 1, Rect().iBr.iY - aPointerEvent.iPosition.iY ); + + if (readyForScrolling) + { + View()->VScrollTo( View()->CalcNewTopItemIndexSoItemIsVisible( + newCurrentItemIndex ) ); + View()->SetCurrentItemIndex( newCurrentItemIndex ); UpdateScrollBarThumbs(); - } - } - } + } + } + } return nextScrollDelay; } @@ -308,14 +308,9 @@ HandlePointerEventInEditModeL( aPointerEvent ); } else - { + { CEikFormattedCellListBoxTypedef::HandlePointerEventL( aPointerEvent ); - } - - if ( iMmDrawer->GetAnimator()->IsActive() ) - { - iMmDrawer->GetAnimator()->CancelNextRedrawL(); - } + } } @@ -383,7 +378,7 @@ // // ----------------------------------------------------------------------------- // -void CMmListBox::ProcessScrollEventL( CEikScrollBar* aScrollBar, +void CMmListBox::ProcessScrollEventL( CEikScrollBar* aScrollBar, TEikScrollEvent aEventType ) { CEikFormattedCellListBoxTypedef::HandleScrollEventL( @@ -403,7 +398,7 @@ } iSkippedScrollbarEventsCount = 0; } - + // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- @@ -434,32 +429,32 @@ + View()->ItemSize( currentItemIndex ).iHeight; if ( currentItemIndex == BottomItemIndex() - && currentItemIndex != previousItemIndex - && itemY > View()->ViewRect().iBr.iY ) - { - if( aType == EEventKey ) - { + && currentItemIndex != previousItemIndex + && itemY > View()->ViewRect().iBr.iY ) + { + if( aType == EEventKey ) + { #ifdef RD_UI_TRANSITION_EFFECTS_LIST - MAknListBoxTfxInternal* transApi = CAknListLoader::TfxApiInternal( - View()->ItemDrawer()->Gc() ); - TBool effects = transApi && !transApi->EffectsDisabled(); - if ( effects ) - { - transApi->SetMoveType( MAknListBoxTfxInternal::EListScrollDown ); - } + MAknListBoxTfxInternal* transApi = CAknListLoader::TfxApiInternal( + View()->ItemDrawer()->Gc() ); + TBool effects = transApi && !transApi->EffectsDisabled(); + if ( effects ) + { + transApi->SetMoveType( MAknListBoxTfxInternal::EListScrollDown ); + } #endif - iView->VScrollTo( - iView->CalcNewTopItemIndexSoItemIsVisible( currentItemIndex ) ); + iView->VScrollTo( + iView->CalcNewTopItemIndexSoItemIsVisible( currentItemIndex ) ); #ifdef RD_UI_TRANSITION_EFFECTS_LIST - if ( effects ) - { - transApi->Draw( Rect() ); - } + if ( effects ) + { + transApi->Draw( Rect() ); + } #endif - } - SetCurrentItemIndex( currentItemIndex ); - } + } + SetCurrentItemIndex( currentItemIndex ); + } RedrawIfNecessary( itemIndex, CurrentItemIndex()); return ret; @@ -508,13 +503,13 @@ if ( differenceIndex == 1 ) { if( sizeAllBefore != sizeAllAfter ) - { + { redrawIndex = Min( aPreviousCurrent, aCurrent ); - } + } else - { - return redrawConsumed; - } + { + return redrawConsumed; + } } else if ( differenceIndex > 1 && sizeAllBefore == sizeAllAfter ) { @@ -533,14 +528,14 @@ lastPotentialItemIndex = iView->BottomItemIndex(); if ( aPreviousCurrent < TopItemIndex() ) - { - lastPotentialItemIndex = BottomItemIndex() ; - } + { + lastPotentialItemIndex = BottomItemIndex() ; + } else if ( BottomItemIndex() < aPreviousCurrent ) - { - lastPotentialItemIndex = BottomItemIndex() + 1; - } - + { + lastPotentialItemIndex = BottomItemIndex() + 1; + } + while ( redrawIndex < lastPotentialItemIndex +1 ) { view->DrawSingleItem( redrawIndex++ ); @@ -570,22 +565,22 @@ // ----------------------------------------------------------------------------- // CMmListBoxModel* CMmListBox::MmModel() - { - return iMmModel; - } + { + return iMmModel; + } // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- // void CMmListBox::SetMmModel( CMmListBoxModel* aMmModel ) - { - if ( iMmModel != aMmModel ) - { - delete iMmModel; - iMmModel = aMmModel; - } - } + { + if ( iMmModel != aMmModel ) + { + delete iMmModel; + iMmModel = aMmModel; + } + } // ----------------------------------------------------------------------------- // @@ -610,45 +605,45 @@ // ----------------------------------------------------------------------------- // void CMmListBox::SetItemDrawerAndViewBgContext (CAknsBasicBackgroundControlContext * aBgContext) - { - iMmDrawer->SetBgContext (aBgContext); - } + { + iMmDrawer->SetBgContext (aBgContext); + } // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- // TBool CMmListBox::HandleScrollbarVisibilityChangeL() - { - TBool ret = EFalse; - if ( AllItemsFitInViewRect() ) - { - if ( ScrollBarFrame()->VerticalScrollBar()->IsVisible() + { + TBool ret = EFalse; + if ( AllItemsFitInViewRect() ) + { + if ( ScrollBarFrame()->VerticalScrollBar()->IsVisible() || iMmDrawer->TemplateLibrary()->GetScrollbarVisibility() ) - { - ScrollBarFrame()->VerticalScrollBar()->MakeVisible( EFalse ); - iMmDrawer->SetScrollbarVisibilityL( EFalse ); + { + ScrollBarFrame()->VerticalScrollBar()->MakeVisible( EFalse ); + iMmDrawer->SetScrollbarVisibilityL( EFalse ); #ifdef RD_UI_TRANSITION_EFFECTS_LIST - MAknListBoxTfxInternal *trans = CAknListLoader::TfxApiInternal( ItemDrawer()->Gc() ); - if ( trans ) - { - trans->Remove( MAknListBoxTfxInternal::EListEverything ); - } + MAknListBoxTfxInternal *trans = CAknListLoader::TfxApiInternal( ItemDrawer()->Gc() ); + if ( trans ) + { + trans->Remove( MAknListBoxTfxInternal::EListEverything ); + } #endif - ret = ETrue; //redraw is needed - } - } - else if ( !ScrollBarFrame()->VerticalScrollBar()->IsVisible() - || !iMmDrawer->TemplateLibrary()->GetScrollbarVisibility() ) - { - ScrollBarFrame()->VerticalScrollBar()->MakeVisible( ETrue ); - iMmDrawer->SetScrollbarVisibilityL( ETrue ); - ret = ETrue; //redraw is needed - } - return ret; - } + ret = ETrue; //redraw is needed + } + } + else if ( !ScrollBarFrame()->VerticalScrollBar()->IsVisible() + || !iMmDrawer->TemplateLibrary()->GetScrollbarVisibility() ) + { + ScrollBarFrame()->VerticalScrollBar()->MakeVisible( ETrue ); + iMmDrawer->SetScrollbarVisibilityL( ETrue ); + ret = ETrue; //redraw is needed + } + return ret; + } // ----------------------------------------------------------------------------- @@ -656,23 +651,23 @@ // ----------------------------------------------------------------------------- // TBool CMmListBox::AllItemsFitInViewRect() - { - CMmListBoxView* view = static_cast< CMmListBoxView* >(iView); - TInt totalHeight = view->GetTotalHeight( view->TopItemIndex(), view->BottomItemIndex()); - if ( view->TopItemIndex() == 0 && iMmModel->NumberOfItems() <= view->BottomItemIndex() + 1 - && totalHeight <= iView->ViewRect().Height() ) - { - return ETrue; - } - else - { - return EFalse; - } - } + { + CMmListBoxView* view = static_cast< CMmListBoxView* >(iView); + TInt totalHeight = view->GetTotalHeight( view->TopItemIndex(), view->BottomItemIndex()); + if ( view->TopItemIndex() == 0 && iMmModel->NumberOfItems() <= view->BottomItemIndex() + 1 + && totalHeight <= iView->ViewRect().Height() ) + { + return ETrue; + } + else + { + return EFalse; + } + } /** * Helper class whose only purpose is to ensure that - * ScrollToItem method will be always re-enabled. + * ScrollToItem method will be always re-enabled. */ struct TScrollToItemEnabler { @@ -685,77 +680,77 @@ // ----------------------------------------------------------------------------- // void CMmListBox::UpdateScrollBarsL() - { - TBool redrawNeeded = HandleScrollbarVisibilityChangeL(); - if (ScrollBarFrame()->VerticalScrollBar()->IsVisible()) - { - CMmListBoxView* view = static_cast( View() ); - view->DisableScrollToItem( ETrue ); - TScrollToItemEnabler reverter = { view }; - CleanupClosePushL( reverter ); - CEikFormattedCellListBoxTypedef::UpdateScrollBarsL(); - CleanupStack::PopAndDestroy( &reverter ); - } - iMmDrawer->TemplateLibrary()->SetScrollbarWidthL( + { + TBool redrawNeeded = HandleScrollbarVisibilityChangeL(); + if (ScrollBarFrame()->VerticalScrollBar()->IsVisible()) + { + CMmListBoxView* view = static_cast( View() ); + view->DisableScrollToItem( ETrue ); + TScrollToItemEnabler reverter = { view }; + CleanupClosePushL( reverter ); + CEikFormattedCellListBoxTypedef::UpdateScrollBarsL(); + CleanupStack::PopAndDestroy( &reverter ); + } + iMmDrawer->TemplateLibrary()->SetScrollbarWidthL( ScrollBarFrame()->VerticalScrollBar()->Rect().Width() ); - FixViewForMirroredLayout(); - if ( redrawNeeded ) - { - DrawNow(); - } - } + FixViewForMirroredLayout(); + if ( redrawNeeded ) + { + DrawNow(); + } + } // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- // void CMmListBox::UpdateScrollBarsNoRedrawL() - { - HandleScrollbarVisibilityChangeL(); - if ( ScrollBarFrame()->VerticalScrollBar()->IsVisible() ) - { - CMmListBoxView* view = static_cast( View() ); - view->DisableScrollToItem( ETrue ); - TScrollToItemEnabler reverter = { view }; - CleanupClosePushL( reverter ); - CEikFormattedCellListBoxTypedef::UpdateScrollBarsL(); - CleanupStack::PopAndDestroy( &reverter ); - iMmDrawer->TemplateLibrary()->SetScrollbarWidthL( - ScrollBarFrame()->VerticalScrollBar()->Rect().Width() ); - } - } + { + HandleScrollbarVisibilityChangeL(); + if ( ScrollBarFrame()->VerticalScrollBar()->IsVisible() ) + { + CMmListBoxView* view = static_cast( View() ); + view->DisableScrollToItem( ETrue ); + TScrollToItemEnabler reverter = { view }; + CleanupClosePushL( reverter ); + CEikFormattedCellListBoxTypedef::UpdateScrollBarsL(); + CleanupStack::PopAndDestroy( &reverter ); + iMmDrawer->TemplateLibrary()->SetScrollbarWidthL( + ScrollBarFrame()->VerticalScrollBar()->Rect().Width() ); + } + } // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- // void CMmListBox::SetMarqueeAdapter( CMmMarqueeAdapter* aAdapter ) - { - iMarqueeAdapter = aAdapter; - iMarqueeAdapter->SetControl( const_cast< CMmListBox *>(this) ); - } + { + iMarqueeAdapter = aAdapter; + iMarqueeAdapter->SetControl( const_cast< CMmListBox *>(this) ); + } // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- // void CMmListBox::SetMarqueeDrawing( TBool aIsMarqueeBeingDrawn ) - { - iMmDrawer->SetMarqueeDrawing( aIsMarqueeBeingDrawn ); - } + { + iMmDrawer->SetMarqueeDrawing( aIsMarqueeBeingDrawn ); + } // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- // void CMmListBox::HandleItemRemovalL() - { - CEikFormattedCellListBoxTypedef::HandleItemRemovalL(); + { + CEikFormattedCellListBoxTypedef::HandleItemRemovalL(); DrawNow(); //avkon does not redraw the items for listbox when item is //removed. This needs to be forced here. UpdateScrollBarsL(); - } + } // ----------------------------------------------------------------------------- // If a parent to the supplied control has its Gc set, this function will find @@ -819,7 +814,7 @@ #ifdef RD_UI_TRANSITION_EFFECTS_LIST MAknListBoxTfxInternal *transApi = CAknListLoader::TfxApiInternal( gc ); - + if ( transApi ) { transApi->SetListType( MAknListBoxTfxInternal::EListBoxTypeMainPane ); @@ -842,7 +837,7 @@ { TRect clientRect; this->RestoreClientRectFromViewRect(clientRect); -#ifdef RD_UI_TRANSITION_EFFECTS_LIST +#ifdef RD_UI_TRANSITION_EFFECTS_LIST if ( transApi ) { transApi->StartDrawing( MAknListBoxTfxInternal::EListView ); @@ -883,7 +878,7 @@ // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- -// +// void CMmListBox::DrawView() { iDisableChildComponentDrawing = ETrue; @@ -896,41 +891,41 @@ // ----------------------------------------------------------------------------- // void CMmListBox::SetVerticalItemOffset( TInt aOffset ) - { - static_cast( View() )->SetItemOffsetInPixels( aOffset ); - UpdateScrollBarThumbs(); - } + { + static_cast( View() )->SetItemOffsetInPixels( aOffset ); + UpdateScrollBarThumbs(); + } // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- // TInt CMmListBox::VerticalItemOffset() const - { - return static_cast( View() )->VerticalItemOffset(); - } + { + return static_cast( View() )->VerticalItemOffset(); + } // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- // void CMmListBox::SetItemHeight( TInt aItemHeight ) - { - if ( aItemHeight != iItemHeight ) - { - iItemHeight = aItemHeight; - TRAP_IGNORE( UpdateScrollBarsNoRedrawL() ); - } - } + { + if ( aItemHeight != iItemHeight ) + { + iItemHeight = aItemHeight; + TRAP_IGNORE( UpdateScrollBarsNoRedrawL() ); + } + } // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- // void CMmListBox::UpdateScrollBarThumbs() - { - CEikFormattedCellListBox::UpdateScrollBarThumbs(); - } + { + CEikFormattedCellListBox::UpdateScrollBarThumbs(); + } // ----------------------------------------------------------------------------- // @@ -940,9 +935,9 @@ { TInt componentControls(0); if ( !iDisableChildComponentDrawing ) - { + { componentControls = CEikFormattedCellListBoxTypedef::CountComponentControls(); - } + } return componentControls; } // ----------------------------------------------------------------------------- @@ -958,7 +953,7 @@ // // ----------------------------------------------------------------------------- // -void CMmListBox::HandleScrollEventL( CEikScrollBar* aScrollBar, +void CMmListBox::HandleScrollEventL( CEikScrollBar* aScrollBar, TEikScrollEvent aEventType ) { if ( aEventType == EEikScrollThumbDragVert && !iScrollbarThumbIsBeingDragged ) diff -r d05a55b217df -r 79311d856354 menufw/menufwui/mmwidgets/src/mmlistboxitemdrawer.cpp --- a/menufw/menufwui/mmwidgets/src/mmlistboxitemdrawer.cpp Wed Apr 14 15:47:59 2010 +0300 +++ b/menufw/menufwui/mmwidgets/src/mmlistboxitemdrawer.cpp Tue Apr 27 16:26:12 2010 +0300 @@ -1,22 +1,22 @@ /* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - + * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ #include +#include #include "mmwidgetsconstants.h" #include "hnconvutils.h" #include @@ -47,13 +47,13 @@ #include "mmmarqueeadapter.h" #include "mmfloatingitem.h" #include "mmgridview.h" +#include "mmlistboxview.h" #include "mmcacheforitem.h" #include "mmitemsdatacache.h" #include "mmwidgetcontainer.h" #include "hnsuitemodel.h" #include "menudebug.h" - // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- @@ -71,24 +71,25 @@ iTemplateLibrary = aTemplateLibrary; iMmModel = aMmListBoxModel; iRedrawBackground = ETrue; + iDrawSeparatorLines = EFalse; iZoomIconIndex = -1; iIconAnimationZoomRatio = 1; // this is needed to get iColors initialized on first use: iLastDrawnItemWasFloating = ETrue; SetFlags( CListItemDrawer::EDisableHighlight ); - } + } // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- // CMmListBoxItemDrawer::~CMmListBoxItemDrawer() - { - iFloatingItems.Close(); - delete iItemsDataCache; - delete iAnimator; - delete iSubcellText; - } + { + iFloatingItems.Close(); + delete iItemsDataCache; + delete iAnimator; + delete iSubcellText; + } // ----------------------------------------------------------------------------- // @@ -97,7 +98,7 @@ void CMmListBoxItemDrawer::EnableCachedDataUse( TBool aEnable ) { iUseCache = aEnable; - if ( aEnable ) + if( aEnable ) { RemoveFloatingItems(); } @@ -138,18 +139,18 @@ // CMmListBoxItemDrawer* CMmListBoxItemDrawer::NewLC( CMmListBoxModel* aMmListBoxModel, - const CFont* aFont, - CFormattedCellListBoxData* aFormattedCellData, - TMmWidgetType aWidgetType, - CMmTemplateLibrary* aTemplateLibrary ) - { - CMmListBoxItemDrawer* self = new (ELeave)CMmListBoxItemDrawer( - aMmListBoxModel, aFont, aFormattedCellData, aWidgetType, - aTemplateLibrary ); - CleanupStack::PushL(self); - self->ConstructL(); - return self; - } + const CFont* aFont, + CFormattedCellListBoxData* aFormattedCellData, + TMmWidgetType aWidgetType, + CMmTemplateLibrary* aTemplateLibrary ) + { + CMmListBoxItemDrawer* self = new ( ELeave ) CMmListBoxItemDrawer( + aMmListBoxModel, aFont, aFormattedCellData, aWidgetType, + aTemplateLibrary ); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } // ----------------------------------------------------------------------------- // @@ -157,24 +158,24 @@ // CMmListBoxItemDrawer* CMmListBoxItemDrawer::NewL( CMmListBoxModel* aMmListBoxModel, - const CFont* aFont, - CFormattedCellListBoxData* aFormattedCellData, - TMmWidgetType aWidgetType, - CMmTemplateLibrary* aTemplateLibrary ) - { - CMmListBoxItemDrawer* self = CMmListBoxItemDrawer::NewLC( - aMmListBoxModel, aFont, aFormattedCellData, aWidgetType, - aTemplateLibrary ); - CleanupStack::Pop( self ); - return self; + const CFont* aFont, + CFormattedCellListBoxData* aFormattedCellData, + TMmWidgetType aWidgetType, + CMmTemplateLibrary* aTemplateLibrary ) + { + CMmListBoxItemDrawer* self = CMmListBoxItemDrawer::NewLC( + aMmListBoxModel, aFont, aFormattedCellData, aWidgetType, + aTemplateLibrary ); + CleanupStack::Pop( self ); + return self; - } + } // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- // -void CMmListBoxItemDrawer::SetView(CEikListBox * aView) +void CMmListBoxItemDrawer::SetView( CEikListBox * aView ) { iWidget = aView; } @@ -193,40 +194,40 @@ // ----------------------------------------------------------------------------- // void CMmListBoxItemDrawer::ConstructL() - { - iAnimator = CMmDrawerAnimator::NewL( *this ); - iItemsDataCache = CMmItemsDataCache::NewL(); - iIsEditMode = EFalse; - iHighlightShown = EFalse; - iDrawMoveIndicators = ETrue; - } + { + iAnimator = CMmDrawerAnimator::NewL( *this ); + iItemsDataCache = CMmItemsDataCache::NewL(); + iIsEditMode = EFalse; + iHighlightShown = EFalse; + iDrawMoveIndicators = ETrue; + } -// ----xm------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- // void CMmListBoxItemDrawer::DrawEmptyItem( TInt aItemIndex, - TPoint aItemRectPos, TBool aViewIsDimmed ) const + TPoint aItemRectPos, TBool aViewIsDimmed ) const { TRect r( aItemRectPos, iItemCellSize ); CFormattedCellListBoxItemDrawer::DrawEmptyItem( aItemIndex, aItemRectPos, aViewIsDimmed ); - const_cast(this)->DrawFloatingItems(r); + const_cast ( this )->DrawFloatingItems( r ); } // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- // -TInt CMmListBoxItemDrawer::GetFloatingItemIndex(TMmFloatingItemType aType) const +TInt CMmListBoxItemDrawer::GetFloatingItemIndex( TMmFloatingItemType aType ) const { - TInt ret (KErrNotFound); - TInt i(iFloatingItems.Count()-1); - for(; i >= 0; i--) + TInt ret( KErrNotFound ); + TInt i( iFloatingItems.Count() - 1 ); + for( ; i >= 0; i-- ) { - if (iFloatingItems[i].GetFloatingItemType() == aType) + if( iFloatingItems[i].GetFloatingItemType() == aType ) { ret = i; break; @@ -242,9 +243,9 @@ // TMmFloatingItem& CMmListBoxItemDrawer::GetFloatingItemL(TMmFloatingItemType aType) { - TInt index = GetFloatingItemIndex(aType); + TInt index = GetFloatingItemIndex( aType ); User::LeaveIfError( index ); - return iFloatingItems[ index ]; + return iFloatingItems[index]; } // ----------------------------------------------------------------------------- @@ -275,6 +276,7 @@ { iAnimator->AnimateItemZoomL( aItemIndex, ETrue ); iAnimator->Trigger(); + static_cast (Widget()->Parent() )->SetAllowMove( EFalse ); } // ----------------------------------------------------------------------------- @@ -291,42 +293,42 @@ // // ----------------------------------------------------------------------------- // -void CMmListBoxItemDrawer::DrawFloatingItems(TRect currentlyDrawnRect) +void CMmListBoxItemDrawer::DrawFloatingItems( TRect currentlyDrawnRect ) { - TBool redrawItemBackground = IsRedrawItemBackgroundEnabled( ); + TBool redrawItemBackground = IsRedrawItemBackgroundEnabled(); SetRedrawItemBackground( EFalse ); - for(TInt i(iFloatingItems.Count()-1); i >= 0 ; i--) + for( TInt i( iFloatingItems.Count() - 1 ); i >= 0; i-- ) { TMmFloatingItemType type = iFloatingItems[i].GetFloatingItemType(); - if ( iFloatingItems[i].IsFloatingItemValid() ) + if( iFloatingItems[i].IsFloatingItemValid() ) { TInt drawnItemIndex = iFloatingItems[i].GetDrawnItemIndex(); TSize size = iWidget->View()->ItemSize( drawnItemIndex ); TRect rect( iFloatingItems[i].GetItemPosition(), iFloatingItems[i].GetItemPosition() + size); - if (rect.Intersects(currentlyDrawnRect)) - { - TInt tempZoomIconIndex = iZoomIconIndex; - TInt tempZoomRatio = iIconAnimationZoomRatio; + if( rect.Intersects( currentlyDrawnRect ) ) + { + TInt tempZoomIconIndex = iZoomIconIndex; + TInt tempZoomRatio = iIconAnimationZoomRatio; - iZoomIconIndex = iFloatingItems[i].GetDrawnItemIndex(); - iIconAnimationZoomRatio = iFloatingItems[i].GetCurrentZoomRatio(); + iZoomIconIndex = iFloatingItems[i].GetDrawnItemIndex(); + iIconAnimationZoomRatio = iFloatingItems[i].GetCurrentZoomRatio(); - if ( ItemHasFloatingType( drawnItemIndex, EDrag) || - ItemHasFloatingType( drawnItemIndex, EDragTransition) ) - { - ClearFlags( CListItemDrawer::EPressedDownState ); - } + if ( ItemHasFloatingType( drawnItemIndex, EDrag) || + ItemHasFloatingType( drawnItemIndex, EDragTransition) ) + { + ClearFlags( CListItemDrawer::EPressedDownState ); + } - DrawActualItem( drawnItemIndex, rect, ETrue, EFalse, EFalse, EFalse ); - iIconAnimationZoomRatio = tempZoomRatio; - iZoomIconIndex = tempZoomIconIndex; - } + DrawActualItem( drawnItemIndex, rect, ETrue, EFalse, EFalse, EFalse ); + iIconAnimationZoomRatio = tempZoomRatio; + iZoomIconIndex = tempZoomIconIndex; + } } else - { - iFloatingItems.Remove(i); - } + { + iFloatingItems.Remove( i ); + } } SetRedrawItemBackground( redrawItemBackground ); } @@ -337,11 +339,11 @@ // TInt CMmListBoxItemDrawer::GetValidFloatingItemCount(TMmFloatingItemType aType) { - TInt count (0); + TInt count( 0 ); - for(TInt i(iFloatingItems.Count()-1); i >= 0; i--) + for( TInt i( iFloatingItems.Count() - 1 ); i >= 0; i-- ) { - if (iFloatingItems[i].GetFloatingItemType() == aType + if( iFloatingItems[i].GetFloatingItemType() == aType && iFloatingItems[i].IsFloatingItemValid() ) count++; } @@ -351,19 +353,19 @@ // // ----------------------------------------------------------------------------- // -void CMmListBoxItemDrawer::DrawItem(TInt aItemIndex, TPoint aItemRectPos, +void CMmListBoxItemDrawer::DrawItem( TInt aItemIndex, TPoint aItemRectPos, TBool aItemIsSelected, TBool aItemIsCurrent, TBool aViewIsEmphasized, TBool aViewIsDimmed) const + { + if( !Widget()->View()->RedrawDisabled() ) { - if ( !Widget()->View()->RedrawDisabled() ) - { - TBool highlightVisible = + TBool highlightVisible = !( Flags() & CListItemDrawer::ESingleClickDisabledHighlight ); - aItemIsCurrent = aItemIsCurrent && highlightVisible; - DoDrawItem( aItemIndex, aItemRectPos, aItemIsSelected, - aItemIsCurrent, aViewIsEmphasized, aViewIsDimmed); - } + aItemIsCurrent = aItemIsCurrent && highlightVisible; + DoDrawItem( aItemIndex, aItemRectPos, aItemIsSelected, + aItemIsCurrent, aViewIsEmphasized, aViewIsDimmed ); } + } // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- @@ -372,25 +374,25 @@ TBool aItemIsSelected, TBool aItemIsCurrent, TBool aViewIsEmphasized, TBool aViewIsDimmed) const { - TSize itemCellSize = TSize( GetItemSize( aItemIndex, aItemIsCurrent )); - TRect actualItemRect(aItemRectPos, itemCellSize); + TSize itemCellSize = TSize( GetItemSize( aItemIndex, aItemIsCurrent ) ); + TRect actualItemRect( aItemRectPos, itemCellSize ); #ifdef RD_UI_TRANSITION_EFFECTS_LIST - MAknListBoxTfxInternal* transApi = CAknListLoader::TfxApiInternal( iGc ); - if ( transApi ) - { - transApi->StartDrawing( MAknListBoxTfxInternal::EListView ); - transApi->StopDrawing(); - transApi->BeginRedraw( MAknListBoxTfxInternal::EListItem, - actualItemRect, aItemIndex ); - } + MAknListBoxTfxInternal* transApi = CAknListLoader::TfxApiInternal( iGc ); + if( transApi ) + { + transApi->StartDrawing( MAknListBoxTfxInternal::EListView ); + transApi->StopDrawing(); + transApi->BeginRedraw( MAknListBoxTfxInternal::EListItem, + actualItemRect, aItemIndex ); + } #endif const_cast(this)->iLeftOverAreaUnderAnimatedItem = EFalse; - for(TInt i(iFloatingItems.Count()-1); i >= 0; i--) + for( TInt i( iFloatingItems.Count() - 1 ); i >= 0; i-- ) { - if ( iFloatingItems[i].GetDrawnItemIndex() == aItemIndex - && iFloatingItems[i].IsFloatingItemValid() ) + if( iFloatingItems[i].GetDrawnItemIndex() == aItemIndex + && iFloatingItems[i].IsFloatingItemValid() ) { const_cast(this)->iLeftOverAreaUnderAnimatedItem = ETrue; break; @@ -398,20 +400,20 @@ } DrawActualItem(aItemIndex, actualItemRect, aItemIsCurrent, aViewIsEmphasized, - aViewIsDimmed, aItemIsSelected); + aViewIsDimmed, aItemIsSelected); const_cast(this)->iLeftOverAreaUnderAnimatedItem = EFalse; const_cast(this)->DrawFloatingItems(actualItemRect); - if (!AknLayoutUtils::PenEnabled() && IsEditMode()) + if( !AknLayoutUtils::PenEnabled() && IsEditMode() ) { - const_cast(this)->DrawActualIndicatorItem( - aItemIndex, actualItemRect ); + const_cast ( this )->DrawActualIndicatorItem( + aItemIndex, actualItemRect ); } #ifdef RD_UI_TRANSITION_EFFECTS_LIST - if ( transApi ) - { + if( transApi ) + { transApi->EndRedraw( MAknListBoxTfxInternal::EListItem, aItemIndex ); } #endif @@ -423,12 +425,12 @@ // // ----------------------------------------------------------------------------- // -void CMmListBoxItemDrawer::DrawItemText(TInt aItemIndex, - const TRect &aItemTextRect, TBool aItemIsCurrent, - TBool aViewIsEmphasized, TBool aItemIsSelected ) const +void CMmListBoxItemDrawer::DrawItemText( TInt aItemIndex, + const TRect &aItemTextRect, TBool aItemIsCurrent, + TBool aViewIsEmphasized, TBool aItemIsSelected ) const { TRAP_IGNORE( DoDrawItemTextL( aItemIndex, aItemTextRect, aItemIsCurrent, - aViewIsEmphasized, aItemIsSelected ) ); + aViewIsEmphasized, aItemIsSelected ) ); } // ----------------------------------------------------------------------------- @@ -436,16 +438,16 @@ // ----------------------------------------------------------------------------- // void CMmListBoxItemDrawer::DoDrawItemTextL( TInt aItemIndex, const TRect - &aItemTextRect, TBool aItemIsCurrent, TBool aViewIsEmphasized, - TBool /* aItemIsSelected */) const + &aItemTextRect, TBool aItemIsCurrent, TBool aViewIsEmphasized, + TBool /* aItemIsSelected */) const { CMmCacheForItem* cache = iItemsDataCache->GetItemCacheL( aItemIndex ); cache->InvalidateIfCacheMayNotBeUsed( aItemIsCurrent, iLastSubcellsSetupCode ); - if ( IsRedrawItemBackgroundEnabled() ) + if( IsRedrawItemBackgroundEnabled() ) { - DrawBackgroundAndSeparatorLines( aItemTextRect ); + DrawBackground( aItemTextRect ); } if ( !iUseCache || !cache->IsValid() ) @@ -456,54 +458,63 @@ FormattedCellData()->SetIconArray( cache->GetIconListL() ); - TBool isFloating = !iUseCache && IsFloating( aItemIndex ); - if ( !!isFloating != !!iLastDrawnItemWasFloating ) // Ex-OR - { - iLastDrawnItemWasFloating = isFloating; - iColors = SetupColors( isFloating ); - } + TBool isFloating = !iUseCache && IsFloating( aItemIndex ); + if( !!isFloating != !!iLastDrawnItemWasFloating ) // Ex-OR + { + iLastDrawnItemWasFloating = isFloating; + iColors = SetupColors( isFloating ); + } - CFormattedCellListBoxData* data = static_cast(iData); - data->EnableMarqueeL( EFalse ); + CFormattedCellListBoxData* data = static_cast(iData); + data->EnableMarqueeL( EFalse ); TBool highlightShown = ETrue; - if (FormattedCellData()->RespectFocus() && !aViewIsEmphasized) - { + if( FormattedCellData()->RespectFocus() && !aViewIsEmphasized ) + { #ifdef RD_UI_TRANSITION_EFFECTS_LIST - MAknListBoxTfxInternal *transApi = CAknListLoader::TfxApiInternal( iGc ); - if ( transApi ) - { - transApi->Remove( MAknListBoxTfxInternal::EListHighlight ); - } + MAknListBoxTfxInternal *transApi = CAknListLoader::TfxApiInternal( iGc ); + if( transApi ) + { + transApi->Remove( MAknListBoxTfxInternal::EListHighlight ); + } #endif - highlightShown = EFalse; - } + highlightShown = EFalse; + } data->Draw( Properties(aItemIndex), *iGc, &( cache->GetItemText() ), aItemTextRect, - GetHighlightVisibility( aItemIndex, aItemIsCurrent, highlightShown ), iColors ); + GetHighlightVisibility( aItemIndex, aItemIsCurrent, highlightShown ), iColors ); #ifdef RD_UI_TRANSITION_EFFECTS_LIST - MAknListBoxTfxInternal *transApi = CAknListLoader::TfxApiInternal( iGc ); - if ( transApi ) - { - transApi->StartDrawing( MAknListBoxTfxInternal::EListItem ); - } + MAknListBoxTfxInternal *transApi = CAknListLoader::TfxApiInternal( iGc ); + if( transApi ) + { + transApi->StartDrawing( MAknListBoxTfxInternal::EListItem ); + } #endif - if ( iMarqueeAdapter && aItemIsCurrent ) - { - DEBUG(("CMmListBoxItemDrawer::DoDrawItemTextL - DrawMarquee")); - iMarqueeAdapter->DrawMarqueeL( *iGc ); - } + if( iMarqueeAdapter && aItemIsCurrent ) + { + DEBUG(("CMmListBoxItemDrawer::DoDrawItemTextL - DrawMarquee")); + iMarqueeAdapter->DrawMarqueeL( *iGc ); + } #ifdef RD_UI_TRANSITION_EFFECTS_LIST - if ( transApi ) - { - transApi->StopDrawing(); - } + if( transApi ) + { + transApi->StopDrawing(); + } #endif - ColumnData()->SetIconArray( NULL ); + if( iDrawSeparatorLines ) + { + CMmListBoxView* view = static_cast( iWidget->View() ); + if( aItemIndex != ( view->ModelItemsCount() - 1 )) + { + AknListUtils::DrawSeparator( *iGc, aItemTextRect, iColors.iBack ); + } + } + ColumnData()->SetIconArray( NULL ); + } // ----------------------------------------------------------------------------- @@ -519,29 +530,42 @@ // // ----------------------------------------------------------------------------- // +void CMmListBoxItemDrawer::SetDrawSeparatorLines( TBool aDraw ) + { + iDrawSeparatorLines = aDraw; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// TBool CMmListBoxItemDrawer::IsRedrawItemBackgroundEnabled() const { return iRedrawBackground; } -void CMmListBoxItemDrawer::DrawBackgroundAndSeparatorLines( const TRect& aItemTextRect ) const +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void CMmListBoxItemDrawer::DrawBackground( const TRect& aItemTextRect ) const { MAknsSkinInstance *skin = AknsUtils::SkinInstance(); CCoeControl* control = FormattedCellData()->Control(); - if ( IsRedrawItemBackgroundEnabled() ) + if( IsRedrawItemBackgroundEnabled() ) { #ifdef RD_UI_TRANSITION_EFFECTS_LIST - MAknListBoxTfxInternal *transApi = CAknListLoader::TfxApiInternal( iGc ); - if ( transApi ) + MAknListBoxTfxInternal *transApi = CAknListLoader::TfxApiInternal( iGc ); + if( transApi ) { transApi->StartDrawing( MAknListBoxTfxInternal::EListView ); } #endif TBool bgDrawn( EFalse ); - if ( control ) + if( control ) { - if ( CAknEnv::Static()->TransparencyEnabled() ) + if( CAknEnv::Static()->TransparencyEnabled() ) { bgDrawn = AknsDrawUtils::Background( skin, iBgContext, control, *iGc, aItemTextRect, @@ -555,12 +579,12 @@ KAknsDrawParamBottomLevelRGBOnly ); } } - if ( !bgDrawn ) + if( !bgDrawn ) { iGc->Clear( aItemTextRect ); } #ifdef RD_UI_TRANSITION_EFFECTS_LIST - if ( transApi ) + if( transApi ) { transApi->StopDrawing(); } @@ -596,7 +620,7 @@ ItemCellSize().iHeight * iIconAnimationZoomRatio); aSubCellTemplate.iRectAccordingToParent.iTl = TPoint(0, 0); - SetupSubCellL( aSubCellTemplate, aIndex , aItemIndex); + SetupSubCellL( aSubCellTemplate, aIndex, aItemIndex ); } // ----------------------------------------------------------------------------- @@ -604,72 +628,72 @@ // ----------------------------------------------------------------------------- // void CMmListBoxItemDrawer::SetupSubCellL( TTemplateChild aSubCellTemplate, - TInt aIndex, TInt aItemIndex ) const - { + TInt aIndex, TInt aItemIndex ) const + { CFormattedCellListBoxData* data = static_cast(iData); TInt width = aSubCellTemplate.iRectAccordingToParent.iBr.iX - aSubCellTemplate.iRectAccordingToParent.iTl.iX; TInt height = aSubCellTemplate.iRectAccordingToParent.iBr.iY - aSubCellTemplate.iRectAccordingToParent.iTl.iY; - data->SetTransparentSubCellL(aIndex, ETrue); - data->SetSubCellSizeL( aIndex, TSize(width,height)); - data->SetSubCellIconSize( aIndex, TSize(width,height) ); - data->SetSubCellPositionL( aIndex, aSubCellTemplate.iRectAccordingToParent.iTl); - data->SetGraphicsSubCellL( aIndex, aSubCellTemplate.iIsImage ); - data->SetSubCellAlignmentL( aIndex, aSubCellTemplate.iTextAlign ); - const CFont* font = AknLayoutUtils::FontFromId(aSubCellTemplate.iFontId); - data->SetSubCellFontL (aIndex, font); - data->SetSubCellBaselinePosL( aIndex, - CAknLayoutFont::AsCAknLayoutFontOrNull( font )->TextPaneTopToBaseline() - + aSubCellTemplate.iRectAccordingToParent.iTl.iY ); + data->SetTransparentSubCellL( aIndex, ETrue ); + data->SetSubCellSizeL( aIndex, TSize( width, height ) ); + data->SetSubCellIconSize( aIndex, TSize( width, height ) ); + data->SetSubCellPositionL( aIndex, aSubCellTemplate.iRectAccordingToParent.iTl); + data->SetGraphicsSubCellL( aIndex, aSubCellTemplate.iIsImage ); + data->SetSubCellAlignmentL( aIndex, aSubCellTemplate.iTextAlign ); + const CFont* font = AknLayoutUtils::FontFromId(aSubCellTemplate.iFontId); + data->SetSubCellFontL (aIndex, font); + data->SetSubCellBaselinePosL( aIndex, + CAknLayoutFont::AsCAknLayoutFontOrNull( font )->TextPaneTopToBaseline() + + aSubCellTemplate.iRectAccordingToParent.iTl.iY ); -// If some text is clipped then marquee will do the drawing right after the subcell is drawn by ListBoxData. -// Setting the subcell size to zero prevents ListBoxData from drawing the text. - if (!aSubCellTemplate.iIsImage - && !iIsMarqueeBeingDrawn - && ( aItemIndex == iWidget->View()->CurrentItemIndex() ) - && !IsEditMode() - && iWidgetType == EListbox - && iSubcellText + // If some text is clipped then marquee will do the drawing right after the subcell is drawn by ListBoxData. + // Setting the subcell size to zero prevents ListBoxData from drawing the text. + if (!aSubCellTemplate.iIsImage + && !iIsMarqueeBeingDrawn + && ( aItemIndex == iWidget->View()->CurrentItemIndex() ) + && !IsEditMode() + && iWidgetType == EListbox + && iSubcellText && iMarqueeAdapter->IsMarqueeEnabled() ) - { - if (iMarqueeAdapter && IsTextClippedL( aSubCellTemplate, *iSubcellText ) - && STATIC_CAST(CMmWidgetContainer*,Widget()->Parent())->IsHighlightVisible() ) - { - data->SetSubCellSizeL( aIndex, TSize(0,0)); - const_cast(this)->AddSubcellMarqueeElementL( - aSubCellTemplate, aIndex, aItemIndex); - } - else if (iMarqueeAdapter) + { + if (iMarqueeAdapter && IsTextClippedL( aSubCellTemplate, *iSubcellText ) + && STATIC_CAST(CMmWidgetContainer*,Widget()->Parent())->IsHighlightVisible() ) { - iMarqueeAdapter->StopMarqueeDrawing(aIndex); + data->SetSubCellSizeL( aIndex, TSize( 0, 0 ) ); + const_cast ( this )->AddSubcellMarqueeElementL( + aSubCellTemplate, aIndex, aItemIndex ); } - } + else if( iMarqueeAdapter ) + { + iMarqueeAdapter->StopMarqueeDrawing( aIndex ); + } + } - if ( iMarqueeAdapter && iIsMarqueeBeingDrawn - && iMarqueeAdapter->SubcellMarqueeElementExists( aIndex ) ) - { - if (aItemIndex != iWidget->View()->CurrentItemIndex() ) + if( iMarqueeAdapter && iIsMarqueeBeingDrawn + && iMarqueeAdapter->SubcellMarqueeElementExists( aIndex ) ) + { + if( aItemIndex != iWidget->View()->CurrentItemIndex() ) { - iMarqueeAdapter->StopMarqueeDrawing(aIndex); + iMarqueeAdapter->StopMarqueeDrawing( aIndex ); } - else - { - data->SetSubCellSizeL(aIndex, TSize(0, 0)); - } + else + { + data->SetSubCellSizeL( aIndex, TSize( 0, 0 ) ); + } } - } + } // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- // CFormattedCellListBoxData::TColors CMmListBoxItemDrawer::SetupColors( TBool aDragged ) const - { - CFormattedCellListBoxData::TColors colors; - MAknsSkinInstance* skin = AknsUtils::SkinInstance(); + { + CFormattedCellListBoxData::TColors colors; + MAknsSkinInstance* skin = AknsUtils::SkinInstance(); - if ( !aDragged ) - { + if( !aDragged ) + { AknsUtils::GetCachedColor( skin, colors.iText, KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG9 ); AknsUtils::GetCachedColor( skin, colors.iBack , KAknsIIDQsnTextColors, @@ -678,9 +702,9 @@ KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG11 ); AknsUtils::GetCachedColor( skin, colors.iHighlightedBack, KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG6 ); - } - else - { + } + else + { AknsUtils::GetCachedColor( skin, colors.iText, KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG11 ); AknsUtils::GetCachedColor( skin, colors.iBack , KAknsIIDQsnTextColors, @@ -689,10 +713,10 @@ KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG11 ); AknsUtils::GetCachedColor( skin, colors.iHighlightedBack, KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG6 ); - } + } - return colors; - } + return colors; + } // ----------------------------------------------------------------------------- // @@ -700,8 +724,8 @@ // TInt CMmListBoxItemDrawer::GetItemHeight( TInt aItemIndex, TBool aItemIsCurrent ) const { - TSize ret(TInt(0),TInt(0)); - ret = GetItemSize(aItemIndex, aItemIsCurrent); + TSize ret( TInt( 0 ), TInt( 0 ) ); + ret = GetItemSize( aItemIndex, aItemIsCurrent ); return ret.iHeight; } @@ -711,14 +735,14 @@ // TInt CMmListBoxItemDrawer::GetFloatingItemCount() { - for( TInt i=0; i< iFloatingItems.Count(); i++) - { - TMmFloatingItem& current = GetFloatingItemAtIndex(i); - if (current.GetDrawnItemIndex() == KErrNotFound) - { - RemoveFloatingItem(i); - } - } + for( TInt i = 0; i < iFloatingItems.Count(); i++ ) + { + TMmFloatingItem& current = GetFloatingItemAtIndex( i ); + if( current.GetDrawnItemIndex() == KErrNotFound ) + { + RemoveFloatingItem( i ); + } + } return iFloatingItems.Count(); } @@ -729,7 +753,7 @@ // TMmFloatingItem& CMmListBoxItemDrawer::GetFloatingItemAtIndex( TInt aIndex ) { - return iFloatingItems[ aIndex ]; + return iFloatingItems[aIndex]; } // ----------------------------------------------------------------------------- @@ -738,10 +762,10 @@ // void CMmListBoxItemDrawer::RemoveFloatingItem( TInt aPosition ) { - if (aPosition != KErrNotFound) - { - iFloatingItems.Remove( aPosition ); - } + if( aPosition != KErrNotFound ) + { + iFloatingItems.Remove( aPosition ); + } } // ----------------------------------------------------------------------------- @@ -761,7 +785,7 @@ TInt aPosition ) { EnableCachedDataUse( EFalse ); - if (aPosition != KErrNotFound) + if( aPosition != KErrNotFound ) { iFloatingItems.InsertL( aFloatingItem, aPosition ); } @@ -777,40 +801,40 @@ // TSize CMmListBoxItemDrawer::GetItemSize( TInt aItemIndex, TBool aItemIsCurrent ) const { - if ( aItemIndex < 0 ) + if( aItemIndex < 0 ) { return TSize( 1, 1 ); } - TSize size; + TSize size; - CMmCacheForItem* cache = NULL; - TRAPD( cacheError, cache = iItemsDataCache->GetItemCacheL( aItemIndex ) ); - if ( cacheError != KErrNone ) - { - cache = NULL; - } + CMmCacheForItem* cache = NULL; + TRAPD( cacheError, cache = iItemsDataCache->GetItemCacheL( aItemIndex ) ); + if( cacheError != KErrNone ) + { + cache = NULL; + } - if ( cache ) - { - cache->InvalidateIfCacheMayNotBeUsed( - aItemIsCurrent, iLastSubcellsSetupCode ); - } + if( cache ) + { + cache->InvalidateIfCacheMayNotBeUsed( + aItemIsCurrent, iLastSubcellsSetupCode ); + } - if ( !iUseCache || !cache || !cache->IsValid() ) + if( !iUseCache || !cache || !cache->IsValid() ) { const TDesC8& mm_template = iMmModel->GetAttributeAsText (aItemIndex, KMmTemplate8); TRect viewRect = iWidget->View()->ViewRect(); TBool landscapeOrientation = Layout_Meta_Data::IsLandscapeOrientation(); - if ( iTemplateLibrary->GetSize( size, iWidgetType, mm_template, + if( iTemplateLibrary->GetSize( size, iWidgetType, mm_template, landscapeOrientation, aItemIsCurrent, viewRect ) != KErrNone ) { size = TSize( 1, 1 ); } - if ( cache ) + if( cache ) { cache->SetSize( size ); } @@ -843,19 +867,19 @@ void CMmListBoxItemDrawer::SetDraggableL( TBool aDraggable ) { - iDraggable = aDraggable; + iDraggable = aDraggable; - if (!iDraggable) + if( !iDraggable ) { - for(int i=0; i< iFloatingItems.Count(); i++) + for( int i = 0; i < iFloatingItems.Count(); i++ ) { - if (iFloatingItems[i].GetFloatingItemType() == EZoomTransition - && iFloatingItems[i].GetZoomingStatus() > 0) + if( iFloatingItems[i].GetFloatingItemType() == EZoomTransition + && iFloatingItems[i].GetZoomingStatus() > 0 ) { AnimateItemZoomOutL( iFloatingItems[i].GetDrawnItemIndex() ); } - else if (iFloatingItems[i].GetFloatingItemType() == EDrag - || iFloatingItems[i].IsManualDelete()) + else if( iFloatingItems[i].GetFloatingItemType() == EDrag + || iFloatingItems[i].IsManualDelete() ) { iFloatingItems[i].InvalidateFloatingItem(); } @@ -869,7 +893,7 @@ // void CMmListBoxItemDrawer::SetEditModeL( TBool aEditMode ) { - if ( aEditMode ) + if( aEditMode ) { EnableCachedDataUse( EFalse ); } @@ -889,9 +913,9 @@ // ----------------------------------------------------------------------------- // TBool CMmListBoxItemDrawer::IsEditMode() const - { - return iIsEditMode; - } + { + return iIsEditMode; + } // ----------------------------------------------------------------------------- // @@ -917,58 +941,58 @@ floatingItem.SetManualDelete( ETrue ); TMmFloatingItem postDragRefresh( item.GetDrawnItemIndex(), - item.GetItemPosition(), EPostDragRefreshItem, - MmEffects::KNoAnimationFramesCount, iWidget->View() ); + item.GetItemPosition(), EPostDragRefreshItem, + MmEffects::KNoAnimationFramesCount, iWidget->View() ); - iFloatingItems.Remove(dragFloatingItem); + iFloatingItems.Remove( dragFloatingItem ); - if (postDragRefresh.GetItemPosition() != floatingItem.GetItemPosition()) - { - iFloatingItems.Append( postDragRefresh ); - } - iFloatingItems.Insert( floatingItem, 0 ); - } - } + if (postDragRefresh.GetItemPosition() != floatingItem.GetItemPosition()) + { + iFloatingItems.Append( postDragRefresh ); + } + iFloatingItems.Insert( floatingItem, 0 ); + } + } // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- // -void CMmListBoxItemDrawer::SetDraggedIndexL(TInt aDraggedItemIndex, - TPoint aPoint) +void CMmListBoxItemDrawer::SetDraggedIndexL( TInt aDraggedItemIndex, + TPoint aPoint ) { TInt dragFloatingItem = KErrNotFound; do - { - dragFloatingItem = GetFloatingItemIndex(EDrag); - if (dragFloatingItem != KErrNotFound) - { - TMmFloatingItem & item = GetFloatingItemAtIndex( dragFloatingItem ); + { + dragFloatingItem = GetFloatingItemIndex( EDrag ); + if( dragFloatingItem != KErrNotFound ) + { + TMmFloatingItem & item = GetFloatingItemAtIndex( dragFloatingItem ); - TMmFloatingItem postDragRefresh( item.GetDrawnItemIndex(), - item.GetItemPosition(), EPostDragRefreshItem, - MmEffects::KNoAnimationFramesCount, iWidget->View() ); + TMmFloatingItem postDragRefresh( item.GetDrawnItemIndex(), + item.GetItemPosition(), EPostDragRefreshItem, + MmEffects::KNoAnimationFramesCount, iWidget->View() ); - if (postDragRefresh.GetItemPosition() != aPoint) - { - iFloatingItems.Append( postDragRefresh ); - } - } + if( postDragRefresh.GetItemPosition() != aPoint ) + { + iFloatingItems.Append( postDragRefresh ); + } + } - RemoveFloatingItem( dragFloatingItem ); + RemoveFloatingItem( dragFloatingItem ); - } - while ( dragFloatingItem != KErrNotFound ); + } + while( dragFloatingItem != KErrNotFound ); - if ( aDraggedItemIndex != KErrNotFound ) - { - TMmFloatingItem floatingItem( aDraggedItemIndex, aPoint, EDrag, - MmEffects::KNoAnimationFramesCount, iWidget->View() ); - floatingItem.SetManualDelete( ETrue ); - AddFloatingItemL(floatingItem, 0); + if( aDraggedItemIndex != KErrNotFound ) + { + TMmFloatingItem floatingItem( aDraggedItemIndex, aPoint, EDrag, + MmEffects::KNoAnimationFramesCount, iWidget->View() ); + floatingItem.SetManualDelete( ETrue ); + AddFloatingItemL( floatingItem, 0 ); - ClearFlags( CListItemDrawer::EPressedDownState ); - } + ClearFlags( CListItemDrawer::EPressedDownState ); + } iAnimator->Trigger(); } @@ -987,45 +1011,45 @@ // ----------------------------------------------------------------------------- // void CMmListBoxItemDrawer::SetBgContext( - CAknsBasicBackgroundControlContext * aBgContext ) - { - iBgContext = aBgContext; - } + CAknsBasicBackgroundControlContext * aBgContext ) + { + iBgContext = aBgContext; + } // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- // void CMmListBoxItemDrawer::SetScrollbarVisibilityL( TBool aIsScrollbarVisible ) - { - iTemplateLibrary->SetScrollbarVisibilityL( aIsScrollbarVisible ); - } + { + iTemplateLibrary->SetScrollbarVisibilityL( aIsScrollbarVisible ); + } // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- // TRect CMmListBoxItemDrawer::AdjustItemRect( TInt aItemIndex ) const - { - TSize size = iWidget->View()->ItemSize (iWidget->View()->CurrentItemIndex () ); - TRect rect(iWidget->View()->ItemPos (iWidget->View()->CurrentItemIndex () ), - iWidget->View()->ItemPos (iWidget->View()->CurrentItemIndex () ) + size); - if ( !AknLayoutUtils::PenEnabled () && iIsIndicatorItem) - { - TBool landscapeOrientation = - Layout_Meta_Data::IsLandscapeOrientation (); - const TDesC8& mm_template = iMmModel->GetAttributeAsText ( - 0, KMmTemplate8); - TRect relativeToParentRect = TRect (TPoint (0, 0), TPoint (0, 0)); - relativeToParentRect = iTemplateLibrary->GetMoveIndicatorRect( - iWidgetType, mm_template, landscapeOrientation, - aItemIndex == iWidget->View()->CurrentItemIndex () ); - rect.Move (relativeToParentRect.iTl); - rect.iBr.iX = rect.iBr.iX + relativeToParentRect.Width (); - rect.iBr.iY = rect.iBr.iY + relativeToParentRect.Height (); - } - return rect; - } + { + TSize size = iWidget->View()->ItemSize (iWidget->View()->CurrentItemIndex () ); + TRect rect(iWidget->View()->ItemPos (iWidget->View()->CurrentItemIndex () ), + iWidget->View()->ItemPos (iWidget->View()->CurrentItemIndex () ) + size); + if( !AknLayoutUtils::PenEnabled() && iIsIndicatorItem ) + { + TBool landscapeOrientation = + Layout_Meta_Data::IsLandscapeOrientation(); + const TDesC8& mm_template = iMmModel->GetAttributeAsText ( + 0, KMmTemplate8); + TRect relativeToParentRect = TRect( TPoint( 0, 0 ), TPoint( 0, 0 ) ); + relativeToParentRect = iTemplateLibrary->GetMoveIndicatorRect( + iWidgetType, mm_template, landscapeOrientation, + aItemIndex == iWidget->View()->CurrentItemIndex () ); + rect.Move( relativeToParentRect.iTl ); + rect.iBr.iX = rect.iBr.iX + relativeToParentRect.Width(); + rect.iBr.iY = rect.iBr.iY + relativeToParentRect.Height(); + } + return rect; + } // ----------------------------------------------------------------------------- // @@ -1040,50 +1064,50 @@ IsRedrawItemBackgroundEnabled( ); SetRedrawItemBackground( EFalse ); - DrawActualItem( aItemIndex, AdjustItemRect( aItemIndex ) , EFalse, EFalse, EFalse, EFalse); + DrawActualItem( aItemIndex, AdjustItemRect( aItemIndex ) , EFalse, EFalse, EFalse, EFalse); - SetRedrawItemBackground( redrawItemBackground ); - iIsIndicatorItem = EFalse; - } - } + SetRedrawItemBackground( redrawItemBackground ); + iIsIndicatorItem = EFalse; + } + } // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- // void CMmListBoxItemDrawer::ReplaceSubCellText( const TDesC& aText ) - { - delete iSubcellText; - iSubcellText = NULL; - if( aText.Compare( KNullDesC() ) ) - { - iSubcellText = aText.Alloc(); - } - } + { + delete iSubcellText; + iSubcellText = NULL; + if( aText.Compare( KNullDesC() ) ) + { + iSubcellText = aText.Alloc(); + } + } // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- // void CMmListBoxItemDrawer::AddSubcellMarqueeElementL( TTemplateChild aSubCellTemplate, TInt aIndex, TInt aItemIndex ) - { - TRgb textColor; - MAknsSkinInstance* skin = AknsUtils::SkinInstance(); - AknsUtils::GetCachedColor( skin, textColor, KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG10 ); - iMarqueeAdapter->AddMarqueeElementL( aSubCellTemplate.iRectAccordingToParent, *iSubcellText, - aSubCellTemplate.iFontId, textColor, aSubCellTemplate.iTextAlign, aIndex, - aSubCellTemplate.iRectAccordingToParent.iTl.iY, - aItemIndex); - } + { + TRgb textColor; + MAknsSkinInstance* skin = AknsUtils::SkinInstance(); + AknsUtils::GetCachedColor( skin, textColor, KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG10 ); + iMarqueeAdapter->AddMarqueeElementL( aSubCellTemplate.iRectAccordingToParent, *iSubcellText, + aSubCellTemplate.iFontId, textColor, aSubCellTemplate.iTextAlign, aIndex, + aSubCellTemplate.iRectAccordingToParent.iTl.iY, + aItemIndex); + } // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- // void CMmListBoxItemDrawer::SetMarqueeAdapter( CMmMarqueeAdapter* aAdapter ) - { - iMarqueeAdapter = aAdapter; - } + { + iMarqueeAdapter = aAdapter; + } // ----------------------------------------------------------------------------- // @@ -1107,17 +1131,17 @@ TInt maxClipWidth = aTemplateChild.iRectAccordingToParent.Width(); const CFont* font = AknLayoutUtils::FontFromId(aTemplateChild.iFontId); return AknBidiTextUtils::ConvertToVisualAndClipL( clipbuf, *font, - aTemplateChild.iRectAccordingToParent.Width(), maxClipWidth ); - } + aTemplateChild.iRectAccordingToParent.Width(), maxClipWidth ); + } // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- // -void CMmListBoxItemDrawer::SetNumberOfColsInView(TInt aNumberOfColumns) - { - iNumberOfColsInWidget = aNumberOfColumns; - } +void CMmListBoxItemDrawer::SetNumberOfColsInView( TInt aNumberOfColumns ) + { + iNumberOfColsInWidget = aNumberOfColumns; + } // ----------------------------------------------------------------------------- // @@ -1135,80 +1159,86 @@ child.iIsImage = EFalse; } - if ( IsDraggable() && aItemIndex == iZoomIconIndex ) - { - const TReal KNormalZoomRatio = 1.0; - TReal zoomDelta = ( iIconAnimationZoomRatio - KNormalZoomRatio ) / 2.0; - TSize size = child.iRectAccordingToParent.Size(); - TSize sizeDelta( size.iWidth * zoomDelta, size.iHeight * zoomDelta ); - child.iRectAccordingToParent.Grow( sizeDelta ); - } - - TSize targetSize = child.iRectAccordingToParent.Size(); + if( IsEditMode() && IsDraggable() && aItemIndex == iZoomIconIndex ) + { + const TReal KNormalZoomRatio = 1.0; + TReal zoomDelta = ( iIconAnimationZoomRatio - KNormalZoomRatio ) / 2.0; + TSize size = child.iRectAccordingToParent.Size(); + TSize sizeDelta( size.iWidth * zoomDelta, size.iHeight * zoomDelta ); + child.iRectAccordingToParent.Grow( sizeDelta ); + TInt targetZoom( KZoomStateZoomRatio * 100 ); + Math::Round( zoomDelta, ( zoomDelta * 1000 ), 0); + if( (TInt)zoomDelta == targetZoom ) + { + static_cast (Widget()->Parent())->SetAllowMove( ETrue ); + } + } - CHnIconHolder* iconHolder = iMmModel->GetAttributeAsRefCountedGraphics( - aItemIndex, child.iData, &targetSize ); - icon = iconHolder ? iconHolder->GetGulIcon() : NULL; - if ( icon ) + TSize targetSize = child.iRectAccordingToParent.Size(); + + CHnIconHolder* iconHolder = iMmModel->GetAttributeAsRefCountedGraphics( + aItemIndex, child.iData, &targetSize ); + icon = iconHolder ? iconHolder->GetGulIcon() : NULL; + if( icon ) + { + CFbsBitmap* bitmap = icon->Bitmap(); + ASSERT( bitmap ); + //resize the item if it is a move indicator + if( iIsIndicatorItem ) { - CFbsBitmap* bitmap = icon->Bitmap(); - ASSERT( bitmap ); - //resize the item if it is a move indicator - if( iIsIndicatorItem ) - { AknIconUtils::SetSize( bitmap, child.iRectAccordingToParent.Size(), - EAspectRatioNotPreserved ); - } - else - { + EAspectRatioNotPreserved ); + } + else + { TSize bmpSize = bitmap->SizeInPixels(); TBool setSizeRequired = bitmap->DisplayMode() == ENone; if ( targetSize.iWidth && targetSize.iHeight && ( setSizeRequired || !BitmapFitsIntoTarget( bmpSize, targetSize ) ) ) { - CFbsBitmap* mask = icon->Mask(); - if ( mask ) - { + CFbsBitmap* mask = icon->Mask(); + if( mask ) + { __ASSERT_DEBUG( bmpSize == mask->SizeInPixels(), User::Invariant() ); AknIconUtils::SetSize( mask, targetSize, EAspectRatioPreservedAndUnusedSpaceRemoved ); } AknIconUtils::SetSize( bitmap, targetSize, EAspectRatioPreservedAndUnusedSpaceRemoved ); - } } + } TInt iconIndex = iItemsDataCache->GetItemCacheL( aItemIndex )->AppendIconL( iconHolder ); - HBufC8* number = HnConvUtils::NumToStr8LC( iconIndex ); - const TInt newLength = aItemText.Length() + number->Length(); + HBufC8* number = HnConvUtils::NumToStr8LC( iconIndex ); + const TInt newLength = aItemText.Length() + number->Length(); + if( aItemText.MaxLength() < newLength ) + { + aItemText.ReAllocL( newLength ); + } + CleanupStack::PopAndDestroy( number ); + aItemText.AppendNum( iconIndex ); + + SetupSubCellL( child, aSubcellIncrement, aItemIndex ); + + if( aChildIndex < aTemplateChildArray.Count() - 1 ) + { + const TInt newLength = aItemText.Length() + KTab().Length(); if( aItemText.MaxLength() < newLength ) { aItemText.ReAllocL( newLength ); } - CleanupStack::PopAndDestroy( number ); - aItemText.AppendNum( iconIndex ); - - SetupSubCellL( child, aSubcellIncrement, aItemIndex ); + aItemText.Append( KTab ); + } - if ( aChildIndex < aTemplateChildArray.Count() - 1 ) - { - const TInt newLength = aItemText.Length() + KTab().Length(); - if( aItemText.MaxLength() < newLength ) - { - aItemText.ReAllocL( newLength ); - } - aItemText.Append( KTab ); - } - - aSubcellIncrement++; - iLastSubcellsSetupCode.AddSubcellInfo( TMmSubcellsSetupCode::EGraphicsSubcell ); - } - else - { - // Mark the fact that subcell was not set to ensure that TMmSubcellsSetupCode - // works properly. + aSubcellIncrement++; + iLastSubcellsSetupCode.AddSubcellInfo( TMmSubcellsSetupCode::EGraphicsSubcell ); + } + else + { + // Mark the fact that subcell was not set to ensure that TMmSubcellsSetupCode + // works properly. iLastSubcellsSetupCode.AddSubcellInfo( TMmSubcellsSetupCode::ESkippedSubcell ); - } - } + } + } // ----------------------------------------------------------------------------- // @@ -1230,61 +1260,61 @@ // ----------------------------------------------------------------------------- // void CMmListBoxItemDrawer::SetupTextSubcellL( - RArray& aTemplateChildArray, TInt aChildIndex, - TInt aItemIndex, RBuf& aItemText, TInt& aSubcellIncrement ) const - { - TTemplateChild child = aTemplateChildArray[aChildIndex]; - RBuf itemChildText; - CleanupClosePushL( itemChildText ); - const TDesC8& mmTitleDes8 = iMmModel->GetAttributeAsText( aItemIndex, - child.iData ); - itemChildText.Assign( HnConvUtils::Str8ToStr( mmTitleDes8 ) ); + RArray& aTemplateChildArray, TInt aChildIndex, + TInt aItemIndex, RBuf& aItemText, TInt& aSubcellIncrement ) const + { + TTemplateChild child = aTemplateChildArray[aChildIndex]; + RBuf itemChildText; + CleanupClosePushL( itemChildText ); + const TDesC8& mmTitleDes8 = iMmModel->GetAttributeAsText( aItemIndex, + child.iData ); + itemChildText.Assign( HnConvUtils::Str8ToStr( mmTitleDes8 ) ); - AppendText( aItemText, itemChildText ); + AppendText( aItemText, itemChildText ); - const_cast(this)->ReplaceSubCellText( - itemChildText ); - CleanupStack::PopAndDestroy( &itemChildText ); + const_cast ( this )->ReplaceSubCellText( + itemChildText ); + CleanupStack::PopAndDestroy( &itemChildText ); - SetupSubCellL( child, aSubcellIncrement, aItemIndex ); + SetupSubCellL( child, aSubcellIncrement, aItemIndex ); - if ( aChildIndex < aTemplateChildArray.Count() - 1 ) - { - AppendText( aItemText, KTab ); - } + if( aChildIndex < aTemplateChildArray.Count() - 1 ) + { + AppendText( aItemText, KTab ); + } - aSubcellIncrement++; - iLastSubcellsSetupCode.AddSubcellInfo( TMmSubcellsSetupCode::ETextSubcell ); - } + aSubcellIncrement++; + iLastSubcellsSetupCode.AddSubcellInfo( TMmSubcellsSetupCode::ETextSubcell ); + } // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- // void CMmListBoxItemDrawer::AppendText( RBuf& aBuffer, const TDesC& aTextToAppend ) const - { - TInt newLength = aBuffer.Length() + aTextToAppend.Length(); - TInt error = KErrNone; + { + TInt newLength = aBuffer.Length() + aTextToAppend.Length(); + TInt error = KErrNone; - if( aBuffer.MaxLength() < newLength ) - { - error = aBuffer.ReAlloc( newLength ); - } - if ( error == KErrNone ) - { - aBuffer.Append( aTextToAppend ); - } - } + if( aBuffer.MaxLength() < newLength ) + { + error = aBuffer.ReAlloc( newLength ); + } + if( error == KErrNone ) + { + aBuffer.Append( aTextToAppend ); + } + } // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- // void CMmListBoxItemDrawer::SetupBackdropSubcellL( - RArray& aTemplateChildArray, TInt aItemIndex, - RBuf& aItemText, TInt& aSubcellIncrement ) const - { + RArray& aTemplateChildArray, TInt aItemIndex, + RBuf& aItemText, TInt& aSubcellIncrement ) const + { CGulIcon* icon = NULL; - for ( TInt i = 0; i < aTemplateChildArray.Count() /*&& - aItemIndex != iWidget->View()->CurrentItemIndex()*/; ++i ) + for( TInt i = 0; i < aTemplateChildArray.Count() /*&& + aItemIndex != iWidget->View()->CurrentItemIndex()*/; ++i ) { TTemplateChild child = aTemplateChildArray[i]; if( child.iImageVisualId == EImageVisualIdEditMode && @@ -1294,14 +1324,14 @@ aItemIndex == iWidget->View()->CurrentItemIndex() ); CHnIconHolder* iconHolder = iMmModel->GetAttributeAsRefCountedGraphics( aItemIndex, child.iData, &itemSize ); icon = iconHolder ? iconHolder->GetGulIcon() : NULL; - if ( icon ) + if( icon ) { CFbsBitmap* bitmap = icon->Bitmap(); - child.iRectAccordingToParent = TRect( TPoint( 0, 0 ), - TPoint( itemSize.iWidth, itemSize.iHeight ) ); - AknIconUtils::SetSize( bitmap, itemSize, - EAspectRatioNotPreserved ); - TInt iconIndex = iItemsDataCache->GetItemCacheL( aItemIndex )->AppendIconL( iconHolder ); + child.iRectAccordingToParent = TRect( TPoint( 0, 0 ), + TPoint( itemSize.iWidth, itemSize.iHeight ) ); + AknIconUtils::SetSize( bitmap, itemSize, + EAspectRatioNotPreserved ); + TInt iconIndex = iItemsDataCache->GetItemCacheL( aItemIndex )->AppendIconL( iconHolder ); HBufC8* number = HnConvUtils::NumToStr8LC( iconIndex ); TInt newLength = aItemText.Length() + number->Length(); @@ -1324,7 +1354,7 @@ } } } - } + } // ----------------------------------------------------------------------------- // @@ -1337,7 +1367,7 @@ cache->MarkAsInvalid(); const TDesC8& mmTemplate = iMmModel->GetAttributeAsText( aItemIndex, KMmTemplate8 ); - if ( !mmTemplate.Compare( KNullDesC8 ) || !mmTemplate.Compare( KEmpty8 ) ) + if( !mmTemplate.Compare( KNullDesC8 ) || !mmTemplate.Compare( KEmpty8 ) ) { User::Leave( KErrNotFound ); } @@ -1354,68 +1384,68 @@ RArray templateChildArray; CleanupClosePushL( templateChildArray ); - if ( !iIsIndicatorItem ) - { - iTemplateLibrary->GetChildrenL( iWidgetType, templateChildArray, mmTemplate, - landscapeOrientation, aItemIsCurrent, IsEditMode() ); - } + if( !iIsIndicatorItem ) + { + iTemplateLibrary->GetChildrenL( iWidgetType, templateChildArray, mmTemplate, + landscapeOrientation, aItemIsCurrent, IsEditMode() ); + } else if ( !AknLayoutUtils::PenEnabled() ) - { - iTemplateLibrary->GetMoveIndicatorChildrenL( iWidgetType, templateChildArray, - mmTemplate, landscapeOrientation, aItemIsCurrent ); - } + { + iTemplateLibrary->GetMoveIndicatorChildrenL( iWidgetType, templateChildArray, + mmTemplate, landscapeOrientation, aItemIsCurrent ); + } iLastSubcellsSetupCode.Clear(); //Backdrop icon as first element to draw TInt subcellIncrement( 0 ); - if ( GetBackdropVisibility( aItemIndex, aItemIsCurrent ) ) + if( GetBackdropVisibility( aItemIndex, aItemIsCurrent ) ) { SetupBackdropSubcellL( templateChildArray, aItemIndex, itemText, subcellIncrement ); iItemHasBackdrop = ETrue; } else - { - iItemHasBackdrop = EFalse; - } + { + iItemHasBackdrop = EFalse; + } - for ( TInt i( 0 ) ; i < templateChildArray.Count() && !iLeftOverAreaUnderAnimatedItem; i++ ) - { - TTemplateChild child = templateChildArray[i]; + for ( TInt i( 0 ) ; i < templateChildArray.Count() && !iLeftOverAreaUnderAnimatedItem; i++ ) + { + TTemplateChild child = templateChildArray[i]; if ( child.iImageVisualId == EImageVisualIdEditMode && child.iIsImage ) { continue; } else if( !child.iIsImage ) - { - SetupTextSubcellL( templateChildArray, i, aItemIndex, itemText, subcellIncrement ); - } - else - { - SetupIconSubcellL( templateChildArray, i, aItemIndex, itemText, subcellIncrement ); - } - } - TInt subcellsJustSet = subcellIncrement; - iCurrentNumberOfSubcellsSet = Max( iCurrentNumberOfSubcellsSet, subcellsJustSet ); - __ASSERT_DEBUG( iCurrentNumberOfSubcellsSet <= MmTemplateContants::KSubCellsCount, - User::Invariant() ); + { + SetupTextSubcellL( templateChildArray, i, aItemIndex, itemText, subcellIncrement ); + } + else + { + SetupIconSubcellL( templateChildArray, i, aItemIndex, itemText, subcellIncrement ); + } + } + TInt subcellsJustSet = subcellIncrement; + iCurrentNumberOfSubcellsSet = Max( iCurrentNumberOfSubcellsSet, subcellsJustSet ); + __ASSERT_DEBUG( iCurrentNumberOfSubcellsSet <= MmTemplateContants::KSubCellsCount, + User::Invariant() ); - for ( TInt i = subcellIncrement; i < iCurrentNumberOfSubcellsSet; i++ ) - { - SetupSubNoCellL( i, aItemIndex ); - } + for( TInt i = subcellIncrement; i < iCurrentNumberOfSubcellsSet; i++ ) + { + SetupSubNoCellL( i, aItemIndex ); + } - iLastSubcellsSetupCode.AddTemplateInfo( - iItemsDataCache->GetTemplateIdentifierL( mmTemplate ) ); - iLastSubcellsSetupCode.AddIsCurrentInfo( aItemIsCurrent ); + iLastSubcellsSetupCode.AddTemplateInfo( + iItemsDataCache->GetTemplateIdentifierL( mmTemplate ) ); + iLastSubcellsSetupCode.AddIsCurrentInfo( aItemIsCurrent ); - CleanupStack::PopAndDestroy( &templateChildArray ); + CleanupStack::PopAndDestroy( &templateChildArray ); - cache->SetSubcellsSetupCode( iLastSubcellsSetupCode ); - // the line below is here only to make the cached information complete - GetItemSize( aItemIndex, aItemIsCurrent ); - cache->MarkAsValidL(); - } + cache->SetSubcellsSetupCode( iLastSubcellsSetupCode ); + // the line below is here only to make the cached information complete + GetItemSize( aItemIndex, aItemIsCurrent ); + cache->MarkAsValidL(); + } // ----------------------------------------------------------------------------- // @@ -1431,10 +1461,10 @@ // ----------------------------------------------------------------------------- // void CMmListBoxItemDrawer::SetHighlightShown( TBool aDrawn ) - { - iHighlightShown = aDrawn; - iDrawMoveIndicators = aDrawn; - } + { + iHighlightShown = aDrawn; + iDrawMoveIndicators = aDrawn; + } // ----------------------------------------------------------------------------- // @@ -1445,16 +1475,16 @@ TBool isFloating( EFalse ); TInt index = GetFloatingItemIndex( EDrag ); - if (index == KErrNotFound) - { - index = GetFloatingItemIndex( EDragTransition ); - } + if( index == KErrNotFound ) + { + index = GetFloatingItemIndex( EDragTransition ); + } - if ( KErrNotFound != index ) + if( KErrNotFound != index ) { TMmFloatingItem& current = const_cast(this)->GetFloatingItemAtIndex( index ); TInt drawnIndex = current.GetDrawnItemIndex(); - if ( drawnIndex == aItemIndex ) + if( drawnIndex == aItemIndex ) { isFloating = ETrue; } @@ -1466,53 +1496,53 @@ // // ----------------------------------------------------------------------------- // -void CMmListBoxItemDrawer::DrawActualItem(TInt aItemIndex, - const TRect& aActualItemRect, TBool aItemIsCurrent, - TBool aViewIsEmphasized, TBool /*aViewIsDimmed*/, - TBool aItemIsSelected) const - { - if (Properties(aItemIndex).IsSelectionHidden()) - { - aItemIsSelected = EFalse; - } - DrawItemText(aItemIndex,aActualItemRect,aItemIsCurrent, - aViewIsEmphasized,aItemIsSelected); - } +void CMmListBoxItemDrawer::DrawActualItem( TInt aItemIndex, + const TRect& aActualItemRect, TBool aItemIsCurrent, + TBool aViewIsEmphasized, TBool /*aViewIsDimmed*/, + TBool aItemIsSelected ) const + { + if( Properties( aItemIndex ).IsSelectionHidden() ) + { + aItemIsSelected = EFalse; + } + DrawItemText( aItemIndex, aActualItemRect, aItemIsCurrent, + aViewIsEmphasized, aItemIsSelected ); + } // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- // TBool CMmListBoxItemDrawer::GetHighlightVisibility( TInt aItemIndex, - TBool aItemIsCurrent, TBool aAllowHighlightForNonDraggedItem ) const - { - TBool highlightVisibility(EFalse); - if (!iItemHasBackdrop && !iLeftOverAreaUnderAnimatedItem ) //never draw highlight when item has backdrop or when left over area under animated item - { - TBool currentlyDraggedItem = - ItemHasFloatingType( aItemIndex, EDrag ) || - ItemHasFloatingType( aItemIndex, EDragTransition ); + TBool aItemIsCurrent, TBool aAllowHighlightForNonDraggedItem ) const + { + TBool highlightVisibility( EFalse ); + if( !iItemHasBackdrop && !iLeftOverAreaUnderAnimatedItem ) //never draw highlight when item has backdrop or when left over area under animated item + { + TBool currentlyDraggedItem = + ItemHasFloatingType( aItemIndex, EDrag ) || + ItemHasFloatingType( aItemIndex, EDragTransition ); - if ( ( STATIC_CAST(CMmWidgetContainer*,Widget()->Parent())->IsHighlightVisible() - && aItemIsCurrent && aAllowHighlightForNonDraggedItem ) - || currentlyDraggedItem ) - { - highlightVisibility = ETrue; - } - } - return highlightVisibility; - } + if( ( STATIC_CAST(CMmWidgetContainer*,Widget()->Parent())->IsHighlightVisible() + && aItemIsCurrent && aAllowHighlightForNonDraggedItem ) + || currentlyDraggedItem ) + { + highlightVisibility = ETrue; + } + } + return highlightVisibility; + } // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- // TBool CMmListBoxItemDrawer::GetBackdropVisibility( TInt aItemIndex, - TBool aItemIsCurrent ) const - { - TBool currentlyDraggedItem = - ItemHasFloatingType( aItemIndex, EDrag ) || - ItemHasFloatingType( aItemIndex, EDragTransition ); + TBool aItemIsCurrent ) const + { + TBool currentlyDraggedItem = + ItemHasFloatingType( aItemIndex, EDrag ) || + ItemHasFloatingType( aItemIndex, EDragTransition ); return IsEditMode() /* draw the backdrop only in edit mode */ && !currentlyDraggedItem /* backdrop is disabled for dragged items */ @@ -1520,26 +1550,26 @@ && !iLeftOverAreaUnderAnimatedItem /* is the currently drawn item the area left over behind dragged item*/ && !( STATIC_CAST( CMmWidgetContainer*,Widget()->Parent() )->IsHighlightVisible() && aItemIsCurrent );/*if the timer is active then we want to draw highlight (not backdrop) on the current index*/ - } + } // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- // TBool CMmListBoxItemDrawer::ItemHasFloatingType( TInt aItemIndex, - TMmFloatingItemType aFloatingType) const - { - TBool hasFloatingType( EFalse ); - for ( TInt i = iFloatingItems.Count() - 1 ; i >= 0; i-- ) + TMmFloatingItemType aFloatingType ) const + { + TBool hasFloatingType( EFalse ); + for( TInt i = iFloatingItems.Count() - 1; i >= 0; i-- ) { - const TMmFloatingItem& item = iFloatingItems[i]; - if ( item.GetFloatingItemType() == aFloatingType - && item.GetDrawnItemIndex() == aItemIndex ) + const TMmFloatingItem& item = iFloatingItems[i]; + if( item.GetFloatingItemType() == aFloatingType + && item.GetDrawnItemIndex() == aItemIndex ) { hasFloatingType = ETrue; break; } } - return hasFloatingType; - } + return hasFloatingType; + } // End of file diff -r d05a55b217df -r 79311d856354 menufw/menufwui/mmwidgets/src/mmlistboxview.cpp --- a/menufw/menufwui/mmwidgets/src/mmlistboxview.cpp Wed Apr 14 15:47:59 2010 +0300 +++ b/menufw/menufwui/mmwidgets/src/mmlistboxview.cpp Tue Apr 27 16:26:12 2010 +0300 @@ -12,7 +12,7 @@ * Contributors: * * Description: - * Version : %version: MM_51 % << Don't touch! Updated by Synergy at check-out. + * Version : %version: MM_52 % << Don't touch! Updated by Synergy at check-out. * */ @@ -198,6 +198,15 @@ return ret; } +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TInt CMmListBoxView::ModelItemsCount() + { + return iModel->NumberOfItems(); + } + // ----------------------------------------------------------------------------- // @@ -330,13 +339,15 @@ if ( !itemDrawer->IsEditMode() ) { - itemDrawer->DrawBackgroundAndSeparatorLines( ViewRect() ); + itemDrawer->DrawBackground( ViewRect() ); itemDrawer->SetRedrawItemBackground( EFalse ); + itemDrawer->SetDrawSeparatorLines( ETrue ); while (i < lastPotentialItemIndex) { DrawItem(i++); } itemDrawer->SetRedrawItemBackground( ETrue ); + itemDrawer->SetDrawSeparatorLines( EFalse ); } else { @@ -378,7 +389,9 @@ if ( !redrawConsumed ) { - DrawSingleItem ( aItemIndex ); + itemDrawer->SetDrawSeparatorLines( ETrue ); + DrawSingleItem ( aItemIndex ); + itemDrawer->SetDrawSeparatorLines( EFalse ); } } diff -r d05a55b217df -r 79311d856354 menufw/menufwui/mmwidgets/src/mmwidgetcontainer.cpp --- a/menufw/menufwui/mmwidgets/src/mmwidgetcontainer.cpp Wed Apr 14 15:47:59 2010 +0300 +++ b/menufw/menufwui/mmwidgets/src/mmwidgetcontainer.cpp Tue Apr 27 16:26:12 2010 +0300 @@ -16,7 +16,6 @@ * */ - #include #include #include @@ -83,32 +82,34 @@ return CMmListBoxContainer::NewL( aRect, aObjectProvider, aTemplateLibrary ); } - // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- // void CMmWidgetContainer::ConstructL() - { + { iBgContext = CAknsBasicBackgroundControlContext::NewL( - KAknsIIDQsnBgAreaMainAppsGrid, Rect(), EFalse); + KAknsIIDQsnBgAreaMainAppsGrid, Rect(), EFalse ); iLongTapDetector = CAknLongTapDetector::NewL( this ); - iLongTapDetector->EnableLongTapAnimation(ETrue); - } + iLongTapDetector->EnableLongTapAnimation( ETrue ); + } // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- // CMmWidgetContainer::CMmWidgetContainer() - : iIsFaded( EFalse ) + : iMarqueeAdapter( NULL ) + , iLongTapInProgress( EFalse ) + , iBgContext( NULL ) + , iIsFaded( EFalse ) , iHasFocus( ETrue ) , iInForeground( ETrue ) + , iAllowMove( EFalse ) + , iRecipientId( KErrNotFound ) + , iEventParameters( NULL ) { - iMarqueeAdapter = NULL; - iBgContext = NULL; iWidgetPositionCache.iValid = EFalse; - iLongTapInProgress = EFalse; } // ----------------------------------------------------------------------------- @@ -122,6 +123,7 @@ delete iBgContext; delete iPostProcessor; delete iLongTapDetector; + delete iEventParameters; } // ----------------------------------------------------------------------------- @@ -130,7 +132,7 @@ // EXPORT_C void CMmWidgetContainer::EnableLongTapAnimation( TBool aEnable ) { - if ( iLongTapDetector ) + if( iLongTapDetector ) { iLongTapDetector->EnableLongTapAnimation( aEnable ); } @@ -142,22 +144,22 @@ // void CMmWidgetContainer::SizeChanged() { - if ( iWidget && iWidgetRect != Rect() ) + if( iWidget && iWidgetRect != Rect() ) { - CMmTemplateLibrary * templateLibrary = - static_cast ( - Widget()->View()->ItemDrawer() )->TemplateLibrary(); - if ( Rect() != templateLibrary->GetParentRect( - Layout_Meta_Data::IsLandscapeOrientation() ) ) - { - templateLibrary->CleanAndClearCache(); - } + CMmTemplateLibrary * templateLibrary = + static_cast ( + Widget()->View()->ItemDrawer() )->TemplateLibrary(); + if( Rect() != templateLibrary->GetParentRect( + Layout_Meta_Data::IsLandscapeOrientation() ) ) + { + templateLibrary->CleanAndClearCache(); + } iWidget->View()->SetViewRect( Rect() ); iWidget->SetRect( Rect() ); iWidgetRect = Rect(); } - if ( iBgContext ) + if( iBgContext ) { TRect rect = iCoeEnv->ScreenDevice()->SizeInPixels(); iBgContext->SetRect( rect ); @@ -172,7 +174,7 @@ // // ----------------------------------------------------------------------------- // -void CMmWidgetContainer::Draw( const TRect& /*aRect*/ ) const +void CMmWidgetContainer::Draw( const TRect& /*aRect*/) const { // do nothing } @@ -180,14 +182,14 @@ // // ----------------------------------------------------------------------------- // -TTypeUid::Ptr CMmWidgetContainer::MopSupplyObject(TTypeUid aId) +TTypeUid::Ptr CMmWidgetContainer::MopSupplyObject( TTypeUid aId ) { - if (aId.iUid == MAknsControlContext::ETypeId && iBgContext ) + if( aId.iUid == MAknsControlContext::ETypeId && iBgContext ) { - return MAknsControlContext::SupplyMopObject(aId, iBgContext ); + return MAknsControlContext::SupplyMopObject( aId, iBgContext ); } - return CCoeControl::MopSupplyObject(aId); + return CCoeControl::MopSupplyObject( aId ); } // ----------------------------------------------------------------------------- @@ -200,19 +202,19 @@ iLastDragPoint = aPointerEvent.iPosition; iLastDragHighlight = GetHighlight(); if( !iWidget->View()->XYPosToItemIndex( - aPointerEvent.iPosition, iDraggedIndex ) ) + aPointerEvent.iPosition, iDraggedIndex ) ) { iDraggedIndex = KErrNotFound; } iItemRelativeTapPoint = aPointerEvent.iPosition - iWidget->View()->ItemPos( - iDraggedIndex ); + iDraggedIndex ); } // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- // -void CMmWidgetContainer::HandleButtonUpL(const TPointerEvent& /*aPointerEvent*/ ) +void CMmWidgetContainer::HandleButtonUpL( const TPointerEvent& /*aPointerEvent*/) { iTapPoint = TPoint( 0, 0 ); CancelDragL( EFalse ); @@ -227,7 +229,7 @@ if ( aType == KEikDynamicLayoutVariantSwitch || aType == KAknsMessageSkinChange ) { - static_cast( iDrawer )->InvalidateCache(); + static_cast ( iDrawer )->InvalidateCache(); CMmTemplateLibrary * templateLibrary = static_cast( iDrawer )->TemplateLibrary(); templateLibrary->CleanAndClearCache(); @@ -235,15 +237,15 @@ TBool highlightVisibleBefore = iWidget->IsVisible() && IsHighlightVisible(); CCoeControl::HandleResourceChange( aType ); - if ( highlightVisibleBefore ) + if( highlightVisibleBefore ) { TRAP_IGNORE( SetHighlightVisibilityL( ETrue ) ); } - if ( aType == KEikDynamicLayoutVariantSwitch && !IsHighlightVisible() ) - { - TRAP_IGNORE( SetDefaultHighlightL( EFalse ) ); - } + if( aType == KEikDynamicLayoutVariantSwitch && !IsHighlightVisible() ) + { + TRAP_IGNORE( SetDefaultHighlightL( EFalse ) ); + } } // ----------------------------------------------------------------------------- @@ -253,7 +255,7 @@ EXPORT_C void CMmWidgetContainer::ItemIconZoomL( TInt /*aItemIndex */) { TInt index = GetHighlight(); - if (index != iDraggedIndex) + if( index != iDraggedIndex ) { iDrawer->AnimateItemZoomInL( index ); } @@ -264,65 +266,65 @@ // ----------------------------------------------------------------------------- // EXPORT_C CHnSuiteModel* CMmWidgetContainer::GetSuiteModelL() - { - return GetMmModel()->GetSuiteModel(); - } + { + return GetMmModel()->GetSuiteModel(); + } // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- // -void CMmWidgetContainer::HandleDragL(const TPointerEvent& aPointerEvent, +void CMmWidgetContainer::HandleDragL( const TPointerEvent& aPointerEvent, TBool aAbortAnimation ) { DEBUG(("\t_Mm_:CMmWidgetContainer::HandleDragL: iLastDragHighlight = %d ", - iLastDragHighlight )); + iLastDragHighlight )); TInt highlight = GetHighlight(); DEBUG(("\t_Mm_:CMmWidgetContainer::HandleDragL: highlight = %d ", highlight )); - TPoint dragDelta ( iLastDragPoint - aPointerEvent.iPosition); + TPoint dragDelta( iLastDragPoint - aPointerEvent.iPosition ); TInt dragSpeed = dragDelta.iX * dragDelta.iX + dragDelta.iY * dragDelta.iY; - TBool tooFast = (dragSpeed > MmEffects::KDragSpeedIgnoreThreshold); + TBool tooFast = ( dragSpeed > MmEffects::KDragSpeedIgnoreThreshold ); - if (iLastDragHighlight != highlight ) + if( iLastDragHighlight != highlight ) { - iDragAndDropObserver->HandleDragOverL( GetHighlight() ); + iDragAndDropObserver->HandleDragOverL( GetHighlight() ); } - if (!tooFast) - { - TSize itemSize = iWidget->View()->ItemSize( highlight ); - TPoint itemPos = iWidget->View()->ItemPos( highlight ); + if( !tooFast ) + { + TSize itemSize = iWidget->View()->ItemSize( highlight ); + TPoint itemPos = iWidget->View()->ItemPos( highlight ); - if ( PointInItemReorderAreaL( highlight, aPointerEvent.iPosition ) ) - { - CHnSuiteModel* model = GetMmModel()->GetSuiteModel(); - CHnItemModel* onItemModel = model->GetItemModel( model->IdByIndex( highlight )); - if (iDrawer->GetAnimator()->IsReadyForNewAnimation() && !aAbortAnimation - && onItemModel->GetItemType() != EItemTypeParentFolder - && iDraggedIndex != highlight) - { - GetMmModel()->ReorderModelL( iDraggedIndex, highlight ); - AnimateShiftL( highlight ); - iDrawer->SetDraggedIndexL( highlight, - aPointerEvent.iPosition - iItemRelativeTapPoint ); - iDraggedIndex = highlight; - iDragAndDropObserver->HandleDraggedIndexUpdatedL( highlight ); - } - } - } + if ( PointInItemReorderAreaL( highlight, aPointerEvent.iPosition ) ) + { + CHnSuiteModel* model = GetMmModel()->GetSuiteModel(); + CHnItemModel* onItemModel = model->GetItemModel( model->IdByIndex( highlight )); + if (iDrawer->GetAnimator()->IsReadyForNewAnimation() && !aAbortAnimation + && onItemModel->GetItemType() != EItemTypeParentFolder + && iDraggedIndex != highlight) + { + GetMmModel()->ReorderModelL( iDraggedIndex, highlight ); + AnimateShiftL( highlight ); + iDrawer->SetDraggedIndexL( highlight, + aPointerEvent.iPosition - iItemRelativeTapPoint ); + iDraggedIndex = highlight; + iDragAndDropObserver->HandleDraggedIndexUpdatedL( highlight ); + } + } + } if ( DeltaSquare( iTapPoint, aPointerEvent.iPosition ) > KDragDelta && - !iDrawer->IsDraggable() ) - { - iDrawer->SetDraggedIndexL( iDraggedIndex, iTapPoint - iItemRelativeTapPoint ); - iDrawer->SetDraggableL( ETrue ); - } - else if ( iDrawer->IsDraggable() ) - { - iDrawer->SetDraggedPointL( aPointerEvent.iPosition - iItemRelativeTapPoint ); - } + !iDrawer->IsDraggable() ) + { + iDrawer->SetDraggedIndexL( iDraggedIndex, iTapPoint - iItemRelativeTapPoint ); + iDrawer->SetDraggableL( ETrue ); + } + else if( iDrawer->IsDraggable() ) + { + iDrawer->SetDraggedPointL( aPointerEvent.iPosition - iItemRelativeTapPoint ); + } DEBUG(("\t_Mm_:CMmWidgetContainer::HandleDragL: iLastDragHighlight = %d ", iLastDragHighlight )); DEBUG(("\t_Mm_:CMmWidgetContainer::HandleDragL: highlight = %d ", highlight )); @@ -334,24 +336,24 @@ // // ----------------------------------------------------------------------------- // -void CMmWidgetContainer::AnimateShiftL(TInt aHighlight) - { +void CMmWidgetContainer::AnimateShiftL( TInt aHighlight ) + { TInt lowerVal = (iDraggedIndex < aHighlight)? iDraggedIndex : aHighlight; TInt higherVal = (iDraggedIndex < aHighlight)? aHighlight : iDraggedIndex; - TInt switchOperation = (iDraggedIndex < aHighlight) ? EFalse : ETrue; + TInt switchOperation = ( iDraggedIndex < aHighlight ) ? EFalse : ETrue; - for(TInt iter(lowerVal); iter < higherVal; iter++ ) - { - TInt from = iter + 1; - TInt to = iter; - if (switchOperation) - { - from = iter; - to = iter + 1; - } - iDrawer->AnimateItemSwapL( from, to ); + for( TInt iter( lowerVal ); iter < higherVal; iter++ ) + { + TInt from = iter + 1; + TInt to = iter; + if( switchOperation ) + { + from = iter; + to = iter + 1; + } + iDrawer->AnimateItemSwapL( from, to ); } - } + } // ----------------------------------------------------------------------------- // @@ -359,7 +361,7 @@ // EXPORT_C void CMmWidgetContainer::CancelDragL( TBool aAnimate ) { - if (aAnimate) + if( aAnimate ) { iDrawer->AnimateDragItemTransitionL(); } @@ -367,7 +369,7 @@ SetHighlightAfterDrag(); iDraggedIndex = -1; - iDrawer->SetDraggedIndexL( iDraggedIndex, TPoint(0,0) ); + iDrawer->SetDraggedIndexL( iDraggedIndex, TPoint( 0, 0 ) ); SetDraggableL( EFalse ); TInt dragFloatingItem; @@ -376,9 +378,7 @@ dragFloatingItem = iDrawer->GetFloatingItemIndex( EDrag ); iDrawer->RemoveFloatingItem( dragFloatingItem ); } - while ( dragFloatingItem != KErrNotFound ); - - iDrawer->GetAnimator()->CancelNextRedrawL(); + while( dragFloatingItem != KErrNotFound ); } @@ -387,24 +387,24 @@ // ----------------------------------------------------------------------------- // -TBool CMmWidgetContainer::IsFolderL(TInt aItemIndex) - { - TBool result = EFalse; +TBool CMmWidgetContainer::IsFolderL( TInt aItemIndex ) + { + TBool result = EFalse; - CHnSuiteModel* model = GetMmModel()->GetSuiteModel(); - if (model) - { - CHnItemModel* onItemModel = model->GetItemModel( model->IdByIndex( aItemIndex )); - if (onItemModel) - { - result = onItemModel->GetItemType() == EItemTypeParentFolder || - onItemModel->GetItemType() == EItemTypeFolder; - } - } + CHnSuiteModel* model = GetMmModel()->GetSuiteModel(); + if( model ) + { + CHnItemModel* onItemModel = model->GetItemModel( model->IdByIndex( aItemIndex )); + if( onItemModel ) + { + result = onItemModel->GetItemType() == EItemTypeParentFolder + || onItemModel->GetItemType() == EItemTypeFolder; + } + } - return result; + return result; - } + } // ----------------------------------------------------------------------------- // @@ -412,20 +412,20 @@ // TBool CMmWidgetContainer::IsNoItemDragged() - { - TBool noItemDragged = EFalse; - noItemDragged = ( KErrNotFound == iDraggedIndex ) ? ETrue : noItemDragged; - CHnSuiteModel* model = GetMmModel()->GetSuiteModel(); - if ( !noItemDragged && model) - { - CHnItemModel* onItemModel = model->GetItemModel( model->IdByIndex( iDraggedIndex )); - if (onItemModel) - { - noItemDragged = ( onItemModel->GetItemType() == EItemTypeParentFolder ); - } - } - return noItemDragged; - } + { + TBool noItemDragged = EFalse; + noItemDragged = ( KErrNotFound == iDraggedIndex ) ? ETrue : noItemDragged; + CHnSuiteModel* model = GetMmModel()->GetSuiteModel(); + if( !noItemDragged && model ) + { + CHnItemModel* onItemModel = model->GetItemModel( model->IdByIndex( iDraggedIndex )); + if( onItemModel ) + { + noItemDragged = ( onItemModel->GetItemType() == EItemTypeParentFolder ); + } + } + return noItemDragged; + } // ----------------------------------------------------------------------------- // @@ -433,15 +433,15 @@ // EXPORT_C void CMmWidgetContainer::SetHasFocusL( TBool aHasFocus ) { - if ( !!aHasFocus != !!iHasFocus ) // logical Ex-OR + if( !!aHasFocus != !!iHasFocus ) // logical Ex-OR { iHasFocus = aHasFocus; StartOrStopMarquee(); } - if ( !aHasFocus ) - { - SetHighlightVisibilityL( EFalse ); - } + if( !aHasFocus ) + { + SetHighlightVisibilityL( EFalse ); + } } // ----------------------------------------------------------------------------- @@ -450,7 +450,7 @@ // EXPORT_C void CMmWidgetContainer::SetIsFaded( TBool aIsFaded ) { - if ( !!aIsFaded != !!iIsFaded ) // logical Ex-OR + if( !!aIsFaded != !!iIsFaded ) // logical Ex-OR { iIsFaded = aIsFaded; StartOrStopMarquee(); @@ -470,139 +470,192 @@ // // ----------------------------------------------------------------------------- // -TBool CMmWidgetContainer::IsDeleteLockedL( TInt aItemIndex ) - { - TBool result = ETrue; +EXPORT_C TBool CMmWidgetContainer::AllowMove() const + { + return iAllowMove; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void CMmWidgetContainer::SetAllowMove( TBool aAllowMove ) + { + iAllowMove = aAllowMove; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +EXPORT_C void CMmWidgetContainer::SetTriggerMoveItemL( const TInt aRecipientId, + CLiwGenericParamList* aEventParameters ) + { + iRecipientId = aRecipientId; + if( !iEventParameters ) + { + iEventParameters = CLiwGenericParamList::NewL(); + } + else + { + iEventParameters->Reset(); + } + + iEventParameters->AppendL(*aEventParameters); + } - CHnSuiteModel* model = GetMmModel()->GetSuiteModel(); - if (model) - { - CHnItemModel* onItemModel = model->GetItemModel(model->IdByIndex( - aItemIndex)); - if (onItemModel) - { - result = onItemModel->IsDeleteLocked(); - } - } +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void CMmWidgetContainer::TriggerMoveItemL() + { + if( iRecipientId != KErrNotFound && iDragAndDropObserver ) + { + iDragAndDropObserver->HandleTriggerMoveItemL( iRecipientId, + iEventParameters ); + iRecipientId = KErrNotFound; + iEventParameters->Reset(); + } + } - return result; - } +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool CMmWidgetContainer::IsDeleteLockedL( TInt aItemIndex ) + { + TBool result = ETrue; + + CHnSuiteModel* model = GetMmModel()->GetSuiteModel(); + if( model ) + { + CHnItemModel* onItemModel = model->GetItemModel( model->IdByIndex( + aItemIndex ) ); + if( onItemModel ) + { + result = onItemModel->IsDeleteLocked(); + } + } + + return result; + } // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- // void CMmWidgetContainer::ManageFolderZoomingL( TBool aDraggedItemOverIcons ) - { - TBool isAnimated; + { + TBool isAnimated( EFalse ); - isAnimated = EFalse; - for(int i=0; i< iDrawer->GetFloatingItemCount(); i++) - { - TMmFloatingItem& current = iDrawer->GetFloatingItemAtIndex(i); - if (/*current.GetFloatingItemType() != EZoomTransition &&*/ - current.GetFloatingItemType() != EPostHighlightChangeRefreshItem && - current.GetDrawnItemIndex() == GetHighlight() ) - { - isAnimated = ETrue; - break; - } - } + for( int i = 0; i < iDrawer->GetFloatingItemCount(); i++ ) + { + TMmFloatingItem& current = iDrawer->GetFloatingItemAtIndex( i ); + if( /*current.GetFloatingItemType() != EZoomTransition &&*/ + current.GetFloatingItemType() != EPostHighlightChangeRefreshItem + && current.GetDrawnItemIndex() == GetHighlight() ) + { + isAnimated = ETrue; + break; + } + } - if (!isAnimated) - { - if ( GetHighlight() != iDraggedIndex && - IsFolderL( GetHighlight() ) && - !IsDeleteLockedL( GetHighlight() ) && - iDrawer->IsDraggable() ) - { - iDrawer->AnimateItemZoomInL( GetHighlight() ); - } - } + if( !isAnimated ) + { + if( GetHighlight() != iDraggedIndex + && IsFolderL( GetHighlight() ) + && !IsDeleteLockedL( GetHighlight() ) + && iDrawer->IsDraggable() ) + { + iDrawer->AnimateItemZoomInL( GetHighlight() ); + } + } - isAnimated = EFalse; - for(int i=0; i< iDrawer->GetFloatingItemCount(); i++) - { - TMmFloatingItem& current = iDrawer->GetFloatingItemAtIndex(i); - if (current.GetFloatingItemType() != EZoomTransition && - current.GetFloatingItemType() != EPostHighlightChangeRefreshItem && - current.GetDrawnItemIndex() == iLastDragHighlight ) - { - isAnimated = ETrue; - break; - } - } + isAnimated = EFalse; + for( int i = 0; i < iDrawer->GetFloatingItemCount(); i++ ) + { + TMmFloatingItem& current = iDrawer->GetFloatingItemAtIndex( i ); + if( current.GetFloatingItemType() != EZoomTransition + && current.GetFloatingItemType() != EPostHighlightChangeRefreshItem + && current.GetDrawnItemIndex() == iLastDragHighlight ) + { + isAnimated = ETrue; + break; + } + } - if (!isAnimated) - { - if ( ( !aDraggedItemOverIcons && IsFolderL( iLastDragHighlight ) ) || - iLastDragHighlight != Widget()->CurrentItemIndex() ) - { - iDrawer->AnimateItemZoomOutL( iLastDragHighlight ); - } - } - } + if( !isAnimated ) + { + if( ( !aDraggedItemOverIcons && IsFolderL( iLastDragHighlight ) ) + || iLastDragHighlight != Widget()->CurrentItemIndex() ) + { + iDrawer->AnimateItemZoomOutL( iLastDragHighlight ); + } + } + } // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- // void CMmWidgetContainer::HandlePointerEventsInEditModeL( - const TPointerEvent& aPointerEvent, TBool aAbortAnimations ) - { + const TPointerEvent& aPointerEvent, TBool aAbortAnimations ) + { - TInt pointedItem = KErrNotFound; - TBool draggedItemOverIcons = iWidget->View()->XYPosToItemIndex( - aPointerEvent.iPosition, pointedItem ); + TInt pointedItem = KErrNotFound; + TBool draggedItemOverIcons = iWidget->View()->XYPosToItemIndex( + aPointerEvent.iPosition, pointedItem ); - if (aPointerEvent.iType == TPointerEvent::EButton1Down) + if( aPointerEvent.iType == TPointerEvent::EButton1Down ) { -//TODO: PROTO OF 2PHASE HIGHLIGHT EDITMODE BEHAVIOUR -// if (!IsFolderL(pointedItem)) -// { -// iDrawer->ClearFlags( CListItemDrawer::EPressedDownState ); -// } - HandleButtonDownL(aPointerEvent); + //TODO: PROTO OF 2PHASE HIGHLIGHT EDITMODE BEHAVIOUR + // if (!IsFolderL(pointedItem)) + // { + // iDrawer->ClearFlags( CListItemDrawer::EPressedDownState ); + // } + HandleButtonDownL( aPointerEvent ); iDragAndDropObserver->HandleDragStartL( GetHighlight() ); } - else if ( (aPointerEvent.iType == TPointerEvent::EDrag || - aPointerEvent.iType == TPointerEvent::EButtonRepeat) && - iDraggedIndex != KErrNotFound) + else if( ( aPointerEvent.iType == TPointerEvent::EDrag + || aPointerEvent.iType == TPointerEvent::EButtonRepeat ) + && iDraggedIndex != KErrNotFound ) { -//TODO: PROTO OF 2PHASE HIGHLIGHT EDITMODE BEHAVIOUR -// if (!IsFolderL(pointedItem)) -// { -// iDrawer->SetFlags( CListItemDrawer::EPressedDownState ); -// } + //TODO: PROTO OF 2PHASE HIGHLIGHT EDITMODE BEHAVIOUR + // if (!IsFolderL(pointedItem)) + // { + // iDrawer->SetFlags( CListItemDrawer::EPressedDownState ); + // } TPointerEvent pointerEvent = aPointerEvent; if( WidgetType() == EListWidget ) - { - pointerEvent.iPosition.iX = - iWidget->View()->ItemPos( pointedItem ).iX + - iItemRelativeTapPoint.iX; - } + { + pointerEvent.iPosition.iX = + iWidget->View()->ItemPos( pointedItem ).iX + + iItemRelativeTapPoint.iX; + } - if (GetHighlight() != Widget()->CurrentItemIndex() ) - { - SetHighlightL( Widget()->CurrentItemIndex() ); - } + if( GetHighlight() != Widget()->CurrentItemIndex() ) + { + SetHighlightL( Widget()->CurrentItemIndex() ); + } ManageFolderZoomingL( draggedItemOverIcons ); - HandleDragL(pointerEvent, aAbortAnimations); + HandleDragL( pointerEvent, aAbortAnimations ); } else if (aPointerEvent.iType == TPointerEvent::EButton1Up && iDrawer->IsDraggable()) { - if ( !draggedItemOverIcons ) - { - SetManualHighlightL( iDraggedIndex ); - } + if( !draggedItemOverIcons ) + { + SetManualHighlightL( iDraggedIndex ); + } iDragAndDropObserver->HandleDragStopL( GetHighlight() ); - HandleButtonUpL(aPointerEvent); + iAllowMove = EFalse ; + HandleButtonUpL( aPointerEvent ); } - } + } // ----------------------------------------------------------------------------- // @@ -611,70 +664,70 @@ void CMmWidgetContainer::HandlePointerEventL(const TPointerEvent& aPointerEvent ) { if ( iMarqueeAdapter && aPointerEvent.iType == TPointerEvent::EButton1Down ) - { - iMarqueeAdapter->StopMarqueeDrawing(); - } + { + iMarqueeAdapter->StopMarqueeDrawing(); + } TInt index = KErrNotFound; TBool itemExists = iWidget->View()->XYPosToItemIndex( aPointerEvent.iPosition, index ); - if ( iLongTapDetector ) + if( iLongTapDetector ) { - if ( aPointerEvent.iType == TPointerEvent::EButton1Down ) + if( aPointerEvent.iType == TPointerEvent::EButton1Down ) { iLongTapDetector->EnableLongTapAnimation( itemExists && GetMmModel()->GetNumberOfSpecificMenuItemsL( index ) > 0 ); } TPointerEvent longTapPointerEvent = aPointerEvent; - if ( aPointerEvent.iType == TPointerEvent::EButtonRepeat ) + if( aPointerEvent.iType == TPointerEvent::EButtonRepeat ) { longTapPointerEvent.iType = TPointerEvent::EDrag; } iLongTapDetector->PointerEventL( longTapPointerEvent ); } - CCoeControl::HandlePointerEventL(aPointerEvent); + CCoeControl::HandlePointerEventL( aPointerEvent ); if ( aPointerEvent.iType == TPointerEvent::EButton1Down && itemExists ) { SetHighlightL( index ); } - else if ( aPointerEvent.iType == TPointerEvent::EDrag - // the line below is needed to enable edit mode in the list widget - // because behaviour in the grid and list is different - || (aPointerEvent.iType == TPointerEvent::EButtonRepeat && WidgetType() == EGridWidget )) - { - if ( itemExists ) - { - if ( GetHighlight() != index ) - { - SetHighlightVisibilityL( EFalse ); - if ( IsEditMode() ) - { - SetHighlightL( index ); - } - } - } - else - { - SetHighlightVisibilityL( EFalse ); - } - } + else if( aPointerEvent.iType == TPointerEvent::EDrag + // the line below is needed to enable edit mode in the list widget + // because behaviour in the grid and list is different + || (aPointerEvent.iType == TPointerEvent::EButtonRepeat && WidgetType() == EGridWidget )) + { + if( itemExists ) + { + if( GetHighlight() != index ) + { + SetHighlightVisibilityL( EFalse ); + if( IsEditMode() ) + { + SetHighlightL( index ); + } + } + } + else + { + SetHighlightVisibilityL( EFalse ); + } + } - TInt lastTopItemIndex = Widget()->TopItemIndex(); + TInt lastTopItemIndex = Widget()->TopItemIndex(); TBool abortAnimation = lastTopItemIndex != Widget()->TopItemIndex(); - if (abortAnimation) + if( abortAnimation ) { iDrawer->GetAnimator()->CancelAnimationsL(); } - if ( IsEditMode() && iDragAndDropObserver ) - { - HandlePointerEventsInEditModeL(aPointerEvent, abortAnimation); - } + if( IsEditMode() && iDragAndDropObserver ) + { + HandlePointerEventsInEditModeL( aPointerEvent, abortAnimation ); + } } // ----------------------------------------------------------------------------- @@ -682,12 +735,12 @@ // ----------------------------------------------------------------------------- // EXPORT_C TRect CMmWidgetContainer::GetItemRectL( TInt aItemIndex ) - { - User::LeaveIfNull( iWidget ); - TPoint pos = iWidget->View()->ItemPos( aItemIndex ); - TSize size = iDrawer->GetItemSize( aItemIndex, EFalse ); - return TRect( pos.iX, pos.iY, pos.iX + size.iWidth, pos.iY + size.iHeight ); - } + { + User::LeaveIfNull( iWidget ); + TPoint pos = iWidget->View()->ItemPos( aItemIndex ); + TSize size = iDrawer->GetItemSize( aItemIndex, EFalse ); + return TRect( pos.iX, pos.iY, pos.iX + size.iWidth, pos.iY + size.iHeight ); + } // ----------------------------------------------------------------------------- // @@ -705,9 +758,9 @@ // ----------------------------------------------------------------------------- // TBool CMmWidgetContainer::IsEditMode() const - { - return iIsEditMode; - } + { + return iIsEditMode; + } // ----------------------------------------------------------------------------- // @@ -716,15 +769,16 @@ void CMmWidgetContainer::SetEditModeL( TBool aIsEditMode ) { iIsEditMode = aIsEditMode; + iAllowMove = EFalse; StartOrStopMarquee(); ASSERT(iDrawer); iDrawer->SetEditModeL( aIsEditMode ); - if ( !AknLayoutUtils::PenEnabled() && aIsEditMode ) - { + if( !AknLayoutUtils::PenEnabled() && aIsEditMode ) + { iDraggedIndex = iWidget->CurrentItemIndex(); ScrollViewIfNeededL(); //only edit mode non-touch - } + } // scrollbar does not work when scrolling is disabled // iWidget->DisableScrolling( aIsEditMode ); @@ -739,24 +793,24 @@ // activate the model CHnSuiteModel* suiteModel = GetMmModel()->GetSuiteModel(); - if ( suiteModel ) + if( suiteModel ) { suiteModel->SetActiveL( aEnable ); } - if ( ( !!aEnable != !!iPreviousHighlightVisibility ) // Ex-OR + if( ( !!aEnable != !!iPreviousHighlightVisibility ) // Ex-OR || ( !!aEnable != !!IsHighlightVisible() ) ) // Ex-OR { #ifdef RD_UI_TRANSITION_EFFECTS_LIST - MAknListBoxTfxInternal *transApi = CAknListLoader::TfxApiInternal( - iDrawer->Gc() ); + MAknListBoxTfxInternal *transApi = CAknListLoader::TfxApiInternal( + iDrawer->Gc() ); #endif - if ( !aEnable ) + if( !aEnable ) { iWidget->View()->ItemDrawer()->SetFlags( - CListItemDrawer::ESingleClickDisabledHighlight ); + CListItemDrawer::ESingleClickDisabledHighlight ); #ifdef RD_UI_TRANSITION_EFFECTS_LIST - if ( transApi ) + if( transApi ) { transApi->Remove( MAknListBoxTfxInternal::EListHighlight ); } @@ -765,10 +819,10 @@ else { iWidget->View()->ItemDrawer()->ClearFlags( - CListItemDrawer::ESingleClickDisabledHighlight ); + CListItemDrawer::ESingleClickDisabledHighlight ); } - if ( IsVisible() ) + if( IsVisible() ) { TInt highlight = GetHighlight(); CListBoxView* view = Widget()->View(); @@ -785,8 +839,8 @@ // EXPORT_C TBool CMmWidgetContainer::IsHighlightVisible() { - return !( iWidget->View()->ItemDrawer()->Flags() & - CListItemDrawer::ESingleClickDisabledHighlight ); + return !( iWidget->View()->ItemDrawer()->Flags() + & CListItemDrawer::ESingleClickDisabledHighlight ); } // ----------------------------------------------------------------------------- @@ -794,7 +848,7 @@ // ----------------------------------------------------------------------------- // EXPORT_C TBool CMmWidgetContainer::IsDraggable() - { + { iDrawer = STATIC_CAST(CMmListBoxItemDrawer*, iWidget->View()->ItemDrawer()); return iDrawer->IsDraggable(); } @@ -813,7 +867,7 @@ // // ----------------------------------------------------------------------------- // -CCoeControl* CMmWidgetContainer::ComponentControl(TInt aIndex) const +CCoeControl* CMmWidgetContainer::ComponentControl( TInt aIndex ) const { switch( aIndex ) { @@ -836,12 +890,12 @@ // // ----------------------------------------------------------------------------- // -EXPORT_C void CMmWidgetContainer::SetObserver( MMmWidgetObserver* aObserver ) +EXPORT_C void CMmWidgetContainer::SetObserver( MMmWidgetObserver* aObserver ) { //iWidget->SetListBoxObserver( aObserver ); iListBoxObserver = aObserver; iKeyEventObserver = aObserver; - iDragAndDropObserver = aObserver; + iDragAndDropObserver = aObserver; } // ----------------------------------------------------------------------------- @@ -856,7 +910,7 @@ // // ----------------------------------------------------------------------------- // -EXPORT_C TInt CMmWidgetContainer::GetHighlight( ) +EXPORT_C TInt CMmWidgetContainer::GetHighlight() { return iCurrentHighlight; } @@ -866,24 +920,24 @@ // ----------------------------------------------------------------------------- // void CMmWidgetContainer::SetManualHighlightL( TInt aItemIndex, - TBool aRedraw ) - { - SetHighlightL( aItemIndex ); + TBool aRedraw ) + { + SetHighlightL( aItemIndex ); - if ( aItemIndex >= 0 && aItemIndex < GetMmModel()->NumberOfItems() ) - { - if ( aItemIndex != iWidget->CurrentItemIndex() ) - { - iWidget->View()->SetCurrentItemIndex( aItemIndex ); - } + if( aItemIndex >= 0 && aItemIndex < GetMmModel()->NumberOfItems() ) + { + if( aItemIndex != iWidget->CurrentItemIndex() ) + { + iWidget->View()->SetCurrentItemIndex( aItemIndex ); + } - if ( aRedraw ) - { - iWidget->SetCurrentItemIndex( aItemIndex ); - iWidget->DrawNow(); - } - } - } + if( aRedraw ) + { + iWidget->SetCurrentItemIndex( aItemIndex ); + iWidget->DrawNow(); + } + } + } // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- @@ -892,49 +946,48 @@ { ASSERT( aItemIndex >= KErrNotFound ); - if (aItemIndex == KErrNotFound) + if( aItemIndex == KErrNotFound ) { - iCurrentHighlight = iPreviousHighlight = KErrNotFound; + iCurrentHighlight = iPreviousHighlight = KErrNotFound; SetDefaultHighlightL( EFalse ); } - else if (aItemIndex >= 0 && aItemIndex < GetMmModel()->NumberOfItems()) + else if( aItemIndex >= 0 && aItemIndex < GetMmModel()->NumberOfItems() ) { iPreviousHighlight = iCurrentHighlight; iCurrentHighlight = aItemIndex; - if ( iPreviousHighlight != iCurrentHighlight ) + if( iPreviousHighlight != iCurrentHighlight ) { HideOptionsMenuIfDisplayed(); } CHnSuiteModel* suiteModel = GetMmModel()->GetSuiteModel(); - if (suiteModel) + if( suiteModel ) { suiteModel->SetSuiteHighlightL( iCurrentHighlight ); } } + if( IsEditMode() ) + { + TMmFloatingItem postDragCurrent( GetHighlight(), + Widget()->View()->ItemPos( GetHighlight() ), + EPostHighlightChangeRefreshItem, + MmEffects::KNoAnimationFramesCount, Widget()->View() ); - if ( IsEditMode() ) - { - TMmFloatingItem postDragCurrent( GetHighlight(), - Widget()->View()->ItemPos( GetHighlight() ), - EPostHighlightChangeRefreshItem, - MmEffects::KNoAnimationFramesCount, Widget()->View() ); - - iDrawer->AddFloatingItemL( postDragCurrent ); + iDrawer->AddFloatingItemL( postDragCurrent ); - if ( GetPreviousHighlight() != GetHighlight() ) - { - TMmFloatingItem postDragPrevious( GetPreviousHighlight(), - Widget()->View()->ItemPos( GetPreviousHighlight() ), - EPostHighlightChangeRefreshItem, - MmEffects::KNoAnimationFramesCount, Widget()->View() ); + if( GetPreviousHighlight() != GetHighlight() ) + { + TMmFloatingItem postDragPrevious( GetPreviousHighlight(), + Widget()->View()->ItemPos( GetPreviousHighlight() ), + EPostHighlightChangeRefreshItem, + MmEffects::KNoAnimationFramesCount, Widget()->View() ); - iDrawer->AddFloatingItemL( postDragPrevious ); - } - } + iDrawer->AddFloatingItemL( postDragPrevious ); + } + } } // ----------------------------------------------------------------------------- @@ -957,7 +1010,7 @@ void CMmWidgetContainer::HideOptionsMenuIfDisplayed() { CEikMenuBar* menuBar = CEikonEnv::Static()->AppUiFactory()->MenuBar(); - if ( menuBar && menuBar->IsDisplayed() ) + if( menuBar && menuBar->IsDisplayed() ) { menuBar->StopDisplayingMenuBar(); } @@ -968,7 +1021,7 @@ // // ----------------------------------------------------------------------------- // -void CMmWidgetContainer::SetFlag(TInt /*Flag*/) +void CMmWidgetContainer::SetFlag( TInt /*Flag*/) { } @@ -994,25 +1047,25 @@ TBool highlightVisibleWhenEventReceived = IsHighlightVisible(); - if ( IsEditMode() && IsDraggable() ) - return resp; + if( IsEditMode() && IsDraggable() ) + return resp; resp = HandleKeyEventL( aKeyEvent, aType ); - if ( iMarqueeAdapter && ( aType == EEventKeyDown ) ) - { - iMarqueeAdapter->StopMarqueeDrawing(); - } + if( iMarqueeAdapter && ( aType == EEventKeyDown ) ) + { + iMarqueeAdapter->StopMarqueeDrawing(); + } - if (!AknLayoutUtils::PenEnabled() && iIsEditMode ) + if( !AknLayoutUtils::PenEnabled() && iIsEditMode ) { - if ((GetHighlight() + ColumnsInCurrentView() > NumberOfItems() - 1) - && aKeyEvent.iScanCode == EStdKeyDownArrow) - // the second condition is needed to block moving item down when there is no item below the moved item. - { - return resp; - } + if( ( GetHighlight() + ColumnsInCurrentView() > NumberOfItems() - 1 ) + && aKeyEvent.iScanCode == EStdKeyDownArrow ) + // the second condition is needed to block moving item down when there is no item below the moved item. + { + return resp; + } - if (aType == EEventKey ) + if( aType == EEventKey ) { TInt prevIndex = GetHighlight(); static_cast(iDrawer)->SetHighlightShown( EFalse ); @@ -1022,45 +1075,45 @@ ScrollViewIfNeededL(); //only edit mode non-touch if ( prevIndex != GetHighlight() - && KErrNotFound != prevIndex ) - { - iDraggedIndex = prevIndex; + && KErrNotFound != prevIndex ) + { + iDraggedIndex = prevIndex; iDragAndDropObserver->HandleDragStartL( iDraggedIndex ); GetMmModel()->ReorderModelL( iDraggedIndex, GetHighlight() ); - iDrawer->AnimateItemSwapL( iDraggedIndex , GetHighlight() ); + iDrawer->AnimateItemSwapL( iDraggedIndex, GetHighlight() ); AnimateShiftL( GetHighlight() ); - } + } return resp; } } - if ( resp == EKeyWasNotConsumed ) + if( resp == EKeyWasNotConsumed ) { resp = iWidget->OfferKeyEventL( aKeyEvent, aType ); } - if ( iKeyEventObserver ) - { - resp = iKeyEventObserver->HandleKeyPressedL( aKeyEvent, aType ); - } + if( iKeyEventObserver ) + { + resp = iKeyEventObserver->HandleKeyPressedL( aKeyEvent, aType ); + } if ( ( aKeyEvent.iScanCode == EStdKeyDevice3 || - aKeyEvent.iScanCode == EStdKeyEnter || - aKeyEvent.iScanCode == EStdKeyNkpEnter ) && aType == EEventKeyDown ) - { - if ( highlightVisibleWhenEventReceived ) - { - iAllowLongPress = EFalse; - } - else - { - iAllowLongPress = ETrue; + aKeyEvent.iScanCode == EStdKeyEnter || + aKeyEvent.iScanCode == EStdKeyNkpEnter ) && aType == EEventKeyDown ) + { + if( highlightVisibleWhenEventReceived ) + { + iAllowLongPress = EFalse; + } + else + { + iAllowLongPress = ETrue; - SetHighlightVisibilityL( ETrue ); - SetDefaultHighlightL( ETrue ); - HandleForegroundGainedL(); - } - } + SetHighlightVisibilityL( ETrue ); + SetDefaultHighlightL( ETrue ); + HandleForegroundGainedL(); + } + } return resp; } @@ -1069,10 +1122,10 @@ // ----------------------------------------------------------------------------- // TInt CMmWidgetContainer::ColumnsInCurrentView() - { - //should be overridden by deriving classes - return NumberOfItems(); - } + { + //should be overridden by deriving classes + return NumberOfItems(); + } // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- @@ -1080,8 +1133,8 @@ TInt CMmWidgetContainer::RowsInCurrentView() { //should be overridden by deriving classes - CListBoxView *view = ((CListBoxView*) Widget()->View()); - return view->NumberOfItemsThatFitInRect( Rect());//Widget()->View()->ViewRect()); + CListBoxView *view = ( (CListBoxView* ) Widget()->View() ); + return view->NumberOfItemsThatFitInRect( Rect() );//Widget()->View()->ViewRect()); } // ----------------------------------------------------------------------------- @@ -1089,7 +1142,7 @@ // ----------------------------------------------------------------------------- // void CMmWidgetContainer::HandleRockerPressL() - { + { TKeyEvent ke; ke.iScanCode = EStdKeyNull; ke.iCode = EStdKeyNull; @@ -1099,7 +1152,7 @@ { iKeyEventObserver->HandleKeyPressedL( ke, EEventUser ); } - } + } // ----------------------------------------------------------------------------- // @@ -1109,37 +1162,37 @@ TEventCode aType ) { TKeyResponse resp = EKeyWasNotConsumed; - TBool arrowKeyPressed = aKeyEvent.iScanCode == EStdKeyRightArrow || - aKeyEvent.iScanCode == EStdKeyLeftArrow || - aKeyEvent.iScanCode == EStdKeyUpArrow || - aKeyEvent.iScanCode == EStdKeyDownArrow; + TBool arrowKeyPressed = aKeyEvent.iScanCode == EStdKeyRightArrow + || aKeyEvent.iScanCode == EStdKeyLeftArrow + || aKeyEvent.iScanCode == EStdKeyUpArrow + || aKeyEvent.iScanCode == EStdKeyDownArrow; TBool arrowHasHandling = ( aKeyEvent.iScanCode == EStdKeyRightArrow - && WidgetType() != EListWidget ) - || ( aKeyEvent.iScanCode == EStdKeyLeftArrow - && WidgetType() != EListWidget ) - || aKeyEvent.iScanCode == EStdKeyUpArrow - || aKeyEvent.iScanCode == EStdKeyDownArrow; + && WidgetType() != EListWidget ) + || ( aKeyEvent.iScanCode == EStdKeyLeftArrow + && WidgetType() != EListWidget ) + || aKeyEvent.iScanCode == EStdKeyUpArrow + || aKeyEvent.iScanCode == EStdKeyDownArrow; // handle arrow: draw highlight when arrow used - if ( arrowHasHandling ) + if( arrowHasHandling ) { - if ( !IsHighlightVisible() ) + if( !IsHighlightVisible() ) { - if ( aType == EEventKey || aType == EEventKeyUp ) + if( aType == EEventKey || aType == EEventKeyUp ) { SetHighlightVisibilityL( ETrue ); SetDefaultHighlightL( ETrue ); } - // override avkon's default highlight setting - resp = EKeyWasConsumed; + // override avkon's default highlight setting + resp = EKeyWasConsumed; } else { // this block is used to set the highlight only once for each event - if ( aKeyEvent.iRepeats > 0 ) + if( aKeyEvent.iRepeats > 0 ) { // if repeated key events we move focus on EEventKey - if ( aType == EEventKey ) + if( aType == EEventKey ) { SetHighlightL( iWidget->CurrentItemIndex() ); } @@ -1147,13 +1200,13 @@ else { // if single event we move focus on EEventKeyUp - if ( aType == EEventKeyUp ) + if( aType == EEventKeyUp ) { SetHighlightL( iWidget->CurrentItemIndex() ); } } } - } + } else if( arrowKeyPressed ) { // ignore left and right arrows in list @@ -1161,19 +1214,19 @@ } // rocker select (short press) else if ( ( aKeyEvent.iScanCode == EStdKeyDevice3 ) && ( aType == EEventKeyDown ) ) - { - HandleRockerPressL(); - resp = EKeyWasConsumed; - } + { + HandleRockerPressL(); + resp = EKeyWasConsumed; + } else if ( iAllowLongPress && aType == EEventKey && aKeyEvent.iRepeats > 0 && - ( aKeyEvent.iScanCode == EStdKeyDevice3 - || aKeyEvent.iScanCode == EStdKeyEnter - || aKeyEvent.iScanCode == EStdKeyNkpEnter ) ) - { - HandleRockerPressL(); - resp = EKeyWasConsumed; - iAllowLongPress = EFalse; - } + ( aKeyEvent.iScanCode == EStdKeyDevice3 + || aKeyEvent.iScanCode == EStdKeyEnter + || aKeyEvent.iScanCode == EStdKeyNkpEnter ) ) + { + HandleRockerPressL(); + resp = EKeyWasConsumed; + iAllowLongPress = EFalse; + } return resp; } @@ -1183,11 +1236,11 @@ // // ----------------------------------------------------------------------------- // -void CMmWidgetContainer::SetSuiteModelL(CHnSuiteModel* aModel) +void CMmWidgetContainer::SetSuiteModelL( CHnSuiteModel* aModel ) { CHnSuiteModel* prevModel = GetMmModel()->GetSuiteModel(); - TInt numberOfItemsBefore (0); + TInt numberOfItemsBefore( 0 ); numberOfItemsBefore = GetMmModel()->NumberOfItems(); GetMmModel()->SetSuiteModelL( aModel ); @@ -1197,8 +1250,8 @@ // This needs to be in place (disabling redraw) // to udpate widget internal state, however to wait for // drawing until all highlight set matters are solved. - iWidget->MakeVisible(EFalse); - if ( GetMmModel()->NumberOfItems() >= numberOfItemsBefore ) + iWidget->MakeVisible( EFalse ); + if( GetMmModel()->NumberOfItems() >= numberOfItemsBefore ) { HandleItemAdditionL(); } @@ -1206,20 +1259,20 @@ { HandleItemRemovalL(); } - if ( prevModel && aModel ) + if( prevModel && aModel ) { SetupWidgetLayoutL(); } - iWidget->MakeVisible(ETrue); + iWidget->MakeVisible( ETrue ); - if ( highlightVisibleBefore ) + if( highlightVisibleBefore ) { SetHighlightVisibilityL( ETrue ); } Widget()->View()->ItemDrawer()->ClearFlags( - CListItemDrawer::EPressedDownState ); - iPostProcessor->StartAt( iWidget->BottomItemIndex() + 1 ); + CListItemDrawer::EPressedDownState ); + iPostProcessor->StartAt( iWidget->BottomItemIndex() + 1 ); } // --------------------------------------------------------------------------- @@ -1227,19 +1280,18 @@ // --------------------------------------------------------------------------- // void CMmWidgetContainer::SetupDrawer() - { - iDrawer = STATIC_CAST(CMmListBoxItemDrawer*, iWidget->View()->ItemDrawer()); - } - + { + iDrawer = STATIC_CAST(CMmListBoxItemDrawer*, iWidget->View()->ItemDrawer()); + } // --------------------------------------------------------------------------- // // --------------------------------------------------------------------------- // EXPORT_C THnSuiteWidgetType CMmWidgetContainer::WidgetType() - { - return EUnspecified; - } + { + return EUnspecified; + } // --------------------------------------------------------------------------- // // --------------------------------------------------------------------------- @@ -1263,11 +1315,11 @@ // Fix for EMWK-7NYKRJ // Matrix Menu: Scrollbar highligted when App Key is pressed while it is held - if ( AknLayoutUtils::PenEnabled() ) + if( AknLayoutUtils::PenEnabled() ) { CEikScrollBar* scrollBar = iWidget->ScrollBarFrame()->VerticalScrollBar(); - if ( scrollBar && scrollBar->IsVisible() ) + if( scrollBar && scrollBar->IsVisible() ) { TPointerEvent fakeButton1UpEvent; fakeButton1UpEvent.iType = TPointerEvent::EButton1Up; @@ -1292,21 +1344,21 @@ // --------------------------------------------------------------------------- // TInt CMmWidgetContainer::DeltaSquare( const TPoint aTapPoint, - const TPoint aPos ) - { - TInt delta( KErrNotFound ); - TInt height = aTapPoint.iY - aPos.iY; - TInt width = aTapPoint.iX - aPos.iX; + const TPoint aPos ) + { + TInt delta( KErrNotFound ); + TInt height = aTapPoint.iY - aPos.iY; + TInt width = aTapPoint.iX - aPos.iX; if( WidgetType() == EListWidget ) - { - delta = height * height + height * height; - } + { + delta = height * height + height * height; + } else - { - delta = height * height + width * width; - } - return delta; - } + { + delta = height * height + width * width; + } + return delta; + } // --------------------------------------------------------------------------- // @@ -1328,120 +1380,118 @@ // --------------------------------------------------------------------------- // EXPORT_C void CMmWidgetContainer::HandleItemAdditionL() - { - // only the the descended method should be invoked. - // this is needed to avoid codescanner warning - User::Leave( KErrNotSupported ); - } - + { + // only the the descended method should be invoked. + // this is needed to avoid codescanner warning + User::Leave( KErrNotSupported ); + } // --------------------------------------------------------------------------- // // --------------------------------------------------------------------------- // EXPORT_C void CMmWidgetContainer::HandleItemRemovalL() - { - // only the the descended method should be invoked. - // this is needed to avoid codescanner warning - User::Leave( KErrNotSupported ); - } + { + // only the the descended method should be invoked. + // this is needed to avoid codescanner warning + User::Leave( KErrNotSupported ); + } // --------------------------------------------------------------------------- // // --------------------------------------------------------------------------- // EXPORT_C void CMmWidgetContainer::StopMovingL() - { - if ( !AknLayoutUtils::PenEnabled() && iDragAndDropObserver ) - iDragAndDropObserver->HandleDragStopL( GetHighlight() ); - } - + { + if( !AknLayoutUtils::PenEnabled() && iDragAndDropObserver ) + iDragAndDropObserver->HandleDragStopL( GetHighlight() ); + } // --------------------------------------------------------------------------- // // --------------------------------------------------------------------------- // void CMmWidgetContainer::ScrollViewIfNeededL() - { - if ((iWidget->BottomItemIndex() / ColumnsInCurrentView() - - iWidget->TopItemIndex() / ColumnsInCurrentView() ) <= 1 ) - { - return; - } + { + if( ( iWidget->BottomItemIndex() / ColumnsInCurrentView() + - iWidget->TopItemIndex() / ColumnsInCurrentView() ) <= 1 ) + { + return; + } - TBool needToScrollUp = - GetHighlight() - iWidget->TopItemIndex() < ColumnsInCurrentView() - && iWidget->TopItemIndex() != 0; + TBool needToScrollUp = + GetHighlight() - iWidget->TopItemIndex() < ColumnsInCurrentView() + && iWidget->TopItemIndex() != 0; - TBool needToScrollDown = - iWidget->BottomItemIndex() - GetHighlight() < ColumnsInCurrentView() - && iWidget->BottomItemIndex() / ColumnsInCurrentView() - != ( NumberOfItems() - 1 ) / ColumnsInCurrentView(); + TBool needToScrollDown = + iWidget->BottomItemIndex() - GetHighlight() < ColumnsInCurrentView() + && iWidget->BottomItemIndex() / ColumnsInCurrentView() + != ( NumberOfItems() - 1 ) / ColumnsInCurrentView(); - if ( WidgetType() == EGridWidget ) - { - // TODO: temporary - invisible partial items in MCL grid :/ - needToScrollDown = - iWidget->BottomItemIndex() - ColumnsInCurrentView() - GetHighlight() < ColumnsInCurrentView() - && ( iWidget->BottomItemIndex() / ColumnsInCurrentView() ) - 1 - != ( NumberOfItems() - 1 ) / ColumnsInCurrentView() - && iWidget->BottomItemIndex() - iWidget->TopItemIndex() - > ColumnsInCurrentView() * RowsInCurrentView(); - } + if( WidgetType() == EGridWidget ) + { + // TODO: temporary - invisible partial items in MCL grid :/ + needToScrollDown = + iWidget->BottomItemIndex() - ColumnsInCurrentView() - GetHighlight() < ColumnsInCurrentView() + && ( iWidget->BottomItemIndex() / ColumnsInCurrentView() ) - 1 + != ( NumberOfItems() - 1 ) / ColumnsInCurrentView() + && iWidget->BottomItemIndex() - iWidget->TopItemIndex() + > ColumnsInCurrentView() * RowsInCurrentView(); + } - if ( needToScrollUp ) - { + if( needToScrollUp ) + { #ifdef RD_UI_TRANSITION_EFFECTS_LIST - MAknListBoxTfxInternal *transApi = CAknListLoader::TfxApiInternal( iDrawer->Gc() ); - if ( transApi ) - { - transApi->SetMoveType( MAknListBoxTfxInternal::EListScrollUp ); - } + MAknListBoxTfxInternal *transApi = CAknListLoader::TfxApiInternal( iDrawer->Gc() ); + if( transApi ) + { + transApi->SetMoveType( MAknListBoxTfxInternal::EListScrollUp ); + } #endif - iDrawer->RemoveFloatingItems(); - iWidget->View()->VScrollTo( - iWidget->TopItemIndex() - ColumnsInCurrentView() ); + iDrawer->RemoveFloatingItems(); + iWidget->View()->VScrollTo( + iWidget->TopItemIndex() - ColumnsInCurrentView() ); #ifdef RD_UI_TRANSITION_EFFECTS_LIST - if ( transApi ) - { - transApi->Draw( Rect() ); - } + if( transApi ) + { + transApi->Draw( Rect() ); + } #endif - UpdateViewScrollBarThumbs(); - } - else if ( needToScrollDown ) - { + UpdateViewScrollBarThumbs(); + } + else if( needToScrollDown ) + { #ifdef RD_UI_TRANSITION_EFFECTS_LIST - MAknListBoxTfxInternal *transApi = CAknListLoader::TfxApiInternal( iDrawer->Gc() ); - if ( transApi ) - { - transApi->SetMoveType( MAknListBoxTfxInternal::EListScrollDown ); - } + MAknListBoxTfxInternal *transApi = CAknListLoader::TfxApiInternal( iDrawer->Gc() ); + if( transApi ) + { + transApi->SetMoveType( MAknListBoxTfxInternal::EListScrollDown ); + } #endif - iDrawer->RemoveFloatingItems(); - iWidget->View()->VScrollTo( - iWidget->TopItemIndex() + ColumnsInCurrentView() ); + iDrawer->RemoveFloatingItems(); + iWidget->View()->VScrollTo( + iWidget->TopItemIndex() + ColumnsInCurrentView() ); #ifdef RD_UI_TRANSITION_EFFECTS_LIST - if ( transApi ) - { - transApi->Draw( Rect() ); - } + if( transApi ) + { + transApi->Draw( Rect() ); + } #endif - UpdateViewScrollBarThumbs(); - } - } + UpdateViewScrollBarThumbs(); + } + } //---------------------------------------------------------------------------- // // --------------------------------------------------------------------------- // void CMmWidgetContainer::UpdateViewScrollBarThumbs() - { + { - } + } //---------------------------------------------------------------------------- // @@ -1449,15 +1499,15 @@ // void CMmWidgetContainer::StartOrStopMarquee() { - if ( iMarqueeAdapter ) + if( iMarqueeAdapter ) { TBool marqueeShouldBeEnabled = iHasFocus && iInForeground && !iIsFaded && !IsEditMode(); - // logical Ex-OR + // logical Ex-OR if ( !!marqueeShouldBeEnabled != !!iMarqueeAdapter->IsMarqueeEnabled() ) { - if ( !marqueeShouldBeEnabled ) + if( !marqueeShouldBeEnabled ) { iMarqueeAdapter->StopMarqueeDrawing(); } @@ -1472,89 +1522,89 @@ // --------------------------------------------------------------------------- // void CMmWidgetContainer::SetHighlightAfterDrag() - { - if ( AknLayoutUtils::PenEnabled() && - iDraggedIndex != KErrNotFound && - iDraggedIndex != Widget()->CurrentItemIndex() - && iDraggedIndex < NumberOfItems() ) - { - TBool isFolder(EFalse); - CHnSuiteModel* model = GetMmModel()->GetSuiteModel(); - CHnItemModel* onItemModel = model->GetItemModel( - model->IdByIndex( Widget()->CurrentItemIndex() )); - if (onItemModel) - { - isFolder = onItemModel->GetItemType() == EItemTypeParentFolder || - onItemModel->GetItemType() == EItemTypeFolder; - } - if (!isFolder) - { - Widget()->View()->SetCurrentItemIndex( iDraggedIndex ); - } - } - } + { + if( AknLayoutUtils::PenEnabled() + && iDraggedIndex != KErrNotFound + && iDraggedIndex != Widget()->CurrentItemIndex() + && iDraggedIndex < NumberOfItems() ) + { + TBool isFolder( EFalse ); + CHnSuiteModel* model = GetMmModel()->GetSuiteModel(); + CHnItemModel* onItemModel = model->GetItemModel( + model->IdByIndex( Widget()->CurrentItemIndex() )); + if( onItemModel ) + { + isFolder = onItemModel->GetItemType() == EItemTypeParentFolder + || onItemModel->GetItemType() == EItemTypeFolder; + } + if( !isFolder ) + { + Widget()->View()->SetCurrentItemIndex( iDraggedIndex ); + } + } + } // --------------------------------------------------------------------------- // // --------------------------------------------------------------------------- // void CMmWidgetContainer::ValidateWidgetCurrentItemIndex() - { - if (Widget()->CurrentItemIndex() >= GetMmModel()->NumberOfItems() - || Widget()->CurrentItemIndex() == KErrNotFound ) - { - iCurrentHighlight = GetMmModel()->NumberOfItems(); - if( iCurrentHighlight > 0 ) - { - Widget()->View()->SetCurrentItemIndex( --iCurrentHighlight ); - } - else - { - iCurrentHighlight = KErrNotFound ; - } - } - } + { + if( Widget()->CurrentItemIndex() >= GetMmModel()->NumberOfItems() + || Widget()->CurrentItemIndex() == KErrNotFound ) + { + iCurrentHighlight = GetMmModel()->NumberOfItems(); + if( iCurrentHighlight > 0 ) + { + Widget()->View()->SetCurrentItemIndex( --iCurrentHighlight ); + } + else + { + iCurrentHighlight = KErrNotFound; + } + } + } // --------------------------------------------------------------------------- // // --------------------------------------------------------------------------- // EXPORT_C void CMmWidgetContainer::CacheWidgetPosition() - { - iWidgetPositionCache.iVerticalItemOffset = VerticalItemOffset(); - iWidgetPositionCache.iTopItemIndex = Widget()->TopItemIndex(); - iWidgetPositionCache.iLandscape - = Layout_Meta_Data::IsLandscapeOrientation(); - iWidgetPositionCache.iHighlightedItemId = KErrNotFound; + { + iWidgetPositionCache.iVerticalItemOffset = VerticalItemOffset(); + iWidgetPositionCache.iTopItemIndex = Widget()->TopItemIndex(); + iWidgetPositionCache.iLandscape + = Layout_Meta_Data::IsLandscapeOrientation(); + iWidgetPositionCache.iHighlightedItemId = KErrNotFound; - TInt highlightedItemIndex = Widget()->CurrentItemIndex(); - CHnSuiteModel* suiteModel = GetMmModel()->GetSuiteModel(); - if ( suiteModel && highlightedItemIndex != KErrNotFound - && suiteModel->GetSuiteHighlight() == highlightedItemIndex - && ItemIsVisible( highlightedItemIndex ) ) - { - iWidgetPositionCache.iHighlightedItemId = + TInt highlightedItemIndex = Widget()->CurrentItemIndex(); + CHnSuiteModel* suiteModel = GetMmModel()->GetSuiteModel(); + if( suiteModel && highlightedItemIndex != KErrNotFound + && suiteModel->GetSuiteHighlight() == highlightedItemIndex + && ItemIsVisible( highlightedItemIndex ) ) + { + iWidgetPositionCache.iHighlightedItemId = suiteModel->IdByIndex( highlightedItemIndex ); - } + } - iWidgetPositionCache.iValid = ETrue; - } + iWidgetPositionCache.iValid = ETrue; + } // --------------------------------------------------------------------------- // // --------------------------------------------------------------------------- // EXPORT_C void CMmWidgetContainer::RestoreWidgetPosition() - { - if (iWidgetPositionCache.iValid) - { - if ( iWidgetPositionCache.iLandscape - == Layout_Meta_Data::IsLandscapeOrientation() ) - { + { + if( iWidgetPositionCache.iValid ) + { + if( iWidgetPositionCache.iLandscape + == Layout_Meta_Data::IsLandscapeOrientation() ) + { // If view position was cached during boundary effect, correct the // cached position. - if ( iWidgetPositionCache.iTopItemIndex == 0 && - iWidgetPositionCache.iVerticalItemOffset > 0 ) + if( iWidgetPositionCache.iTopItemIndex == 0 + && iWidgetPositionCache.iVerticalItemOffset > 0 ) { iWidgetPositionCache.iVerticalItemOffset = 0; // This corrects the position cached during the upper boundary @@ -1562,139 +1612,139 @@ // effect. } - Widget()->View()->SetTopItemIndex(iWidgetPositionCache.iTopItemIndex); - SetVerticalItemOffset(iWidgetPositionCache.iVerticalItemOffset); - TRAP_IGNORE( AlignBottomOfViewL() ); + Widget()->View()->SetTopItemIndex(iWidgetPositionCache.iTopItemIndex); + SetVerticalItemOffset( iWidgetPositionCache.iVerticalItemOffset ); + TRAP_IGNORE( AlignBottomOfViewL() ); - // Important: If an item that was previously highlighted and visible is - // still highlighted and yet somehow is not visible after the position - // has been restored, fix the problem by scrolling the view until that - // item is visible again: - CHnSuiteModel* suiteModel = GetMmModel()->GetSuiteModel(); - if ( suiteModel && IsHighlightVisible() ) - { - TInt highlightedItemIndex = suiteModel->GetSuiteHighlight(); - TInt highlightedItemId = highlightedItemIndex != KErrNotFound ? - suiteModel->IdByIndex( highlightedItemIndex ) : KErrNotFound; - if ( highlightedItemId != KErrNotFound - && highlightedItemId == iWidgetPositionCache.iHighlightedItemId - && !ItemIsVisible( highlightedItemIndex ) ) - { - TRAP_IGNORE( ScrollToItemL( highlightedItemIndex ) ); - } - } - } - else - { - TRAP_IGNORE( ScrollToItemL(Widget()->CurrentItemIndex()) ); - } + // Important: If an item that was previously highlighted and visible is + // still highlighted and yet somehow is not visible after the position + // has been restored, fix the problem by scrolling the view until that + // item is visible again: + CHnSuiteModel* suiteModel = GetMmModel()->GetSuiteModel(); + if( suiteModel && IsHighlightVisible() ) + { + TInt highlightedItemIndex = suiteModel->GetSuiteHighlight(); + TInt highlightedItemId = highlightedItemIndex != KErrNotFound ? + suiteModel->IdByIndex( highlightedItemIndex ) : KErrNotFound; + if ( highlightedItemId != KErrNotFound + && highlightedItemId == iWidgetPositionCache.iHighlightedItemId + && !ItemIsVisible( highlightedItemIndex ) ) + { + TRAP_IGNORE( ScrollToItemL( highlightedItemIndex ) ); + } + } + } + else + { + TRAP_IGNORE( ScrollToItemL(Widget()->CurrentItemIndex()) ); + } - iWidgetPositionCache.iValid = EFalse; - } - } + iWidgetPositionCache.iValid = EFalse; + } + } // --------------------------------------------------------------------------- // // --------------------------------------------------------------------------- // -void CMmWidgetContainer::MakeVisible(TBool aVisible) - { - if ( !aVisible ) - { - RestoreWidgetPosition(); - CacheWidgetPosition(); - iDrawer->RemoveFloatingItems(); - } - else if ( aVisible ) - { - RestoreWidgetPosition(); - } - CCoeControl::MakeVisible(aVisible); - iWidget->MakeVisible(aVisible); - if ( !aVisible ) +void CMmWidgetContainer::MakeVisible( TBool aVisible ) + { + if( !aVisible ) + { + RestoreWidgetPosition(); + CacheWidgetPosition(); + iDrawer->RemoveFloatingItems(); + } + else if( aVisible ) { - TRAP_IGNORE( SetHighlightVisibilityL( EFalse ) ); + RestoreWidgetPosition(); } - } + CCoeControl::MakeVisible( aVisible ); + iWidget->MakeVisible( aVisible ); + if( !aVisible ) + { + TRAP_IGNORE( SetHighlightVisibilityL( EFalse ) ); + } + } // --------------------------------------------------------------------------- // // --------------------------------------------------------------------------- // EXPORT_C void CMmWidgetContainer::ResetWidgetPosition() - { - iWidgetPositionCache.iVerticalItemOffset = 0; - iWidgetPositionCache.iTopItemIndex = 0; - iWidgetPositionCache.iValid = EFalse; - iWidgetPositionCache.iHighlightedItemId = KErrNotFound; - Widget()->SetTopItemIndex(0); - SetVerticalItemOffset(0); - } + { + iWidgetPositionCache.iVerticalItemOffset = 0; + iWidgetPositionCache.iTopItemIndex = 0; + iWidgetPositionCache.iValid = EFalse; + iWidgetPositionCache.iHighlightedItemId = KErrNotFound; + Widget()->SetTopItemIndex( 0 ); + SetVerticalItemOffset( 0 ); + } // --------------------------------------------------------------------------- // // --------------------------------------------------------------------------- // EXPORT_C void CMmWidgetContainer::NumberOfItemsChangedL( TItemsChangeType aChange ) - { - if ( AknLayoutUtils::PenEnabled() ) - { - CacheWidgetPosition(); - Widget()->View()->SetDisableRedraw( ETrue ); + { + if( AknLayoutUtils::PenEnabled() ) + { + CacheWidgetPosition(); + Widget()->View()->SetDisableRedraw( ETrue ); - HandleNumberOfItemsChangedL( aChange ); + HandleNumberOfItemsChangedL( aChange ); - Widget()->View()->SetDisableRedraw( EFalse ); - RestoreWidgetPosition(); - } - else - { - // there is no need to cache and restore widget position in non-touch; - // moreover, it can cause some problems with scrolling when adding - // new folder - HandleNumberOfItemsChangedL( aChange ); - } - } + Widget()->View()->SetDisableRedraw( EFalse ); + RestoreWidgetPosition(); + } + else + { + // there is no need to cache and restore widget position in non-touch; + // moreover, it can cause some problems with scrolling when adding + // new folder + HandleNumberOfItemsChangedL( aChange ); + } + } // --------------------------------------------------------------------------- // // --------------------------------------------------------------------------- // void CMmWidgetContainer::HandleNumberOfItemsChangedL( TItemsChangeType aChange ) - { - SetHighlightVisibilityL( EFalse ); - if ( aChange == EItemsAdded ) - { - HandleItemAdditionL(); - } - else if ( aChange == EItemsRemoved ) - { - HandleItemRemovalL(); - } - } + { + SetHighlightVisibilityL( EFalse ); + if( aChange == EItemsAdded ) + { + HandleItemAdditionL(); + } + else if( aChange == EItemsRemoved ) + { + HandleItemRemovalL(); + } + } // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- // TBool CMmWidgetContainer::AlignBottomOfViewL() - { - TInt scrollConsumed( EFalse ); - TInt pixelsToScroll( 0 ); + { + TInt scrollConsumed( EFalse ); + TInt pixelsToScroll( 0 ); - if ( NumberOfItems() > 0 ) - { - pixelsToScroll = CalcBottomPixelsToScroll(); - } + if( NumberOfItems() > 0 ) + { + pixelsToScroll = CalcBottomPixelsToScroll(); + } - if ( pixelsToScroll != 0 ) - { - ScrollInPixelsL( pixelsToScroll ); - scrollConsumed = ETrue; - } + if( pixelsToScroll != 0 ) + { + ScrollInPixelsL( pixelsToScroll ); + scrollConsumed = ETrue; + } - return scrollConsumed; - } + return scrollConsumed; + } // ----------------------------------------------------------------------------- // @@ -1705,11 +1755,11 @@ const TInt firstItemIndex( 0 ); TInt lastItemIndex = NumberOfItems() - 1; TInt viewHeight = Widget()->View()->ViewRect().Height(); - TInt lastItemBottomY = Widget()->View()->ItemPos(lastItemIndex).iY - + Widget()->ItemHeight(); + TInt lastItemBottomY = Widget()->View()->ItemPos( lastItemIndex ).iY + + Widget()->ItemHeight(); TInt pixelsToScroll( 0 ); - if ( Widget()->ScrollBarFrame()->VerticalScrollBar()->IsVisible() ) + if( Widget()->ScrollBarFrame()->VerticalScrollBar()->IsVisible() ) { pixelsToScroll = Min( 0, lastItemBottomY - viewHeight ); } @@ -1721,7 +1771,6 @@ return pixelsToScroll; } - // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- @@ -1735,155 +1784,156 @@ // // ----------------------------------------------------------------------------- // -EXPORT_C TBool CMmWidgetContainer::ItemIsFullyVisible(TInt aIndex) - { - return ItemIsVisible( aIndex ) - && !Widget()->View()->ItemIsPartiallyVisible(aIndex); - } +EXPORT_C TBool CMmWidgetContainer::ItemIsFullyVisible( TInt aIndex ) + { + return ItemIsVisible( aIndex ) + && !Widget()->View()->ItemIsPartiallyVisible( aIndex ); + } // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- // -void CMmWidgetContainer::ScrollInPixelsL(TInt aPixels) - { - SetupScrollingEffectsL( aPixels > 0 ); +void CMmWidgetContainer::ScrollInPixelsL( TInt aPixels ) + { + SetupScrollingEffectsL( aPixels > 0 ); - if ( AknLayoutUtils::PenEnabled() ) - { - Widget()->HandlePhysicsScrollEventL(aPixels); - } - else - { - // non-touch avkon doesn't seem to support scrolling by given - // amount of pixels - TInt delta = aPixels / Widget()->View()->ItemHeight(); + if( AknLayoutUtils::PenEnabled() ) + { + Widget()->HandlePhysicsScrollEventL( aPixels ); + } + else + { + // non-touch avkon doesn't seem to support scrolling by given + // amount of pixels + TInt delta = aPixels / Widget()->View()->ItemHeight(); - Widget()->View()->VScrollTo( Widget()->TopItemIndex() + - delta * ColumnsInCurrentView() ); - } - } + Widget()->View()->VScrollTo( Widget()->TopItemIndex() + + delta * ColumnsInCurrentView() ); + } + } // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- // -EXPORT_C TBool CMmWidgetContainer::ScrollToItemL(TInt aIndex) - { - TInt scrollConsumed(EFalse); - if (aIndex >= 0 && aIndex <= NumberOfItems()) - { - scrollConsumed = AlignBottomOfViewL(); - if ( !scrollConsumed && Widget()->View()->ItemIsPartiallyVisible(aIndex)) - { -// the case when the item is partially visible at top or -// bottom of screen. Th e view is scrolled the offset to -// make the item entirely visible. - TInt offsetBottom = Widget()->View()->ItemPos(aIndex).iY - + Widget()->ItemHeight() - - Widget()->View()->ViewRect().Height(); - TInt offsetTop = Widget()->View()->ItemPos(aIndex).iY; - TBool takeTop = Abs(offsetTop) < Abs(offsetBottom); - TInt offset = (takeTop) ? offsetTop : offsetBottom; - if (offset != 0) - { - ScrollInPixelsL( offset ); - scrollConsumed = ETrue; - } +EXPORT_C TBool CMmWidgetContainer::ScrollToItemL( TInt aIndex ) + { + TInt scrollConsumed( EFalse ); + if( aIndex >= 0 && aIndex <= NumberOfItems() ) + { + scrollConsumed = AlignBottomOfViewL(); + if ( !scrollConsumed && Widget()->View()->ItemIsPartiallyVisible(aIndex)) + { + // the case when the item is partially visible at top or + // bottom of screen. Th e view is scrolled the offset to + // make the item entirely visible. + TInt offsetBottom = Widget()->View()->ItemPos( aIndex ).iY + + Widget()->ItemHeight() + - Widget()->View()->ViewRect().Height(); + TInt offsetTop = Widget()->View()->ItemPos( aIndex ).iY; + TBool takeTop = Abs( offsetTop ) < Abs( offsetBottom ); + TInt offset = ( takeTop ) ? offsetTop : offsetBottom; + if( offset != 0 ) + { + ScrollInPixelsL( offset ); + scrollConsumed = ETrue; + } - } - else if (!Widget()->View()->ItemIsVisible(aIndex)) - { -// the case when the item is not visible on screen - SetupScrollingEffectsL( aIndex > Widget()->BottomItemIndex() ); - Widget()->ScrollToMakeItemVisible(aIndex); - AlignBottomOfViewL(); - scrollConsumed = ETrue; - } - } - return scrollConsumed; - } + } + else if( !Widget()->View()->ItemIsVisible( aIndex ) ) + { + // the case when the item is not visible on screen + SetupScrollingEffectsL( aIndex > Widget()->BottomItemIndex() ); + Widget()->ScrollToMakeItemVisible( aIndex ); + AlignBottomOfViewL(); + scrollConsumed = ETrue; + } + } + return scrollConsumed; + } // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- // -void CMmWidgetContainer::SetupScrollingEffectsL(TBool aDown) - { +void CMmWidgetContainer::SetupScrollingEffectsL( TBool aDown ) + { #ifdef RD_UI_TRANSITION_EFFECTS_LIST - MAknListBoxTfxInternal *transApi = CAknListLoader::TfxApiInternal( - iDrawer->Gc()); - if (transApi) - { - MAknListBoxTfxInternal::TMovementType movementType; - movementType = (aDown == (TInt)ETrue ) ? MAknListBoxTfxInternal::EListScrollDown - : MAknListBoxTfxInternal::EListScrollUp; - transApi->SetMoveType(movementType); - } + MAknListBoxTfxInternal *transApi = CAknListLoader::TfxApiInternal( + iDrawer->Gc() ); + if( transApi ) + { + MAknListBoxTfxInternal::TMovementType movementType; + movementType = ( aDown == (TInt ) ETrue ) + ? MAknListBoxTfxInternal::EListScrollDown + : MAknListBoxTfxInternal::EListScrollUp; + transApi->SetMoveType( movementType ); + } #endif - } + } // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- // EXPORT_C void CMmWidgetContainer::PrepareForGarbage() - { -// This is called when the suite model is destoyed and the container is set to be destroyed -// by the garbage collector. There should be no redraws done to the widget in this period -// because this will cause the screen to be redrawn only containing the balnk background. -// Before garbage cleanup an asynchronous redraw event may intend to redraw the widget. -// SetDisableRedraw() prevents redrawing. Animator is also prepared for garbage so there is -// no instance which can enable redraw of the widget. - Widget()->View()->SetDisableRedraw( ETrue ); - iDrawer->RemoveFloatingItems(); -// Prapares the animator for garbage, which means it blocks any animator drawing. - iDrawer->GetAnimator()->PrepareForGarbage(); - } + { + // This is called when the suite model is destoyed and the container is set to be destroyed + // by the garbage collector. There should be no redraws done to the widget in this period + // because this will cause the screen to be redrawn only containing the balnk background. + // Before garbage cleanup an asynchronous redraw event may intend to redraw the widget. + // SetDisableRedraw() prevents redrawing. Animator is also prepared for garbage so there is + // no instance which can enable redraw of the widget. + Widget()->View()->SetDisableRedraw( ETrue ); + iDrawer->RemoveFloatingItems(); + // Prapares the animator for garbage, which means it blocks any animator drawing. + iDrawer->GetAnimator()->PrepareForGarbage(); + } // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- // void CMmWidgetContainer::HandleLongTapEventL( const TPoint& aPenEventLocation, - const TPoint& aPenEventScreenLocation ) - { - TInt index( KErrNotFound ); - if ( iWidget->View()->XYPosToItemIndex( aPenEventLocation, index ) ) - { - SetHighlightVisibilityL( ETrue ); - iLongTapInProgress = ETrue; - if ( iLongTapObserver ) - { - iLongTapObserver->HandleLongTapEventL( aPenEventScreenLocation ); - } - } - } + const TPoint& aPenEventScreenLocation ) + { + TInt index( KErrNotFound ); + if( iWidget->View()->XYPosToItemIndex( aPenEventLocation, index ) ) + { + SetHighlightVisibilityL( ETrue ); + iLongTapInProgress = ETrue; + if( iLongTapObserver ) + { + iLongTapObserver->HandleLongTapEventL( aPenEventScreenLocation ); + } + } + } // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- // EXPORT_C void CMmWidgetContainer::SetLongTapObserver( MMmLongTapObserver* aObserver ) - { - iLongTapObserver = aObserver; - } + { + iLongTapObserver = aObserver; + } // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- // EXPORT_C void CMmWidgetContainer::EndLongTapL( TBool aStopTimer ) - { - if ( iLongTapInProgress ) - { - iLongTapInProgress = EFalse; - if( aStopTimer ) - { - SetHighlightVisibilityL( EFalse ); - } - } - } + { + if( iLongTapInProgress ) + { + iLongTapInProgress = EFalse; + if( aStopTimer ) + { + SetHighlightVisibilityL( EFalse ); + } + } + } // --------------------------------------------------------------------------- // @@ -1892,65 +1942,65 @@ void CMmWidgetContainer::HandleListBoxEventL( CEikListBox* aListBox, TListBoxEvent aEventType ) { -// handle same behaviour in edit mode and normal mode - switch ( aEventType ) - { - case MEikListBoxObserver::EEventPenDownOnItem: - case MEikListBoxObserver::EEventItemSingleClicked: - { - iDragOccured = EFalse; - break; - } - case MEikListBoxObserver::EEventItemDraggingActioned: - { - iDragOccured = ETrue; - break; - } - } + // handle same behaviour in edit mode and normal mode + switch( aEventType ) + { + case MEikListBoxObserver::EEventPenDownOnItem: + case MEikListBoxObserver::EEventItemSingleClicked: + { + iDragOccured = EFalse; + break; + } + case MEikListBoxObserver::EEventItemDraggingActioned: + { + iDragOccured = ETrue; + break; + } + } -// handle different behaviour in edit mode and normal mode - if ( !IsEditMode() ) - { - switch ( aEventType ) - { - case MEikListBoxObserver::EEventFlickStarted: - case MEikListBoxObserver::EEventPanningStarted: - { - static_cast( - Widget()->View()->ItemDrawer() )-> - EnableCachedDataUse( ETrue ); - break; - } - case MEikListBoxObserver::EEventFlickStopped: - { - static_cast( - Widget()->View()->ItemDrawer() )-> - EnableCachedDataUse( EFalse ); - DrawView(); - break; - } - case MEikListBoxObserver::EEventPanningStopped: - { - static_cast( - Widget()->View()->ItemDrawer() )-> - EnableCachedDataUse( EFalse ); - break; - } - } - } - else - { - switch ( aEventType ) - { - case MEikListBoxObserver::EEventFlickStopped: - { - // this fixes some problems with messed edit mode - // caused by kinetic scrolling - iDrawer->GetAnimator()->SetNextRedrawToWholeScreen(); - break; - } - } - } + // handle different behaviour in edit mode and normal mode + if( !IsEditMode() ) + { + switch( aEventType ) + { + case MEikListBoxObserver::EEventFlickStarted: + case MEikListBoxObserver::EEventPanningStarted: + { + static_cast( + Widget()->View()->ItemDrawer() )-> + EnableCachedDataUse( ETrue ); + break; + } + case MEikListBoxObserver::EEventFlickStopped: + { + static_cast( + Widget()->View()->ItemDrawer() )-> + EnableCachedDataUse( EFalse ); + DrawView(); + break; + } + case MEikListBoxObserver::EEventPanningStopped: + { + static_cast( + Widget()->View()->ItemDrawer() )-> + EnableCachedDataUse( EFalse ); + break; + } + } + } + else + { + switch( aEventType ) + { + case MEikListBoxObserver::EEventFlickStopped: + { + // this fixes some problems with messed edit mode + // caused by kinetic scrolling + iDrawer->GetAnimator()->SetNextRedrawToWholeScreen(); + break; + } + } + } if ( aEventType == MEikListBoxObserver::EEventItemSingleClicked && iListBoxObserver && !iLongTapInProgress && !iDrawer->IsDraggable() ) diff -r d05a55b217df -r 79311d856354 menufw/menusuites/foldersuite/bwins/dummyCu.def --- a/menufw/menusuites/foldersuite/bwins/dummyCu.def Wed Apr 14 15:47:59 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -EXPORTS - ?E32Main@@YAHXZ @ 1 NONAME ; int E32Main(void) - diff -r d05a55b217df -r 79311d856354 menufw/menusuites/foldersuite/data/matrixmenudata.xml --- a/menufw/menusuites/foldersuite/data/matrixmenudata.xml Wed Apr 14 15:47:59 2010 +0300 +++ b/menufw/menusuites/foldersuite/data/matrixmenudata.xml Tue Apr 27 16:26:12 2010 +0300 @@ -105,6 +105,9 @@ #include -TARGET dummyC.dll -TARGETTYPE dll - -UID 0x0 0x02349823 -CAPABILITY CAP_GENERAL_DLL +TARGET foldersuite +TARGETTYPE NONE APP_LAYER_SYSTEMINCLUDE -SOURCEPATH ../src -SOURCE dummyC.cpp - -SOURCEPATH . USERINCLUDE ../../../menufwui/matrixmenu/loc - START RESOURCE ../data/foldersuite.rss HEADER TARGETPATH APP_RESOURCE_DIR diff -r d05a55b217df -r 79311d856354 menufw/menusuites/foldersuite/loc/matrixmenudata.loc Binary file menufw/menusuites/foldersuite/loc/matrixmenudata.loc has changed diff -r d05a55b217df -r 79311d856354 menufw/menusuites/foldersuite/src/dummyC.cpp --- a/menufw/menusuites/foldersuite/src/dummyC.cpp Wed Apr 14 15:47:59 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,23 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include - -EXPORT_C int E32Main() -{ - return 0; -} diff -r d05a55b217df -r 79311d856354 taskswitcher/contextengine/tsfswpreviewprovider/wsplugin/inc/previewprovidercrp.h --- a/taskswitcher/contextengine/tsfswpreviewprovider/wsplugin/inc/previewprovidercrp.h Wed Apr 14 15:47:59 2010 +0300 +++ b/taskswitcher/contextengine/tsfswpreviewprovider/wsplugin/inc/previewprovidercrp.h Tue Apr 27 16:26:12 2010 +0300 @@ -178,6 +178,7 @@ RArray iWgIds; TTime iScreenChangedTime; // fix for orientation changed/wg group changed problem TBool iClockwiseRot; // for marking rotation direction + TBool iLastWgIdRedraw; }; #endif // PREVIEWPROVIDERCRP_H diff -r d05a55b217df -r 79311d856354 taskswitcher/contextengine/tsfswpreviewprovider/wsplugin/src/previewprovidercrp.cpp --- a/taskswitcher/contextengine/tsfswpreviewprovider/wsplugin/src/previewprovidercrp.cpp Wed Apr 14 15:47:59 2010 +0300 +++ b/taskswitcher/contextengine/tsfswpreviewprovider/wsplugin/src/previewprovidercrp.cpp Tue Apr 27 16:26:12 2010 +0300 @@ -53,7 +53,8 @@ // -------------------------------------------------------------------------- // void CPreviewProviderCRP::ConstructL() - { + { + iLastWgIdRedraw = ETrue; } // -------------------------------------------------------------------------- @@ -147,7 +148,8 @@ BaseConstructL( aEnv, aId, aOwner ); aEnv.RegisterEventHandler( this, this, TWservCrEvent::EWindowGroupChanged | - TWservCrEvent::EDeviceOrientationChanged ); + TWservCrEvent::EDeviceOrientationChanged | + TWservCrEvent::EScreenDrawing ); iScreenChangedTime = 0; TSLOG_OUT(); @@ -174,7 +176,10 @@ TInt err = currTime.SecondsFrom( iScreenChangedTime, secondsFrom ); if ( err != KErrNone || secondsFrom.Int() > KMinTimeForOrientationSwitch ) { - TRAP_IGNORE( ScreenshotL() ); + if ( iLastWgIdRedraw ) + { + TRAP_IGNORE( ScreenshotL() ); + } } else { @@ -186,11 +191,19 @@ iPrevReg = 0; } iPrevId = wgId; + iLastWgIdRedraw = EFalse; } else if ( aEvent.Type() == TWservCrEvent::EDeviceOrientationChanged ) { iScreenChangedTime.HomeTime(); - TRAP_IGNORE( ScreenshotL() ); + if ( iLastWgIdRedraw ) + { + TRAP_IGNORE( ScreenshotL() ); + } + } + else if ( aEvent.Type() == TWservCrEvent::EScreenDrawing ) + { + iLastWgIdRedraw = ETrue; } TSLOG_OUT(); diff -r d05a55b217df -r 79311d856354 taskswitcher/contextengine/tsfswserver/engine/inc/tsfswdatalist.h --- a/taskswitcher/contextengine/tsfswserver/engine/inc/tsfswdatalist.h Wed Apr 14 15:47:59 2010 +0300 +++ b/taskswitcher/contextengine/tsfswserver/engine/inc/tsfswdatalist.h Tue Apr 27 16:26:12 2010 +0300 @@ -123,6 +123,29 @@ * the first position on conten data list */ void MoveEntryAtStart( TInt aAppId, TBool aWidget ); + + /** + * If application uid exists in the contained CTsFsAlwaysShownAppList + * @return ETrue application uid exists in the list + * EFalse application uid doesn't exist in the list + * @param TInt aWgId the window group application + */ + TBool IsAlwaysShownAppL( TInt aWgId ); + + /** + * Finds out the app uid for the given window group id. + * @param aWgId a valid window group id + * @param aUid requested uid + * @return error code + */ + TInt AppUidForWgId( TInt aWgId, TUid& aUid ); + + /** + * Finds out the app uid for the given window group id. + * @param aWgId a valid window group id + * @return application uid + */ + TUid AppUidForWgIdL( TInt aWgId ); private: /** diff -r d05a55b217df -r 79311d856354 taskswitcher/contextengine/tsfswserver/engine/inc/tsfswengine.h --- a/taskswitcher/contextengine/tsfswserver/engine/inc/tsfswengine.h Wed Apr 14 15:47:59 2010 +0300 +++ b/taskswitcher/contextengine/tsfswserver/engine/inc/tsfswengine.h Tue Apr 27 16:26:12 2010 +0300 @@ -161,12 +161,6 @@ */ TBool CollectTasksL(); - /** - * Finds out the app uid for the given window group id. - * @param aWgId a valid window group id - * @return application uid - */ - TUid AppUidForWgIdL( TInt aWgId ); /** * Makes a copy of the bitmap with the given handle. diff -r d05a55b217df -r 79311d856354 taskswitcher/contextengine/tsfswserver/engine/src/tsfswdatalist.cpp --- a/taskswitcher/contextengine/tsfswserver/engine/src/tsfswdatalist.cpp Wed Apr 14 15:47:59 2010 +0300 +++ b/taskswitcher/contextengine/tsfswserver/engine/src/tsfswdatalist.cpp Tue Apr 27 16:26:12 2010 +0300 @@ -153,8 +153,8 @@ TBool CTsFswDataList::CollectTasksL() { // clear dirty flag + TBool changed = iTaskListDirty; iTaskListDirty = EFalse; - TBool changed = EFalse; RTsFswArray newAppsList; RTsFswArray newWidgetsList; @@ -280,9 +280,29 @@ { TSLOG_CONTEXT( MoveEntryAtStart, TSLOG_LOCAL ); + TInt appId(0); + //check embeded case + if( !aWidget ) + { + TInt wgId(0); + CApaWindowGroupName::FindByAppUid(TUid::Uid(aAppId), iWsSession, wgId); + TInt parentWgId = FindMostTopParentWgId( wgId ); + if( parentWgId != KErrNotFound ) + { + TUid appUid = TUid::Uid(0); + AppUidForWgId(parentWgId, appUid); + appId = appUid.iUid; + } + } + + if( !appId ) + { + appId = aAppId; + } + for ( TInt i = 0; i < iData.Count(); ++i ) { - if( iData[i]->AppUid().iUid == aAppId && iData[i]->Widget() == aWidget) + if( iData[i]->AppUid().iUid == appId && iData[i]->Widget() == aWidget) { CTsFswEntry* entry = iData[i]; iData.Remove(i); @@ -301,8 +321,6 @@ { TSLOG_CONTEXT( CollectTasksL, TSLOG_LOCAL ); TSLOG_IN(); - // clear dirty flag - iTaskListDirty = EFalse; // update app data if needed // (usually on startup and when new apps might have been installed) @@ -750,4 +768,36 @@ return exists; } +// -------------------------------------------------------------------------- +// CTsFswDataList::AppUidForWgIdL +// -------------------------------------------------------------------------- +// +TBool CTsFswDataList::IsAlwaysShownAppL( TInt aWgId ) + { + return iAlwaysShownAppList->IsAlwaysShownApp( AppUidForWgIdL(aWgId) ); + } + +// -------------------------------------------------------------------------- +// CTsFswDataList::AppUidForWgId +// -------------------------------------------------------------------------- +// +TInt CTsFswDataList::AppUidForWgId( TInt aWgId, TUid& aUid ) + { + TRAPD(err, aUid = AppUidForWgIdL( aWgId ) ); + return err; + } + +// -------------------------------------------------------------------------- +// CTsFswDataList::AppUidForWgIdL +// -------------------------------------------------------------------------- +// +TUid CTsFswDataList::AppUidForWgIdL( TInt aWgId ) + { + CApaWindowGroupName* windowName = + CApaWindowGroupName::NewLC( iWsSession, aWgId ); + TUid appUid = windowName->AppUid(); + CleanupStack::PopAndDestroy( windowName ); + return appUid; + } + // end of file diff -r d05a55b217df -r 79311d856354 taskswitcher/contextengine/tsfswserver/engine/src/tsfswengine.cpp --- a/taskswitcher/contextengine/tsfswserver/engine/src/tsfswengine.cpp Wed Apr 14 15:47:59 2010 +0300 +++ b/taskswitcher/contextengine/tsfswserver/engine/src/tsfswengine.cpp Tue Apr 27 16:26:12 2010 +0300 @@ -172,7 +172,7 @@ // convert aWgId to an index in the list of running widgets and close widget CloseWidgetL( -aWgId -1 ); } - else if( !iDataList->AlwaysShownApps()->IsAlwaysShownApp( AppUidForWgIdL( aWgId ) ) ) + else if( !iDataList->IsAlwaysShownAppL( aWgId ) ) { // send window group event to kill the app TWsEvent event; @@ -243,12 +243,12 @@ // There can be many calls in a row, use a timer to prevent degrading // device performance. + iDataList->SetDirty(); if ( !iUpdateStarter->IsActive() ) { iUpdateStarter->Start( KContentRefreshDelay, 0, TCallBack( UpdateStarterCallback, this ) ); } - iDataList->SetDirty(); // screenshot taking support - call Register and Unregister when needed UpdatePreviewContent(); @@ -366,20 +366,6 @@ } // -------------------------------------------------------------------------- -// CTsFswEngine::AppUidForWgIdL -// -------------------------------------------------------------------------- -// -TUid CTsFswEngine::AppUidForWgIdL( TInt aWgId ) - { - CApaWindowGroupName* windowName = - CApaWindowGroupName::NewLC( iWsSession, aWgId ); - TUid appUid = windowName->AppUid(); - CleanupStack::PopAndDestroy( windowName ); - return appUid; - - } - -// -------------------------------------------------------------------------- // CTsFswEngine::CopyBitmapL // -------------------------------------------------------------------------- // @@ -496,7 +482,7 @@ TSLOG2_IN( "aWgId = %d aFbsHandle = %d", aWgId, aFbsHandle ); TUid appUid; - TRAPD( err, appUid = AppUidForWgIdL( aWgId ) ); + TInt err = iDataList->AppUidForWgId( aWgId, appUid ); if ( err || appUid == KTsCameraUid ) { // Dont't assign screenshot to camera app @@ -511,8 +497,8 @@ iPreviewProvider->AckPreview(aFbsHandle); if ( err == KErrNone ) { + iDataList->MoveEntryAtStart(appUid.iUid, EFalse); StoreScreenshot(aWgId, bmp); - iDataList->MoveEntryAtStart(appUid.iUid, EFalse); } TSLOG_OUT(); @@ -767,7 +753,10 @@ void CTsFswEngine::HandleWidgetUpdateL(TInt aWidgetId, TInt aBitmapHandle) { TSLOG_CONTEXT( HandleWidgetUpdateL, TSLOG_LOCAL ); - CFbsBitmap* bmp = 0; + + iDataList->MoveEntryAtStart(aWidgetId, ETrue); + + CFbsBitmap* bmp = 0; TBool contentChanged(EFalse); if( aBitmapHandle ) { @@ -782,7 +771,6 @@ iObserver.FswDataChanged(); } - iDataList->MoveEntryAtStart(aWidgetId, ETrue); TSLOG_OUT(); } diff -r d05a55b217df -r 79311d856354 taskswitcher/taskswitcherui/taskswitcherapp/inc/tsappview.h --- a/taskswitcher/taskswitcherui/taskswitcherapp/inc/tsappview.h Wed Apr 14 15:47:59 2010 +0300 +++ b/taskswitcher/taskswitcherui/taskswitcherapp/inc/tsappview.h Tue Apr 27 16:26:12 2010 +0300 @@ -180,7 +180,7 @@ /** * Updates the text in the applications and suggestions heading panes. */ - void UpdateHeadingsL(); + void UpdateHeadingsL( TInt aNewCount ); /** * Disables transition animations for taskswitcher app. diff -r d05a55b217df -r 79311d856354 taskswitcher/taskswitcherui/taskswitcherapp/inc/tsfastswaparea.h --- a/taskswitcher/taskswitcherui/taskswitcherapp/inc/tsfastswaparea.h Wed Apr 14 15:47:59 2010 +0300 +++ b/taskswitcher/taskswitcherui/taskswitcherapp/inc/tsfastswaparea.h Tue Apr 27 16:26:12 2010 +0300 @@ -386,7 +386,17 @@ * @return 1 if landscape, 0 if portait */ TInt GetCurrentScreenOrientation(); - + + /** + * Retrieves variety value, based on current screen resolution. + * + * @param aVariety result of the function, 0 value means portrait + * value of 1 indicates landscape + * @return ETrue if screen resolution differs from vale returned by + * layout meta data functions. + */ + TBool GetVariety( TInt& aVariety ); + private: // Data // parent control @@ -441,7 +451,10 @@ // Key event handling TBool iConsumeEvent; TBool iKeyEvent; + + // App closing handling RArray iIsClosing; + TInt iWidgetClosingCount; }; #endif // TSFASTSWAPAREA_H diff -r d05a55b217df -r 79311d856354 taskswitcher/taskswitcherui/taskswitcherapp/loc/taskswitcher.loc --- a/taskswitcher/taskswitcherui/taskswitcherapp/loc/taskswitcher.loc Wed Apr 14 15:47:59 2010 +0300 +++ b/taskswitcher/taskswitcherui/taskswitcherapp/loc/taskswitcher.loc Tue Apr 27 16:26:12 2010 +0300 @@ -41,7 +41,7 @@ //l:heading_pane_t1 //r:5.0 // -#define qtn_task_switcher_heading_applications "Open applications" +#define qtn_task_switcher_heading_applications "Open applications (%d)" //d:Text for no appliactions //l:none diff -r d05a55b217df -r 79311d856354 taskswitcher/taskswitcherui/taskswitcherapp/src/tsappui.cpp --- a/taskswitcher/taskswitcherui/taskswitcherapp/src/tsappui.cpp Wed Apr 14 15:47:59 2010 +0300 +++ b/taskswitcher/taskswitcherui/taskswitcherapp/src/tsappui.cpp Tue Apr 27 16:26:12 2010 +0300 @@ -274,7 +274,7 @@ if ( aWgId == iUnderAppWgId ) { // App under task switcher was launched - StartTransition( EActivationTransition, + StartTransition( EBackgroundTransition, EFalse, ETrue, CAknTransitionUtils::EForceInvisible ); @@ -290,7 +290,7 @@ EActivationAppShowTransition, ApplicationRect(), AknTransEffect::EParameterType, AknTransEffect::GfxTransParam( aNextAppUid , KTsAppUid ) ); - GfxTransEffect::Begin( iAppView, EActivationTransition ); + GfxTransEffect::Begin( iAppView, EBackgroundTransition ); GfxTransEffect::SetDemarcation( iAppView, iAppView->Rect() ); GfxTransEffect::NotifyExternalState( ECaptureComponentsBegin, ptr ); iAppView->MakeVisible( EFalse ); diff -r d05a55b217df -r 79311d856354 taskswitcher/taskswitcherui/taskswitcherapp/src/tsappview.cpp --- a/taskswitcher/taskswitcherui/taskswitcherapp/src/tsappview.cpp Wed Apr 14 15:47:59 2010 +0300 +++ b/taskswitcher/taskswitcherui/taskswitcherapp/src/tsappview.cpp Tue Apr 27 16:26:12 2010 +0300 @@ -249,7 +249,7 @@ CleanupStack::PopAndDestroy( &rects ); - UpdateHeadingsL(); + UpdateHeadingsL(0); } // ----------------------------------------------------------------------------- @@ -629,28 +629,22 @@ // CTsAppView::DataChanged // ----------------------------------------------------------------------------- // -void CTsAppView::DataChanged( CCoeControl* /*aWhere*/, TInt /*aNewCount*/ ) +void CTsAppView::DataChanged( CCoeControl* /*aWhere*/, TInt aNewCount ) { - TRAP_IGNORE( UpdateHeadingsL() ); + TRAP_IGNORE( UpdateHeadingsL( aNewCount ) ); } // ----------------------------------------------------------------------------- // CTsAppView::UpdateHeadingsL // ----------------------------------------------------------------------------- // -void CTsAppView::UpdateHeadingsL() +void CTsAppView::UpdateHeadingsL( TInt aNewCount ) { -#ifndef TASKSWITCHER_USE_CUSTOM_LAYOUT HBufC* text = StringLoader::LoadLC( - R_TASK_SWITCHER_HEADING_APPLICATIONS ); -#else - _LIT( KTitle, "Task switcher" ); - HBufC* text = KTitle().AllocLC(); -#endif + R_TASK_SWITCHER_HEADING_APPLICATIONS, aNewCount ); iAppsHeading->SetTextL( *text ); iAppsHeading->DrawDeferred(); CleanupStack::PopAndDestroy( text ); - } diff -r d05a55b217df -r 79311d856354 taskswitcher/taskswitcherui/taskswitcherapp/src/tsfastswaparea.cpp --- a/taskswitcher/taskswitcherui/taskswitcherapp/src/tsfastswaparea.cpp Wed Apr 14 15:47:59 2010 +0300 +++ b/taskswitcher/taskswitcherui/taskswitcherapp/src/tsfastswaparea.cpp Tue Apr 27 16:26:12 2010 +0300 @@ -103,7 +103,7 @@ CTsDeviceState& aDeviceState, CTsEventControler& aEventHandler) : iParent(aParent), iDeviceState(aDeviceState), iEvtHandler(aEventHandler), - iIgnoreLayoutSwitch(EFalse) + iIgnoreLayoutSwitch(EFalse), iWidgetClosingCount(0) { // no implementation required } @@ -237,8 +237,14 @@ TAknLayoutRect gridNextItem = rects[3]; CleanupStack::PopAndDestroy(&rects); - TInt variety = Layout_Meta_Data::IsLandscapeOrientation() ? 1 : 0; iGrid->SetRect(gridAppPane.Rect()); + + TInt variety; + TBool disable = GetVariety(variety); + if ( disable ) + { + TRAP_IGNORE(static_cast(iEikonEnv->AppUi())->RequestPopUpL()); + } TAknLayoutScalableParameterLimits gridParams = AknLayoutScalable_Apps::cell_tport_appsw_pane_ParamLimits( variety ); TPoint empty( ELayoutEmpty, ELayoutEmpty ); @@ -293,6 +299,11 @@ // Update state HandleDeviceStateChanged( EDeviceType ); + + if ( disable ) + { + TRAP_IGNORE(static_cast(iEikonEnv->AppUi())->DisablePopUpL()); + } } @@ -307,7 +318,12 @@ TAknLayoutRect gridImage; TAknLayoutRect gridNextItem; - TInt variety = Layout_Meta_Data::IsLandscapeOrientation() ? 1 : 0; + TInt variety; + TBool disable = GetVariety(variety); + if ( disable ) + { + TRAP_IGNORE(static_cast(iEikonEnv->AppUi())->RequestPopUpL()); + } gridAppPane.LayoutRect( Rect(), AknLayoutScalable_Apps::tport_appsw_pane( variety ) ); @@ -323,6 +339,11 @@ gridNextItem.LayoutRect( gridAppPane.Rect(), AknLayoutScalable_Apps::cell_tport_appsw_pane_cp03( variety ) ); aRects.Append(gridNextItem); + + if ( disable ) + { + TRAP_IGNORE(static_cast(iEikonEnv->AppUi())->DisablePopUpL()); + } } @@ -437,6 +458,10 @@ TInt wgId = iArray[aIndex]->WgId(); iFSClient->CloseApp( wgId ); iIsClosing.Append(wgId); + if ( iArray[aIndex]->Widget() ) + { + iWidgetClosingCount++; + } // The fsw content will change sooner or later // but the updated content (without the closed app) will not // come very fast. It looks better to the user if the item @@ -574,6 +599,20 @@ TSLOG4( TSLOG_INFO, "[%d]: %d %d %S", i, e->WgId(), e->AppUid(), &name ); } #endif + + // Update closing widget count if necessary + if ( iWidgetClosingCount ) + { + TInt widgetCount(0); + for ( TInt i = 0, ie = iArray.Count(); i != ie; ++i ) + { + if ( iArray[i]->Widget() ) + { + widgetCount++; + } + } + iWidgetClosingCount = widgetCount; + } // draw RenderContentL(); @@ -604,7 +643,6 @@ RArray strokeItemArray; CleanupClosePushL(strokeItemArray); - TInt variety = Layout_Meta_Data::IsLandscapeOrientation() ? 1 : 0; RArray rects; CleanupClosePushL(rects); rects.ReserveL(KLayoutItemCount); @@ -789,6 +827,7 @@ TSLOG_IN(); iIsClosing.Reset(); + iWidgetClosingCount = 0; CTsGridItemDrawer* itemDrawer = static_cast( iGrid->ItemDrawer() ); @@ -1712,6 +1751,22 @@ // ----------------------------------------------------------------------------- +// CTsFastSwapArea::GetVariety +// ----------------------------------------------------------------------------- +// +TBool CTsFastSwapArea::GetVariety( TInt& aVariety ) + { + aVariety = Layout_Meta_Data::IsLandscapeOrientation() ? 1 : 0; + TInt screenOrientation = GetCurrentScreenOrientation(); + if ( aVariety != screenOrientation ) + { + aVariety = screenOrientation; + return ETrue; + } + return EFalse; + } + +// ----------------------------------------------------------------------------- // CTsFastSwapArea::IsAppClosing // ----------------------------------------------------------------------------- // @@ -1726,6 +1781,23 @@ { iIsClosing.Remove(idx); } + else if ( iWidgetClosingCount ) + { + retVal = ETrue; + iWidgetClosingCount--; + } + } + else + { + // Check current item list + for ( TInt i = 0; i < iArray.Count(); i++ ) + { + TInt wgId = iArray[i]->WgId(); + if ( wgId == aWgId ) + { + retVal = ETrue; + } + } } return retVal; }