filemanager/Engine/src/CFileManagerUtils.cpp
branchRCL_3
changeset 52 40fb776cbfb3
parent 42 f5c50b8af68c
--- a/filemanager/Engine/src/CFileManagerUtils.cpp	Wed Sep 15 11:58:56 2010 +0300
+++ b/filemanager/Engine/src/CFileManagerUtils.cpp	Wed Oct 13 14:17:31 2010 +0300
@@ -885,62 +885,58 @@
         const TInt aDrive,
         const TInt aTextIdForDefaultName,
         const TInt aTextIdForName ) const
-    {  
-    // get drive letter and drive name
+    {
     TUint driveStatus( 0 );
+    HBufC* ret = NULL;
     CDesCArray* array = GetDriveNameArrayLC( aDrive, driveStatus );
-    
-    // get the format string for drive name
-    HBufC* ret = NULL; 
     if ( aTextIdForName && array->MdcaCount() > 1 )
         {
-        // named resource is available
-        // resource needs two paraments
-        ret = StringLoader::LoadL( aTextIdForName,*array );
+        ret = StringLoader::LoadL(
+            aTextIdForName,
+            *array );
         }
-    // default resource is available
     else if ( aTextIdForDefaultName )
         {
-        // USB memory 
-        if ( driveStatus & DriveInfo::EDriveUsbMemory )
-            {
-            // alloc array for usb letter name and drive name
-            CDesCArray* usbLetterAndName = new ( ELeave ) CDesCArrayFlat( KDriveNameArrayLen );
-            CleanupStack::PushL( usbLetterAndName );
-            
-            // append driver letter 
-            TPtrC16 driveLetter = array->MdcaPoint( KDriveLetterIndex );
-            usbLetterAndName->AppendL( driveLetter );
-            
-            // USB is already named, just append it 
-            if ( array->MdcaCount() > 1 )
-                {
-                TPtrC16 drivename=array->MdcaPoint( KDriveNameIndex );
-                usbLetterAndName->AppendL( drivename );
-                }
-            // USB is still not named,append default name
-            else
-                {
-                HBufC* usbDefaultName = StringLoader::LoadLC( R_QTN_FMGR_USB_MEMORY_DEFAULT_NAME );
-                usbLetterAndName->AppendL( *usbDefaultName );
-                CleanupStack::PopAndDestroy( usbDefaultName );
-                }
-            ret = StringLoader::LoadL( aTextIdForDefaultName,*usbLetterAndName );
-            // pop and destory the array for usb letter name and drive name
-            CleanupStack::PopAndDestroy( usbLetterAndName );
-            }
-        // other drives
-        else
-            {
-            ret = StringLoader::LoadL( aTextIdForDefaultName, array->MdcaPoint( KDriveLetterIndex ) );
-            }
+			if( driveStatus & DriveInfo::EDriveUsbMemory )
+				{
+				CDesCArray* usbLetterName = new ( ELeave ) CDesCArrayFlat( KDriveNameArrayLen );
+				CleanupStack::PushL( usbLetterName );
+				
+				TPtrC16 driveletter=array->MdcaPoint( KDriveLetterIndex );
+				usbLetterName->AppendL( driveletter );							
+				HBufC* usbDriveDefaultName = NULL;			
+				if(array->MdcaCount() > 1 )
+					{
+					TPtrC16 drivename=array->MdcaPoint( KDriveNameIndex );
+					usbLetterName->AppendL( drivename );
+					}
+				else
+					{
+				    usbDriveDefaultName = StringLoader::LoadLC( R_QTN_FMGR_USB_MEMORY_DEFAULT_NAME );
+				    TPtrC16 drivename = usbDriveDefaultName->Des();
+				    usbLetterName->AppendL( drivename );
+					}
+				
+				
+				ret = StringLoader::LoadL(
+				aTextIdForDefaultName,*usbLetterName );
+	
+				CleanupStack::PopAndDestroy( usbLetterName );
+				if ( usbDriveDefaultName )
+				    {
+				    CleanupStack::PopAndDestroy( usbDriveDefaultName );
+				    }
+			    }
+		    else
+			    {
+			    ret = StringLoader::LoadL(aTextIdForDefaultName, array->MdcaPoint(
+					KDriveLetterIndex));
+            	}
         }
-    // drive name is available
     else if (  array->MdcaCount() > 1 )
         {
         ret = array->MdcaPoint( KDriveNameIndex ).AllocL();
         }
-    // others
     else
         {
         User::Leave( KErrNotFound );