idlehomescreen/widgetmanager/inc/wmwidgetdata.h
changeset 2 08c6ee43b396
parent 1 5315654608de
child 5 c743ef5928ba
equal deleted inserted replaced
1:5315654608de 2:08c6ee43b396
    24 #include <e32std.h>
    24 #include <e32std.h>
    25 #include <e32base.h>
    25 #include <e32base.h>
    26 #include <f32file.h>
    26 #include <f32file.h>
    27 #include <bamdesca.h>
    27 #include <bamdesca.h>
    28 #include <hscontentinfo.h>
    28 #include <hscontentinfo.h>
       
    29 #include <SWInstApi.h> //installer
    29 
    30 
    30 #include "wmimageconverter.h"
    31 #include "wmimageconverter.h"
    31 
    32 
    32 // FORWARD DECLARATIONS
    33 // FORWARD DECLARATIONS
    33 class CDictionaryFileStore;
    34 class CDictionaryFileStore;
    34 class MWmWidgetDataObserver;
    35 class MWmWidgetDataObserver;
    35 class CFbsBitmap;
    36 class CFbsBitmap;
    36 class CHsContentInfo;
    37 class CHsContentInfo;
    37 class CWmPersistentWidgetOrder;
    38 class CWmPersistentWidgetOrder;
    38 class RWidgetRegistryClientSession;
    39 class RWidgetRegistryClientSession;
       
    40 class CWmResourceLoader;
    39 
    41 
    40 // CLASS DECLARATION
    42 // CLASS DECLARATION
    41 /**
    43 /**
    42  * CWmWidgetData is a representation of a widget in CWmListBox. it
    44  * CWmWidgetData is a representation of a widget in CWmListBox. it
    43  * stores all data required for drawing the item in a list box, and
    45  * stores all data required for drawing the item in a list box, and
    44  * handling the list item.
    46  * handling the list item.
    45  */
    47  */
    46 NONSHARABLE_CLASS( CWmWidgetData )
    48 NONSHARABLE_CLASS( CWmWidgetData )
    47     : public CBase
    49     : public CActive
    48     , public MConverterObserver
    50     , public MConverterObserver
    49     {
    51     {
    50 
    52 
    51 public: // types
    53 public: // types
    52 
    54 
    59             };
    61             };
    60 
    62 
    61 public: // construction
    63 public: // construction
    62     /**
    64     /**
    63      * static constructor
    65      * static constructor
       
    66      * @param aLogoSize size of logo image.
    64      * @param aHsContentInfo (takes ownership)
    67      * @param aHsContentInfo (takes ownership)
    65      * @param aRegistryClientSession (does not take ownership)
    68      * @param aRegistryClientSession (does not take ownership)
    66      */
    69      */
    67     static CWmWidgetData* NewL( 
    70     static CWmWidgetData* NewL(
       
    71             const TSize& aLogoSize,
       
    72             CWmResourceLoader& aWmResourceLoader,
    68             CHsContentInfo* aHsContentInfo,
    73             CHsContentInfo* aHsContentInfo,
    69             RWidgetRegistryClientSession* aRegistryClientSession );
    74             RWidgetRegistryClientSession* aRegistryClientSession );
    70 
    75 
    71     /**
    76     /**
    72      * static constructor, leaves object in cleanup stack
    77      * static constructor, leaves object in cleanup stack
       
    78      * @param aLogoSize size of logo image.
    73      * @param aHsContentInfo (takes ownership)
    79      * @param aHsContentInfo (takes ownership)
    74      * @param aRegistryClientSession (does not take ownership)
    80      * @param aRegistryClientSession (does not take ownership)
    75      */
    81      */
    76     static CWmWidgetData* NewLC( 
    82     static CWmWidgetData* NewLC(
       
    83             const TSize& aLogoSize,
       
    84             CWmResourceLoader& aWmResourceLoader,
    77             CHsContentInfo* aHsContentInfo,
    85             CHsContentInfo* aHsContentInfo,
    78             RWidgetRegistryClientSession* aRegistryClientSession );
    86             RWidgetRegistryClientSession* aRegistryClientSession );
    79         
    87         
    80     /** Destructor. */
    88     /** Destructor. */
    81     ~CWmWidgetData();
    89     ~CWmWidgetData();
    82 
    90 
       
    91 protected: // implementation of CActive
       
    92     /**
       
    93      * Implements cancellation of an outstanding request.
       
    94      * 
       
    95      * @see CActive::DoCancel
       
    96      */
       
    97     void DoCancel();
       
    98     
       
    99     /**
       
   100      * Handles an active object's request completion event.
       
   101      * 
       
   102      * @see CActive::RunL
       
   103      */
       
   104     void RunL();
       
   105     
       
   106     /**
       
   107      * RunError
       
   108      * 
       
   109      * @see CActive::RunError
       
   110      */
       
   111     TInt RunError(TInt aError);
       
   112 
    83 private: // private construction
   113 private: // private construction
    84     /** Constructor for performing 1st stage construction */
   114     /** Constructor for performing 1st stage construction */
    85     CWmWidgetData();
   115     CWmWidgetData( const TSize& aLogoSize, 
       
   116             CWmResourceLoader& aWmResourceLoader );
    86 
   117 
    87     /** 2nd phase constructor */
   118     /** 2nd phase constructor */
    88     void ConstructL(
   119     void ConstructL(
    89             CHsContentInfo* aHsContentInfo,
   120             CHsContentInfo* aHsContentInfo,
    90             RWidgetRegistryClientSession* aRegistryClientSession );
   121             RWidgetRegistryClientSession* aRegistryClientSession );
    97             CHsContentInfo* aHsContentInfo,
   128             CHsContentInfo* aHsContentInfo,
    98             RWidgetRegistryClientSession* aRegistryClientSession );
   129             RWidgetRegistryClientSession* aRegistryClientSession );
    99 
   130 
   100 public: // external handles
   131 public: // external handles
   101 
   132 
       
   133     /**
       
   134      * Init uninstallation of widget.
       
   135      */
       
   136     void UnInstallL();
       
   137 
       
   138     /** current uninstall animation bitmap */
       
   139     const CFbsBitmap* AnimationBitmap( const TSize& aSize );
       
   140 
       
   141     /** current uninstall animation mask */
       
   142     const CFbsBitmap* AnimationMask( const TSize& aSize );
       
   143     
       
   144     /**
       
   145      * @return ETrue if widget is being uninstalled.
       
   146      */
       
   147     TBool IsUninstalling();
       
   148     
       
   149     /**
       
   150      * @return ETrue if logo is being created,false otherwise.
       
   151      */
       
   152     TBool IsPrepairingLogo();
       
   153     
   102     /** 
   154     /** 
   103      * sets an observer for callbacks 
   155      * sets an observer for callbacks 
   104      *
   156      *
   105      * @param aObserver notifications when changes occur in widget data
   157      * @param aObserver notifications when changes occur in widget data
   106      */
   158      */
   111      */
   163      */
   112     void SetPersistentWidgetOrder(
   164     void SetPersistentWidgetOrder(
   113             const CWmPersistentWidgetOrder* aPersistentWidgetOrder );
   165             const CWmPersistentWidgetOrder* aPersistentWidgetOrder );
   114     
   166     
   115     /**
   167     /**
   116      * set logo rect size
       
   117      */
       
   118     void SetLogoSize( const TSize& aSize );
       
   119 
       
   120     /**
       
   121      * Init logo re-creation
   168      * Init logo re-creation
   122      */
   169      */
   123     void ReCreateLogo( const TSize& aSize );
   170     void ReCreateLogo( const TSize& aSize );
       
   171     
       
   172     /**
       
   173      * returns widget description
       
   174      */
       
   175     const TDesC& Description() const;
   124     
   176     
   125     /**
   177     /**
   126      * Replaces the content of this widget data. The method is called
   178      * Replaces the content of this widget data. The method is called
   127      * during widget update. If widget values change, a change event is
   179      * during widget update. If widget values change, a change event is
   128      * fired for the observer.
   180      * fired for the observer.
   158     inline const CHsContentInfo& HsContentInfo() const;
   210     inline const CHsContentInfo& HsContentInfo() const;
   159 
   211 
   160     /** widget name */
   212     /** widget name */
   161     inline const TDesC& Name() const;
   213     inline const TDesC& Name() const;
   162 
   214 
   163     /** widget description */
       
   164     inline const TDesC& Description() const;
       
   165 
       
   166     /** widget uid */
   215     /** widget uid */
   167     inline TUid Uid() const;
   216     inline TUid Uid() const;
   168     
   217     
   169     /** cps widget publisher id */
   218     /** cps widget publisher id */
   170     inline const TDesC& PublisherId() const;
   219     inline const TDesC& PublisherId() const;
   194 
   243 
   195     /** image conversin completed */
   244     /** image conversin completed */
   196     void NotifyCompletion( TInt aError );
   245     void NotifyCompletion( TInt aError );
   197 
   246 
   198 private: // new functions
   247 private: // new functions
   199 
   248     
       
   249     /** uninstall animation related*/
       
   250     void VisualizeUninstall();
       
   251     void PrepairAnimL();
       
   252     void DestroyAnimData();
       
   253     static TInt Tick( TAny* aPtr );
       
   254     static TInt CloseSwiSession( TAny* aPtr );
       
   255     
   200     /** fetches publisher uid from widget registry*/
   256     /** fetches publisher uid from widget registry*/
   201     void FetchPublisherUidL( 
   257     void FetchPublisherUidL( 
   202             RWidgetRegistryClientSession* aRegistryClientSession );
   258             RWidgetRegistryClientSession* aRegistryClientSession );
   203 
   259 
   204     /** Converts uid to TUid from TDesC8 */
   260     /** Converts uid to TUid from TDesC8 */
   205     TUid UidFromString( const TDesC8& aUidString ) const;
   261     TUid UidFromString( const TDesC8& aUidString ) const;
   206     
   262     
   207     /** Logo icon string handling */
   263     /** Logo icon string handling */
   208     static TInt HandleAsyncIconString( TAny* aPtr );
   264     void HandleIconString( const TDesC& aIconStr );
   209     void HandleIconStringL( const TDesC& aIconStr );
       
   210     void FireDataChanged();
   265     void FireDataChanged();
   211 
   266 
   212 private: // data members
   267 private: // data members
       
   268     
       
   269     /* reference to resource loader */
       
   270     CWmResourceLoader& iWmResourceLoader;
   213     
   271     
   214     /* instance of the CIdle class for async iconStr handling*/
   272     /* instance of the CIdle class for async iconStr handling*/
   215     CIdle*              iIdle;
   273     CIdle*              iIdle;
   216 
   274 
   217     /* the image converter utility */
   275     /* the image converter utility */
   218     CWmImageConverter*    iImageConverter;
   276     CWmImageConverter*    iImageConverter;
   219 
   277 
   220     /* observes this widget representation (NOT OWNED) */
   278     /* observes this widget representation (NOT OWNED) */
   221     MWmWidgetDataObserver* iObserver;
   279     MWmWidgetDataObserver* iObserver;
   222 
   280 
   223     /* rotating animation index */
       
   224     TInt                iInstallAnimationIndex;
       
   225 
       
   226     /** the widget logo bitmap */
   281     /** the widget logo bitmap */
   227     CFbsBitmap*         iLogoImage;
   282     CFbsBitmap*         iLogoImage;
   228 
   283 
   229     /** the widget logo mask */
   284     /** the widget logo mask */
   230     CFbsBitmap*         iLogoImageMask;
   285     CFbsBitmap*         iLogoImageMask;
   231     
   286 
   232     /** The CHsContentInfo that corresponds to this list row */
   287     /** The CHsContentInfo that corresponds to this list row */
   233     CHsContentInfo*     iHsContentInfo;
   288     CHsContentInfo*     iHsContentInfo;
   234 
   289 
   235     /** type oif the widget */
   290     /** type oif the widget */
   236     TWidgetType         iWidgetType;
   291     TWidgetType         iWidgetType;
   244     /** size of logo rect in list item */
   299     /** size of logo rect in list item */
   245     TSize               iLogoSize;
   300     TSize               iLogoSize;
   246     
   301     
   247     /** validity of the widget - used during list refresh */
   302     /** validity of the widget - used during list refresh */
   248     TBool               iValid;
   303     TBool               iValid;
   249     
   304 
       
   305     /* Array of uninstall animation bitmaps*/
       
   306     RArray<CFbsBitmap*> iUninstallAnimIcons;
       
   307     
       
   308     /** periodic timer for updating animation */
       
   309     CPeriodic*          iPeriodic;
       
   310     
       
   311     /* uninstall animation index */
       
   312     TInt                iAnimationIndex;
       
   313 
       
   314     /** uninstallation switch */
       
   315     TBool               iAsyncUninstalling;
       
   316     
       
   317     /** logo changed switch */
       
   318     TBool               iFireLogoChanged;
       
   319 
       
   320     /**
       
   321      * silent install launcher.
       
   322      */
       
   323     SwiUI::RSWInstSilentLauncher iInstaller;
       
   324 
       
   325     /**
       
   326      * ActiveSchedulerWait used to wait while logo image
       
   327      * is being prepaired.
       
   328      */
       
   329     CActiveSchedulerWait* iWait;
   250     };
   330     };
   251 
   331 
   252 
   332 
   253 /**
   333 /**
   254  * Pointer array of widget data objects.
   334  * Pointer array of widget data objects.