164 aDriveInfo.iVolumeLabel = volumeInfo.iName; |
165 aDriveInfo.iVolumeLabel = volumeInfo.iName; |
165 |
166 |
166 // If type is remote drive and aConnectionState is required |
167 // If type is remote drive and aConnectionState is required |
167 if( driveInfo.iDriveAtt & KDriveAttRemote ) |
168 if( driveInfo.iDriveAtt & KDriveAttRemote ) |
168 { |
169 { |
169 // TChar driveLetter; |
170 TChar driveLetter; |
170 // fs.DriveToChar( aDriveNumber, driveLetter ); |
171 fs.DriveToChar( aDriveNumber, driveLetter ); |
171 // |
172 |
172 // // This statement migth cause leave.. to be solved |
173 // This statement migth cause leave.. to be solved |
173 // CRsfwMountMan* mountMgr = CRsfwMountMan::NewL( 0, NULL ); |
174 CRsfwMountMan* mountMgr = CRsfwMountMan::NewL( 0, NULL ); |
174 // TRsfwMountInfo mountInfo; |
175 TRsfwMountInfo mountInfo; |
175 // error = mountMgr->GetMountInfo( driveLetter, mountInfo ); |
176 error = mountMgr->GetMountInfo( driveLetter, mountInfo ); |
176 // delete mountMgr; |
177 delete mountMgr; |
177 // aDriveInfo.iConnectionState = mountInfo.iMountStatus.iConnectionState; |
178 aDriveInfo.iConnectionState = mountInfo.iMountStatus.iConnectionState; |
178 // if( error || |
179 if( error || |
179 // mountInfo.iMountStatus.iConnectionState != KMountStronglyConnected ) |
180 mountInfo.iMountStatus.iConnectionState != KMountStronglyConnected ) |
180 // { |
181 { |
181 // aDriveInfo.iDriveStatus = EDriveNotReady; |
182 aDriveInfo.iDriveStatus = EDriveNotReady; |
182 // return error; |
183 return error; |
183 // } |
184 } |
184 } |
185 } |
185 return error; |
186 return error; |
186 } |
187 } |
187 |
188 |
188 |
189 |
252 } |
253 } |
253 |
254 |
254 // If type is remote drive and aConnectionState is required |
255 // If type is remote drive and aConnectionState is required |
255 if( driveInfo.iDriveAtt & KDriveAttRemote ) |
256 if( driveInfo.iDriveAtt & KDriveAttRemote ) |
256 { |
257 { |
257 // TChar driveLetter; |
258 TChar driveLetter; |
258 // fs.DriveToChar( aDriveNumber, driveLetter ); |
259 fs.DriveToChar( aDriveNumber, driveLetter ); |
259 // // This statement migth cause leave.. to be solved |
260 // This statement migth cause leave.. to be solved |
260 // CRsfwMountMan* mountMgr = CRsfwMountMan::NewL( 0, NULL ); |
261 CRsfwMountMan* mountMgr = CRsfwMountMan::NewL( 0, NULL ); |
261 // TRsfwMountInfo mountInfo; |
262 TRsfwMountInfo mountInfo; |
262 // error = mountMgr->GetMountInfo( driveLetter, mountInfo ); |
263 error = mountMgr->GetMountInfo( driveLetter, mountInfo ); |
263 // delete mountMgr; |
264 delete mountMgr; |
264 // |
265 |
265 // if( error || |
266 if( error || |
266 // mountInfo.iMountStatus.iConnectionState != KMountStronglyConnected ) |
267 mountInfo.iMountStatus.iConnectionState != KMountStronglyConnected ) |
267 // { |
268 { |
268 // return EDriveNotReady; |
269 return EDriveNotReady; |
269 // } |
270 } |
270 } |
271 } |
271 return EDriveOK; |
272 return EDriveOK; |
272 } |
273 } |
273 |
274 |
274 // --------------------------------------------------------------------------- |
275 // --------------------------------------------------------------------------- |
495 // --------------------------------------------------------------------------- |
496 // --------------------------------------------------------------------------- |
496 // |
497 // |
497 void AknCFDUtility::ReadDynamicDrivesL( |
498 void AknCFDUtility::ReadDynamicDrivesL( |
498 CDesCArrayFlat& aRootPathArray, TInt aIncludedMedias ) |
499 CDesCArrayFlat& aRootPathArray, TInt aIncludedMedias ) |
499 { |
500 { |
500 //#ifdef _DEBUG |
501 #ifdef _DEBUG |
501 // CDesCArray* mediaTypeStrings = new (ELeave) CDesCArrayFlat(10); |
502 CDesCArray* mediaTypeStrings = new (ELeave) CDesCArrayFlat(10); |
502 // CleanupStack::PushL( mediaTypeStrings ); |
503 CleanupStack::PushL( mediaTypeStrings ); |
503 // |
504 |
504 // // TMediaType enumeration as string representation for debugging. |
505 // TMediaType enumeration as string representation for debugging. |
505 // mediaTypeStrings->AppendL( _L( "EMediaNotPresent" ) ); |
506 mediaTypeStrings->AppendL( _L( "EMediaNotPresent" ) ); |
506 // mediaTypeStrings->AppendL( _L( "EMediaUnknown" ) ); |
507 mediaTypeStrings->AppendL( _L( "EMediaUnknown" ) ); |
507 // mediaTypeStrings->AppendL( _L( "EMediaFloppy" ) ); |
508 mediaTypeStrings->AppendL( _L( "EMediaFloppy" ) ); |
508 // mediaTypeStrings->AppendL( _L( "EMediaHardDisk" )); |
509 mediaTypeStrings->AppendL( _L( "EMediaHardDisk" )); |
509 // mediaTypeStrings->AppendL( _L( "EMediaCdRom" )); |
510 mediaTypeStrings->AppendL( _L( "EMediaCdRom" )); |
510 // mediaTypeStrings->AppendL( _L( "EMediaRam" )); |
511 mediaTypeStrings->AppendL( _L( "EMediaRam" )); |
511 // mediaTypeStrings->AppendL( _L( "EMediaFlash" )); |
512 mediaTypeStrings->AppendL( _L( "EMediaFlash" )); |
512 // mediaTypeStrings->AppendL( _L( "EMediaRom" )); |
513 mediaTypeStrings->AppendL( _L( "EMediaRom" )); |
513 // mediaTypeStrings->AppendL( _L( "EMediaRemote" )); |
514 mediaTypeStrings->AppendL( _L( "EMediaRemote" )); |
514 // mediaTypeStrings->AppendL( _L( "EMediaNANDFlash" )); |
515 mediaTypeStrings->AppendL( _L( "EMediaNANDFlash" )); |
515 // _LOG( "[CFDUtility] Drive info: " ); |
516 _LOG( "[CFDUtility] Drive info: " ); |
516 //#endif // _DEBUG |
517 #endif // _DEBUG |
517 // |
518 |
518 // // Get list of drives dynamically (move this to CFDUtility?) |
519 // Get list of drives dynamically (move this to CFDUtility?) |
519 // RFs& fs = CCoeEnv::Static()->FsSession(); |
520 RFs& fs = CCoeEnv::Static()->FsSession(); |
520 // TDriveList driveList; |
521 TDriveList driveList; |
521 // |
522 |
522 // CRsfwMountMan* mountMgr = CRsfwMountMan::NewL( 0, NULL ); |
523 CRsfwMountMan* mountMgr = CRsfwMountMan::NewL( 0, NULL ); |
523 // CleanupStack::PushL( mountMgr ); |
524 CleanupStack::PushL( mountMgr ); |
524 // mountMgr->GetRemoteMountListL( driveList ); |
525 mountMgr->GetRemoteMountListL( driveList ); |
525 // CleanupStack::PopAndDestroy( mountMgr ); |
526 CleanupStack::PopAndDestroy( mountMgr ); |
526 // |
527 |
527 // _LOG1( "[CFDUtility] driveList:%S", &driveList ); |
528 _LOG1( "[CFDUtility] driveList:%S", &driveList ); |
528 // |
529 |
529 // TChar driveLetter; |
530 TChar driveLetter; |
530 // TInt driveNumber = 0; |
531 TInt driveNumber = 0; |
531 // _LIT( KDrivePath, "%c:\\" ); |
532 _LIT( KDrivePath, "%c:\\" ); |
532 // TDriveInfo driveInfo; |
533 TDriveInfo driveInfo; |
533 // |
534 |
534 // for( TInt i = 0; i < driveList.Length(); i++ ) |
535 for( TInt i = 0; i < driveList.Length(); i++ ) |
535 // { |
536 { |
536 // driveLetter = driveList[ i ]; |
537 driveLetter = driveList[ i ]; |
537 // User::LeaveIfError( fs.CharToDrive( driveLetter, driveNumber ) ); |
538 User::LeaveIfError( fs.CharToDrive( driveLetter, driveNumber ) ); |
538 // User::LeaveIfError( fs.Drive( driveInfo, driveNumber ) ); |
539 User::LeaveIfError( fs.Drive( driveInfo, driveNumber ) ); |
539 // |
540 |
540 //#ifdef _DEBUG |
541 #ifdef _DEBUG |
541 // TPtrC mediaType( mediaTypeStrings->MdcaPoint( driveInfo.iType ) ); |
542 TPtrC mediaType( mediaTypeStrings->MdcaPoint( driveInfo.iType ) ); |
542 // _LOG4( "[CFDUtility] %c:, ID:%d, Type:%S (%d)", |
543 _LOG4( "[CFDUtility] %c:, ID:%d, Type:%S (%d)", |
543 // TUint( driveLetter ), |
544 TUint( driveLetter ), |
544 // driveNumber, |
545 driveNumber, |
545 // &mediaType, |
546 &mediaType, |
546 // driveInfo.iType ); |
547 driveInfo.iType ); |
547 //#endif // _DEBUG |
548 #endif // _DEBUG |
548 // // If drive does not already exist and it is required in included |
549 // If drive does not already exist and it is required in included |
549 // // media types, append drive letter to rootpaths in correct format: |
550 // media types, append drive letter to rootpaths in correct format: |
550 // if( !DriveAlreadyExists( aRootPathArray, driveLetter ) && |
551 if( !DriveAlreadyExists( aRootPathArray, driveLetter ) && |
551 // IsIncludedMedia( driveInfo, aIncludedMedias ) ) |
552 IsIncludedMedia( driveInfo, aIncludedMedias ) ) |
552 // { |
553 { |
553 // TBuf<5> driveBuf; |
554 TBuf<5> driveBuf; |
554 // TDesC16 drivePath(KDrivePath); |
555 TDesC16 drivePath(KDrivePath); |
555 // driveBuf.Format( drivePath, &driveLetter ); |
556 driveBuf.Format( drivePath, &driveLetter ); |
556 // aRootPathArray.AppendL( driveBuf ); |
557 aRootPathArray.AppendL( driveBuf ); |
557 // } |
558 } |
558 // |
559 |
559 // } |
560 } |
560 // |
561 |
561 //#ifdef _DEBUG |
562 #ifdef _DEBUG |
562 // CleanupStack::PopAndDestroy( mediaTypeStrings ); |
563 CleanupStack::PopAndDestroy( mediaTypeStrings ); |
563 //#endif // _DEBUG |
564 #endif // _DEBUG |
564 } |
565 } |
565 |
566 |
566 |
567 |
567 // --------------------------------------------------------------------------- |
568 // --------------------------------------------------------------------------- |
568 // AknCFDUtility::DriveAlreadyExists |
569 // AknCFDUtility::DriveAlreadyExists |
792 else |
793 else |
793 { |
794 { |
794 |
795 |
795 if (( aFreeSpace >= KHundredNum ) && ( aFreeSpace < KMegaNum )) |
796 if (( aFreeSpace >= KHundredNum ) && ( aFreeSpace < KMegaNum )) |
796 { |
797 { |
797 tempNum /= KThousandNum; // Divide to kilobytes |
798 tempNum /= TReal64( KThousandNum ); // Divide to kilobytes |
798 tempNum = TReal32( TInt( tempNum * 10 ) ) / 10; |
|
799 unitBuf = StringLoader::LoadLC( |
799 unitBuf = StringLoader::LoadLC( |
800 R_CFD_QTN_MEMC_UNITS_KILOBYTE, |
800 R_CFD_QTN_MEMC_UNITS_KILOBYTE, |
801 CCoeEnv::Static()); |
801 CCoeEnv::Static()); |
802 } |
802 } |
803 else if (( aFreeSpace >= KMegaNum ) && ( aFreeSpace < KGigaNum )) |
803 else if (( aFreeSpace >= KMegaNum ) && ( aFreeSpace < KGigaNum )) |
804 { |
804 { |
805 tempNum /= KMegaNum; // Divide to Megabytes |
805 tempNum /= TReal64( KMegaNum ); // Divide to Megabytes |
806 tempNum = TReal32( TInt( tempNum * 10 ) ) / 10; |
|
807 unitBuf = StringLoader::LoadLC( |
806 unitBuf = StringLoader::LoadLC( |
808 R_CFD_QTN_MEMC_UNITS_MEGABYTE, |
807 R_CFD_QTN_MEMC_UNITS_MEGABYTE, |
809 CCoeEnv::Static()); |
808 CCoeEnv::Static()); |
810 } |
809 } |
811 else if (aFreeSpace >= KGigaNum ) |
810 else if (aFreeSpace >= KGigaNum ) |
812 { |
811 { |
813 tempNum /= KGigaNum; // Divide to Gigabytes |
812 tempNum /= TReal64( KGigaNum ); // Divide to Gigabytes |
814 tempNum = TReal32( TInt( tempNum * 10 ) ) / 10; |
|
815 unitBuf = StringLoader::LoadLC( |
813 unitBuf = StringLoader::LoadLC( |
816 R_CFD_QTN_MEMC_UNITS_GIGABYTE, |
814 R_CFD_QTN_MEMC_UNITS_GIGABYTE, |
817 CCoeEnv::Static()); |
815 CCoeEnv::Static()); |
818 } |
816 } |
819 |
817 |