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