codhandler/codui/src/CodDialog.cpp
changeset 10 a359256acfc6
parent 0 dd21522fd290
child 48 79859ed3eea9
equal deleted inserted replaced
5:10e98eab6f85 10:a359256acfc6
    22 #include <CAknMemorySelectionDialog.h>
    22 #include <CAknMemorySelectionDialog.h>
    23 #include <CodUi.rsg>
    23 #include <CodUi.rsg>
    24 #include "CodDialog.h"
    24 #include "CodDialog.h"
    25 #include "CodLogger.h"
    25 #include "CodLogger.h"
    26 #include <pathinfo.h>
    26 #include <pathinfo.h>
       
    27 #include <SysUtil.h>
       
    28 
    27 #ifndef RD_MULTIPLE_DRIVE
    29 #ifndef RD_MULTIPLE_DRIVE
    28 _LIT(KBackSlash,"\\");
    30 _LIT(KBackSlash,"\\");
    29 #endif
    31 #endif
    30 
    32 
    31 #ifdef RD_MULTIPLE_DRIVE
    33 #ifdef RD_MULTIPLE_DRIVE
   105 	        {
   107 	        {
   106 	            err = fs.CharToDrive( drives[i], drive ); 
   108 	            err = fs.CharToDrive( drives[i], drive ); 
   107 	        }
   109 	        }
   108         User::LeaveIfError( PathInfo::GetRootPath( aRootPath, drive ) );
   110         User::LeaveIfError( PathInfo::GetRootPath( aRootPath, drive ) );
   109 #else
   111 #else
   110 	TBuf<KMaxDrives> driveList;
   112         TBool mmcOk = EFalse;
   111 	TInt drive( EDriveC );
   113         TRAP_IGNORE( mmcOk = !SysUtil::MMCSpaceBelowCriticalLevelL
   112 
   114         			       ( &fs, 0 ); )
   113 	if( repository->Get(KBrowserDrivePrefListForDownloadedContent, driveList) == KErrNone )
   115         if(!mmcOk)
   114         {
   116         	{
   115 	    TPtrC drives(driveList);
   117         	CLOG(( 2, _L("void CodDialog::GetRootPathL  No mmc") ));
   116 	    TInt err(KErrNone);
   118         	TDriveUnit driveUnit(EDriveC);
   117 	    for( TInt i = 0; i < drives.Length(); i = i + 2 )
   119 	        aRootPath = driveUnit.Name();
   118 	        {
   120 	        aRootPath.Append(KBackSlash);
   119 	            err = fs.CharToDrive( drives[i], drive );
   121         
   120 	            if (err == KErrNone)
   122         	}
   121 	            		break;	            
   123        else
   122 	        }
   124            {
   123 	    TDriveUnit driveUnit(drive);
   125              CLOG(( 2, _L("void CodDialog::GetRootPathL  No mmc") ));
   124 	    aRootPath = driveUnit.Name();
   126        	    TVolumeInfo volInfoC;
   125 	    aRootPath.Append(KBackSlash);
   127             TVolumeInfo volInfoE;
   126         }
   128             fs.Volume(volInfoC,EDriveC);
       
   129             fs.Volume(volInfoE,EDriveE);
       
   130             TInt64 freeC = volInfoC.iFree;//free memory available in that drive
       
   131             TInt64 freeE = volInfoE.iFree;
       
   132             
       
   133             TDriveUnit driveUnit(freeC>=freeE?EDriveC:EDriveE);
       
   134 	        aRootPath = driveUnit.Name();
       
   135 	        aRootPath.Append(KBackSlash);
       
   136            }
       
   137         
       
   138      
   127 #endif
   139 #endif
   128     fs.Close();
   140     fs.Close();
   129 	CleanupStack::PopAndDestroy(repository);   
   141 	CleanupStack::PopAndDestroy(repository);   
   130     CLOG(( 2, _L("<- CodDialog::GetRootPathL <%S>"), &aRootPath ));
   142     CLOG(( 2, _L("<- CodDialog::GetRootPathL <%S>"), &aRootPath ));
   131     }
   143     }