mediasettings/mediasettingsapp/src/MPSettingsVideoSettingItemList.cpp
branchRCL_3
changeset 8 ce5ada96ab30
parent 1 6711b85517b7
equal deleted inserted replaced
6:7d91903f795f 8:ce5ada96ab30
    13 *
    13 *
    14 * Description:   Setting item list class for Video settings list view.*
    14 * Description:   Setting item list class for Video settings list view.*
    15 */
    15 */
    16 
    16 
    17 
    17 
    18 // Version : %version: 19 %
    18 // Version : %version: 20 %
    19 
    19 
    20 
    20 
    21 
    21 
    22 
    22 
    23 // INCLUDE FILES
    23 // INCLUDE FILES
    24 #include <eikappui.h>
    24 #include <eikappui.h>
    25 #include <MediaSettings.rsg>
    25 #include <MediaSettings.rsg>
    26 #include <StringLoader.h>
    26 #include <StringLoader.h>
    27 #include <swi/sisregistrysession.h>
       
    28 #include <swi/sisregistryentry.h>
       
    29 #include <AknCommonDialogsDynMem.h>
       
    30 #include <CAknMemorySelectionDialogMultiDrive.h>
       
    31 #include <cmmanagerext.h>
    27 #include <cmmanagerext.h>
    32 #include <cmdestinationext.h>
    28 #include <cmdestinationext.h>
    33 #include <cmapplicationsettingsui.h>
    29 #include <cmapplicationsettingsui.h>
    34 
    30 
    35 #include "MediaPlayerVariant.hrh" 
    31 #include "MediaPlayerVariant.hrh" 
    42 #include "videoplayersettingsengine.h"
    38 #include "videoplayersettingsengine.h"
    43 #include "videoplayercenrepkeys.h"
    39 #include "videoplayercenrepkeys.h"
    44 #include "mpxlog.h"
    40 #include "mpxlog.h"
    45 
    41 
    46 
    42 
    47 const TInt KParentControlAdult( 18 );
       
    48 const TInt KParentControlMinAge( 4 );
       
    49 const TInt KParentControlIndexShift( 3 );
       
    50 const TInt KParentControlMaxIndex( 15 );
       
    51 const TInt KParentControlSelections( 16 );
       
    52 const TInt KParentControlOff( 0 );
       
    53 
       
    54 
       
    55 // ============================ MEMBER FUNCTIONS ===============================
    43 // ============================ MEMBER FUNCTIONS ===============================
    56 
    44 
    57 // -----------------------------------------------------------------------------
    45 // -----------------------------------------------------------------------------
    58 // CMPSettingsVideoSettingItemList::CMPSettingsVideoSettingItemList
    46 // CMPSettingsVideoSettingItemList::CMPSettingsVideoSettingItemList
    59 // C++ default constructor can NOT contain any code, that
    47 // C++ default constructor can NOT contain any code, that
    60 // might leave.
    48 // might leave.
    61 // -----------------------------------------------------------------------------
    49 // -----------------------------------------------------------------------------
    62 //
    50 //
    63 CMPSettingsVideoSettingItemList::CMPSettingsVideoSettingItemList(
    51 CMPSettingsVideoSettingItemList::CMPSettingsVideoSettingItemList(
    64         CMPSettingsModelForROP* aModel, CVcxNsSettingsEngine& aVideoSettingsEngine) :
    52         CMPSettingsModelForROP* aModel, 
    65     iModel(aModel), iVideoSettingsEngine(aVideoSettingsEngine), iRockerKeysSupported(EFalse)
    53         CVcxNsSettingsEngine& aVideoSettingsEngine) 
       
    54     : iModel( aModel ), 
       
    55       iVideoSettingsEngine(aVideoSettingsEngine), 
       
    56       iRockerKeysSupported( EFalse )
    66     {
    57     {
    67     CMPSettingsAppUi* AppUi =
    58     CMPSettingsAppUi* AppUi =
    68             static_cast<CMPSettingsAppUi*> (CCoeEnv::Static()->AppUi());
    59             static_cast<CMPSettingsAppUi*> (CCoeEnv::Static()->AppUi());
    69     iLandscapeSupportedByDevice = AppUi->OrientationCanBeChanged();
    60     iLandscapeSupportedByDevice = AppUi->OrientationCanBeChanged();
    70     
    61     
    83 // -----------------------------------------------------------------------------
    74 // -----------------------------------------------------------------------------
    84 //
    75 //
    85 CMPSettingsVideoSettingItemList::~CMPSettingsVideoSettingItemList()
    76 CMPSettingsVideoSettingItemList::~CMPSettingsVideoSettingItemList()
    86     {   
    77     {   
    87     MPX_DEBUG1(_L("#MS# CMPSettingsVideoSettingItemList::~CMPSettingsVideoSettingItemList()"));
    78     MPX_DEBUG1(_L("#MS# CMPSettingsVideoSettingItemList::~CMPSettingsVideoSettingItemList()"));
    88     delete iDriveMonitor;
       
    89     }
    79     }
    90 
    80 
    91 // -----------------------------------------------------------------------------
    81 // -----------------------------------------------------------------------------
    92 // CMPSettingsVideoSettingItemList::EditItemL
    82 // CMPSettingsVideoSettingItemList::EditItemL
    93 // -----------------------------------------------------------------------------
    83 // -----------------------------------------------------------------------------
   108          case EMPSettVideoContrastSettingId:
    98          case EMPSettVideoContrastSettingId:
   109             {
    99             {
   110             CAknSettingItemList::EditItemL( itemIndex, aCalledFromMenu );
   100             CAknSettingItemList::EditItemL( itemIndex, aCalledFromMenu );
   111             break;
   101             break;
   112             }
   102             }
   113         
   103 
   114          case EVcSettingsViewParentControlItem:     
       
   115             {
       
   116             EditParentControlItemL( itemIndex, aCalledFromMenu );
       
   117             break;
       
   118             }
       
   119         
       
   120          case EVcSettingsViewMemoryItem:
       
   121             {
       
   122             EditPreferredMemoryItemL( itemIndex, aCalledFromMenu );
       
   123             break;    
       
   124             }
       
   125           
       
   126          case EVcSettingsViewThumbnails:    
       
   127             {
       
   128             EditThumbnailItemL( itemIndex, aCalledFromMenu );
       
   129             break;
       
   130             }
       
   131          case EVcSettingsviewIadUpdateItem:     
       
   132             {
       
   133             // Not editable
       
   134             storeModifiedSetting = EFalse;
       
   135             }
       
   136             break;
       
   137          
       
   138          default:
   104          default:
   139             break;
   105             break;
   140          }
   106          }
   141     
   107     
   142     if ( storeModifiedSetting )
   108     if ( storeModifiedSetting )
   158                 break;
   124                 break;
   159             }
   125             }
   160         }
   126         }
   161     }
   127     }
   162 
   128 
   163 // -----------------------------------------------------------------------------
       
   164 // CMPSettingsVideoSettingItemList::EditThumbnailItemL
       
   165 // -----------------------------------------------------------------------------
       
   166 //
       
   167 void CMPSettingsVideoSettingItemList::EditThumbnailItemL( TInt itemIndex, TBool aCalledFromMenu )
       
   168     {
       
   169     if ( aCalledFromMenu )
       
   170         {
       
   171         CAknSettingItemList::EditItemL( itemIndex, aCalledFromMenu);
       
   172         (*SettingItemArray())[itemIndex]->StoreL();
       
   173         }
       
   174     else
       
   175         {
       
   176         if (iSettingThumbnails)
       
   177             {
       
   178             iSettingThumbnails = 0;
       
   179             }
       
   180         else
       
   181             {
       
   182             iSettingThumbnails = 1;
       
   183             }
       
   184         (*SettingItemArray())[itemIndex]->LoadL();
       
   185         (*SettingItemArray())[itemIndex]->UpdateListBoxTextL();
       
   186         }
       
   187     
       
   188         iVideoSettingsEngine.SetVideoOnDemandThumbnails(
       
   189                         iSettingThumbnails);
       
   190         DrawDeferred();
       
   191     }
       
   192 
       
   193 // -----------------------------------------------------------------------------
       
   194 // CMPSettingsVideoSettingItemList::EditParentControlItemL
       
   195 // -----------------------------------------------------------------------------
       
   196 //
       
   197 void CMPSettingsVideoSettingItemList::EditParentControlItemL( 
       
   198     TInt itemIndex, 
       
   199     TBool aCalledFromMenu )
       
   200     {
       
   201     if (!iLockCodeAccepted)
       
   202         {
       
   203         iLockCodeAccepted = iVideoSettingsEngine.CheckLockCodeL();
       
   204         }
       
   205     if (iLockCodeAccepted)
       
   206         {
       
   207         // can edit setting
       
   208         iParentControlIndex = GetCurrentParentControl();
       
   209         CAknSettingItemList::EditItemL( itemIndex, aCalledFromMenu );
       
   210         (*SettingItemArray())[itemIndex]->StoreL();
       
   211         }
       
   212     
       
   213     SetCurrentParentControl( iParentControlIndex );
       
   214     iParentControlIndex = GetCurrentParentControl();
       
   215     }
       
   216 
       
   217 // -----------------------------------------------------------------------------
       
   218 // CMPSettingsVideoSettingItemList::EditPreferredMemoryItemL
       
   219 // -----------------------------------------------------------------------------
       
   220 //
       
   221 void CMPSettingsVideoSettingItemList::EditPreferredMemoryItemL( 
       
   222         TInt itemIndex, 
       
   223         TBool 
       
   224 #ifndef RD_MULTIPLE_DRIVE_ENABLERS
       
   225         aCalledFromMenu 
       
   226 #endif 
       
   227         )
       
   228     {
       
   229     TInt drive;
       
   230     iVideoSettingsEngine.GetUsedMemoryL(drive);
       
   231     iSettingMemory = iDriveMonitor->ArrayPos(drive);
       
   232     if (iSettingMemory == KErrNotFound)
       
   233         {
       
   234         iSettingMemory = 0;
       
   235         }
       
   236 
       
   237 #ifndef RD_MULTIPLE_DRIVE_ENABLERS
       
   238     const TInt KThree( 3 );
       
   239     if ( iDriveMonitor->iAvailableDrives.Count() < KThree && !aCalledFromMenu )
       
   240         {
       
   241         if ( iSettingMemory == 1 )
       
   242             {
       
   243             iSettingMemory = 0;
       
   244             }
       
   245         else
       
   246             {
       
   247             iSettingMemory = 1;
       
   248             }
       
   249         }
       
   250     else
       
   251         {
       
   252         CAknSettingItemList::EditItemL( aIndex, aCalledFromMenu );
       
   253         ( *SettingItemArray() )[aIndex]->StoreL();
       
   254         }
       
   255 #else
       
   256 
       
   257     TBool driveSelected(EFalse);
       
   258 
       
   259     TDriveNumber selectedMem;
       
   260     TInt includedMedias = 0;
       
   261 
       
   262     if (iDriveMonitor->PhoneMemoryDrive() != KErrNotFound)
       
   263         {
       
   264         includedMedias = AknCommonDialogsDynMem::EMemoryTypePhone;
       
   265         }
       
   266 
       
   267     includedMedias |= AknCommonDialogsDynMem::EMemoryTypeMMCExternal
       
   268             | AknCommonDialogsDynMem::EMemoryTypeInternalMassStorage;
       
   269 
       
   270     CAknMemorySelectionDialogMultiDrive* dlg =
       
   271             CAknMemorySelectionDialogMultiDrive::NewL(
       
   272                     ECFDDialogTypeSelect,
       
   273                     R_MTV_MEMORY_SELECTION_DIALOG, EFalse,
       
   274                     includedMedias);
       
   275     CleanupStack::PushL(dlg);
       
   276     driveSelected = dlg->ExecuteL(selectedMem);
       
   277     CleanupStack::PopAndDestroy(dlg);
       
   278 
       
   279     if (driveSelected)
       
   280         {
       
   281         iSettingMemory = iDriveMonitor->ArrayPos(selectedMem);
       
   282         }
       
   283        
       
   284 #endif
       
   285    
       
   286     if ( iSettingMemory != KErrNotFound )
       
   287         {
       
   288         (*SettingItemArray())[itemIndex]->LoadL();
       
   289         (*SettingItemArray())[itemIndex]->UpdateListBoxTextL();
       
   290    
       
   291         iVideoSettingsEngine.SetUsedMemory( 
       
   292                 iDriveMonitor->iAvailableDrives[iSettingMemory].iDrive );
       
   293         }
       
   294     DrawDeferred();
       
   295     }
       
   296 
       
   297 // --------------------------------------------------------------------------
   129 // --------------------------------------------------------------------------
   298 // CMPSettingsVideoSettingItemList::HandleListBoxEventL()
   130 // CMPSettingsVideoSettingItemList::HandleListBoxEventL()
   299 // --------------------------------------------------------------------------
   131 // --------------------------------------------------------------------------
   300 //
   132 //
   301 void CMPSettingsVideoSettingItemList::HandleListBoxEventL(
   133 void CMPSettingsVideoSettingItemList::HandleListBoxEventL(
   354     MPX_DEBUG1(_L("#MS# CMPSettingsVideoSettingItemList::LoadSettingsL()"));
   186     MPX_DEBUG1(_L("#MS# CMPSettingsVideoSettingItemList::LoadSettingsL()"));
   355     // Get setting values from settings model
   187     // Get setting values from settings model
   356     LoadAllL();
   188     LoadAllL();
   357 
   189 
   358     CAknSettingItemList::LoadSettingsL();
   190     CAknSettingItemList::LoadSettingsL();
   359     
       
   360     FinishConstructionL();
       
   361     }
   191     }
   362 
   192 
   363 // -----------------------------------------------------------------------------
   193 // -----------------------------------------------------------------------------
   364 // CMPSettingsVideoSettingItemList::CreateSettingItemL
   194 // CMPSettingsVideoSettingItemList::CreateSettingItemL
   365 // -----------------------------------------------------------------------------
   195 // -----------------------------------------------------------------------------
   380 			    {
   210 			    {
   381                 settingItem->SetHidden( ETrue );
   211                 settingItem->SetHidden( ETrue );
   382 				}
   212 				}
   383             break;
   213             break;
   384             }
   214             }
   385         case EVcSettingsViewParentControlItem:
       
   386             {
       
   387             iParentControlIndex = GetCurrentParentControl();
       
   388 
       
   389             iSettingParentControlItem
       
   390                     = new (ELeave) CAknEnumeratedTextPopupSettingItem(
       
   391                             aSettingId, iParentControlIndex);
       
   392             return iSettingParentControlItem;
       
   393             }
       
   394 
       
   395         case EVcSettingsViewMemoryItem:
       
   396             {
       
   397             if (!iDriveMonitor)
       
   398                 {
       
   399                 iDriveMonitor = CVideoSettingsDriveMonitor::NewL();
       
   400                 iDriveMonitor->RegisterObserverL(this);
       
   401                 }
       
   402 
       
   403             TInt drive;
       
   404             iVideoSettingsEngine.GetUsedMemoryL(drive);
       
   405             iSettingMemory = iDriveMonitor->ArrayPos(drive);
       
   406             if (iSettingMemory == KErrNotFound)
       
   407                 {
       
   408                 iSettingMemory = 0;
       
   409                 }
       
   410 
       
   411             iSettingMemoryItem
       
   412                     = new (ELeave) CAknEnumeratedTextPopupSettingItem(
       
   413                             aSettingId, iSettingMemory);
       
   414 
       
   415             return iSettingMemoryItem;
       
   416             }
       
   417 
       
   418         case EVcSettingsviewIadUpdateItem:
       
   419             {
       
   420             // Set text value to empty. The version number is displayed by
       
   421             // changing the string of empty item in UpdateVersionNumberTextL().
       
   422             iSettingVersionText = KNullDesC();
       
   423             iSettingIadUpdateItem = new (ELeave) CAknTextSettingItem(
       
   424                     aSettingId, iSettingVersionText);
       
   425             return iSettingIadUpdateItem;
       
   426             }
       
   427        
       
   428         case EVcSettingsViewThumbnails:
       
   429             {
       
   430             iVideoSettingsEngine.GetVideoOnDemandThumbnails(iSettingThumbnails);
       
   431             iSettingThumbnailsItem
       
   432                     = new (ELeave) CAknEnumeratedTextPopupSettingItem(
       
   433                             aSettingId, iSettingThumbnails);
       
   434             return iSettingThumbnailsItem;
       
   435             }   
       
   436             
       
   437         default:
   215         default:
   438             break;
   216             break;
   439         }
   217         }
   440 
   218 
   441     return settingItem;   
   219     return settingItem;   
   489     iModel->LoadSettingsL(EConfigUser);
   267     iModel->LoadSettingsL(EConfigUser);
   490     LoadSettingL(EMPSettVideoContrastSettingId);
   268     LoadSettingL(EMPSettVideoContrastSettingId);
   491     }
   269     }
   492 
   270 
   493 // --------------------------------------------------------------------------
   271 // --------------------------------------------------------------------------
   494 // CMPSettingsVideoSettingItemList::FinishConstructionL()
       
   495 // --------------------------------------------------------------------------
       
   496 //
       
   497 void CMPSettingsVideoSettingItemList::FinishConstructionL()
       
   498     {
       
   499     UpdateMemoryItemTextL();
       
   500     UpdateVersionNumberTextL();
       
   501     UpdateParentControlTextL();
       
   502     }
       
   503 
       
   504 // --------------------------------------------------------------------------
       
   505 // CMPSettingsVideoSettingItemList::UpdateVersionNumberTextL()
       
   506 // --------------------------------------------------------------------------
       
   507 //
       
   508 void CMPSettingsVideoSettingItemList::UpdateVersionNumberTextL()
       
   509     {
       
   510     Swi::RSisRegistrySession sisRegistrySession;
       
   511 
       
   512     if ( sisRegistrySession.Connect() == KErrNone )
       
   513         {
       
   514         CleanupClosePushL( sisRegistrySession );
       
   515 
       
   516         if ( sisRegistrySession.IsInstalledL( KSisUid ) )
       
   517             {
       
   518             Swi::RSisRegistryEntry sisRegistryEntry;
       
   519             TInt error = sisRegistryEntry.Open( sisRegistrySession, KSisUid );
       
   520             if ( error == KErrNone )
       
   521                 {
       
   522                 CleanupClosePushL( sisRegistryEntry );
       
   523                 TVersion vcVersion( sisRegistryEntry.VersionL() );
       
   524                 CleanupStack::PopAndDestroy( &sisRegistryEntry );
       
   525 
       
   526                 HBufC* versionString = HBufC::NewLC( KMaxVersionNumberLength );
       
   527                 TPtr versionPtr( versionString->Des() );
       
   528                 versionPtr.Format(
       
   529                         KVersionNumberFormat,
       
   530                         vcVersion.iMajor,
       
   531                         vcVersion.iMinor,
       
   532                         vcVersion.iBuild );
       
   533                 iSettingIadUpdateItem->SetEmptyItemTextL( *versionString );
       
   534                 CleanupStack::PopAndDestroy( versionString );
       
   535                 iSettingIadUpdateItem->UpdateListBoxTextL();
       
   536                 }
       
   537             }
       
   538         CleanupStack::PopAndDestroy( &sisRegistrySession );
       
   539         }
       
   540     }
       
   541 
       
   542 // --------------------------------------------------------------------------
       
   543 // Build dynamic listbox for parental control selection.
       
   544 // --------------------------------------------------------------------------
       
   545 //
       
   546 void CMPSettingsVideoSettingItemList::UpdateParentControlTextL()
       
   547     {
       
   548     // Set up the dynamic texts for this setting item. Choices are:
       
   549     //
       
   550     // 0:    Parent control not in use.
       
   551     // 1-15: Selected minimum age 4-18.
       
   552 
       
   553     CArrayPtrFlat<CAknEnumeratedText>* enumeratedTextArray =
       
   554         new ( ELeave ) CArrayPtrFlat<CAknEnumeratedText>(
       
   555             KParentControlSelections );
       
   556     CleanupStack::PushL( enumeratedTextArray );
       
   557     CArrayPtr<HBufC>* poppedUpTextArray =
       
   558         new ( ELeave ) CArrayPtrFlat<HBufC>( KParentControlSelections );
       
   559     CleanupStack::PushL( poppedUpTextArray );
       
   560 
       
   561     HBufC* parentControlStrOff1 = NULL;
       
   562     HBufC* parentControlStrOff2 = NULL;
       
   563 
       
   564     parentControlStrOff1 =
       
   565         StringLoader::LoadLC( R_IPTV_PARENTAL_CONTROL_OFF );
       
   566     parentControlStrOff2 =
       
   567         StringLoader::LoadLC( R_IPTV_PARENTAL_CONTROL_OFF );
       
   568 
       
   569     CAknEnumeratedText* enumeratedTextOff =
       
   570         new ( ELeave ) CAknEnumeratedText( 0, parentControlStrOff1 );
       
   571     CleanupStack::PushL( enumeratedTextOff );
       
   572     enumeratedTextArray->AppendL( enumeratedTextOff );
       
   573     poppedUpTextArray->AppendL( parentControlStrOff2 );
       
   574     CleanupStack::Pop( enumeratedTextOff );
       
   575     CleanupStack::Pop( parentControlStrOff2 );
       
   576     CleanupStack::Pop( parentControlStrOff1 );
       
   577 
       
   578     for ( TInt age = KParentControlMinAge; age <= KParentControlAdult; age++ )
       
   579         {
       
   580         HBufC* parentControlStr1 = NULL;
       
   581         HBufC* parentControlStr2 = NULL;
       
   582 
       
   583         parentControlStr1 =
       
   584             StringLoader::LoadLC( R_IPTV_PARENTAL_CONTROL_N_YEARS, age );
       
   585         parentControlStr2 =
       
   586             StringLoader::LoadLC( R_IPTV_PARENTAL_CONTROL_N_YEARS, age );
       
   587 
       
   588         CAknEnumeratedText* enumeratedText =
       
   589             new ( ELeave ) CAknEnumeratedText(
       
   590                 age - KParentControlIndexShift, parentControlStr1 );
       
   591         CleanupStack::PushL( enumeratedText );
       
   592         enumeratedTextArray->AppendL( enumeratedText );
       
   593         poppedUpTextArray->AppendL( parentControlStr2 );
       
   594         CleanupStack::Pop( enumeratedText );
       
   595 
       
   596         CleanupStack::Pop( parentControlStr2 );
       
   597         CleanupStack::Pop( parentControlStr1 );
       
   598         }
       
   599 
       
   600     CleanupStack::Pop( poppedUpTextArray );
       
   601     CleanupStack::Pop( enumeratedTextArray );
       
   602 
       
   603     iSettingParentControlItem->SetEnumeratedTextArrays(
       
   604         enumeratedTextArray,
       
   605         poppedUpTextArray );
       
   606     iSettingParentControlItem->HandleTextArrayUpdateL();
       
   607     iSettingParentControlItem->UpdateListBoxTextL();
       
   608     }
       
   609 
       
   610 
       
   611 // --------------------------------------------------------------------------
       
   612 // Fetch current parent control age and return corresponding index.
       
   613 // --------------------------------------------------------------------------
       
   614 //
       
   615 TInt CMPSettingsVideoSettingItemList::GetCurrentParentControl()
       
   616     {
       
   617     TInt parentControlAge( 0 );
       
   618     TInt parentControlIndex( 0 );
       
   619 
       
   620     if ( !iVideoSettingsEngine.GetParentControl( parentControlAge ) )
       
   621         {
       
   622         parentControlAge = KIptvCenRepParentControlKeyDefault;
       
   623         }
       
   624 
       
   625     // Fix age as index.
       
   626     if ( KParentControlAdult < parentControlAge )
       
   627         {
       
   628         parentControlIndex = KParentControlMaxIndex;
       
   629         }
       
   630     else if ( KParentControlMinAge <= parentControlAge )
       
   631         {
       
   632         parentControlIndex = parentControlAge - KParentControlIndexShift;
       
   633         }
       
   634     else
       
   635         {
       
   636         parentControlIndex = KParentControlOff;
       
   637         }
       
   638 
       
   639     return parentControlIndex;
       
   640     }
       
   641 
       
   642 // -----------------------------------------------------------------------------
       
   643 // CMPSettingsVideoSettingItemList::HandleDriveMonitorEvent
       
   644 // -----------------------------------------------------------------------------
       
   645 //
       
   646 void CMPSettingsVideoSettingItemList::HandleDriveMonitorEvent( 
       
   647         TIptvDriveMonitorEvent& /*aEvent*/ )
       
   648     {
       
   649     TRAP_IGNORE( UpdateMemoryItemTextL() );       
       
   650     }
       
   651 
       
   652 // --------------------------------------------------------------------------
       
   653 // CVcSettingsViewSettingsListbox::UpdateMemoryItemTextL()
       
   654 // --------------------------------------------------------------------------
       
   655 //
       
   656 void CMPSettingsVideoSettingItemList::UpdateMemoryItemTextL()
       
   657     {
       
   658     MPX_FUNC(
       
   659         "CMPSettingsVideoSettingItemList::UpdateMemoryItemTextL() start");
       
   660 
       
   661     if ( !iDriveMonitor )
       
   662         {
       
   663         iDriveMonitor = CVideoSettingsDriveMonitor::NewL();
       
   664         iDriveMonitor->RegisterObserverL( this );
       
   665         }
       
   666 
       
   667     CArrayPtrFlat<CAknEnumeratedText>* enumeratedTextArray =
       
   668         new ( ELeave ) CArrayPtrFlat<CAknEnumeratedText>( 2 );
       
   669     CleanupStack::PushL( enumeratedTextArray ); // 1->
       
   670     
       
   671     CArrayPtr<HBufC>*  poppedUpTextArray  =
       
   672         new ( ELeave ) CArrayPtrFlat<HBufC>( 2 );
       
   673     CleanupStack::PushL( poppedUpTextArray ); // 2->
       
   674 
       
   675     TInt i;
       
   676     TInt listIndex = 0;
       
   677     for ( i = 0; i < iDriveMonitor->iAvailableDrives.Count(); i++ )
       
   678         {
       
   679         if ( (iDriveMonitor->iAvailableDrives[i].iFlags &
       
   680                         TIptvDriveInfo::ERemovable) )
       
   681             {
       
   682             /*
       
   683              * MMC
       
   684              */
       
   685             if ( (iDriveMonitor->iAvailableDrives[i].iFlags & 
       
   686                             TIptvDriveInfo::EMediaNotPresent) )
       
   687                 {
       
   688                 //removable media not present -> Memory card
       
   689                 MPX_DEBUG1(_L("CMPSettingsVideoSettingItemList:: media not present, adding memory card to the list"));
       
   690                 
       
   691                 AddMemoryCardDesToArraysL( listIndex++, 
       
   692                                            *enumeratedTextArray, 
       
   693                                            *poppedUpTextArray );
       
   694                 }
       
   695             else
       
   696                 {
       
   697                 if ( (iDriveMonitor->iAvailableDrives[i].iFlags & 
       
   698                                 TIptvDriveInfo::ELocked) )
       
   699                     {
       
   700                     //removable media present and locked -> Locked memory card
       
   701                     MPX_DEBUG1(_L("CMPSettingsVideoSettingItemList:: Adding locked memory card to the list"));
       
   702                     
       
   703                     AddLockedMemoryCardDesToArraysL( listIndex++, 
       
   704                                                      *enumeratedTextArray, 
       
   705                                                      *poppedUpTextArray );
       
   706                     }
       
   707                 else
       
   708                     {
       
   709                     //removable media present and not locked
       
   710                     if ( iDriveMonitor->iAvailableDrives[i].iVolumeName.Length() > 0 )
       
   711                         {
       
   712                         //removable media present, not locked and name text exits-> Volume name
       
   713                         MPX_DEBUG1(_L("CMPSettingsVideoSettingItemList:: adding volume name to the list"));
       
   714                         HBufC* volumeName = 
       
   715                             HBufC::NewL( iDriveMonitor->iAvailableDrives[i].iVolumeName.Length() );
       
   716                         CleanupStack::PushL( volumeName ); // 3->
       
   717                         volumeName->Des() = iDriveMonitor->iAvailableDrives[i].iVolumeName;
       
   718                         AddDesToArraysL( listIndex++, 
       
   719                                          volumeName, 
       
   720                                          *enumeratedTextArray, 
       
   721                                          *poppedUpTextArray );
       
   722                         CleanupStack::Pop( volumeName ); // <-3
       
   723                         }
       
   724                     else
       
   725                         {
       
   726                         //removable media present, not locked and label text does not exit-> Memory card
       
   727                         MPX_DEBUG1(_L("CMPSettingsVideoSettingItemList:: volume name not defined, adding memory card to the list") );
       
   728                         AddMemoryCardDesToArraysL( listIndex++, 
       
   729                                                    *enumeratedTextArray,
       
   730                                                    *poppedUpTextArray );
       
   731                         }
       
   732                     }
       
   733                 }
       
   734             }
       
   735         else
       
   736             {
       
   737             /*
       
   738              * Fixed drive
       
   739              */
       
   740             if ( iDriveMonitor->iAvailableDrives[i].iDrive == 
       
   741                     iDriveMonitor->PhoneMemoryDrive() )
       
   742                 {
       
   743                 //2 = c-drive -> Phone Memory
       
   744                 MPX_DEBUG1(_L("CMPSettingsVideoSettingItemList:: adding Phone memory to the list"));
       
   745                 AddPhoneMemoryDesToArraysL( listIndex++, 
       
   746                                             *enumeratedTextArray, 
       
   747                                             *poppedUpTextArray );
       
   748                 }
       
   749             else
       
   750                 {
       
   751                 //->Hard disk
       
   752                 MPX_DEBUG1(_L("CMPSettingsVideoSettingItemList:: adding Hard disk to the list"));
       
   753                 AddHardDiskDesToArraysL( listIndex++, 
       
   754                                          *enumeratedTextArray, 
       
   755                                          *poppedUpTextArray );
       
   756                 }
       
   757             }
       
   758         }
       
   759 
       
   760     iSettingMemoryItem->SetEnumeratedTextArrays(
       
   761         enumeratedTextArray, poppedUpTextArray );
       
   762     iSettingMemoryItem->HandleTextArrayUpdateL();
       
   763     iSettingMemoryItem->UpdateListBoxTextL();
       
   764 
       
   765     CleanupStack::Pop( poppedUpTextArray );   // <-2
       
   766     CleanupStack::Pop( enumeratedTextArray ); // <-1     
       
   767 	
       
   768     DrawDeferred();
       
   769     }
       
   770 
       
   771 // --------------------------------------------------------------------------
       
   772 // CMPSettingsVideoSettingItemList::AddPhoneMemoryDesToArraysL()
       
   773 // --------------------------------------------------------------------------
       
   774 //
       
   775 void CMPSettingsVideoSettingItemList::AddPhoneMemoryDesToArraysL( TInt aIndex,
       
   776                               CArrayPtrFlat<CAknEnumeratedText>& aEnumeratedTextArray,
       
   777                               CArrayPtr<HBufC>&  aPoppedUpTextArray )
       
   778     {
       
   779     HBufC* phoneMemoryDes = StringLoader::LoadLC( R_IPTV_SETTING_PHONE_MEMORY ); // 1->
       
   780     AddDesToArraysL( aIndex, phoneMemoryDes, aEnumeratedTextArray, aPoppedUpTextArray );
       
   781     CleanupStack::Pop( phoneMemoryDes ); // <-1
       
   782     }
       
   783 
       
   784 // --------------------------------------------------------------------------
       
   785 // CMPSettingsVideoSettingItemList::AddMemoryCardDesToArraysL()
       
   786 // --------------------------------------------------------------------------
       
   787 //
       
   788 void CMPSettingsVideoSettingItemList::AddMemoryCardDesToArraysL( TInt aIndex,
       
   789                             CArrayPtrFlat<CAknEnumeratedText>& aEnumeratedTextArray,
       
   790                             CArrayPtr<HBufC>&  aPoppedUpTextArray )
       
   791     {
       
   792     HBufC* memoryCardDes = StringLoader::LoadLC( R_IPTV_SETTING_MEMORY_CARD ); // 1->
       
   793     AddDesToArraysL( aIndex, memoryCardDes, aEnumeratedTextArray, aPoppedUpTextArray );
       
   794     CleanupStack::Pop( memoryCardDes ); // <-1
       
   795     }
       
   796 
       
   797 // --------------------------------------------------------------------------
       
   798 // CVcSettingsViewSettingsListbox::AddLockedMemoryCardDesToArraysL()
       
   799 // --------------------------------------------------------------------------
       
   800 //
       
   801 void CMPSettingsVideoSettingItemList::AddLockedMemoryCardDesToArraysL( TInt aIndex,
       
   802                             CArrayPtrFlat<CAknEnumeratedText>& aEnumeratedTextArray,
       
   803                             CArrayPtr<HBufC>&  aPoppedUpTextArray )
       
   804     {
       
   805     HBufC* lockedMemoryCardDes = StringLoader::LoadLC( R_IPTV_LOCKED_MEMORY_CARD ); // 1->
       
   806     AddDesToArraysL( aIndex, lockedMemoryCardDes, aEnumeratedTextArray, aPoppedUpTextArray);
       
   807     CleanupStack::Pop( lockedMemoryCardDes ); // <-1
       
   808     }
       
   809 
       
   810 // --------------------------------------------------------------------------
       
   811 // CMPSettingsVideoSettingItemList::AddHardDiskDesToArraysL()
       
   812 // --------------------------------------------------------------------------
       
   813 //
       
   814 void CMPSettingsVideoSettingItemList::AddHardDiskDesToArraysL( TInt aIndex,
       
   815                             CArrayPtrFlat<CAknEnumeratedText>& aEnumeratedTextArray,
       
   816                             CArrayPtr<HBufC>&  aPoppedUpTextArray )
       
   817     {
       
   818     HBufC* hardDiskDes = StringLoader::LoadLC( R_IPTV_SETTING_MASS_MEMORY ); // 1->
       
   819     AddDesToArraysL( aIndex, hardDiskDes, aEnumeratedTextArray, aPoppedUpTextArray);
       
   820     CleanupStack::Pop( hardDiskDes ); // <-1
       
   821     }
       
   822 
       
   823 // --------------------------------------------------------------------------
       
   824 // CMPSettingsVideoSettingItemList::AddDesToArraysL()
       
   825 // NOTE: Codescanner whines about passing non const HBufC,
       
   826 // but that's needed for CAknEnumeratedText construction.
       
   827 // --------------------------------------------------------------------------
       
   828 //
       
   829 void CMPSettingsVideoSettingItemList::AddDesToArraysL( TInt aIndex, HBufC* aText,
       
   830                             CArrayPtrFlat<CAknEnumeratedText>& aEnumeratedTextArray,
       
   831                             CArrayPtr<HBufC>&  aPoppedUpTextArray )
       
   832     {
       
   833     CAknEnumeratedText* enumeratedText =
       
   834         new ( ELeave ) CAknEnumeratedText( aIndex, aText );
       
   835     CleanupStack::PushL( enumeratedText ); //1->
       
   836     aEnumeratedTextArray.AppendL( enumeratedText );
       
   837     CleanupStack::Pop( enumeratedText ); // <-1
       
   838     
       
   839     HBufC* textCopy = HBufC::NewL( aText->Des().Length() );
       
   840     CleanupStack::PushL( textCopy ); // 1->
       
   841     textCopy->Des() = aText->Des();
       
   842     
       
   843     aPoppedUpTextArray.AppendL( textCopy );
       
   844     CleanupStack::Pop( textCopy ); // <-1
       
   845     }
       
   846 
       
   847 // --------------------------------------------------------------------------
       
   848 // Convert and save parent control index as age.
       
   849 // --------------------------------------------------------------------------
       
   850 //
       
   851 void CMPSettingsVideoSettingItemList::SetCurrentParentControl(
       
   852     TInt aParentControlIndex )
       
   853     {
       
   854     TInt parentControlAge( 0 );
       
   855 
       
   856     // Fix index as age.
       
   857     if ( KParentControlMaxIndex < aParentControlIndex )
       
   858         {
       
   859         parentControlAge = KParentControlAdult;
       
   860         }
       
   861     else if ( 1 <= aParentControlIndex )
       
   862         {
       
   863         parentControlAge = aParentControlIndex + KParentControlIndexShift;
       
   864         }
       
   865     else
       
   866         {
       
   867         parentControlAge = 0;
       
   868         }
       
   869 
       
   870     iVideoSettingsEngine.SetParentControl( parentControlAge );
       
   871     }
       
   872 
       
   873 // --------------------------------------------------------------------------
       
   874 // Check if video contrast is supported.
   272 // Check if video contrast is supported.
   875 // --------------------------------------------------------------------------
   273 // --------------------------------------------------------------------------
   876 //
   274 //
   877 TBool CMPSettingsVideoSettingItemList::VideoContrastIsSupportedL()
   275 TBool CMPSettingsVideoSettingItemList::VideoContrastIsSupportedL()
   878     {
   276     {
   879     TInt flags;
   277     // As video contrast is only item in video settings list, 
   880 
   278     // we can assume here that contrast is supported, because
   881     CRepository* repository = CRepository::NewL( KCRUidMediaPlayerFeatures );
   279     // it has been already checked in AppUi/GsPlugin level.
   882     repository->Get( KMPLocalVariation, flags );
   280     return ETrue;
   883     delete repository;
   281     
   884 
       
   885     if ( flags & KMediaPlayerVideoContrast )
       
   886         {
       
   887         return ETrue;
       
   888         }
       
   889     
       
   890     return EFalse;
       
   891     }
   282     }
   892 
   283 
   893 //  End of File  
   284 //  End of File