idlehomescreen/widgetmanager/src/wminstaller.cpp
branchRCL_3
changeset 17 b8fae6b8a148
parent 12 9674c1a575e9
child 18 d05a55b217df
equal deleted inserted replaced
12:9674c1a575e9 17:b8fae6b8a148
    15 * widget manager plugin implementation
    15 * widget manager plugin implementation
    16 *
    16 *
    17 */
    17 */
    18 
    18 
    19 #include <e32base.h>
    19 #include <e32base.h>
       
    20 #include <eikenv.h>
    20 
    21 
    21 #include "wminstaller.h"
    22 #include "wminstaller.h"
    22 #include "wmwidgetdata.h"
    23 #include "wmwidgetdata.h"
    23 #include "wmplugin.h"
    24 #include "wmplugin.h"
    24 
    25 
    25 
    26 
    26 // CONSTANTS
    27 // CONSTANTS
    27 _LIT8( KWrtMime, "application/x-nokia-widget");
    28 _LIT8( KWrtMime, "application/x-nokia-widget");
       
    29 
       
    30 /* 
       
    31   Note: 
       
    32   same mime type as above is used for wgz & wgt in wk9.
       
    33   \ext\mw\cwrt\app\platform\s60\WidgetRecognizer\
       
    34   Uninstalltion will fail with KErrNotFound for now.
       
    35 */
       
    36 _LIT8( KCWrtMime, "application/widget");
    28 
    37 
    29 // ---------------------------------------------------------
    38 // ---------------------------------------------------------
    30 // CWmInstaller::NewL
    39 // CWmInstaller::NewL
    31 // ---------------------------------------------------------
    40 // ---------------------------------------------------------
    32 //
    41 //
    66 // CWmInstaller::ConstructL
    75 // CWmInstaller::ConstructL
    67 // ---------------------------------------------------------
    76 // ---------------------------------------------------------
    68 //
    77 //
    69 void CWmInstaller::ConstructL()
    78 void CWmInstaller::ConstructL()
    70     {
    79     {
    71     iMime = KWrtMime().AllocL();
       
    72     iIdle = CIdle::NewL( CActive::EPriorityStandard );
    80     iIdle = CIdle::NewL( CActive::EPriorityStandard );
    73     }
    81     }
    74 
    82 
    75 // ---------------------------------------------------------
    83 // ---------------------------------------------------------
    76 // CWmInstaller::~CWmInstaller
    84 // CWmInstaller::~CWmInstaller
   108 // CWmInstaller::RunL
   116 // CWmInstaller::RunL
   109 // ---------------------------------------------------------
   117 // ---------------------------------------------------------
   110 //
   118 //
   111 void CWmInstaller::RunL()
   119 void CWmInstaller::RunL()
   112     {
   120     {
   113     // error has occurred, stop uninstallation animation.
   121     // if error has occurred, stop uninstallation animation.
   114     if ( iStatus != KErrNone )
   122     if ( iStatus.Int() != KErrNone )
   115         { 
   123         {
   116         CWmWidgetData* widget = iWmPlugin.GetUninstalledWidgetByUid( iUid );
   124         CWmWidgetData* widget = 
       
   125                 iWmPlugin.GetUninstalledWidgetByUid( iUid );
   117         if ( widget )
   126         if ( widget )
   118             {
   127             {
   119             widget->StopUninstallAnimationL();
   128             widget->StopUninstallAnimationL();
   120             }
   129             }
       
   130         
       
   131         // display error note
       
   132         CEikonEnv::Static()->HandleError( iStatus.Int() );
   121         }
   133         }
   122     
   134     
   123     // close SWI session
   135     // close SWI session
   124     if ( iIdle && iIdle->IsActive() )
   136     if ( iIdle && iIdle->IsActive() )
   125         {
   137         {
   170     {
   182     {
   171     if ( IsActive() )
   183     if ( IsActive() )
   172         {
   184         {
   173         User::Leave( KErrInUse );
   185         User::Leave( KErrInUse );
   174         }
   186         }
       
   187     else if ( !aData || aData->PublisherUid() == KNullUid ||
       
   188         aData->WrtType() == CWmWidgetData::EUnIdentified )
       
   189         {
       
   190         User::Leave( KErrArgument );
       
   191         }
   175     else
   192     else
   176         {
   193         {
       
   194         delete iMime;
       
   195         iMime = NULL;
   177         User::LeaveIfError( iInstaller.Connect() );
   196         User::LeaveIfError( iInstaller.Connect() );
       
   197         iMime = ( ( aData->WrtType() == CWmWidgetData::EWgt ) ?
       
   198             KCWrtMime().AllocL() : KWrtMime().AllocL() );
   178         iUid = aData->PublisherUid();
   199         iUid = aData->PublisherUid();
   179         SwiUI::TUninstallOptions optionsUninstall;
   200         SwiUI::TUninstallOptions optionsUninstall;
   180         optionsUninstall.iBreakDependency = SwiUI::EPolicyAllowed;
   201         optionsUninstall.iBreakDependency = SwiUI::EPolicyAllowed;
   181         optionsUninstall.iKillApp = SwiUI::EPolicyAllowed;
   202         optionsUninstall.iKillApp = SwiUI::EPolicyAllowed;
   182         SwiUI::TUninstallOptionsPckg uninstallOptionsPkg( optionsUninstall );
   203         SwiUI::TUninstallOptionsPckg uninstallOptionsPkg( optionsUninstall );