appinstaller/AppinstUi/sisxsifplugin/src/sisxsifpluginuihandlerbase.cpp
changeset 80 9dcba1ee99f7
parent 75 2d2d25361590
equal deleted inserted replaced
77:d1838696558c 80:9dcba1ee99f7
    26 //#include <hb/hbcore/hbtextresolversymbian.h> // HbTextResolverSymbian
    26 //#include <hb/hbcore/hbtextresolversymbian.h> // HbTextResolverSymbian
    27 #include <usif/scr/screntries.h>            // CComponentEntry
    27 #include <usif/scr/screntries.h>            // CComponentEntry
    28 
    28 
    29 using namespace Usif;
    29 using namespace Usif;
    30 
    30 
    31 _LIT( KTextResolverPath, "z:/resource/qt/translations/" );
    31 // TODO: restore
    32 _LIT( KSifUiTranslationFile, "sifuidevicedialogplugin_" );
    32 //_LIT( KTextResolverPath, "z:/resource/qt/translations/" );
    33 _LIT( KCommonButtonContinue, "txt_common_button_continue" );
    33 //_LIT( KSifUiTranslationFile, "sifuidevicedialogplugin_" );
       
    34 //_LIT( KCommonButtonContinue, "txt_common_button_continue" );
    34 
    35 
    35 _LIT( KMemoryFull, "txt_error_info_memory_full" );
    36 _LIT( KMemoryFull, "txt_error_info_memory_full" );
    36 _LIT( KUnexpectedError, "txt_error_info_an_unexpected_error_occurred" );
    37 _LIT( KUnexpectedError, "txt_error_info_an_unexpected_error_occurred" );
    37 _LIT( KNotEnoughSpace, "txt_error_info_there_is_not_enough_space_currently" );
    38 _LIT( KNotEnoughSpace, "txt_error_info_there_is_not_enough_space_currently" );
    38 _LIT( KNetworkUnavailable, "txt_error_info_network_is_unavailable_currently" );
    39 _LIT( KNetworkUnavailable, "txt_error_info_network_is_unavailable_currently" );
    44 _LIT( KNotDeleted , "txt_error_info_application_not_deleted" );
    45 _LIT( KNotDeleted , "txt_error_info_application_not_deleted" );
    45 _LIT( KCannotBeDeleted , "txt_error_info_application_cannot_be_deleted" );
    46 _LIT( KCannotBeDeleted , "txt_error_info_application_cannot_be_deleted" );
    46 
    47 
    47 const TInt KDefaultTimeout = 6000;  // milliseconds
    48 const TInt KDefaultTimeout = 6000;  // milliseconds
    48 
    49 
       
    50 // TODO: replace with proper logging
       
    51 #ifdef _DEBUG
       
    52 #define FLOG(x)         RDebug::Print(x)
       
    53 #define FLOG_1(x,y)     RDebug::Print((x),(y))
       
    54 #define FLOG_2(x,y,z)   RDebug::Print((x),(y),(z))
       
    55 #else
       
    56 #define FLOG(x)
       
    57 #define FLOG_1(x,y)
       
    58 #define FLOG_2(x,y,z)
       
    59 #endif
       
    60 
    49 
    61 
    50 // ======== MEMBER FUNCTIONS ========
    62 // ======== MEMBER FUNCTIONS ========
    51 
    63 
    52 // ---------------------------------------------------------------------------
    64 // ---------------------------------------------------------------------------
    53 // CSisxSifPluginUiHandlerBase::CSisxSifPluginUiHandlerBase()
    65 // CSisxSifPluginUiHandlerBase::CSisxSifPluginUiHandlerBase()
    55 //
    67 //
    56 CSisxSifPluginUiHandlerBase::CSisxSifPluginUiHandlerBase( RFs& aFs,
    68 CSisxSifPluginUiHandlerBase::CSisxSifPluginUiHandlerBase( RFs& aFs,
    57         CSisxSifPluginErrorHandler& aErrorHandler ) : iFs( aFs ),
    69         CSisxSifPluginErrorHandler& aErrorHandler ) : iFs( aFs ),
    58         iErrorHandler( aErrorHandler )
    70         iErrorHandler( aErrorHandler )
    59     {
    71     {
       
    72     FLOG( _L("CSisxSifPluginUiHandlerBase::CSisxSifPluginUiHandlerBase") );
    60     // TODO: restore
    73     // TODO: restore
    61     //HbTextResolverSymbian::Init( KSifUiTranslationFile, KTextResolverPath );
    74     //HbTextResolverSymbian::Init( KSifUiTranslationFile, KTextResolverPath );
    62     }
    75     }
    63 
    76 
    64 // ---------------------------------------------------------------------------
    77 // ---------------------------------------------------------------------------
    65 // CSisxSifPluginUiHandlerBase::~CSisxSifPluginUiHandlerBase()
    78 // CSisxSifPluginUiHandlerBase::~CSisxSifPluginUiHandlerBase()
    66 // ---------------------------------------------------------------------------
    79 // ---------------------------------------------------------------------------
    67 //
    80 //
    68 CSisxSifPluginUiHandlerBase::~CSisxSifPluginUiHandlerBase()
    81 CSisxSifPluginUiHandlerBase::~CSisxSifPluginUiHandlerBase()
    69     {
    82     {
       
    83     FLOG( _L("CSisxSifPluginUiHandlerBase::~CSisxSifPluginUiHandlerBase") );
    70     delete iInstallParams;
    84     delete iInstallParams;
    71     delete iPublishSifOperationInfo;
    85     delete iPublishSifOperationInfo;
    72     delete iGlobalComponentId;
    86     delete iGlobalComponentId;
    73     }
    87     }
    74 
    88 
    77 // ---------------------------------------------------------------------------
    91 // ---------------------------------------------------------------------------
    78 //
    92 //
    79 void CSisxSifPluginUiHandlerBase::SetInstallParamsL(
    93 void CSisxSifPluginUiHandlerBase::SetInstallParamsL(
    80         const CSisxSifPluginInstallParams& aInstallParams )
    94         const CSisxSifPluginInstallParams& aInstallParams )
    81     {
    95     {
       
    96     FLOG( _L("CSisxSifPluginUiHandlerBase::SetInstallParamsL") );
    82     if( iInstallParams )
    97     if( iInstallParams )
    83         {
    98         {
    84         delete iInstallParams;
    99         delete iInstallParams;
    85         iInstallParams = NULL;
   100         iInstallParams = NULL;
    86         }
   101         }
    91 // CSisxSifPluginUiHandlerBase::SetMaxInstalledSize()
   106 // CSisxSifPluginUiHandlerBase::SetMaxInstalledSize()
    92 // ---------------------------------------------------------------------------
   107 // ---------------------------------------------------------------------------
    93 //
   108 //
    94 void CSisxSifPluginUiHandlerBase::SetMaxInstalledSize( TInt aSize )
   109 void CSisxSifPluginUiHandlerBase::SetMaxInstalledSize( TInt aSize )
    95     {
   110     {
       
   111     FLOG_1( _L("CSisxSifPluginUiHandlerBase::SetMaxInstalledSize, aSize=%d"), aSize );
    96     iMaxInstalledSize = aSize;
   112     iMaxInstalledSize = aSize;
    97     }
   113     }
    98 
   114 
    99 // ---------------------------------------------------------------------------
   115 // ---------------------------------------------------------------------------
   100 // CSisxSifPluginUiHandlerBase::SetDriveSelectionRequired()
   116 // CSisxSifPluginUiHandlerBase::SetDriveSelectionRequired()
   101 // ---------------------------------------------------------------------------
   117 // ---------------------------------------------------------------------------
   102 //
   118 //
   103 void CSisxSifPluginUiHandlerBase::SetDriveSelectionRequired( TBool aIsRequired )
   119 void CSisxSifPluginUiHandlerBase::SetDriveSelectionRequired( TBool aIsRequired )
   104     {
   120     {
       
   121     FLOG_1( _L("CSisxSifPluginUiHandlerBase::SetDriveSelectionRequired, aIsRequired=%d"),
       
   122         aIsRequired );
   105     iIsDriveSelectionRequired = aIsRequired;
   123     iIsDriveSelectionRequired = aIsRequired;
   106     }
   124     }
   107 
   125 
   108 // ---------------------------------------------------------------------------
   126 // ---------------------------------------------------------------------------
   109 // CSisxSifPluginUiHandlerBase::IsOcspMandatoryL()
   127 // CSisxSifPluginUiHandlerBase::IsOcspMandatoryL()
   110 // ---------------------------------------------------------------------------
   128 // ---------------------------------------------------------------------------
   111 //
   129 //
   112 TBool CSisxSifPluginUiHandlerBase::IsOcspMandatoryL() const
   130 TBool CSisxSifPluginUiHandlerBase::IsOcspMandatoryL() const
   113     {
   131     {
       
   132     FLOG( _L("CSisxSifPluginUiHandlerBase::IsOcspMandatoryL, begin") );
   114     CRepository* cenRep = CRepository::NewLC( KCRUidSWInstallerSettings );
   133     CRepository* cenRep = CRepository::NewLC( KCRUidSWInstallerSettings );
   115     TInt ocspProcedure = ESWInstallerOcspProcedureOff;
   134     TInt ocspProcedure = ESWInstallerOcspProcedureOff;
   116     User::LeaveIfError( cenRep->Get( KSWInstallerOcspProcedure, ocspProcedure ) );
   135     TInt err = cenRep->Get( KSWInstallerOcspProcedure, ocspProcedure );
       
   136     FLOG_2( _L("CSisxSifPluginUiHandlerBase::IsOcspMandatoryL, ocspProcedure=%d, err=%d"),
       
   137         ocspProcedure, err );
   117     CleanupStack::PopAndDestroy( cenRep );
   138     CleanupStack::PopAndDestroy( cenRep );
   118     return ( ocspProcedure == ESWInstallerOcspProcedureMust );
   139 
       
   140     TBool isOcspMandatory = ( ocspProcedure == ESWInstallerOcspProcedureMust );
       
   141     FLOG_1( _L("CSisxSifPluginUiHandlerBase::IsOcspMandatoryL, return %d"),
       
   142         isOcspMandatory );
       
   143     return isOcspMandatory;
   119     }
   144     }
   120 
   145 
   121 // ---------------------------------------------------------------------------
   146 // ---------------------------------------------------------------------------
   122 // CSisxSifPluginUiHandlerBase::PublishStartL()
   147 // CSisxSifPluginUiHandlerBase::PublishStartL()
   123 // ---------------------------------------------------------------------------
   148 // ---------------------------------------------------------------------------
   124 //
   149 //
   125 void CSisxSifPluginUiHandlerBase::PublishStartL( const CComponentInfo::CNode& aRootNode,
   150 void CSisxSifPluginUiHandlerBase::PublishStartL( const CComponentInfo::CNode& aRootNode,
   126         TSifOperationPhase aPhase )
   151         TSifOperationPhase aPhase )
   127     {
   152     {
       
   153     FLOG_1( _L("CSisxSifPluginUiHandlerBase::PublishStartL, aPhase=%d"), aPhase );
   128     iOperationPhase = aPhase;
   154     iOperationPhase = aPhase;
   129 
   155 
   130     RPointerArray<HBufC> appNames;
   156     RPointerArray<HBufC> appNames;
   131     CleanupResetAndDestroyPushL( appNames );
   157     CleanupResetAndDestroyPushL( appNames );
   132     RPointerArray<HBufC> appIcons;
   158     RPointerArray<HBufC> appIcons;
   159         iPublishSifOperationInfo = CPublishSifOperationInfo::NewL();
   185         iPublishSifOperationInfo = CPublishSifOperationInfo::NewL();
   160         }
   186         }
   161     iPublishSifOperationInfo->PublishStartL( *data );
   187     iPublishSifOperationInfo->PublishStartL( *data );
   162 
   188 
   163     CleanupStack::PopAndDestroy( 3, &appNames );    // data, appIcons, appNames
   189     CleanupStack::PopAndDestroy( 3, &appNames );    // data, appIcons, appNames
       
   190     FLOG( _L("CSisxSifPluginUiHandlerBase::PublishStartL, end") );
   164     }
   191     }
   165 
   192 
   166 // ---------------------------------------------------------------------------
   193 // ---------------------------------------------------------------------------
   167 // CSisxSifPluginUiHandlerBase::PublishStartL()
   194 // CSisxSifPluginUiHandlerBase::PublishStartL()
   168 // ---------------------------------------------------------------------------
   195 // ---------------------------------------------------------------------------
   169 //
   196 //
   170 void CSisxSifPluginUiHandlerBase::PublishStartL( const CComponentEntry& aEntry,
   197 void CSisxSifPluginUiHandlerBase::PublishStartL( const CComponentEntry& aEntry,
   171         TSifOperationPhase aPhase )
   198         TSifOperationPhase aPhase )
   172     {
   199     {
       
   200     FLOG_1( _L("CSisxSifPluginUiHandlerBase::PublishStartL, aPhase=%d"), aPhase );
   173     iOperationPhase = aPhase;
   201     iOperationPhase = aPhase;
   174 
   202 
   175     RPointerArray<HBufC> appNames;
   203     RPointerArray<HBufC> appNames;
   176     CleanupResetAndDestroyPushL( appNames );
   204     CleanupResetAndDestroyPushL( appNames );
   177     RPointerArray<HBufC> appIcons;
   205     RPointerArray<HBufC> appIcons;
   193         iPublishSifOperationInfo = CPublishSifOperationInfo::NewL();
   221         iPublishSifOperationInfo = CPublishSifOperationInfo::NewL();
   194         }
   222         }
   195     iPublishSifOperationInfo->PublishStartL( *data );
   223     iPublishSifOperationInfo->PublishStartL( *data );
   196 
   224 
   197     CleanupStack::PopAndDestroy( 3, &appNames );    // data, appIcons, appNames
   225     CleanupStack::PopAndDestroy( 3, &appNames );    // data, appIcons, appNames
       
   226     FLOG( _L("CSisxSifPluginUiHandlerBase::PublishStartL, end") );
   198     }
   227     }
   199 
   228 
   200 // ---------------------------------------------------------------------------
   229 // ---------------------------------------------------------------------------
   201 // CSisxSifPluginUiHandlerBase::PublishProgressL()
   230 // CSisxSifPluginUiHandlerBase::PublishProgressL()
   202 // ---------------------------------------------------------------------------
   231 // ---------------------------------------------------------------------------
   203 //
   232 //
   204 void CSisxSifPluginUiHandlerBase::PublishProgressL( TSifOperationSubPhase aSubPhase )
   233 void CSisxSifPluginUiHandlerBase::PublishProgressL( TSifOperationSubPhase aSubPhase )
   205     {
   234     {
       
   235     FLOG_1( _L("CSisxSifPluginUiHandlerBase::PublishProgressL, aSubPhase=%d"), aSubPhase );
   206     User::LeaveIfNull( iPublishSifOperationInfo );
   236     User::LeaveIfNull( iPublishSifOperationInfo );
   207     CSifOperationProgressData* data = CSifOperationProgressData::NewLC( *iGlobalComponentId,
   237     CSifOperationProgressData* data = CSifOperationProgressData::NewLC( *iGlobalComponentId,
   208             iOperationPhase, aSubPhase, iProgressBarCurrentValue, iProgressBarFinalValue );
   238             iOperationPhase, aSubPhase, iProgressBarCurrentValue, iProgressBarFinalValue );
   209     iPublishSifOperationInfo->PublishProgressL( *data );
   239     iPublishSifOperationInfo->PublishProgressL( *data );
   210     CleanupStack::PopAndDestroy( data );
   240     CleanupStack::PopAndDestroy( data );
       
   241     FLOG( _L("CSisxSifPluginUiHandlerBase::PublishProgressL, end") );
   211     }
   242     }
   212 
   243 
   213 // ---------------------------------------------------------------------------
   244 // ---------------------------------------------------------------------------
   214 // CSisxSifPluginUiHandlerBase::PublishCompletionL()
   245 // CSisxSifPluginUiHandlerBase::PublishCompletionL()
   215 // ---------------------------------------------------------------------------
   246 // ---------------------------------------------------------------------------
   216 //
   247 //
   217 void CSisxSifPluginUiHandlerBase::PublishCompletionL()
   248 void CSisxSifPluginUiHandlerBase::PublishCompletionL()
   218     {
   249     {
       
   250     FLOG( _L("CSisxSifPluginUiHandlerBase::PublishCompletionL") );
   219     User::LeaveIfNull( iPublishSifOperationInfo );
   251     User::LeaveIfNull( iPublishSifOperationInfo );
   220     CSifOperationEndData* data = CSifOperationEndData::NewLC( *iGlobalComponentId,
   252     CSifOperationEndData* data = CSifOperationEndData::NewLC( *iGlobalComponentId,
   221             iErrorHandler.ErrorCategory(), iErrorHandler.ErrorCode(),
   253             iErrorHandler.ErrorCategory(), iErrorHandler.ErrorCode(),
   222             iErrorHandler.ErrorMessage(), iErrorHandler.ErrorMessageDetails() );
   254             iErrorHandler.ErrorMessage(), iErrorHandler.ErrorMessageDetails() );
   223     iPublishSifOperationInfo->PublishCompletionL( *data );
   255     iPublishSifOperationInfo->PublishCompletionL( *data );
   224     CleanupStack::PopAndDestroy( data );
   256     CleanupStack::PopAndDestroy( data );
       
   257     FLOG( _L("CSisxSifPluginUiHandlerBase::PublishCompletionL, end") );
   225     }
   258     }
   226 
   259 
   227 // ---------------------------------------------------------------------------
   260 // ---------------------------------------------------------------------------
   228 // CSisxSifPluginUiHandlerBase::SetErrorL()
   261 // CSisxSifPluginUiHandlerBase::SetErrorL()
   229 // ---------------------------------------------------------------------------
   262 // ---------------------------------------------------------------------------
   230 //
   263 //
   231 void CSisxSifPluginUiHandlerBase::SetErrorL( TInt aErrorCode, TInt aExtErrorCode )
   264 void CSisxSifPluginUiHandlerBase::SetErrorL( TInt aErrorCode, TInt aExtErrorCode )
   232     {
   265     {
       
   266     FLOG_1( _L("CSisxSifPluginUiHandlerBase::SetErrorL, aErrorCode=%d"), aErrorCode );
   233     iErrorHandler.SetErrorCode( aErrorCode );
   267     iErrorHandler.SetErrorCode( aErrorCode );
   234     iErrorHandler.SetExtendedErrorCode( aExtErrorCode );
   268     iErrorHandler.SetExtendedErrorCode( aExtErrorCode );
   235 
   269 
   236     switch( iErrorHandler.ErrorCategory() )
   270     switch( iErrorHandler.ErrorCategory() )
   237         {
   271         {
   284 // ---------------------------------------------------------------------------
   318 // ---------------------------------------------------------------------------
   285 //
   319 //
   286 void CSisxSifPluginUiHandlerBase::SetErrorL( TInt aErrorCode, TInt aExtErrorCode,
   320 void CSisxSifPluginUiHandlerBase::SetErrorL( TInt aErrorCode, TInt aExtErrorCode,
   287     const TDesC& aErrMsgDetails )
   321     const TDesC& aErrMsgDetails )
   288     {
   322     {
       
   323     FLOG_1( _L("CSisxSifPluginUiHandlerBase::SetErrorL, aErrorCode=%d"), aErrorCode );
   289     SetErrorL( aErrorCode, aExtErrorCode );
   324     SetErrorL( aErrorCode, aExtErrorCode );
   290     iErrorHandler.SetErrorMessageDetails( aErrMsgDetails );
   325     iErrorHandler.SetErrorMessageDetails( aErrMsgDetails );
   291     }
   326     }
   292 
   327 
   293 // ---------------------------------------------------------------------------
   328 // ---------------------------------------------------------------------------
   295 // ---------------------------------------------------------------------------
   330 // ---------------------------------------------------------------------------
   296 //
   331 //
   297 void CSisxSifPluginUiHandlerBase::SetErrorSwiErrorL( Swi::TErrorDialog aType,
   332 void CSisxSifPluginUiHandlerBase::SetErrorSwiErrorL( Swi::TErrorDialog aType,
   298         const TDesC& /*aParam*/ )
   333         const TDesC& /*aParam*/ )
   299     {
   334     {
       
   335     FLOG_1( _L("CSisxSifPluginUiHandlerBase::SetErrorSwiErrorL, aType=%d"), aType );
   300     // TODO: localised detailed error messages
   336     // TODO: localised detailed error messages
   301     // TODO: append aParam when message supports parameters
   337     // TODO: append aParam when message supports parameters
   302     TBuf<512> details;
   338     TBuf<512> details;
   303     switch( aType )
   339     switch( aType )
   304         {
   340         {
   380 // CSisxSifPluginUiHandlerBase::SetOcspErrorL()
   416 // CSisxSifPluginUiHandlerBase::SetOcspErrorL()
   381 // ---------------------------------------------------------------------------
   417 // ---------------------------------------------------------------------------
   382 //
   418 //
   383 void CSisxSifPluginUiHandlerBase::SetOcspErrorL( Swi::TRevocationDialogMessage aMessage )
   419 void CSisxSifPluginUiHandlerBase::SetOcspErrorL( Swi::TRevocationDialogMessage aMessage )
   384     {
   420     {
       
   421     FLOG_1( _L("CSisxSifPluginUiHandlerBase::SetOcspErrorL, aMessage=%d"), aMessage );
   385     // TODO: localised error strings needed
   422     // TODO: localised error strings needed
   386     iErrorHandler.SetErrorMessage( _L("Unable to check certificate validity online." ) );
   423     iErrorHandler.SetErrorMessage( _L("Unable to check certificate validity online." ) );
   387     iErrorHandler.SetExtendedErrorCode( aMessage );
   424     iErrorHandler.SetExtendedErrorCode( aMessage );
   388     switch( aMessage )
   425     switch( aMessage )
   389         {
   426         {