appinstaller/AppinstUi/sisxsifplugin/src/sisxsifpluginuihandlerbase.cpp
changeset 58 67f2119dc623
parent 55 ac7f90a6ff4c
child 69 b18a4bf55ddb
equal deleted inserted replaced
57:0dae4436159f 58:67f2119dc623
   125         }
   125         }
   126     iGlobalComponentId = aRootNode.GlobalComponentId().AllocL();
   126     iGlobalComponentId = aRootNode.GlobalComponentId().AllocL();
   127 
   127 
   128     CSifOperationStartData* data = CSifOperationStartData::NewLC( *iGlobalComponentId,
   128     CSifOperationStartData* data = CSifOperationStartData::NewLC( *iGlobalComponentId,
   129             aRootNode.ComponentName(), appNames, appIcons, aRootNode.MaxInstalledSize(),
   129             aRootNode.ComponentName(), appNames, appIcons, aRootNode.MaxInstalledSize(),
   130             KNullDesC, KNullDesC, aRootNode.SoftwareTypeName() );
   130             KNullDesC, KNullDesC, aRootNode.SoftwareTypeName(), iOperationPhase );
   131 
   131 
   132     if( !iPublishSifOperationInfo )
   132     if( !iPublishSifOperationInfo )
   133         {
   133         {
   134         iPublishSifOperationInfo = CPublishSifOperationInfo::NewL();
   134         iPublishSifOperationInfo = CPublishSifOperationInfo::NewL();
   135         }
   135         }
   156         }
   156         }
   157     iGlobalComponentId = aEntry.GlobalId().AllocL();
   157     iGlobalComponentId = aEntry.GlobalId().AllocL();
   158 
   158 
   159     CSifOperationStartData* data = CSifOperationStartData::NewLC( *iGlobalComponentId,
   159     CSifOperationStartData* data = CSifOperationStartData::NewLC( *iGlobalComponentId,
   160             aEntry.Name(), appNames, appIcons, aEntry.ComponentSize(),
   160             aEntry.Name(), appNames, appIcons, aEntry.ComponentSize(),
   161             KNullDesC, KNullDesC, aEntry.SoftwareType() );
   161             KNullDesC, KNullDesC, aEntry.SoftwareType(), iOperationPhase );
   162 
   162 
   163     if( !iPublishSifOperationInfo )
   163     if( !iPublishSifOperationInfo )
   164         {
   164         {
   165         iPublishSifOperationInfo = CPublishSifOperationInfo::NewL();
   165         iPublishSifOperationInfo = CPublishSifOperationInfo::NewL();
   166         }
   166         }
   195     iPublishSifOperationInfo->PublishCompletionL( *data );
   195     iPublishSifOperationInfo->PublishCompletionL( *data );
   196     CleanupStack::PopAndDestroy( data );
   196     CleanupStack::PopAndDestroy( data );
   197     }
   197     }
   198 
   198 
   199 // ---------------------------------------------------------------------------
   199 // ---------------------------------------------------------------------------
   200 // CSisxSifPluginUiHandlerBase::SetDisplayErrorL()
   200 // CSisxSifPluginUiHandlerBase::SetErrorL()
   201 // ---------------------------------------------------------------------------
   201 // ---------------------------------------------------------------------------
   202 //
   202 //
   203 void CSisxSifPluginUiHandlerBase::SetDisplayErrorL( Swi::TErrorDialog aType, const TDesC& aParam )
   203 void CSisxSifPluginUiHandlerBase::SetErrorL( TInt aErrorCode, TInt aExtErrorCode )
   204     {
   204     {
   205     iErrorHandler.SetExtendedErrorCode( aType );
   205     iErrorHandler.SetErrorCode( aErrorCode );
   206 
   206     iErrorHandler.SetExtendedErrorCode( aExtErrorCode );
       
   207 
       
   208     // TODO: localized UI strings needed
       
   209     switch( iErrorHandler.ErrorCategory() )
       
   210         {
       
   211         case ELowMemory:
       
   212             // txt_error_info_there_is_not_enough_memory_currentl
       
   213             iErrorHandler.SetErrorMessage( _L("There is not enough memory currently.") );
       
   214             break;
       
   215         case ELowDiskSpace:
       
   216             // txt_error_info_there_is_not_enough_space_currently
       
   217             iErrorHandler.SetErrorMessage( _L("There is not enough space currently in this drive.") );
       
   218             break;
       
   219         case ENetworkUnavailable:
       
   220             // txt_error_info_network_is_unavailable_currently
       
   221             iErrorHandler.SetErrorMessage( _L("Network  is unavailable currently.") );
       
   222             break;
       
   223         case EInstallerBusy:
       
   224             // txt_error_info_installer_is_busy_currently
       
   225             iErrorHandler.SetErrorMessage( _L("Installer is busy currently.") );
       
   226             break;
       
   227         case ECorruptedPackage:
       
   228             // txt_error_info_installation_package_is_corrupted
       
   229             iErrorHandler.SetErrorMessage( _L("Installation package is corrupted. You may want to try again.") );
       
   230             break;
       
   231         case EApplicationNotCompatible:
       
   232             // txt_error_info_application_is_not_compatible_with
       
   233             iErrorHandler.SetErrorMessage( _L("Application is not compatible with this device.") );
       
   234             break;
       
   235         case ESecurityError:
       
   236             // txt_error_info_there_is_a_security_issue_with_this
       
   237             iErrorHandler.SetErrorMessage( _L("There is a security issue with this application.") );
       
   238             break;
       
   239         case EUnexpectedError:
       
   240         case EUnknown:
       
   241             // txt_error_info_an_unexpected_error_occurred
       
   242             iErrorHandler.SetErrorMessage( _L("An unexpected error occurred.") );
       
   243             break;
       
   244         case EUserCancelled:
       
   245             if( iOperationPhase == EInstalling )
       
   246                 {
       
   247                 // txt_error_info_application_not_installed
       
   248                 iErrorHandler.SetErrorMessage( _L("Application not installed.") );
       
   249                 }
       
   250             else
       
   251                 {
       
   252                 // txt_error_info_application_not_deleted
       
   253                 iErrorHandler.SetErrorMessage( _L("Application not deleted. ") );
       
   254                 }
       
   255             break;
       
   256         case EUninstallationBlocked:
       
   257             // txt_error_info_application_cannot_be_deleted
       
   258             iErrorHandler.SetErrorMessage( _L("Application cannot be deleted.") );
       
   259             break;
       
   260         case ENone:
       
   261         default:
       
   262             break;
       
   263         }
       
   264     }
       
   265 
       
   266 // ---------------------------------------------------------------------------
       
   267 // CSisxSifPluginUiHandlerBase::SetErrorL()
       
   268 // ---------------------------------------------------------------------------
       
   269 //
       
   270 void CSisxSifPluginUiHandlerBase::SetErrorL( TInt aErrorCode, TInt aExtErrorCode,
       
   271     const TDesC& aErrMsgDetails )
       
   272     {
       
   273     SetErrorL( aErrorCode, aExtErrorCode );
       
   274     iErrorHandler.SetErrorMessageDetails( aErrMsgDetails );
       
   275     }
       
   276 
       
   277 // ---------------------------------------------------------------------------
       
   278 // CSisxSifPluginUiHandlerBase::SetErrorSwiErrorL()
       
   279 // ---------------------------------------------------------------------------
       
   280 //
       
   281 void CSisxSifPluginUiHandlerBase::SetErrorSwiErrorL( Swi::TErrorDialog aType,
       
   282         const TDesC& /*aParam*/ )
       
   283     {
   207     // TODO: localised detailed error messages
   284     // TODO: localised detailed error messages
       
   285     // TODO: append aParam when message supports parameters
   208     TBuf<512> details;
   286     TBuf<512> details;
   209     switch( aType )
   287     switch( aType )
   210         {
   288         {
   211         case Swi::EUiAlreadyInRom:
   289         case Swi::EUiAlreadyInRom:
   212             details.Copy(_L("EUiAlreadyInRom"));
   290             details.Copy(_L("EUiAlreadyInRom"));
   240             break;
   318             break;
   241         case Swi::EUiInsufficientSpaceOnDrive:
   319         case Swi::EUiInsufficientSpaceOnDrive:
   242             details.Copy(_L("EUiInsufficientSpaceOnDrive"));
   320             details.Copy(_L("EUiInsufficientSpaceOnDrive"));
   243             break;
   321             break;
   244         case Swi::EUiCapabilitiesCannotBeGranted:
   322         case Swi::EUiCapabilitiesCannotBeGranted:
   245             details.Copy(_L("EUiCapabilitiesCannotBeGranted"));
   323             // aParam contains list of capability names
       
   324             details.Copy(_L("Cannot grant capabilities requested by the application."));
   246             break;
   325             break;
   247         case Swi::EUiUnknownFile:
   326         case Swi::EUiUnknownFile:
   248             details.Copy(_L("EUiUnknownFile"));
   327             details.Copy(_L("EUiUnknownFile"));
   249             break;
   328             break;
   250         case Swi::EUiMissingBasePackage:
   329         case Swi::EUiMissingBasePackage:
   276             break;
   355             break;
   277         default:
   356         default:
   278             break;
   357             break;
   279         }
   358         }
   280 
   359 
   281     if( aParam.Length() )
   360     SetErrorL( KErrGeneral, aType, details );
   282         {
       
   283         details.Append( _L("\n") );
       
   284         details.Append( aParam );
       
   285         }
       
   286     }
   361     }
   287 
   362 
   288 // ---------------------------------------------------------------------------
   363 // ---------------------------------------------------------------------------
   289 // CSisxSifPluginUiHandlerBase::SetOcspErrorL()
   364 // CSisxSifPluginUiHandlerBase::SetOcspErrorL()
   290 // ---------------------------------------------------------------------------
   365 // ---------------------------------------------------------------------------
   351 
   426 
   352     CleanupStack::PopAndDestroy( note );
   427     CleanupStack::PopAndDestroy( note );
   353     return questionAccepted;
   428     return questionAccepted;
   354     }
   429     }
   355 
   430 
   356 
   431 // ---------------------------------------------------------------------------
       
   432 // CSisxSifPluginUiHandlerBase::ShowQuestionWithContinueL()
       
   433 // ---------------------------------------------------------------------------
       
   434 //
       
   435 void CSisxSifPluginUiHandlerBase::ShowQuestionWithContinueL( const TDesC& aText ) const
       
   436     {
       
   437     CHbDeviceMessageBoxSymbian *note = NULL;
       
   438     note = CHbDeviceMessageBoxSymbian::NewL( CHbDeviceMessageBoxSymbian::EQuestion );
       
   439     CleanupStack::PushL( note );
       
   440 
       
   441     note->SetTextL( aText );
       
   442     note->SetTimeout( 0 );
       
   443     note->SetButton( CHbDeviceMessageBoxSymbian::EAcceptButton, EFalse );
       
   444     note->SetButton( CHbDeviceMessageBoxSymbian::ERejectButton, ETrue );
       
   445     // TODO: localized UI string needed
       
   446     note->SetButtonTextL( CHbDeviceMessageBoxSymbian::ERejectButton, _L("Continue") );
       
   447     (void)note->ExecL();
       
   448 
       
   449     CleanupStack::PopAndDestroy( note );
       
   450     }
       
   451