idlehomescreen/widgetmanager/src/wmwidgetdata.cpp
changeset 2 08c6ee43b396
parent 1 5315654608de
child 5 c743ef5928ba
equal deleted inserted replaced
1:5315654608de 2:08c6ee43b396
    21 #include <fbs.h>
    21 #include <fbs.h>
    22 #include <bautils.h>
    22 #include <bautils.h>
    23 #include <s32file.h>
    23 #include <s32file.h>
    24 #include <hscontentinfo.h>
    24 #include <hscontentinfo.h>
    25 #include <widgetregistryclient.h> // widgetreqistry
    25 #include <widgetregistryclient.h> // widgetreqistry
    26 #include <StringLoader.h>
       
    27 #include <eikenv.h>
    26 #include <eikenv.h>
       
    27 #include <avkon.mbg>
       
    28 #include <avkon.rsg>
       
    29 #include <AknsDrawUtils.h>
       
    30 #include <AknBitmapAnimation.h>
       
    31 #include <barsread.h>
    28 
    32 
    29 #include "wmwidgetdata.h"
    33 #include "wmwidgetdata.h"
    30 #include "wmwidgetdataobserver.h"
    34 #include "wmwidgetdataobserver.h"
    31 #include "wmpersistentwidgetorder.h"
    35 #include "wmpersistentwidgetorder.h"
       
    36 #include "wmresourceloader.h"
    32 #include "wmcommon.h"
    37 #include "wmcommon.h"
    33 #include <widgetmanagerview.rsg>
    38 
       
    39 // CONSTANTS
       
    40 _LIT8( KWrtMime, "application/x-nokia-widget");
    34 
    41 
    35 // ---------------------------------------------------------
    42 // ---------------------------------------------------------
    36 // CWmWidgetData::NewL
    43 // CWmWidgetData::NewL
    37 // ---------------------------------------------------------
    44 // ---------------------------------------------------------
    38 //
    45 //
    39 CWmWidgetData* CWmWidgetData::NewL( 
    46 CWmWidgetData* CWmWidgetData::NewL(
       
    47         const TSize& aLogoSize,
       
    48         CWmResourceLoader& aWmResourceLoader,
    40         CHsContentInfo* aHsContentInfo,
    49         CHsContentInfo* aHsContentInfo,
    41         RWidgetRegistryClientSession* aRegistryClientSession )
    50         RWidgetRegistryClientSession* aRegistryClientSession )
    42     {
    51     {
    43     CWmWidgetData* self = CWmWidgetData::NewLC( 
    52     CWmWidgetData* self = CWmWidgetData::NewLC( 
       
    53             aLogoSize, aWmResourceLoader,
    44             aHsContentInfo, aRegistryClientSession );
    54             aHsContentInfo, aRegistryClientSession );
    45     CleanupStack::Pop(); // self;
    55     CleanupStack::Pop(); // self;
    46     return self;
    56     return self;
    47     }
    57     }
    48 
    58 
    49 // ---------------------------------------------------------
    59 // ---------------------------------------------------------
    50 // CWmWidgetData::NewLC
    60 // CWmWidgetData::NewLC
    51 // ---------------------------------------------------------
    61 // ---------------------------------------------------------
    52 //
    62 //
    53 CWmWidgetData* CWmWidgetData::NewLC( 
    63 CWmWidgetData* CWmWidgetData::NewLC(
       
    64         const TSize& aLogoSize,
       
    65         CWmResourceLoader& aWmResourceLoader,
    54         CHsContentInfo* aHsContentInfo,
    66         CHsContentInfo* aHsContentInfo,
    55         RWidgetRegistryClientSession* aRegistryClientSession )
    67         RWidgetRegistryClientSession* aRegistryClientSession )
    56     {
    68     {
    57     CWmWidgetData* self = new ( ELeave ) CWmWidgetData();
    69     CWmWidgetData* self = new ( ELeave ) CWmWidgetData( 
       
    70             aLogoSize, aWmResourceLoader );
    58     CleanupStack::PushL(self);
    71     CleanupStack::PushL(self);
    59     self->ConstructL( aHsContentInfo, aRegistryClientSession );
    72     self->ConstructL( aHsContentInfo, aRegistryClientSession );
    60     return self;
    73     return self;
    61     }
    74     }
    62 
    75 
    63 // ---------------------------------------------------------
    76 // ---------------------------------------------------------
    64 // CWmWidgetData::CWmWidgetData
    77 // CWmWidgetData::CWmWidgetData
    65 // ---------------------------------------------------------
    78 // ---------------------------------------------------------
    66 //
    79 //
    67 CWmWidgetData::CWmWidgetData()
    80 CWmWidgetData::CWmWidgetData( const TSize& aLogoSize, 
       
    81         CWmResourceLoader& aWmResourceLoader )
       
    82     : CActive( EPriorityStandard ),
       
    83     iWmResourceLoader( aWmResourceLoader )
    68     {
    84     {
    69     iIdle = NULL;
    85     iIdle = NULL;
    70     iLogoImage = NULL;    
    86     iLogoImage = NULL;    
    71     iLogoImageMask = NULL;
    87     iLogoImageMask = NULL;
    72     iHsContentInfo = NULL;
    88     iHsContentInfo = NULL;
    73     iWidgetType = CWmWidgetData::EUnknown;
    89     iWidgetType = CWmWidgetData::EUnknown;
    74     iInstallAnimationIndex = KErrNotFound;
       
    75     iPublisherUid = KNullUid;
    90     iPublisherUid = KNullUid;
    76     iLogoSize = TSize( 0, 0 );
    91     iLogoSize = aLogoSize;
       
    92     iPeriodic = NULL;
       
    93     iAnimationIndex = 0;
       
    94     iAsyncUninstalling = EFalse;
       
    95     iFireLogoChanged = EFalse;
       
    96     CActiveScheduler::Add( this );
    77     }
    97     }
    78 
    98 
    79 // ---------------------------------------------------------
    99 // ---------------------------------------------------------
    80 // CWmWidgetData::ConstructL
   100 // CWmWidgetData::ConstructL
    81 // ---------------------------------------------------------
   101 // ---------------------------------------------------------
    86     {
   106     {
    87     InitL( aHsContentInfo, aRegistryClientSession );
   107     InitL( aHsContentInfo, aRegistryClientSession );
    88 
   108 
    89     // start decoding the icon
   109     // start decoding the icon
    90     iImageConverter = CWmImageConverter::NewL( this );
   110     iImageConverter = CWmImageConverter::NewL( this );
    91     iIdle = CIdle::NewL( CActive::EPriorityLow );
   111     iIdle = CIdle::NewL( CActive::EPriorityStandard );
    92     iIdle->Start( TCallBack( HandleAsyncIconString, this ) );
   112     iWait = new (ELeave) CActiveSchedulerWait();
       
   113     iPeriodic = CPeriodic::NewL( CActive::EPriorityStandard );
       
   114 
       
   115     // start logo handling
       
   116     iImageConverter->SetLogoSize( iLogoSize );
       
   117     HandleIconString( HsContentInfo().IconPath() );
    93     }
   118     }
    94 
   119 
    95 // ---------------------------------------------------------
   120 // ---------------------------------------------------------
    96 // CWmWidgetData::InitL
   121 // CWmWidgetData::InitL
    97 // ---------------------------------------------------------
   122 // ---------------------------------------------------------
   122 // CWmWidgetData::~CWmWidgetData
   147 // CWmWidgetData::~CWmWidgetData
   123 // ---------------------------------------------------------
   148 // ---------------------------------------------------------
   124 //
   149 //
   125 CWmWidgetData::~CWmWidgetData()
   150 CWmWidgetData::~CWmWidgetData()
   126     {
   151     {
       
   152     Cancel();
   127     if ( iIdle && iIdle->IsActive() )
   153     if ( iIdle && iIdle->IsActive() )
   128         {
   154         {
   129         iIdle->Cancel();
   155         iIdle->Cancel();
   130         }
   156         }
   131     delete iIdle;
   157     delete iIdle;
       
   158     if ( iWait && iWait->IsStarted() )
       
   159         {
       
   160         iWait->AsyncStop();
       
   161         }
       
   162     delete iWait;
   132     SetObserver( NULL );
   163     SetObserver( NULL );
       
   164     DestroyAnimData();
       
   165     delete iPeriodic;
   133     delete iLogoImage;
   166     delete iLogoImage;
   134     delete iLogoImageMask;
   167     delete iLogoImageMask;
   135     delete iImageConverter;
   168     delete iImageConverter;
   136     delete iHsContentInfo;
   169     delete iHsContentInfo;
   137     }
   170     }
   217         }
   250         }
   218     else
   251     else
   219         {
   252         {
   220         iLogoImage = iImageConverter->Bitmap();
   253         iLogoImage = iImageConverter->Bitmap();
   221         iLogoImageMask = iImageConverter->Mask();
   254         iLogoImageMask = iImageConverter->Mask();
   222         FireDataChanged();
   255 
   223         }
   256         if ( iWait && iWait->IsStarted() )
   224     }
   257             {
   225 
   258             iWait->AsyncStop();
   226 // ---------------------------------------------------------
   259             }
   227 // CWmWidgetData::HandleIconStringL
   260         if ( iFireLogoChanged ) 
   228 // ---------------------------------------------------------
   261             {
   229 //
   262             iFireLogoChanged = EFalse;
   230 void CWmWidgetData::HandleIconStringL( const TDesC& aIconStr )
   263             FireDataChanged(); 
       
   264             }
       
   265         }
       
   266     }
       
   267 
       
   268 // ---------------------------------------------------------
       
   269 // CWmWidgetData::HandleIconString
       
   270 // ---------------------------------------------------------
       
   271 //
       
   272 void CWmWidgetData::HandleIconString( const TDesC& aIconStr )
   231     {
   273     {
   232     HBufC* iconStr = NULL;
   274     HBufC* iconStr = NULL;
   233     if ( aIconStr.Length() == 0 && 
   275     if ( aIconStr.Length() == 0 && 
   234         iPublisherUid != KNullUid )
   276         iPublisherUid != KNullUid )
   235         {
   277         {
   236         // workaround for wrt widgets icon
   278         // workaround for wrt widgets icon
   237         _LIT( KUidTag, "uid(0x%x)" );
   279         _LIT( KUidTag, "uid(0x%x)" );
   238         const TInt KLength = 32;
   280         const TInt KLength = 32;
   239         iconStr = HBufC::NewLC( KLength );
   281         TBuf<KLength> uidBuf;
   240         iconStr->Des().Format( KUidTag, iPublisherUid.iUid );
   282         uidBuf.Format( KUidTag, iPublisherUid.iUid );
       
   283         iconStr = uidBuf.Alloc();
   241         }
   284         }
   242     else
   285     else
   243         {
   286         {
   244         iconStr = aIconStr.AllocLC();
   287         iconStr = aIconStr.Alloc();
   245         }
   288         }
   246 
   289 
   247     TSize size( iLogoSize );
   290     TSize size( iLogoSize );
   248     if ( iLogoImage ) { size = iLogoImage->SizeInPixels(); }
   291     if ( iLogoImage ) { size = iLogoImage->SizeInPixels(); }
   249     if ( size != iLogoSize &&
   292     if ( size != iLogoSize &&
   250         iLogoSize.iWidth > 0 && iLogoSize.iHeight > 0 )
   293         iLogoSize.iWidth > 0 && iLogoSize.iHeight > 0 )
   251         {
   294         {
   252         size = iLogoSize;
   295         size = iLogoSize;
   253         }
   296         }
   254     iImageConverter->HandleIconStringL( 
   297     TInt err = iImageConverter->HandleIconString( 
   255             size.iWidth, size.iHeight, *iconStr );
   298             size.iWidth, size.iHeight, *iconStr );
   256     
   299     
   257     CleanupStack::PopAndDestroy( iconStr );    
   300     delete iconStr;
       
   301     iconStr = NULL;
       
   302     
       
   303     // handle result
       
   304     if ( KErrNone == err && IsPrepairingLogo() )
       
   305         {
       
   306         iWait->Start();
       
   307         }
       
   308     else if ( KErrNone != err && iFireLogoChanged )
       
   309         {
       
   310         FireDataChanged(); // draw default icon
       
   311         }
   258     }
   312     }
   259 
   313 
   260 // ---------------------------------------------------------
   314 // ---------------------------------------------------------
   261 // CWmWidgetData::FireDataChanged
   315 // CWmWidgetData::FireDataChanged
   262 // ---------------------------------------------------------
   316 // ---------------------------------------------------------
   312         {
   366         {
   313         TInt widgetUid = aRegistryClientSession->GetWidgetUidL( PublisherId() );
   367         TInt widgetUid = aRegistryClientSession->GetWidgetUidL( PublisherId() );
   314         if ( widgetUid != 0 )
   368         if ( widgetUid != 0 )
   315             {
   369             {
   316             // WRT widget
   370             // WRT widget
   317             iPublisherUid = TUid::Uid( widgetUid );
   371             iPublisherUid = TUid::Uid( widgetUid );            
   318             
       
   319             HBufC* desc = StringLoader::LoadLC( R_QTN_WM_WIDGET_DETAILS_WRT, 
       
   320                     CEikonEnv::Static() );
       
   321             iHsContentInfo->SetDescriptionL( *desc );
       
   322             CleanupStack::PopAndDestroy( desc );
       
   323             }
   372             }
   324         else
   373         else
   325             {
   374             {
   326             iPublisherUid = KNullUid;
   375             iPublisherUid = KNullUid;
   327             }
   376             }
   328         }
   377         }
   329     }
   378     }
   330 // ----------------------------------------------------
   379 
   331 // CWmWidgetData::SetLogoSize
   380 // ---------------------------------------------------------
   332 // ----------------------------------------------------
   381 // CWmWidgetData::Description
   333 //
   382 // ---------------------------------------------------------
   334 void CWmWidgetData::SetLogoSize( const TSize& aSize )
   383 //
   335     {
   384 const TDesC& CWmWidgetData::Description() const
   336     iLogoSize = aSize;
   385     {
   337     if ( iImageConverter )
   386     if ( iHsContentInfo->Description().Length() <= 0 &&
   338         {
   387         &iWmResourceLoader )
   339         iImageConverter->SetLogoSize( aSize );
   388         {
   340         }
   389         return ( ( iPublisherUid != KNullUid ) ? 
   341     }
   390             iWmResourceLoader.WrtDescription() : 
   342 
   391             iWmResourceLoader.NoDescription() );
   343 // ---------------------------------------------------------
   392         }
   344 // CWmWidgetData::HandleAsyncIconString
   393     return iHsContentInfo->Description(); 
   345 // ---------------------------------------------------------
       
   346 //
       
   347 TInt CWmWidgetData::HandleAsyncIconString( TAny* aPtr )
       
   348     {
       
   349     CWmWidgetData* self = static_cast< CWmWidgetData* >( aPtr );    
       
   350     if ( self->iIdle->IsActive() )
       
   351       { 
       
   352       self->iIdle->Cancel(); 
       
   353       }
       
   354     TRAP_IGNORE( self->HandleIconStringL( 
       
   355             self->HsContentInfo().IconPath() ); );
       
   356     return KErrNone;
       
   357     }
   394     }
   358 
   395 
   359 // ---------------------------------------------------------
   396 // ---------------------------------------------------------
   360 // CWmWidgetData::ReCreateLogo
   397 // CWmWidgetData::ReCreateLogo
   361 // ---------------------------------------------------------
   398 // ---------------------------------------------------------
   362 //
   399 //
   363 void CWmWidgetData::ReCreateLogo( const TSize& aSize )
   400 void CWmWidgetData::ReCreateLogo( const TSize& aSize )
   364     {
   401     {    
   365     iLogoSize = aSize;
       
   366     
       
   367     delete iLogoImage;
   402     delete iLogoImage;
   368     iLogoImage = NULL;
   403     iLogoImage = NULL;
   369     delete iLogoImageMask;
   404     delete iLogoImageMask;
   370     iLogoImageMask = NULL;
   405     iLogoImageMask = NULL;
   371 
   406     
   372     if ( iIdle && !iIdle->IsActive() )
   407     if ( iWait && iWait->IsStarted() )
   373         {
   408         {
   374         // start decoding the icon
   409         iWait->AsyncStop();
   375         iIdle->Start( TCallBack( HandleAsyncIconString, this ) );
   410         }
   376         }
   411     
       
   412     iFireLogoChanged = ETrue;
       
   413     iLogoSize = aSize;
       
   414     HandleIconString( HsContentInfo().IconPath() );
   377     }
   415     }
   378 
   416 
   379 // ---------------------------------------------------------
   417 // ---------------------------------------------------------
   380 // CWmWidgetData::ReplaceContentInfoL
   418 // CWmWidgetData::ReplaceContentInfoL
   381 // ---------------------------------------------------------
   419 // ---------------------------------------------------------
   410         ReCreateLogo( iLogoSize );
   448         ReCreateLogo( iLogoSize );
   411         }
   449         }
   412 
   450 
   413     return !( sameAppearance && sameLogo );
   451     return !( sameAppearance && sameLogo );
   414     }
   452     }
       
   453 
       
   454 // ---------------------------------------------------------
       
   455 // CWmWidgetData::IsPrepairingLogo
       
   456 // ---------------------------------------------------------
       
   457 //
       
   458 TBool CWmWidgetData::IsPrepairingLogo()
       
   459     {
       
   460     TBool prepairing( EFalse );            
       
   461     if ( !iLogoImage )
       
   462         {
       
   463         prepairing = iImageConverter->IsProcessing();
       
   464         }
       
   465     return prepairing;
       
   466     }
       
   467 
       
   468 // ---------------------------------------------------------
       
   469 // CWmWidgetData::UnInstallL
       
   470 // ---------------------------------------------------------
       
   471 //
       
   472 void CWmWidgetData::UnInstallL()
       
   473     {
       
   474     if ( IsUninstalling() || IsActive() )
       
   475         {
       
   476         User::Leave( KErrInUse );
       
   477         }
       
   478 
       
   479     DestroyAnimData();
       
   480     
       
   481     TInt err = iInstaller.Connect();
       
   482     if ( KErrNone == err )
       
   483         {
       
   484         CleanupClosePushL( iInstaller );
       
   485         PrepairAnimL();
       
   486         CleanupStack::Pop( &iInstaller );
       
   487         SwiUI::TUninstallOptions optionsUninstall;
       
   488         optionsUninstall.iBreakDependency = SwiUI::EPolicyAllowed;
       
   489         optionsUninstall.iKillApp = SwiUI::EPolicyAllowed;
       
   490         SwiUI::TUninstallOptionsPckg uninstallOptionsPkg( optionsUninstall );
       
   491         iInstaller.SilentUninstall( iStatus, iPublisherUid, 
       
   492                                 uninstallOptionsPkg, KWrtMime );
       
   493         VisualizeUninstall();
       
   494         SetActive();
       
   495         }
       
   496     else
       
   497         {
       
   498         // do normal uninstall
       
   499         iAsyncUninstalling = EFalse;
       
   500         SwiUI::RSWInstLauncher installer;
       
   501         User::LeaveIfError( installer.Connect() );
       
   502         CleanupClosePushL( installer );
       
   503         User::LeaveIfError( installer.Uninstall( iPublisherUid, KWrtMime ) );
       
   504         CleanupStack::PopAndDestroy( &installer );
       
   505         }
       
   506     }
       
   507 
       
   508 // ---------------------------------------------------------
       
   509 // CWmWidgetData::VisualizeUninstall
       
   510 // ---------------------------------------------------------
       
   511 //
       
   512 void CWmWidgetData::VisualizeUninstall()
       
   513     {
       
   514     iAsyncUninstalling = ETrue;
       
   515     iAnimationIndex = 0;
       
   516     const TInt tickInterval = 400000;
       
   517     iPeriodic->Start(
       
   518             tickInterval,tickInterval,TCallBack(Tick, this));
       
   519     }
       
   520 
       
   521 // ---------------------------------------------------------
       
   522 // CWmWidgetData::PrepairAnimL
       
   523 // ---------------------------------------------------------
       
   524 //
       
   525 void CWmWidgetData::PrepairAnimL()
       
   526     {
       
   527     TInt resourceId = R_QGN_GRAF_WAIT_BAR_ANIM;
       
   528     CAknBitmapAnimation* aknAnimation = CAknBitmapAnimation::NewL();
       
   529     CleanupStack::PushL( aknAnimation );
       
   530     aknAnimation->SetScaleModeForAnimationFrames(EAspectRatioNotPreserved);
       
   531     TAknsItemID iid;
       
   532     iid.Set(EAknsMajorAvkon, resourceId );
       
   533     if ( !aknAnimation ->ConstructFromSkinL( iid ) )
       
   534         {
       
   535         TResourceReader readerForAnimation;
       
   536         CCoeEnv::Static()->CreateResourceReaderLC( readerForAnimation,resourceId );
       
   537         aknAnimation->ConstructFromResourceL( readerForAnimation );
       
   538         CleanupStack::PopAndDestroy();
       
   539         }
       
   540     TInt endFrame = aknAnimation ->BitmapAnimData()->FrameArray().Count()-1;
       
   541     for ( TInt i=0; i<=endFrame; i++ )
       
   542         {
       
   543         aknAnimation ->BitmapAnimData()->FrameArray().At(i)->SetBitmapsOwnedExternally( ETrue );
       
   544         CFbsBitmap* bitmap  = aknAnimation ->BitmapAnimData()->FrameArray().At(i)->Bitmap();
       
   545         CFbsBitmap* bitmapMask = aknAnimation ->BitmapAnimData()->FrameArray().At(i)->Mask();
       
   546         if ( bitmap && bitmapMask )
       
   547             {
       
   548             iUninstallAnimIcons.AppendL( bitmap );
       
   549             iUninstallAnimIcons.AppendL( bitmapMask );
       
   550             }
       
   551         }
       
   552     CleanupStack::PopAndDestroy( aknAnimation );
       
   553     }
       
   554 
       
   555 // ---------------------------------------------------------
       
   556 // CWmWidgetData::DestroyAnimData
       
   557 // ---------------------------------------------------------
       
   558 //
       
   559 void CWmWidgetData::DestroyAnimData()
       
   560     {
       
   561     if ( iPeriodic && iPeriodic->IsActive() )
       
   562         {
       
   563         iPeriodic->Cancel();
       
   564         }
       
   565         
       
   566     for( TInt i=0; i < iUninstallAnimIcons.Count(); i++ )
       
   567         {
       
   568         CFbsBitmap* bitmap = iUninstallAnimIcons[i];
       
   569         delete bitmap; bitmap = NULL;
       
   570         }
       
   571     iUninstallAnimIcons.Close();    
       
   572     }
       
   573 
       
   574 // ---------------------------------------------------------
       
   575 // CWmWidgetData::Tick
       
   576 // ---------------------------------------------------------
       
   577 //
       
   578 TInt CWmWidgetData::Tick( TAny* aPtr )
       
   579     {
       
   580     CWmWidgetData* self = static_cast< CWmWidgetData* >( aPtr );
       
   581     self->iAnimationIndex += 2;
       
   582     if ( self->iAnimationIndex >= self->iUninstallAnimIcons.Count() -1 )
       
   583         {
       
   584         self->iAnimationIndex = 0; // restart from beginging
       
   585         }
       
   586     self->FireDataChanged();
       
   587     return 1;
       
   588     }
       
   589 
       
   590 // ---------------------------------------------------------
       
   591 // CWmWidgetData::CloseSwiSession
       
   592 // ---------------------------------------------------------
       
   593 //
       
   594 TInt CWmWidgetData::CloseSwiSession( TAny* aPtr )
       
   595     {
       
   596     CWmWidgetData* self = static_cast< CWmWidgetData* >( aPtr );
       
   597     if ( self->iIdle->IsActive() )
       
   598       {
       
   599       self->iIdle->Cancel(); 
       
   600       }
       
   601 
       
   602     self->iInstaller.Close();
       
   603     return KErrNone;
       
   604     }
       
   605 
       
   606 // ---------------------------------------------------------
       
   607 // CWmWidgetData::AnimationBitmap
       
   608 // ---------------------------------------------------------
       
   609 //
       
   610 const CFbsBitmap* CWmWidgetData::AnimationBitmap( const TSize& aSize )
       
   611     {
       
   612     CFbsBitmap* bitmap = NULL;
       
   613     if ( iUninstallAnimIcons.Count() )
       
   614         {
       
   615         TInt index = iAnimationIndex;
       
   616         if ( index >= iUninstallAnimIcons.Count() - 1 )
       
   617             {
       
   618             index = 0;
       
   619             }
       
   620         bitmap = iUninstallAnimIcons[index];
       
   621         if ( bitmap->SizeInPixels() != aSize )
       
   622             {
       
   623             AknIconUtils::SetSize( bitmap, aSize, 
       
   624                     EAspectRatioNotPreserved );
       
   625             }               
       
   626         }
       
   627     return bitmap;
       
   628     }
       
   629 
       
   630 // ---------------------------------------------------------
       
   631 // CWmWidgetData::AnimationMask
       
   632 // ---------------------------------------------------------
       
   633 //
       
   634 const CFbsBitmap* CWmWidgetData::AnimationMask( const TSize& aSize )
       
   635     {
       
   636     CFbsBitmap* mask = NULL;
       
   637     if ( iUninstallAnimIcons.Count() )
       
   638         {
       
   639         TInt index = iAnimationIndex+1;
       
   640         if ( index >= iUninstallAnimIcons.Count() )
       
   641             {
       
   642             index = 1;
       
   643             }
       
   644         mask = iUninstallAnimIcons[index];
       
   645         if ( mask && mask->SizeInPixels() != aSize )
       
   646             {
       
   647             AknIconUtils::SetSize( mask, aSize,
       
   648                     EAspectRatioNotPreserved );
       
   649             }
       
   650         }    
       
   651     return mask;
       
   652     }
       
   653 
       
   654 // ---------------------------------------------------------
       
   655 // CWmWidgetData::IsUninstalling
       
   656 // ---------------------------------------------------------
       
   657 //
       
   658 TBool CWmWidgetData::IsUninstalling()
       
   659     {
       
   660     return iAsyncUninstalling;
       
   661     }
       
   662 
       
   663 // ---------------------------------------------------------
       
   664 // CWmWidgetData::DoCancel
       
   665 // ---------------------------------------------------------
       
   666 //
       
   667 void CWmWidgetData::DoCancel()
       
   668     {
       
   669     if ( IsActive() && iAsyncUninstalling )
       
   670         {
       
   671         iInstaller.CancelAsyncRequest( 
       
   672                 SwiUI::ERequestSilentUninstall );
       
   673 
       
   674 		// close session
       
   675 		iInstaller.Close();
       
   676         }
       
   677     iAsyncUninstalling = EFalse;
       
   678     iAnimationIndex = 0;
       
   679     }
       
   680 
       
   681 // ---------------------------------------------------------
       
   682 // CWmWidgetData::RunL
       
   683 // ---------------------------------------------------------
       
   684 //
       
   685 void CWmWidgetData::RunL()
       
   686     {
       
   687     iAsyncUninstalling = EFalse;
       
   688     iAnimationIndex = 0;
       
   689 
       
   690     DestroyAnimData();
       
   691     FireDataChanged();
       
   692 
       
   693     // close SWI session
       
   694     if ( iIdle && iIdle->IsActive() )
       
   695         {
       
   696         iIdle->Cancel();
       
   697         }
       
   698     iIdle->Start( TCallBack( CloseSwiSession, this ) );
       
   699     }
       
   700 
       
   701 // ---------------------------------------------------------
       
   702 // CWmWidgetData::RunError
       
   703 // ---------------------------------------------------------
       
   704 //
       
   705 TInt CWmWidgetData::RunError(TInt /*aError*/)
       
   706     {
       
   707     iAsyncUninstalling = EFalse;
       
   708     iAnimationIndex = 0;
       
   709     DestroyAnimData();
       
   710     FireDataChanged();
       
   711     
       
   712     // close SWI session
       
   713     if ( iIdle && iIdle->IsActive() )
       
   714         {
       
   715         iIdle->Cancel();
       
   716         }
       
   717     iIdle->Start( TCallBack( CloseSwiSession, this ) );
       
   718 
       
   719     return KErrNone;
       
   720     }
       
   721 
   415 // End of file
   722 // End of file
   416 
   723