appinstall_plat/sifui_api/src/sifuiprivate.cpp
changeset 60 245df5276b97
parent 42 d17dc5398051
child 67 3a625661d1ce
equal deleted inserted replaced
53:ae54820ef82c 60:245df5276b97
    16 */
    16 */
    17 
    17 
    18 #include "sifuiprivate.h"                       // CSifUiPrivate
    18 #include "sifuiprivate.h"                       // CSifUiPrivate
    19 #include "sifuicertificateinfo.h"               // CSifUiCertificateInfo
    19 #include "sifuicertificateinfo.h"               // CSifUiCertificateInfo
    20 #include "sifuiappinfo.h"                       // CSifUiAppInfo
    20 #include "sifuiappinfo.h"                       // CSifUiAppInfo
       
    21 #include "sifuierrorinfo.h"                     // CSifUiErrorInfo
       
    22 #include "sifuiinstallindicatordefinitions.h"   // indicator type label and parameter names
    21 #include <hb/hbcore/hbsymbianvariant.h>         // CHbSymbianVariantMap
    23 #include <hb/hbcore/hbsymbianvariant.h>         // CHbSymbianVariantMap
    22 #include <hb/hbwidgets/hbdevicenotificationdialogsymbian.h> // CHbDeviceNotificationDialogSymbian
    24 #include <hb/hbwidgets/hbdevicenotificationdialogsymbian.h> // CHbDeviceNotificationDialogSymbian
    23 #include <apgicnfl.h>                           // CApaMaskedBitmap
    25 #include <apgicnfl.h>                           // CApaMaskedBitmap
    24 #include <s32mem.h>                             // RDesReadStream
    26 #include <s32mem.h>                             // RDesReadStream
    25 #include <e32property.h>                        // RProperty
    27 #include <e32property.h>                        // RProperty
    26 
    28 
    27 const TInt KDriveLettersLen = 32;
    29 const TInt KDriveLettersLen = 32;
    28 const TInt KCertificateBufferGranularity = 1024;
    30 const TInt KBufferGranularity = 1024;
    29 const TInt KProgFull = 100;                     // 100%
    31 const TInt KProgFull = 100;                     // 100%
    30 
    32 
    31 const TUid KInstallIndicatorCategory = { 0x20022FC5 };
    33 const TUid KInstallIndicatorCategory = { 0x20022FC5 };
    32 const TUint KInstallIndicatorStatus = 0x2002E690;
    34 const TUint KInstallIndicatorStatus = 0x2002E690;
    33 
    35 
    34 _LIT( KSifUiDefaultApplicationIcon, "qtg_large_application" );
    36 _LIT( KSifUiDefaultApplicationIcon, "qtg_large_application" );
    35 
    37 
       
    38 // TODO: replace with proper logging
       
    39 #ifdef _DEBUG
       
    40 #define FLOG(x)         RDebug::Print(x);
       
    41 #define FLOG_1(x,y)     RDebug::Print(x, y);
       
    42 #define FLOG_2(x,y,z)   RDebug::Print(x, y, z);
       
    43 #define FLOG_3(x,y,z,v) RDebug::Print(x, y, z, v);
       
    44 #else
       
    45 #define FLOG(x)
       
    46 #define FLOG_1(x,y)
       
    47 #define FLOG_2(x,y,z)
       
    48 #define FLOG_3(x,y,z,v)
       
    49 #endif
       
    50 
    36 
    51 
    37 // ======== MEMBER FUNCTIONS ========
    52 // ======== MEMBER FUNCTIONS ========
    38 
    53 
    39 // ---------------------------------------------------------------------------
    54 // ---------------------------------------------------------------------------
    40 // CSifUiPrivate::NewL()
    55 // CSifUiPrivate::NewL()
    41 // ---------------------------------------------------------------------------
    56 // ---------------------------------------------------------------------------
    42 //
    57 //
    43 CSifUiPrivate* CSifUiPrivate::NewL()
    58 CSifUiPrivate* CSifUiPrivate::NewL()
    44     {
    59     {
       
    60     FLOG( _L("CSifUiPrivate::NewL") );
       
    61 
    45     CSifUiPrivate* self = new( ELeave ) CSifUiPrivate();
    62     CSifUiPrivate* self = new( ELeave ) CSifUiPrivate();
    46     CleanupStack::PushL( self );
    63     CleanupStack::PushL( self );
    47     self->ConstructL();
    64     self->ConstructL();
    48     CleanupStack::Pop( self );
    65     CleanupStack::Pop( self );
    49     return self;
    66     return self;
    53 // CSifUiPrivate::~CSifUiPrivate()
    70 // CSifUiPrivate::~CSifUiPrivate()
    54 // ---------------------------------------------------------------------------
    71 // ---------------------------------------------------------------------------
    55 //
    72 //
    56 CSifUiPrivate::~CSifUiPrivate()
    73 CSifUiPrivate::~CSifUiPrivate()
    57     {
    74     {
       
    75     FLOG( _L("CSifUiPrivate::~CSifUiPrivate") );
       
    76 
    58     Cancel();
    77     Cancel();
    59     delete iWait;
    78     delete iWait;
    60     delete iDeviceDialog;
    79     delete iDeviceDialog;
    61     delete iVariantMap;
    80     delete iVariantMap;
    62     delete iIndicator;
    81     delete iIndicator;
    64     delete iSelectableDrives;
    83     delete iSelectableDrives;
    65     delete iCertificateBuffer;
    84     delete iCertificateBuffer;
    66     }
    85     }
    67 
    86 
    68 // ---------------------------------------------------------------------------
    87 // ---------------------------------------------------------------------------
    69 // CSifUiPrivate::ShowConfirmationL()
    88 // CSifUiPrivate::ShowPreparingL()
    70 // ---------------------------------------------------------------------------
    89 // ---------------------------------------------------------------------------
    71 //
    90 //
    72 TBool CSifUiPrivate::ShowConfirmationL( const CSifUiAppInfo& aAppInfo )
    91 void CSifUiPrivate::ShowPreparingL()
    73     {
    92     {
    74     ChangeNoteTypeL( ESifUiConfirmationQuery );
    93     // TODO: implement
    75 
       
    76     AddParamsAppInfoL( aAppInfo );
       
    77     if( iSelectableDrives )
       
    78         {
       
    79         AddParamL( KSifUiMemorySelection, *iSelectableDrives );
       
    80         }
       
    81     AddParamsCertificatesL();
       
    82 
       
    83     UpdateDialogAndWaitForResponseL();
       
    84     return( iDialogReturnValue == KErrNone );
       
    85     }
    94     }
    86 
    95 
    87 // ---------------------------------------------------------------------------
    96 // ---------------------------------------------------------------------------
    88 // CSifUiPrivate::SetMemorySelectionL()
    97 // CSifUiPrivate::SetMemorySelectionL()
    89 // ---------------------------------------------------------------------------
    98 // ---------------------------------------------------------------------------
    90 //
    99 //
    91 void CSifUiPrivate::SetMemorySelectionL( const RArray<TInt>& aDriveNumbers )
   100 void CSifUiPrivate::SetMemorySelectionL( const RArray<TInt>& aDriveNumbers )
    92     {
   101     {
       
   102     FLOG( _L("CSifUiPrivate::SetMemorySelectionL") );
       
   103 
    93     if( iSelectableDrives )
   104     if( iSelectableDrives )
    94         {
   105         {
    95         delete iSelectableDrives;
   106         delete iSelectableDrives;
    96         iSelectableDrives = NULL;
   107         iSelectableDrives = NULL;
    97         }
   108         }
   103         TBuf<KDriveLettersLen> driveList;
   114         TBuf<KDriveLettersLen> driveList;
   104         for( TInt index = 0; index < driveCount; ++index )
   115         for( TInt index = 0; index < driveCount; ++index )
   105             {
   116             {
   106             TChar driveLetter;
   117             TChar driveLetter;
   107             TInt err = RFs::DriveToChar( aDriveNumbers[ index ], driveLetter );
   118             TInt err = RFs::DriveToChar( aDriveNumbers[ index ], driveLetter );
       
   119             FLOG_3( _L("CSifUiPrivate::SetMemorySelectionL, index %d, drive %d, err %d"),
       
   120                     index, aDriveNumbers[ index ], err );
   108             if( !err )
   121             if( !err )
   109                 {
   122                 {
   110                 driveList.Append( driveLetter );
   123                 driveList.Append( driveLetter );
   111                 driveList.Append( KComma );
   124                 driveList.Append( KComma );
   112                 }
   125                 }
   113             }
   126             }
   114         iSelectableDrives = driveList.AllocL();
   127         iSelectableDrives = driveList.AllocL();
   115         }
   128         }
   116     }
   129     FLOG_1( _L("CSifUiPrivate::SetMemorySelectionL, iSelectableDrives=%S"), iSelectableDrives );
   117 
       
   118 // ---------------------------------------------------------------------------
       
   119 // CSifUiPrivate::SelectedDrive()
       
   120 // ---------------------------------------------------------------------------
       
   121 //
       
   122 TInt CSifUiPrivate::SelectedDrive( TInt& aDriveNumber )
       
   123     {
       
   124     if( iSelectedDriveSet )
       
   125         {
       
   126         return RFs::CharToDrive( iSelectedDrive, aDriveNumber );
       
   127         }
       
   128     return KErrNotFound;
       
   129     }
   130     }
   130 
   131 
   131 // ---------------------------------------------------------------------------
   132 // ---------------------------------------------------------------------------
   132 // CSifUiPrivate::SetCertificateInfoL()
   133 // CSifUiPrivate::SetCertificateInfoL()
   133 // ---------------------------------------------------------------------------
   134 // ---------------------------------------------------------------------------
   134 //
   135 //
   135 void CSifUiPrivate::SetCertificateInfoL(
   136 void CSifUiPrivate::SetCertificateInfoL(
   136         const RPointerArray<CSifUiCertificateInfo>& aCertificates )
   137         const RPointerArray<CSifUiCertificateInfo>& aCertificates )
   137     {
   138     {
       
   139     FLOG( _L("CSifUiPrivate::SetCertificateInfoL") );
       
   140 
   138     if( iCertificateBuffer )
   141     if( iCertificateBuffer )
   139         {
   142         {
   140         delete iCertificateBuffer;
   143         delete iCertificateBuffer;
   141         iCertificateBuffer = NULL;
   144         iCertificateBuffer = NULL;
   142         }
   145         }
   143     if( aCertificates.Count() )
   146     if( aCertificates.Count() )
   144         {
   147         {
   145         iCertificateBuffer = CBufFlat::NewL( KCertificateBufferGranularity );
   148         iCertificateBuffer = CBufFlat::NewL( KBufferGranularity );
   146         RBufWriteStream writeStream( *iCertificateBuffer );
   149         RBufWriteStream writeStream( *iCertificateBuffer );
   147         CleanupClosePushL( writeStream );
   150         CleanupClosePushL( writeStream );
   148 
   151 
   149         TInt32 count = aCertificates.Count();
   152         TInt32 count = aCertificates.Count();
   150         writeStream.WriteInt32L( count );
   153         writeStream.WriteInt32L( count );
   156         CleanupStack::PopAndDestroy( &writeStream );
   159         CleanupStack::PopAndDestroy( &writeStream );
   157         }
   160         }
   158     }
   161     }
   159 
   162 
   160 // ---------------------------------------------------------------------------
   163 // ---------------------------------------------------------------------------
       
   164 // CSifUiPrivate::ShowConfirmationL()
       
   165 // ---------------------------------------------------------------------------
       
   166 //
       
   167 TBool CSifUiPrivate::ShowConfirmationL( const CSifUiAppInfo& aAppInfo )
       
   168     {
       
   169     FLOG( _L("CSifUiPrivate::ShowConfirmationL") );
       
   170 
       
   171     ChangeNoteTypeL( ESifUiConfirmationQuery );
       
   172 
       
   173     AddParamsAppInfoL( aAppInfo );
       
   174     if( iSelectableDrives )
       
   175         {
       
   176         AddParamL( KSifUiMemorySelection, *iSelectableDrives );
       
   177         }
       
   178     AddParamsCertificatesL();
       
   179 
       
   180     UpdateDialogAndWaitForResponseL();
       
   181     return( iDialogReturnValue == KErrNone );
       
   182     }
       
   183 
       
   184 // ---------------------------------------------------------------------------
       
   185 // CSifUiPrivate::SelectedDrive()
       
   186 // ---------------------------------------------------------------------------
       
   187 //
       
   188 TInt CSifUiPrivate::SelectedDrive( TInt& aDriveNumber )
       
   189     {
       
   190     FLOG( _L("CSifUiPrivate::SelectedDrive") );
       
   191 
       
   192     if( iSelectedDriveSet )
       
   193         {
       
   194         TInt err = RFs::CharToDrive( iSelectedDrive, aDriveNumber );
       
   195         FLOG_2( _L("CSifUiPrivate::SelectedDrive, aDriveNumber=%d, err=%d"), aDriveNumber, err );
       
   196         return err;
       
   197         }
       
   198     FLOG( _L("CSifUiPrivate::SelectedDrive, KErrNotFound") );
       
   199     return KErrNotFound;
       
   200     }
       
   201 
       
   202 // ---------------------------------------------------------------------------
   161 // CSifUiPrivate::ShowProgressL()
   203 // CSifUiPrivate::ShowProgressL()
   162 // ---------------------------------------------------------------------------
   204 // ---------------------------------------------------------------------------
   163 //
   205 //
   164 void CSifUiPrivate::ShowProgressL( const CSifUiAppInfo& aAppInfo,
   206 void CSifUiPrivate::ShowProgressL( const CSifUiAppInfo& aAppInfo,
   165         TInt aProgressBarFinalValue )
   207         TInt aProgressBarFinalValue, CSifUi::TInstallingPhase aPhase )
   166     {
   208     {
       
   209     FLOG( _L("CSifUiPrivate::ShowProgressL") );
       
   210 
   167     ChangeNoteTypeL( ESifUiProgressNote );
   211     ChangeNoteTypeL( ESifUiProgressNote );
   168 
   212 
   169     AddParamsAppInfoL( aAppInfo );
   213     AddParamsAppInfoL( aAppInfo );
   170     AddParamL( KSifUiProgressNoteFinalValue, aProgressBarFinalValue );
   214     AddParamL( KSifUiProgressNoteFinalValue, aProgressBarFinalValue );
   171     iProgressBarFinalValue = aProgressBarFinalValue;
   215     iProgressBarFinalValue = aProgressBarFinalValue;
       
   216     AddParamL( KSifUiProgressNotePhase, aPhase );
       
   217     iInstallingPhase = aPhase;
   172     AddParamsHiddenButtonsL();
   218     AddParamsHiddenButtonsL();
   173 
   219 
   174     UpdateDialogOrIndicatorWithoutWaitingL();
   220     UpdateDialogOrIndicatorWithoutWaitingL();
   175     }
   221     }
   176 
   222 
   178 // CSifUiPrivate::IncreaseProgressBarValueL()
   224 // CSifUiPrivate::IncreaseProgressBarValueL()
   179 // ---------------------------------------------------------------------------
   225 // ---------------------------------------------------------------------------
   180 //
   226 //
   181 void CSifUiPrivate::IncreaseProgressBarValueL( TInt aNewValue )
   227 void CSifUiPrivate::IncreaseProgressBarValueL( TInt aNewValue )
   182     {
   228     {
       
   229     FLOG_1( _L("CSifUiPrivate::IncreaseProgressBarValueL, aNewValue=%d"), aNewValue );
       
   230 
   183     ChangeNoteTypeL( ESifUiProgressNote );
   231     ChangeNoteTypeL( ESifUiProgressNote );
   184 
   232 
   185     AddParamL( KSifUiProgressNoteValue, aNewValue );
   233     AddParamL( KSifUiProgressNoteValue, aNewValue );
   186     iProgressBarCurrentValue += aNewValue;
   234     iProgressBarCurrentValue += aNewValue;
   187     AddParamsHiddenButtonsL();
   235     AddParamsHiddenButtonsL();
   197     {
   245     {
   198     return( iDialogReturnValue == KErrCancel );
   246     return( iDialogReturnValue == KErrCancel );
   199     }
   247     }
   200 
   248 
   201 // ---------------------------------------------------------------------------
   249 // ---------------------------------------------------------------------------
       
   250 // CSifUiPrivate::ShowCompleteL()
       
   251 // ---------------------------------------------------------------------------
       
   252 //
       
   253 void CSifUiPrivate::ShowCompleteL()
       
   254     {
       
   255     FLOG( _L("CSifUiPrivate::ShowCompleteL") );
       
   256 
       
   257     ChangeNoteTypeL( ESifUiCompleteNote );
       
   258 
       
   259     AddParamsHiddenButtonsL();
       
   260 
       
   261     CompleteDialogOrIndicatorAndWaitForResponseL( KErrNone );
       
   262     }
       
   263 
       
   264 // ---------------------------------------------------------------------------
       
   265 // CSifUiPrivate::ShowFailedL()
       
   266 // ---------------------------------------------------------------------------
       
   267 //
       
   268 void CSifUiPrivate::ShowFailedL( const CSifUiErrorInfo& aErrorInfo )
       
   269     {
       
   270     FLOG_1( _L("CSifUiPrivate::ShowFailedL, aErrorCode=%d"), aErrorInfo.ErrorCode() );
       
   271 
       
   272     ChangeNoteTypeL( ESifUiErrorNote );
       
   273 
       
   274     AddParamL( KSifUiErrorCategory, aErrorInfo.ErrorCategory() );
       
   275     AddParamL( KSifUiErrorCode, aErrorInfo.ErrorCode() );
       
   276     AddParamL( KSifUiErrorCodeExtended, aErrorInfo.ExtendedErrorCode() );
       
   277     AddParamL( KSifUiErrorMessage, aErrorInfo.ErrorMessage() );
       
   278     AddParamL( KSifUiErrorDetails, aErrorInfo.ErrorMessageDetails() );
       
   279     AddParamsHiddenButtonsL();
       
   280 
       
   281     CompleteDialogOrIndicatorAndWaitForResponseL( aErrorInfo.ErrorCode() );
       
   282     }
       
   283 
       
   284 // ---------------------------------------------------------------------------
   202 // CSifUiPrivate::SetButtonVisible()
   285 // CSifUiPrivate::SetButtonVisible()
   203 // ---------------------------------------------------------------------------
   286 // ---------------------------------------------------------------------------
   204 //
   287 //
   205 void CSifUiPrivate::SetButtonVisible( CSifUi::TOptionalButton aButton, TBool aIsVisible )
   288 void CSifUiPrivate::SetButtonVisible( CSifUi::TOptionalButton aButton, TBool aIsVisible )
   206     {
   289     {
       
   290     FLOG( _L("CSifUiPrivate::SetButtonVisible") );
       
   291 
   207     switch( aButton )
   292     switch( aButton )
   208         {
   293         {
   209         case CSifUi::EHideProgressButton:
   294         case CSifUi::EHideProgressButton:
   210             iNoHideProgressButton = !aIsVisible;
   295             iNoHideProgressButton = !aIsVisible;
   211             break;
   296             break;
   222             break;
   307             break;
   223         }
   308         }
   224     }
   309     }
   225 
   310 
   226 // ---------------------------------------------------------------------------
   311 // ---------------------------------------------------------------------------
   227 // CSifUiPrivate::ShowCompleteL()
   312 // CSifUiPrivate::ShowGrantCapabilitiesL()
   228 // ---------------------------------------------------------------------------
   313 // ---------------------------------------------------------------------------
   229 //
   314 //
   230 void CSifUiPrivate::ShowCompleteL()
   315 TBool CSifUiPrivate::ShowGrantCapabilitiesL( const TCapabilitySet& aCapabilities )
   231     {
   316     {
   232     ChangeNoteTypeL( ESifUiCompleteNote );
   317     CBufFlat* buffer = CBufFlat::NewL( KBufferGranularity );
   233 
   318     CleanupStack::PushL( buffer );
   234     AddParamsHiddenButtonsL();
   319 
   235 
   320     RBufWriteStream writeStream( *buffer );
   236     CompleteDialogOrIndicatorAndWaitForResponseL( KErrNone );
   321     CleanupClosePushL( writeStream );
   237     }
   322     TPckg<TCapabilitySet> capabilitySetPackage( aCapabilities );
   238 
   323     writeStream.WriteL( capabilitySetPackage );
   239 // ---------------------------------------------------------------------------
   324     writeStream.CommitL();
   240 // CSifUiPrivate::ShowFailedL()
   325     CleanupStack::PopAndDestroy( &writeStream );
   241 // ---------------------------------------------------------------------------
   326 
   242 //
   327     AddParamBinaryL( KSifUiGrantCapabilities, *buffer );
   243 void CSifUiPrivate::ShowFailedL( TInt aErrorCode, const TDesC& aErrorMessage,
   328     UpdateDialogAndWaitForResponseL();
   244         const TDesC& aErrorDetails )
   329 
   245     {
   330     CleanupStack::PopAndDestroy( buffer );
   246     ChangeNoteTypeL( ESifUiErrorNote );
   331     return( iDialogReturnValue == KErrNone );
   247 
   332     }
   248     AddParamL( KSifUiErrorCode, aErrorCode );
   333 
   249     AddParamL( KSifUiErrorMessage, aErrorMessage );
   334 // ---------------------------------------------------------------------------
   250     if( aErrorDetails != KNullDesC )
   335 // CSifUiPrivate::ShowSingleSelectionL()
   251         {
   336 // ---------------------------------------------------------------------------
   252         AddParamL( KSifUiErrorDetails, aErrorDetails );
   337 //
   253         }
   338 TBool CSifUiPrivate::ShowSingleSelectionL( const TDesC& /*aTitle*/,
   254 
   339         const MDesCArray& /*aSelectableItems*/, TInt& aSelectedIndex )
   255     CompleteDialogOrIndicatorAndWaitForResponseL( aErrorCode );
   340     {
       
   341     // TODO: implement
       
   342     aSelectedIndex = 0;
       
   343     return ETrue;
       
   344     }
       
   345 
       
   346 // ---------------------------------------------------------------------------
       
   347 // CSifUiPrivate::ShowMultiSelectionL()
       
   348 // ---------------------------------------------------------------------------
       
   349 //
       
   350 TBool CSifUiPrivate::ShowMultiSelectionL( const TDesC& /*aTitle*/,
       
   351         const MDesCArray& /*aSelectableItems*/, RArray<TInt>& aSelectedIndexes )
       
   352     {
       
   353     // TODO: implement
       
   354     aSelectedIndexes.Reset();
       
   355     return ETrue;
   256     }
   356     }
   257 
   357 
   258 // ---------------------------------------------------------------------------
   358 // ---------------------------------------------------------------------------
   259 // CSifUiPrivate::DoCancel()
   359 // CSifUiPrivate::DoCancel()
   260 // ---------------------------------------------------------------------------
   360 // ---------------------------------------------------------------------------
   261 //
   361 //
   262 void CSifUiPrivate::DoCancel()
   362 void CSifUiPrivate::DoCancel()
   263     {
   363     {
       
   364     FLOG( _L("CSifUiPrivate::DoCancel") );
       
   365 
   264     if( iWait && iWait->IsStarted() && iWait->CanStopNow() )
   366     if( iWait && iWait->IsStarted() && iWait->CanStopNow() )
   265         {
   367         {
   266         iWaitCompletionCode = KErrCancel;
   368         iWaitCompletionCode = KErrCancel;
   267         iWait->AsyncStop();
   369         iWait->AsyncStop();
   268         }
   370         }
   272 // CSifUiPrivate::RunL()
   374 // CSifUiPrivate::RunL()
   273 // ---------------------------------------------------------------------------
   375 // ---------------------------------------------------------------------------
   274 //
   376 //
   275 void CSifUiPrivate::RunL()
   377 void CSifUiPrivate::RunL()
   276     {
   378     {
       
   379     FLOG_1( _L("CSifUiPrivate::RunL, iStatus.Int()=%d"), iStatus.Int() );
       
   380 
   277     if( iWait )
   381     if( iWait )
   278         {
   382         {
   279         iWait->AsyncStop();
   383         iWait->AsyncStop();
   280         }
   384         }
   281     }
   385     }
   284 // CSifUiPrivate::DataReceived()
   388 // CSifUiPrivate::DataReceived()
   285 // ---------------------------------------------------------------------------
   389 // ---------------------------------------------------------------------------
   286 //
   390 //
   287 void CSifUiPrivate::DataReceived( CHbSymbianVariantMap& aData )
   391 void CSifUiPrivate::DataReceived( CHbSymbianVariantMap& aData )
   288     {
   392     {
       
   393     FLOG( _L("CSifUiPrivate::DataReceived") );
       
   394 
   289     const CHbSymbianVariant* selectedDriveVariant = aData.Get( KSifUiSelectedMemory );
   395     const CHbSymbianVariant* selectedDriveVariant = aData.Get( KSifUiSelectedMemory );
   290     if( selectedDriveVariant )
   396     if( selectedDriveVariant )
   291         {
   397         {
   292         iSelectedDrive = *( selectedDriveVariant->Value<TChar>() );
   398         iSelectedDrive = *( selectedDriveVariant->Value<TChar>() );
   293         iSelectedDriveSet = ETrue;
   399         iSelectedDriveSet = ETrue;
       
   400         FLOG_1( _L("CSifUiPrivate::DataReceived, iSelectedDrive=%d"), (TUint)iSelectedDrive );
   294         }
   401         }
   295 
   402 
   296     const CHbSymbianVariant* variant = aData.Get( KSifUiQueryReturnValue );
   403     const CHbSymbianVariant* variant = aData.Get( KSifUiQueryReturnValue );
   297     if( variant )
   404     if( variant )
   298         {
   405         {
   330 // CSifUiPrivate::DeviceDialogClosed()
   437 // CSifUiPrivate::DeviceDialogClosed()
   331 // ---------------------------------------------------------------------------
   438 // ---------------------------------------------------------------------------
   332 //
   439 //
   333 void CSifUiPrivate::DeviceDialogClosed( TInt aCompletionCode )
   440 void CSifUiPrivate::DeviceDialogClosed( TInt aCompletionCode )
   334     {
   441     {
       
   442     FLOG_1( _L("CSifUiPrivate::DeviceDialogClosed, aCompletionCode=%d"), aCompletionCode );
       
   443 
   335     iIsDisplayingDialog = EFalse;
   444     iIsDisplayingDialog = EFalse;
   336     WaitedResponseReceived( aCompletionCode );
   445     WaitedResponseReceived( aCompletionCode );
   337     }
   446     }
   338 
   447 
   339 // ---------------------------------------------------------------------------
   448 // ---------------------------------------------------------------------------
   341 // ---------------------------------------------------------------------------
   450 // ---------------------------------------------------------------------------
   342 //
   451 //
   343 void CSifUiPrivate::IndicatorUserActivated( const TDesC& aType,
   452 void CSifUiPrivate::IndicatorUserActivated( const TDesC& aType,
   344         CHbSymbianVariantMap& /*aData*/ )
   453         CHbSymbianVariantMap& /*aData*/ )
   345     {
   454     {
       
   455     FLOG( _L("CSifUiPrivate::IndicatorUserActivated") );
       
   456 
   346     if( aType == KSifUiInstallIndicatorType )
   457     if( aType == KSifUiInstallIndicatorType )
   347         {
   458         {
   348         CloseInstallIndicator();
   459         CloseInstallIndicator();
       
   460         iIsFirstTimeToDisplay = ETrue;
   349         TRAP_IGNORE( DisplayDeviceDialogL() );
   461         TRAP_IGNORE( DisplayDeviceDialogL() );
   350         }
   462         }
   351     }
   463     }
   352 
   464 
   353 // ---------------------------------------------------------------------------
   465 // ---------------------------------------------------------------------------
   440     variant = CHbSymbianVariant::NewL( &aList, CHbSymbianVariant::EDesArray );
   552     variant = CHbSymbianVariant::NewL( &aList, CHbSymbianVariant::EDesArray );
   441     User::LeaveIfError( VariantMapL()->Add( aKey, variant ) );
   553     User::LeaveIfError( VariantMapL()->Add( aKey, variant ) );
   442     }
   554     }
   443 
   555 
   444 // ---------------------------------------------------------------------------
   556 // ---------------------------------------------------------------------------
       
   557 // CSifUiPrivate::AddParamBinaryL()
       
   558 // ---------------------------------------------------------------------------
       
   559 //
       
   560 void CSifUiPrivate::AddParamBinaryL( const TDesC& aKey, const CBufBase& aBinary )
       
   561     {
       
   562     CHbSymbianVariant* variant = NULL;
       
   563     const TPtrC8 ptr( const_cast<CBufBase&>( aBinary ).Ptr( 0 ).Ptr(), aBinary.Size() );
       
   564     variant = CHbSymbianVariant::NewL( &ptr, CHbSymbianVariant::EBinary );
       
   565     CleanupStack::PushL( variant );
       
   566     User::LeaveIfError( VariantMapL()->Add( aKey, variant ) );
       
   567     CleanupStack::Pop( variant );
       
   568     }
       
   569 
       
   570 // ---------------------------------------------------------------------------
   445 // CSifUiPrivate::AddParamsAppInfoL()
   571 // CSifUiPrivate::AddParamsAppInfoL()
   446 // ---------------------------------------------------------------------------
   572 // ---------------------------------------------------------------------------
   447 //
   573 //
   448 void CSifUiPrivate::AddParamsAppInfoL( const CSifUiAppInfo& aAppInfo )
   574 void CSifUiPrivate::AddParamsAppInfoL( const CSifUiAppInfo& aAppInfo )
   449     {
   575     {
   450     AddParamL( KSifUiApplicationName, aAppInfo.Name() );
   576     AddParamL( KSifUiApplicationName, aAppInfo.Name() );
   451     const TVersion& version( aAppInfo.Version() );
   577     const TVersion& version( aAppInfo.Version() );
   452     if( version.iBuild || version.iMajor || version.iMinor )
   578     if( version.iMajor || version.iMinor )
   453         {
   579         {
   454         AddParamL( KSifUiApplicationVersion, version.Name() );
   580         TVersionName versionName;
       
   581         versionName.AppendNum( version.iMajor );
       
   582         versionName.Append( TChar('.') );
       
   583         versionName.AppendNum( version.iMinor );
       
   584         AddParamL( KSifUiApplicationVersion, versionName );
   455         }
   585         }
   456     if( aAppInfo.Vendor().Length() )
   586     if( aAppInfo.Vendor().Length() )
   457         {
   587         {
   458         AddParamL( KSifUiApplicationDetails, aAppInfo.Vendor() );
   588         AddParamL( KSifUiApplicationDetails, aAppInfo.Vendor() );
   459         }
   589         }
   480 //
   610 //
   481 void CSifUiPrivate::AddParamsCertificatesL()
   611 void CSifUiPrivate::AddParamsCertificatesL()
   482     {
   612     {
   483     if( iCertificateBuffer )
   613     if( iCertificateBuffer )
   484         {
   614         {
   485         const TPtrC8 dataPtr( iCertificateBuffer->Ptr( 0 ).Ptr(),
   615         AddParamBinaryL( KSifUiCertificates, *iCertificateBuffer );
   486                 iCertificateBuffer->Size() );
       
   487         CHbSymbianVariant* certificates = CHbSymbianVariant::NewL( &dataPtr,
       
   488                 CHbSymbianVariant::EBinary );
       
   489         CleanupStack::PushL( certificates );
       
   490         User::LeaveIfError( VariantMapL()->Add( KSifUiCertificates, certificates ) );
       
   491         CleanupStack::Pop( certificates );
       
   492         }
   616         }
   493     }
   617     }
   494 
   618 
   495 // ---------------------------------------------------------------------------
   619 // ---------------------------------------------------------------------------
   496 // CSifUiPrivate::AddParamsHiddenButtonsL()
   620 // CSifUiPrivate::AddParamsHiddenButtonsL()
   535     if( iAppInfo )
   659     if( iAppInfo )
   536         {
   660         {
   537         AddParamsAppInfoL( *iAppInfo );
   661         AddParamsAppInfoL( *iAppInfo );
   538         }
   662         }
   539     AddParamsCertificatesL();
   663     AddParamsCertificatesL();
       
   664     if( iProgressBarFinalValue )
       
   665         {
       
   666         AddParamL( KSifUiProgressNoteFinalValue, iProgressBarFinalValue );
       
   667         }
       
   668     if( iProgressBarCurrentValue )
       
   669         {
       
   670         AddParamL( KSifUiProgressNoteValue, iProgressBarCurrentValue );
       
   671         }
       
   672     AddParamL( KSifUiProgressNotePhase, iInstallingPhase );
       
   673     AddParamsHiddenButtonsL();
   540     // TODO: AddParamsIconL();
   674     // TODO: AddParamsIconL();
   541     AddParamsHiddenButtonsL();
       
   542     }
   675     }
   543 
   676 
   544 // ---------------------------------------------------------------------------
   677 // ---------------------------------------------------------------------------
   545 // CSifUiPrivate::ActivateInstallIndicatorL()
   678 // CSifUiPrivate::ActivateInstallIndicatorL()
   546 // ---------------------------------------------------------------------------
   679 // ---------------------------------------------------------------------------
   551         {
   684         {
   552         iIndicator = CHbIndicatorSymbian::NewL();
   685         iIndicator = CHbIndicatorSymbian::NewL();
   553         iIndicator->SetObserver( this );
   686         iIndicator->SetObserver( this );
   554         }
   687         }
   555 
   688 
       
   689     UpdateInstallIndicatorProgressL();
       
   690     }
       
   691 
       
   692 // ---------------------------------------------------------------------------
       
   693 // CSifUiPrivate::UpdateInstallIndicatorProgressL()
       
   694 // ---------------------------------------------------------------------------
       
   695 //
       
   696 void CSifUiPrivate::UpdateInstallIndicatorProgressL()
       
   697     {
       
   698     CHbSymbianVariantMap* parameters = CHbSymbianVariantMap::NewL();
       
   699     CleanupStack::PushL( parameters );
       
   700 
       
   701     CHbSymbianVariant* param = NULL;
       
   702 
   556     if( iAppInfo && iAppInfo->Name().Length() )
   703     if( iAppInfo && iAppInfo->Name().Length() )
   557         {
   704         {
   558         CHbSymbianVariant* param = NULL;
       
   559         TPtrC appName = iAppInfo->Name();
   705         TPtrC appName = iAppInfo->Name();
   560         param = CHbSymbianVariant::NewL( &appName, CHbSymbianVariant::EDes );
   706         param = CHbSymbianVariant::NewL( &appName, CHbSymbianVariant::EDes );
   561         CleanupStack::PushL( param );
   707         parameters->Add( KSifUiInstallIndicatorAppName, param );
   562         iIndicator->Activate( KSifUiInstallIndicatorType, param );
   708         }
   563         CleanupStack::PopAndDestroy( param );
   709     if( iInstallingPhase )
   564         }
   710         {
   565     else
   711         param = CHbSymbianVariant::NewL( &iInstallingPhase, CHbSymbianVariant::EInt );
   566         {
   712         parameters->Add( KSifUiInstallIndicatorPhase, param );
   567         iIndicator->Activate( KSifUiInstallIndicatorType );
   713         }
   568         }
       
   569     }
       
   570 
       
   571 // ---------------------------------------------------------------------------
       
   572 // CSifUiPrivate::UpdateInstallIndicatorProgressL()
       
   573 // ---------------------------------------------------------------------------
       
   574 //
       
   575 void CSifUiPrivate::UpdateInstallIndicatorProgressL()
       
   576     {
       
   577     if( iProgressBarFinalValue )
   714     if( iProgressBarFinalValue )
   578         {
   715         {
   579         CHbSymbianVariant* param = NULL;
       
   580         TInt progressPercent = KProgFull * iProgressBarCurrentValue / iProgressBarFinalValue;
   716         TInt progressPercent = KProgFull * iProgressBarCurrentValue / iProgressBarFinalValue;
   581         param = CHbSymbianVariant::NewL( &progressPercent, CHbSymbianVariant::EInt );
   717         param = CHbSymbianVariant::NewL( &progressPercent, CHbSymbianVariant::EInt );
   582         CleanupStack::PushL( param );
   718         parameters->Add( KSifUiInstallIndicatorProgress, param );
   583         iIndicator->Activate( KSifUiInstallIndicatorType, param );
   719         }
   584         CleanupStack::PopAndDestroy( param );
   720 
   585         }
   721     // TODO: should both install indicator and device dialog use the same variant map?
       
   722 
       
   723     param = CHbSymbianVariant::NewL( parameters, CHbSymbianVariant::EVariantMap );
       
   724     CleanupStack::Pop( parameters );
       
   725     CleanupStack::PushL( param );
       
   726     iIndicator->Activate( KSifUiInstallIndicatorType, param );
       
   727     CleanupStack::PopAndDestroy( param );
   586     }
   728     }
   587 
   729 
   588 // ---------------------------------------------------------------------------
   730 // ---------------------------------------------------------------------------
   589 // CSifUiPrivate::CloseInstallIndicator()
   731 // CSifUiPrivate::CloseInstallIndicator()
   590 // ---------------------------------------------------------------------------
   732 // ---------------------------------------------------------------------------