idlehomescreen/widgetmanager/src/wminstaller.cpp
branchRCL_3
changeset 30 b8fae6b8a148
parent 16 9674c1a575e9
child 34 d05a55b217df
--- a/idlehomescreen/widgetmanager/src/wminstaller.cpp	Mon Mar 15 12:39:47 2010 +0200
+++ b/idlehomescreen/widgetmanager/src/wminstaller.cpp	Wed Mar 31 21:17:19 2010 +0300
@@ -17,6 +17,7 @@
 */
 
 #include <e32base.h>
+#include <eikenv.h>
 
 #include "wminstaller.h"
 #include "wmwidgetdata.h"
@@ -26,6 +27,14 @@
 // CONSTANTS
 _LIT8( KWrtMime, "application/x-nokia-widget");
 
+/* 
+  Note: 
+  same mime type as above is used for wgz & wgt in wk9.
+  \ext\mw\cwrt\app\platform\s60\WidgetRecognizer\
+  Uninstalltion will fail with KErrNotFound for now.
+*/
+_LIT8( KCWrtMime, "application/widget");
+
 // ---------------------------------------------------------
 // CWmInstaller::NewL
 // ---------------------------------------------------------
@@ -68,7 +77,6 @@
 //
 void CWmInstaller::ConstructL()
     {
-    iMime = KWrtMime().AllocL();
     iIdle = CIdle::NewL( CActive::EPriorityStandard );
     }
 
@@ -110,14 +118,18 @@
 //
 void CWmInstaller::RunL()
     {
-    // error has occurred, stop uninstallation animation.
-    if ( iStatus != KErrNone )
-        { 
-        CWmWidgetData* widget = iWmPlugin.GetUninstalledWidgetByUid( iUid );
+    // if error has occurred, stop uninstallation animation.
+    if ( iStatus.Int() != KErrNone )
+        {
+        CWmWidgetData* widget = 
+                iWmPlugin.GetUninstalledWidgetByUid( iUid );
         if ( widget )
             {
             widget->StopUninstallAnimationL();
             }
+        
+        // display error note
+        CEikonEnv::Static()->HandleError( iStatus.Int() );
         }
     
     // close SWI session
@@ -172,9 +184,18 @@
         {
         User::Leave( KErrInUse );
         }
+    else if ( !aData || aData->PublisherUid() == KNullUid ||
+        aData->WrtType() == CWmWidgetData::EUnIdentified )
+        {
+        User::Leave( KErrArgument );
+        }
     else
         {
+        delete iMime;
+        iMime = NULL;
         User::LeaveIfError( iInstaller.Connect() );
+        iMime = ( ( aData->WrtType() == CWmWidgetData::EWgt ) ?
+            KCWrtMime().AllocL() : KWrtMime().AllocL() );
         iUid = aData->PublisherUid();
         SwiUI::TUninstallOptions optionsUninstall;
         optionsUninstall.iBreakDependency = SwiUI::EPolicyAllowed;