voicerecorder/AppSrc/CVRSettingsDialogMMCSupported.cpp
branchRCL_3
changeset 19 2f5c9ee7098c
parent 14 f962425b9f8b
equal deleted inserted replaced
17:41c99112ff9d 19:2f5c9ee7098c
    34 
    34 
    35 #ifdef RD_MULTIPLE_DRIVE
    35 #ifdef RD_MULTIPLE_DRIVE
    36 #include <AknCommonDialogsDynMem.h>
    36 #include <AknCommonDialogsDynMem.h>
    37 #include <driveinfo.h>
    37 #include <driveinfo.h>
    38 #include <CAknMemorySelectionDialogMultiDrive.h>
    38 #include <CAknMemorySelectionDialogMultiDrive.h>
    39 #endif
    39 #include <CAknMemorySelectionSettingItemMultiDrive.h>
    40 
    40 #endif
       
    41 
       
    42 // ListBox item index
       
    43 enum TListItemIndex
       
    44     {
       
    45     EListItemQualityIndex = 0,
       
    46     ElistItemMemoStoreIndex,
       
    47     };
    41 // ---------------------------------------------------------------------------
    48 // ---------------------------------------------------------------------------
    42 // CVRSettingsDialog::~CVRSettingsDialog
    49 // CVRSettingsDialog::~CVRSettingsDialog
    43 // 
    50 // 
    44 // ---------------------------------------------------------------------------
    51 // ---------------------------------------------------------------------------
    45 //
    52 //
   129 										( Control( EVRSettingsListboxId ) );
   136 										( Control( EVRSettingsListboxId ) );
   130 	User::LeaveIfNull( listBox );
   137 	User::LeaveIfNull( listBox );
   131     CAknSettingItem* settingItem;
   138     CAknSettingItem* settingItem;
   132   
   139   
   133     HBufC* itemTitle;
   140     HBufC* itemTitle;
   134    	TInt id( 0 );
       
   135     if ( VRUtils::FeatureEnabled( EVRFeatureShowQualitySetting ) )
   141     if ( VRUtils::FeatureEnabled( EVRFeatureShowQualitySetting ) )
   136         {
   142         {
   137     	// Add quality setting
   143     	// Add quality setting
   138 #ifdef  __AAC_ENCODER_PLUGIN    	
   144 #ifdef  __AAC_ENCODER_PLUGIN    	
   139     	settingItem = new( ELeave ) CAknEnumeratedTextPopupSettingItem ( 0, ( TInt& ) iQuality );
   145     	settingItem = new( ELeave ) CAknEnumeratedTextPopupSettingItem ( 0, ( TInt& ) iQuality );
   143 #endif
   149 #endif
   144 
   150 
   145     	CleanupStack::PushL( settingItem );
   151     	CleanupStack::PushL( settingItem );
   146 
   152 
   147     	itemTitle = iCoeEnv->AllocReadResourceLC( R_QTN_VOREC_SET_QUALITY );
   153     	itemTitle = iCoeEnv->AllocReadResourceLC( R_QTN_VOREC_SET_QUALITY );
   148     	settingItem->ConstructL( EFalse, id, *itemTitle, NULL,
   154     	settingItem->ConstructL( EFalse, EListItemQualityIndex, *itemTitle, NULL,
   149     	                     R_VR_SETTINGS_DEFAULT_SPEAKER_PAGE, EAknCtPopupField, NULL,
   155     	                     R_VR_SETTINGS_DEFAULT_SPEAKER_PAGE, EAknCtPopupField, NULL,
   150     						 R_VR_SETTINGS_QUALITY_TEXTS );
   156     						 R_VR_SETTINGS_QUALITY_TEXTS );
   151     	CleanupStack::PopAndDestroy();		// itemTitle
   157     	CleanupStack::PopAndDestroy();		// itemTitle
   152 
   158 
   153     	// Add quality item to the settings array
   159     	// Add quality item to the settings array
   154     	iSettingItemArray.AppendL( settingItem ); 
   160     	iSettingItemArray.AppendL( settingItem ); 
   155     	CleanupStack::Pop();	// settingItem
   161     	CleanupStack::Pop();	// settingItem
   156     	id++;
       
   157         }
   162         }
   158 
   163 
   159     if ( VRUtils::MultipleMassStorageAvailable() )
   164     if ( VRUtils::MultipleMassStorageAvailable() )
   160     	{
   165     	{
   161     	// Create the memo store item
   166     	// Create the memo store item
   171 	iSettingItemArray.AppendL( settingItem );
   176 	iSettingItemArray.AppendL( settingItem );
   172 	id++;
   177 	id++;
   173 	CleanupStack::Pop();	// settingItem
   178 	CleanupStack::Pop();	// settingItem
   174 
   179 
   175 #else    //multiple drives
   180 #else    //multiple drives
   176 
   181         settingItem = new( ELeave ) CAknMemorySelectionSettingItemMultiDrive(0, iDrive );
   177 	CAknMemorySelectionDialogMultiDrive* dlg = CAknMemorySelectionDialogMultiDrive::NewL(
   182         CleanupStack::PushL( settingItem );
   178     ECFDDialogTypeNormal, 
   183         TInt includedMedias = AknCommonDialogsDynMem::EMemoryTypeInternalMassStorage |
   179     R_VOREC_MEMORY_SELECTION_DIALOG, // Default resource Id
   184                                  AknCommonDialogsDynMem::EMemoryTypeMMCExternal;
   180     EFalse,
   185         static_cast< CAknMemorySelectionSettingItemMultiDrive *> ( settingItem )->SetIncludedMediasL( includedMedias );
   181     AknCommonDialogsDynMem::EMemoryTypeInternalMassStorage |
   186         // Set memo store item's title
   182     AknCommonDialogsDynMem::EMemoryTypeMMCExternal);
   187         settingItem->ConstructL( EFalse, ElistItemMemoStoreIndex, *itemTitle, NULL, 0, EAknSetListBox );
   183 
   188         // Add memo store item to the settings array
   184     CleanupStack::PushL( dlg );
   189         iSettingItemArray.AppendL( settingItem );
   185     TBool value = dlg->ExecuteL( iDrive );
   190         CleanupStack::Pop();	// settingItem
   186     CleanupStack::PopAndDestroy( dlg );
       
   187     if (value)
       
   188      	{
       
   189         VRUtils::SetMemoDriveL( iDrive );
       
   190        	}
       
   191  
   191  
   192 #endif
   192 #endif
   193 
   193 
   194 		CleanupStack::PopAndDestroy();	// itemTitle
   194 		CleanupStack::PopAndDestroy();	// itemTitle
   195 	}
   195 	}
   224 		case EEventItemDoubleClicked: // Pointer events (highlighted item before pressing) 
   224 		case EEventItemDoubleClicked: // Pointer events (highlighted item before pressing) 
   225 		case EEventEnterKeyPressed:	// Normal button presses
   225 		case EEventEnterKeyPressed:	// Normal button presses
   226 		case EEventEditingStarted: // From ProcessCommand->ECmdChange
   226 		case EEventEditingStarted: // From ProcessCommand->ECmdChange
   227 			{
   227 			{
   228 			TInt index( aListBox->CurrentItemIndex() );
   228 			TInt index( aListBox->CurrentItemIndex() );
       
   229 			TInt driveDefaultMassStorage = VRUtils::DefaultMemoDriveL();
       
   230 			TInt driveRemovableMassStorage = VRUtils::GetRemovableMassStorageL();
       
   231 			
   229 			if ( index >=0 )	// index is -1 if there are no items in the list
   232 			if ( index >=0 )	// index is -1 if there are no items in the list
   230 				{
   233 				{
       
   234 			    if(index == ElistItemMemoStoreIndex && 
       
   235 			        !VRUtils::DriveValid(driveDefaultMassStorage) && 
       
   236 			            !VRUtils::DriveValid(driveRemovableMassStorage) )
       
   237 			        {
       
   238 			        break;
       
   239 			        }
   231 			    iSettingItemArray.At( index )->EditItemL( 
   240 			    iSettingItemArray.At( index )->EditItemL( 
   232 				aEventType == EEventEditingStarted );
   241 				aEventType == EEventEditingStarted );
   233 			    aListBox->DrawItem( index );
   242 			    aListBox->DrawItem( index );
   234 				}
   243 				}
   235 			StoreAllSettingsL();	
   244 			StoreAllSettingsL();	
   333         
   342         
   334         	// use default device drive to save files
   343         	// use default device drive to save files
   335         	iDrive = (TDriveNumber)defaultDrive;
   344         	iDrive = (TDriveNumber)defaultDrive;
   336   			}
   345   			}
   337 	 	}
   346 	 	}
       
   347     if(iDrive == defaultDrive || iDrive == VRUtils::GetRemovableMassStorageL())
       
   348         {
   338         VRUtils::SetMemoDriveL( iDrive );
   349         VRUtils::SetMemoDriveL( iDrive );
       
   350         }
   339 #endif 
   351 #endif 
   340      
   352      
   341     if ( VRUtils::FeatureEnabled( EVRFeatureShowQualitySetting ) )
   353     if ( VRUtils::FeatureEnabled( EVRFeatureShowQualitySetting ) )
   342         {
   354         {
   343         // Save the quality setting	
   355         // Save the quality setting