widgets/widgetinstaller/src/WidgetUIOperationsWatcher.cpp
changeset 11 c8a366e56285
parent 10 a359256acfc6
child 26 cb62a4f66ebe
equal deleted inserted replaced
10:a359256acfc6 11:c8a366e56285
    17 *                for midlet installation.
    17 *                for midlet installation.
    18 *
    18 *
    19 *
    19 *
    20 */
    20 */
    21 
    21 
       
    22 // INCLUDE FILES
    22 #include <f32file.h>
    23 #include <f32file.h>
    23 #include <SWInstDefs.h>
    24 #include <SWInstDefs.h>
    24 #include <zipfile.h>
    25 #include <zipfile.h>
    25 
    26 
    26 #include <SWInstTaskManager.h>
    27 #include <SWInstTaskManager.h>
   233         // widget file with no icon.  Why, I'm not sure but probably
   234         // widget file with no icon.  Why, I'm not sure but probably
   234         // had to do with this active object blocking display
   235         // had to do with this active object blocking display
   235         // processing.  So here is a good place to put up the displays
   236         // processing.  So here is a good place to put up the displays
   236         // (before RunL() is invoked) which lets other objects run.
   237         // (before RunL() is invoked) which lets other objects run.
   237 
   238 
   238         iUIHandler->DisplayFinalizeDialogL(); // a dialog without a cancel option
   239         if ( !iSilent )
   239         iUIHandler->DisplayProgressDialogL(); // progress bar
   240             {
       
   241             iUIHandler->DisplayFinalizeDialogL(); // a dialog without a cancel option
       
   242             iUIHandler->DisplayProgressDialogL(); // progress bar
       
   243             }
   240 
   244 
   241         if ( replaceExisting )
   245         if ( replaceExisting )
   242             {
   246             {
   243             BackupL(); // nothing need be undone if backup leaves
   247             BackupL(); // nothing need be undone if backup leaves
   244             // backup will gaurantee that install dir is empty
   248             // backup will gaurantee that install dir is empty
   263             }
   267             }
   264         }
   268         }
   265     else
   269     else
   266         {
   270         {
   267         userCancel = ETrue;
   271         userCancel = ETrue;
   268         iUIHandler->DisplayCancelL();
   272 
       
   273         if ( !iSilent ) { iUIHandler->DisplayCancelL(); }
       
   274 
   269         TRequestStatus* status = &aRequestStatus;
   275         TRequestStatus* status = &aRequestStatus;
   270         User::RequestComplete( status, KErrNone );
   276         User::RequestComplete( status, KErrNone );
   271         }
   277         }
   272     }
   278     }
   273 
   279 
   315 
   321 
   316     TBool userCancel = EFalse;
   322     TBool userCancel = EFalse;
   317     TRAPD( error, InstallSubfunctionL( aFile, userCancel, aRequestStatus ) );
   323     TRAPD( error, InstallSubfunctionL( aFile, userCancel, aRequestStatus ) );
   318     if ( KErrNone != error )
   324     if ( KErrNone != error )
   319         {
   325         {
   320         iUIHandler->DisplayErrorL( error );
   326         if ( !iSilent ) { iUIHandler->DisplayErrorL( error ); }
   321         User::Leave( error );
   327         User::Leave( error );
   322         }
   328         }
   323     else if ( userCancel )
   329     else if ( userCancel )
   324         {
   330         {
   325         return; // can't do return inside trap
   331         return; // can't do return inside trap
   445             {
   451             {
   446             //Runnning widget should be first closed
   452             //Runnning widget should be first closed
   447             RApaLsSession apaLsSession;
   453             RApaLsSession apaLsSession;
   448             apaLsSession.Connect();
   454             apaLsSession.Connect();
   449             TApaAppInfo info;
   455             TApaAppInfo info;
   450                         
   456 
   451             User::LeaveIfError( apaLsSession.GetAppInfo( info, aUid ) );
   457             User::LeaveIfError( apaLsSession.GetAppInfo( info, aUid ) );
   452             iWidgetName = info.iFullName;
   458             iWidgetName = info.iFullName;
   453             HBufC *widgetName = iWidgetName.AllocLC();
   459             HBufC *widgetName = iWidgetName.AllocLC();
   454             HandleWidgetCommandL(apaLsSession, *widgetName, aUid, Deactivate);
   460             HandleWidgetCommandL(apaLsSession, *widgetName, aUid, Deactivate);
   455                         
   461 
   456             CleanupStack::PopAndDestroy( widgetName );
   462             CleanupStack::PopAndDestroy( widgetName );
   457             apaLsSession.Close();
   463             apaLsSession.Close();
   458             }
   464             }
   459         // get original install dir from registry in case user
   465         // get original install dir from registry in case user
   460         // decides to "overrite" to another memory location
   466         // decides to "overrite" to another memory location
   628                     User::LeaveIfError( file.Write( *buffer ) );
   634                     User::LeaveIfError( file.Write( *buffer ) );
   629                     }
   635                     }
   630                 CleanupStack::PopAndDestroy( 3 ); // file, buffer, stream
   636                 CleanupStack::PopAndDestroy( 3 ); // file, buffer, stream
   631                 }
   637                 }
   632 
   638 
   633             // more progress!!!
   639             if ( !iSilent )
   634             if ( member->UncompressedSize() )
       
   635                 {
   640                 {
   636                 iUIHandler->UpdateProgressDialogL( member->UncompressedSize() );
   641                 // more progress!!!
       
   642                 if ( member->UncompressedSize() )
       
   643                     {
       
   644                     iUIHandler->UpdateProgressDialogL( member->UncompressedSize() );
       
   645                     }
   637                 }
   646                 }
   638 
   647 
   639             // if this is the icon file, then start icon processing
   648             // if this is the icon file, then start icon processing
   640             if ( EFalse == iIconSearchFinished )
   649             if ( EFalse == iIconSearchFinished )
   641                 {
   650                 {
   663             User::RequestComplete( stat, KErrNone );
   672             User::RequestComplete( stat, KErrNone );
   664             SetActive();
   673             SetActive();
   665             }
   674             }
   666         else // done with zip archive
   675         else // done with zip archive
   667             {
   676             {
   668             iUIHandler->CloseProgressDialogL();
   677             if ( !iSilent ) { iUIHandler->CloseProgressDialogL(); }
   669             // and reveal finalize dialog underneath
   678             // and reveal finalize dialog underneath
   670 
   679 
   671             // finished unzip
   680             // finished unzip
   672             iUnzipping = EFalse;
   681             iUnzipping = EFalse;
   673 
   682 
   683             // done
   692             // done
   684             }
   693             }
   685         }
   694         }
   686     else // user cancel (not DoCancel)
   695     else // user cancel (not DoCancel)
   687         {
   696         {
   688         iUIHandler->CloseProgressDialogL();
   697         if ( !iSilent )
   689         iUIHandler->CloseFinalizeDialogL();
   698             {
   690         iUIHandler->DisplayCancelL();
   699             iUIHandler->CloseProgressDialogL();
       
   700             iUIHandler->CloseFinalizeDialogL();
       
   701             iUIHandler->DisplayCancelL();
       
   702             }
   691 
   703 
   692         // stop icon conversion (if there is a converter)
   704         // stop icon conversion (if there is a converter)
   693         delete iIconConverter;
   705         delete iIconConverter;
   694         iIconConverter = NULL;
   706         iIconConverter = NULL;
   695         iProcessingIcon = EFalse;
   707         iProcessingIcon = EFalse;
   740         {
   752         {
   741         if ( iOverwriting )
   753         if ( iOverwriting )
   742             {
   754             {
   743             TUid uid = TUid::Uid( *(iPropertyValues[EUid]) );
   755             TUid uid = TUid::Uid( *(iPropertyValues[EUid]) );
   744             iRegistry.DeRegisterWidgetL( uid );
   756             iRegistry.DeRegisterWidgetL( uid );
       
   757             iAppManager->DeregisterWidgetL( uid );
   745             }
   758             }
   746 
   759 
   747         // TODO if registration steps fail does it leave inconsistent state???
   760         // TODO if registration steps fail does it leave inconsistent state???
   748 
   761 
   749         iRegistry.RegisterWidgetL( iPropertyValues );
   762         iRegistry.RegisterWidgetL( iPropertyValues );
   756 
   769 
   757         if ( iOverwriting )
   770         if ( iOverwriting )
   758             {
   771             {
   759             // delete backup
   772             // delete backup
   760             (void)iFileMgr->RmDir( iBackupDir );
   773             (void)iFileMgr->RmDir( iBackupDir );
   761             
       
   762             // if widget was in home screen, add it back to home screen
       
   763             if ( iWidgetInHS )
   774             if ( iWidgetInHS )
   764                 {
   775                 {
   765                 RApaLsSession apaLsSession;
   776                 RApaLsSession apaLsSession;
   766                 apaLsSession.Connect();
   777                 apaLsSession.Connect();
   767        
   778 
   768                 HBufC* widgetName = iWidgetName.AllocLC();
   779                 HBufC* widgetName = iWidgetName.AllocLC();
   769                 HandleWidgetCommandL(apaLsSession, *widgetName, TUid::Uid( *(iPropertyValues[EUid]) ), WidgetRestart);
   780                 HandleWidgetCommandL(apaLsSession, *widgetName, TUid::Uid( *(iPropertyValues[EUid]) ), WidgetRestart);
   770                 CleanupStack::PopAndDestroy( widgetName );
   781                 CleanupStack::PopAndDestroy( widgetName );
   771 
   782 
   772                 apaLsSession.Close();
   783                 apaLsSession.Close();
   773                 }
   784                 }
   774             }
   785             }
   775 
   786         if ( !iSilent )
   776         iUIHandler->CloseFinalizeDialogL();
   787             {
   777         iUIHandler->DisplayCompleteL();
   788             iUIHandler->CloseFinalizeDialogL();
       
   789             iUIHandler->DisplayCompleteL();
       
   790             }
   778 
   791 
   779         HandleLogsL(*(iPropertyValues[EBundleDisplayName]), TUid::Uid( *(iPropertyValues[EUid]) ), *(iPropertyValues[ENokiaWidget]), SwiUI::ELogTaskActionInstall);
   792         HandleLogsL(*(iPropertyValues[EBundleDisplayName]), TUid::Uid( *(iPropertyValues[EUid]) ), *(iPropertyValues[ENokiaWidget]), SwiUI::ELogTaskActionInstall);
   780         }
   793         }
   781     else // cancelled
   794     else // cancelled
   782         {
   795         {
   842 
   855 
   843     iCancelled = ETrue;
   856     iCancelled = ETrue;
   844 
   857 
   845     TRAP_IGNORE(
   858     TRAP_IGNORE(
   846         {
   859         {
   847         iUIHandler->CloseProgressDialogL();
   860         if ( !iSilent )
   848         iUIHandler->CloseFinalizeDialogL();
   861             {
   849         iUIHandler->DisplayCancelL();
   862             iUIHandler->CloseProgressDialogL();
       
   863             iUIHandler->CloseFinalizeDialogL();
       
   864             iUIHandler->DisplayCancelL();
       
   865             }
   850 
   866 
   851         // stop icon conversion (if there is a converter)
   867         // stop icon conversion (if there is a converter)
   852         delete iIconConverter;
   868         delete iIconConverter;
   853         iIconConverter = NULL;
   869         iIconConverter = NULL;
   854         iProcessingIcon = EFalse;
   870         iProcessingIcon = EFalse;
   875     iCancelled = ETrue;
   891     iCancelled = ETrue;
   876     iUnzipping = EFalse;
   892     iUnzipping = EFalse;
   877 
   893 
   878     TRAP_IGNORE(
   894     TRAP_IGNORE(
   879         {
   895         {
   880         iUIHandler->CloseProgressDialogL();
   896         if ( !iSilent )
   881         iUIHandler->CloseFinalizeDialogL();
   897             {
   882         iUIHandler->DisplayErrorL( aError );
   898             iUIHandler->CloseProgressDialogL();
       
   899             iUIHandler->CloseFinalizeDialogL();
       
   900             iUIHandler->DisplayErrorL( aError );
       
   901             }
   883 
   902 
   884         // stop icon conversion (if there is a converter)
   903         // stop icon conversion (if there is a converter)
   885         delete iIconConverter;
   904         delete iIconConverter;
   886         iIconConverter = NULL;
   905         iIconConverter = NULL;
   887         iProcessingIcon = EFalse;
   906         iProcessingIcon = EFalse;
   931     iUIHandler =
   950     iUIHandler =
   932         CWidgetUIHandler::NewL( CWidgetUIHandler::EModeUninstall, this );
   951         CWidgetUIHandler::NewL( CWidgetUIHandler::EModeUninstall, this );
   933 
   952 
   934     // save client status to use in finish uninstall
   953     // save client status to use in finish uninstall
   935     iRequestStatus = &aRequestStatus;
   954     iRequestStatus = &aRequestStatus;
   936     
   955 
   937     TBuf<KWidgetRegistryVal> bundleName;
   956     TBuf<KWidgetRegistryVal> bundleName;
   938     iRegistry.GetWidgetBundleName( aUid, bundleName );
   957     iRegistry.GetWidgetBundleName( aUid, bundleName );
   939 
   958 
   940     if( bundleName.Length() <= 0 )
   959     if( bundleName.Length() <= 0 )
   941         {
   960         {
   942         FinishUninstallL( KErrCorrupt );
   961         FinishUninstallL( KErrCorrupt );
   943         return;
   962         return;
   944         }
   963         }
   945             
   964 
   946     TBool widgetinHomeScreen(EFalse);
   965     TBool widgetinHomeScreen(EFalse);
   947     widgetinHomeScreen = iRegistry.IsWidgetInMiniView( aUid ); 
   966     widgetinHomeScreen = iRegistry.IsWidgetInMiniView( aUid );
       
   967 
       
   968     TBool uninstall( ETrue );
       
   969     if ( !iSilent )
       
   970         {
       
   971         uninstall = iUIHandler->DisplayUninstallL( bundleName,widgetinHomeScreen );
       
   972         }
   948     // prompt user to uninstall
   973     // prompt user to uninstall
   949     if( iUIHandler->DisplayUninstallL( bundleName,widgetinHomeScreen ) )
   974     if( uninstall )
   950         {
   975         {
   951         if(iRegistry.IsWidgetRunning( aUid ))
   976         if(iRegistry.IsWidgetRunning( aUid ))
   952         //Runnning widget should be first closed    
   977         //Runnning widget should be first closed
   953             {
   978             {
   954             RApaLsSession apaLsSession;
   979             RApaLsSession apaLsSession;
   955             apaLsSession.Connect();
   980             apaLsSession.Connect();
   956             TApaAppInfo info;
   981             TApaAppInfo info;
   957             
   982 
   958             User::LeaveIfError( apaLsSession.GetAppInfo( info, aUid ) );
   983             User::LeaveIfError( apaLsSession.GetAppInfo( info, aUid ) );
   959             HBufC* widgetName = info.iFullName.AllocLC();        
   984             HBufC* widgetName = info.iFullName.AllocLC();
   960             HandleWidgetCommandL(apaLsSession,*widgetName,aUid,Deactivate);
   985             HandleWidgetCommandL(apaLsSession,*widgetName,aUid,Deactivate);
   961             
   986 
   962             CleanupStack::PopAndDestroy( widgetName );
   987             CleanupStack::PopAndDestroy( widgetName );
   963             apaLsSession.Close();            
   988             apaLsSession.Close();
   964             }
   989             }
   965         iUIHandler->DisplayUninstallInProgressL();
   990         if ( !iSilent ) { iUIHandler->DisplayUninstallInProgressL(); }
   966         TBuf<KWidgetRegistryVal> widgetPath;
   991         TBuf<KWidgetRegistryVal> widgetPath;
   967         iRegistry.GetWidgetPath( aUid, widgetPath );
   992         iRegistry.GetWidgetPath( aUid, widgetPath );
   968         TBool aVendor = *(iRegistry.GetWidgetPropertyValueL(aUid, ENokiaWidget));
   993         TBool aVendor = *(iRegistry.GetWidgetPropertyValueL(aUid, ENokiaWidget));
   969         
   994 
   970 
   995 
   971         // TODO if any of next steps leave does state become inconsistent?
   996         // TODO if any of next steps leave does state become inconsistent?
   972 
   997 
   973         // remove the dir for the widget
   998         // remove the dir for the widget
   974         // TODO why this validation?
   999         // TODO why this validation?
   975         if ( widgetPath.Length() > 0 )
  1000         if ( widgetPath.Length() > 0 )
   976             {
  1001             {
   977             iFileMgr->RmDir( widgetPath );
  1002             iFileMgr->RmDir( widgetPath );
   978             //Widget should delete any cookie it created
  1003             //Widget should delete any cookie it created
   979             HBufC* fileName = HBufC::NewLC(KMaxFileName);            
  1004             HBufC* fileName = HBufC::NewLC(KMaxFileName);
   980             TPtr ptr(fileName->Des());
  1005             TPtr ptr(fileName->Des());
   981             TBuf<8> buf1; 
  1006             TBuf<8> buf1;
   982             ptr = KCookieFile;
  1007             ptr = KCookieFile;
   983             TInt pos = ptr.LocateReverse('.');            
  1008             TInt pos = ptr.LocateReverse('.');
   984             buf1.AppendNum(aUid.iUid,EHex);
  1009             buf1.AppendNum(aUid.iUid,EHex);
   985             ptr.Insert(pos,_L("_"));
  1010             ptr.Insert(pos,_L("_"));
   986             ptr.Insert(pos+1,buf1);
  1011             ptr.Insert(pos+1,buf1);
   987             iRfs.Delete(ptr);
  1012             iRfs.Delete(ptr);
   988             CleanupStack::PopAndDestroy(fileName);
  1013             CleanupStack::PopAndDestroy(fileName);
   997            HandleLogsL(bundleName, aUid, aVendor, SwiUI::ELogTaskActionUninstall);
  1022            HandleLogsL(bundleName, aUid, aVendor, SwiUI::ELogTaskActionUninstall);
   998            }
  1023            }
   999         }
  1024         }
  1000     else
  1025     else
  1001         {
  1026         {
  1002         iUIHandler->DisplayCancelL();
  1027         if ( !iSilent ) { iUIHandler->DisplayCancelL(); }
  1003 
  1028 
  1004         // must return cancel because upper-levels will take uninstall
  1029         // must return cancel because upper-levels will take uninstall
  1005         // actions (remove widget from applications list) if we return KErrNone
  1030         // actions (remove widget from applications list) if we return KErrNone
  1006         User::RequestComplete( iRequestStatus, KErrCancel );
  1031         User::RequestComplete( iRequestStatus, KErrCancel );
  1007         return;
  1032         return;
  1014 // @since 3.1
  1039 // @since 3.1
  1015 // ============================================================================
  1040 // ============================================================================
  1016 //
  1041 //
  1017 void CWidgetUIOperationsWatcher::FinishUninstallL( TInt aErr )
  1042 void CWidgetUIOperationsWatcher::FinishUninstallL( TInt aErr )
  1018     {
  1043     {
  1019     iUIHandler->CloseUninstallInProgressDialogL();
  1044     if ( !iSilent ) { iUIHandler->CloseUninstallInProgressDialogL(); }
  1020     if ( aErr )
  1045     if ( aErr )
  1021         {
  1046         {
  1022         iUIHandler->DisplayErrorL( aErr );
  1047         if ( !iSilent ) { iUIHandler->DisplayErrorL( aErr ); }
  1023         User::Leave( aErr );
  1048         User::Leave( aErr );
  1024         }
  1049         }
  1025     iUIHandler->DisplayCompleteL();
  1050     if ( !iSilent ) { iUIHandler->DisplayCompleteL(); }
  1026     User::RequestComplete( iRequestStatus, KErrNone );
  1051     User::RequestComplete( iRequestStatus, KErrNone );
  1027     iRequestStatus = NULL;
  1052     iRequestStatus = NULL;
  1028     }
  1053     }
  1029 
  1054 
  1030 // ============================================================================
  1055 // ============================================================================
  1162 // @since 3.1
  1187 // @since 3.1
  1163 // ============================================================================
  1188 // ============================================================================
  1164 //
  1189 //
  1165 TBool CWidgetUIOperationsWatcher::PromptUserForInstallL( TBool aOverwrite )
  1190 TBool CWidgetUIOperationsWatcher::PromptUserForInstallL( TBool aOverwrite )
  1166     {
  1191     {
  1167     TBool userAnswer;
  1192     TBool userAnswer( ETrue );
  1168 
  1193 
  1169     if ( aOverwrite )
  1194     if ( !iSilent )
  1170         {
  1195         {
  1171         userAnswer =
  1196         if ( aOverwrite )
  1172             iUIHandler->DisplayOverwriteL( *(iPropertyValues[EBundleDisplayName]) );
  1197             {
       
  1198             userAnswer =
       
  1199                 iUIHandler->DisplayOverwriteL( *(iPropertyValues[EBundleDisplayName]) );
       
  1200             }
       
  1201         else
       
  1202             {
       
  1203             userAnswer =
       
  1204                 iUIHandler->DisplayInstallL( *(iPropertyValues[EBundleDisplayName]) );
       
  1205             }
       
  1206         if ( userAnswer )
       
  1207             {
       
  1208             userAnswer = SelectMemoryL();
       
  1209             }
  1173         }
  1210         }
  1174     else
  1211     else
  1175         {
  1212             {
  1176         userAnswer =
  1213             TDriveUnit selectedDrive(_L("C"));        // in real should be read from install options which are ignore too at the moment.
  1177             iUIHandler->DisplayInstallL( *(iPropertyValues[EBundleDisplayName]) );
  1214             UpdateWidgetBasePathL( selectedDrive );
  1178         }
  1215             *(iPropertyValues[EDriveName]) = selectedDrive.Name();
  1179     if ( userAnswer )
  1216             }
  1180         {
  1217 
  1181         userAnswer = SelectMemoryL();
       
  1182         }
       
  1183     return userAnswer;
  1218     return userAnswer;
  1184     }
  1219     }
  1185 
  1220 
  1186 // ============================================================================
  1221 // ============================================================================
  1187 // CWidgetUIOperationsWatcher::PromptUserForUntrustedWidgetL()
  1222 // CWidgetUIOperationsWatcher::PromptUserForUntrustedWidgetL()
  1281     TLogTaskParam params;
  1316     TLogTaskParam params;
  1282     params.iName.Copy(aWidgetName);
  1317     params.iName.Copy(aWidgetName);
  1283     params.iUid = aUid;
  1318     params.iUid = aUid;
  1284     params.iAction = aAction;
  1319     params.iAction = aAction;
  1285     params.iVendor.Copy((aVender ? _L("Nokia") : _L("Non-Nokia")));
  1320     params.iVendor.Copy((aVender ? _L("Nokia") : _L("Non-Nokia")));
  1286     
  1321 
  1287     TTime time;
  1322     TTime time;
  1288     time.UniversalTime();
  1323     time.UniversalTime();
  1289     params.iTime = time;
  1324     params.iTime = time;
  1290 
  1325 
  1291     TLogTaskParamPckg pckg( params );
  1326     TLogTaskParamPckg pckg( params );
  1292     task->SetParameterL( pckg, 0 );
  1327     task->SetParameterL( pckg, 0 );
  1293     iTaskManager->AddTaskL( task );
  1328     iTaskManager->AddTaskL( task );
  1294     iTaskManager->CommitL();
  1329     iTaskManager->CommitL();
  1295     
  1330 
  1296     CleanupStack::Pop(task);
  1331     CleanupStack::Pop(task);
  1297     }
  1332     }
  1298 
  1333 
  1299 // ============================================================================
  1334 // ============================================================================
  1300 //
  1335 //
  1302 //
  1337 //
  1303 // ============================================================================
  1338 // ============================================================================
  1304 void CWidgetUIOperationsWatcher::HandleWidgetCommandL( RApaLsSession& aSession,const TDesC& aWidget,const TUid& aUid,TUint32 aOperation )
  1339 void CWidgetUIOperationsWatcher::HandleWidgetCommandL( RApaLsSession& aSession,const TDesC& aWidget,const TUid& aUid,TUint32 aOperation )
  1305     {
  1340     {
  1306     const TInt size( 2* aWidget.Length() + 3*sizeof( TUint32 ) );
  1341     const TInt size( 2* aWidget.Length() + 3*sizeof( TUint32 ) );
  1307     
  1342 
  1308     // Message format is <filenameLength><unicode_filename><someintegervalue>
  1343     // Message format is <filenameLength><unicode_filename><someintegervalue>
  1309     CApaCommandLine* cmd( CApaCommandLine::NewLC() );
  1344     CApaCommandLine* cmd( CApaCommandLine::NewLC() );
  1310     HBufC8* opaque( HBufC8::NewLC( size ) );
  1345     HBufC8* opaque( HBufC8::NewLC( size ) );
  1311     
  1346 
  1312     RDesWriteStream stream;
  1347     RDesWriteStream stream;
  1313     TPtr8 des( opaque->Des() );
  1348     TPtr8 des( opaque->Des() );
  1314     
  1349 
  1315     stream.Open( des );
  1350     stream.Open( des );
  1316     CleanupClosePushL( stream );
  1351     CleanupClosePushL( stream );
  1317     
  1352 
  1318     // Generate the command.
  1353     // Generate the command.
  1319     stream.WriteUint32L( aUid.iUid );
  1354     stream.WriteUint32L( aUid.iUid );
  1320     stream.WriteUint32L( aWidget.Length() );
  1355     stream.WriteUint32L( aWidget.Length() );
  1321     stream.WriteL( reinterpret_cast< const TUint8* >( aWidget.Ptr() ),
  1356     stream.WriteL( reinterpret_cast< const TUint8* >( aWidget.Ptr() ),
  1322                    aWidget.Size() );
  1357                    aWidget.Size() );
  1323     
  1358 
  1324     stream.WriteInt32L( aOperation );
  1359     stream.WriteInt32L( aOperation );
  1325     
  1360 
  1326     CleanupStack::PopAndDestroy( &stream );
  1361     CleanupStack::PopAndDestroy( &stream );
  1327     
  1362 
  1328     // Generate command.
  1363     // Generate command.
  1329     cmd->SetCommandL( EApaCommandBackgroundAndWithoutViews );
  1364     cmd->SetCommandL( EApaCommandBackgroundAndWithoutViews );
  1330     cmd->SetOpaqueDataL( *opaque );    
  1365     cmd->SetOpaqueDataL( *opaque );
  1331 
  1366 
  1332     CleanupStack::PopAndDestroy( opaque );
  1367     CleanupStack::PopAndDestroy( opaque );
  1333     
  1368 
  1334     cmd->SetExecutableNameL( KLauncherApp );
  1369     cmd->SetExecutableNameL( KLauncherApp );
  1335     
  1370 
  1336     User::LeaveIfError( aSession.StartApp( *cmd ) );
  1371     User::LeaveIfError( aSession.StartApp( *cmd ) );
  1337     CleanupStack::PopAndDestroy( cmd );    
  1372     CleanupStack::PopAndDestroy( cmd );
  1338     }
  1373     }
  1339 //  End of File
  1374 //  End of File