appinstall_plat/sifui_api/src/sifuiprivate.cpp
changeset 67 3a625661d1ce
parent 60 245df5276b97
child 72 a0dc14075813
equal deleted inserted replaced
60:245df5276b97 67:3a625661d1ce
   312 // CSifUiPrivate::ShowGrantCapabilitiesL()
   312 // CSifUiPrivate::ShowGrantCapabilitiesL()
   313 // ---------------------------------------------------------------------------
   313 // ---------------------------------------------------------------------------
   314 //
   314 //
   315 TBool CSifUiPrivate::ShowGrantCapabilitiesL( const TCapabilitySet& aCapabilities )
   315 TBool CSifUiPrivate::ShowGrantCapabilitiesL( const TCapabilitySet& aCapabilities )
   316     {
   316     {
       
   317     TPckg<TCapabilitySet> capabilitySetPckg( aCapabilities );
       
   318     AddParamPckgL( KSifUiGrantCapabilities, capabilitySetPckg );
       
   319     UpdateDialogAndWaitForResponseL();
       
   320     return( iDialogReturnValue == KErrNone );
       
   321     }
       
   322 
       
   323 // ---------------------------------------------------------------------------
       
   324 // CSifUiPrivate::ShowSelectLanguageL()
       
   325 // ---------------------------------------------------------------------------
       
   326 //
       
   327 TInt CSifUiPrivate::ShowSelectLanguageL( const RArray<TLanguage>& aLanguages )
       
   328     {
   317     CBufFlat* buffer = CBufFlat::NewL( KBufferGranularity );
   329     CBufFlat* buffer = CBufFlat::NewL( KBufferGranularity );
   318     CleanupStack::PushL( buffer );
   330     CleanupStack::PushL( buffer );
   319 
   331 
   320     RBufWriteStream writeStream( *buffer );
   332     RBufWriteStream writeStream( *buffer );
   321     CleanupClosePushL( writeStream );
   333     CleanupClosePushL( writeStream );
   322     TPckg<TCapabilitySet> capabilitySetPackage( aCapabilities );
   334     TPckg< const RArray<TLanguage> > languagesPckg( aLanguages );
   323     writeStream.WriteL( capabilitySetPackage );
   335     writeStream.WriteL( languagesPckg );
   324     writeStream.CommitL();
   336     writeStream.CommitL();
   325     CleanupStack::PopAndDestroy( &writeStream );
   337     CleanupStack::PopAndDestroy( &writeStream );
   326 
   338 
   327     AddParamBinaryL( KSifUiGrantCapabilities, *buffer );
   339     AddParamBinaryL( KSifUiSelectableLanguages, *buffer );
       
   340     CleanupStack::PopAndDestroy( buffer );
   328     UpdateDialogAndWaitForResponseL();
   341     UpdateDialogAndWaitForResponseL();
   329 
   342     if( iDialogReturnValue == KErrNone )
   330     CleanupStack::PopAndDestroy( buffer );
   343         {
       
   344         return iSelectedLanguage;
       
   345         }
       
   346     return iDialogReturnValue;
       
   347     }
       
   348 
       
   349 // ---------------------------------------------------------------------------
       
   350 // CSifUiPrivate::ShowSelectOptionsL()
       
   351 // ---------------------------------------------------------------------------
       
   352 //
       
   353 TBool CSifUiPrivate::ShowSelectOptionsL( const MDesCArray& aSelectableItems,
       
   354         RArray<TInt>& aSelectedIndexes )
       
   355     {
       
   356     AddParamListL( KSifUiSelectableOptions, aSelectableItems );
       
   357     iSelectedOptions.Reset();
       
   358     UpdateDialogAndWaitForResponseL();
       
   359     if( iSelectedOptions.Count() )
       
   360         {
       
   361         aSelectedIndexes = iSelectedOptions;
       
   362         }
   331     return( iDialogReturnValue == KErrNone );
   363     return( iDialogReturnValue == KErrNone );
   332     }
   364     }
   333 
   365 
   334 // ---------------------------------------------------------------------------
   366 // ---------------------------------------------------------------------------
   335 // CSifUiPrivate::ShowSingleSelectionL()
       
   336 // ---------------------------------------------------------------------------
       
   337 //
       
   338 TBool CSifUiPrivate::ShowSingleSelectionL( const TDesC& /*aTitle*/,
       
   339         const MDesCArray& /*aSelectableItems*/, TInt& aSelectedIndex )
       
   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;
       
   356     }
       
   357 
       
   358 // ---------------------------------------------------------------------------
       
   359 // CSifUiPrivate::DoCancel()
   367 // CSifUiPrivate::DoCancel()
   360 // ---------------------------------------------------------------------------
   368 // ---------------------------------------------------------------------------
   361 //
   369 //
   362 void CSifUiPrivate::DoCancel()
   370 void CSifUiPrivate::DoCancel()
   363     {
   371     {
   364     FLOG( _L("CSifUiPrivate::DoCancel") );
   372     FLOG( _L("CSifUiPrivate::DoCancel") );
   365 
   373     if( iDeviceDialog )
   366     if( iWait && iWait->IsStarted() && iWait->CanStopNow() )
   374         {
   367         {
   375         iDeviceDialog->Cancel();        // Closes the device dialog.
   368         iWaitCompletionCode = KErrCancel;
   376         }
       
   377 
       
   378     // Cancelled device dialog does not call DeviceDialogClosed() hence have
       
   379     // to complete the request now. CActive::Cancel() waits until the request
       
   380     // is completed.
       
   381     TRequestStatus* status( &iStatus );
       
   382     User::RequestComplete( status, KErrCancel );
       
   383 
       
   384     // Normally User::RequestComplete() invokes RunL(), but not now, because
       
   385     // the object is not active any more (after it has been cancelled). Hence,
       
   386     // have to stop CActiveSchedulerWait too.
       
   387     iWaitCompletionCode = KErrCancel;
       
   388     if( iWait && iWait->IsStarted() )
       
   389         {
   369         iWait->AsyncStop();
   390         iWait->AsyncStop();
   370         }
   391         }
   371     }
   392     }
   372 
   393 
   373 // ---------------------------------------------------------------------------
   394 // ---------------------------------------------------------------------------
   376 //
   397 //
   377 void CSifUiPrivate::RunL()
   398 void CSifUiPrivate::RunL()
   378     {
   399     {
   379     FLOG_1( _L("CSifUiPrivate::RunL, iStatus.Int()=%d"), iStatus.Int() );
   400     FLOG_1( _L("CSifUiPrivate::RunL, iStatus.Int()=%d"), iStatus.Int() );
   380 
   401 
   381     if( iWait )
   402     if( iWait && iWait->IsStarted() )
   382         {
   403         {
   383         iWait->AsyncStop();
   404         iWait->AsyncStop();
   384         }
   405         }
   385     }
   406     }
   386 
   407 
   396     if( selectedDriveVariant )
   417     if( selectedDriveVariant )
   397         {
   418         {
   398         iSelectedDrive = *( selectedDriveVariant->Value<TChar>() );
   419         iSelectedDrive = *( selectedDriveVariant->Value<TChar>() );
   399         iSelectedDriveSet = ETrue;
   420         iSelectedDriveSet = ETrue;
   400         FLOG_1( _L("CSifUiPrivate::DataReceived, iSelectedDrive=%d"), (TUint)iSelectedDrive );
   421         FLOG_1( _L("CSifUiPrivate::DataReceived, iSelectedDrive=%d"), (TUint)iSelectedDrive );
       
   422         }
       
   423 
       
   424     const CHbSymbianVariant* selectedLangVariant = aData.Get( KSifUiSelectedLanguageIndex );
       
   425     if( selectedLangVariant )
       
   426         {
       
   427         iSelectedLanguage = *( selectedLangVariant->Value<TInt>() );
       
   428         FLOG_1( _L("CSifUiPrivate::DataReceived, iSelectedLanguage=%d"), iSelectedLanguage );
       
   429         }
       
   430 
       
   431     const CHbSymbianVariant* selectedOptsVariant = aData.Get( KSifUiSelectedOptions );
       
   432     if( selectedOptsVariant )
       
   433         {
       
   434         const TDesC8 *dataPtr = reinterpret_cast< const TDesC8* >( selectedOptsVariant->Data() );
       
   435         RMemReadStream readStream( selectedOptsVariant->Data(), dataPtr->Size() );
       
   436         CleanupClosePushL( readStream );
       
   437         TPckg< RArray<TInt> > selectedOptionsPckg( iSelectedOptions );
       
   438         readStream.ReadL( selectedOptionsPckg );
       
   439         CleanupStack::PopAndDestroy( &readStream );
       
   440         FLOG_1( _L("CSifUiPrivate::DataReceived, iSelectedOptions.Count()=%d"),
       
   441             iSelectedOptions.Count() );
   401         }
   442         }
   402 
   443 
   403     const CHbSymbianVariant* variant = aData.Get( KSifUiQueryReturnValue );
   444     const CHbSymbianVariant* variant = aData.Get( KSifUiQueryReturnValue );
   404     if( variant )
   445     if( variant )
   405         {
   446         {
   566     User::LeaveIfError( VariantMapL()->Add( aKey, variant ) );
   607     User::LeaveIfError( VariantMapL()->Add( aKey, variant ) );
   567     CleanupStack::Pop( variant );
   608     CleanupStack::Pop( variant );
   568     }
   609     }
   569 
   610 
   570 // ---------------------------------------------------------------------------
   611 // ---------------------------------------------------------------------------
       
   612 // CSifUiPrivate::AddParamPckgL()
       
   613 // ---------------------------------------------------------------------------
       
   614 //
       
   615 void CSifUiPrivate::AddParamPckgL( const TDesC& aKey, const TDesC8& aPckg )
       
   616     {
       
   617     CHbSymbianVariant* variant = NULL;
       
   618     variant = CHbSymbianVariant::NewL( &aPckg, CHbSymbianVariant::EBinary );
       
   619     User::LeaveIfError( VariantMapL()->Add( aKey, variant ) );
       
   620     }
       
   621 
       
   622 // ---------------------------------------------------------------------------
   571 // CSifUiPrivate::AddParamsAppInfoL()
   623 // CSifUiPrivate::AddParamsAppInfoL()
   572 // ---------------------------------------------------------------------------
   624 // ---------------------------------------------------------------------------
   573 //
   625 //
   574 void CSifUiPrivate::AddParamsAppInfoL( const CSifUiAppInfo& aAppInfo )
   626 void CSifUiPrivate::AddParamsAppInfoL( const CSifUiAppInfo& aAppInfo )
   575     {
   627     {