commonuis/CommonDialogs/src/caknmemoryselectionmodelmultidrive.cpp
branchRCL_3
changeset 18 0aa5fbdfbc30
parent 4 8ca85d2f0db7
child 25 941195f2d488
equal deleted inserted replaced
16:71dd06cfe933 18:0aa5fbdfbc30
   455         	AddUSBItemToLbxL( aDriveInfo );
   455         	AddUSBItemToLbxL( aDriveInfo );
   456         	}
   456         	}
   457         else
   457         else
   458         	{
   458         	{
   459         	AddMMCItemToLbxL( aDriveInfo );
   459         	AddMMCItemToLbxL( aDriveInfo );
       
   460         	iHasMMCUnavailable = ( aDriveInfo.iDriveStatus == EDriveNotReady );
   460         	}
   461         	}
   461 
       
   462         iHasMMCUnavailable = ( aDriveInfo.iDriveStatus == EDriveNotReady );
       
   463         }
   462         }
   464     else if ( ( aDriveInfo.iStatus & DriveInfo::EDriveRemote )
   463     else if ( ( aDriveInfo.iStatus & DriveInfo::EDriveRemote )
   465         && ( aDriveInfo.iMediaType == EMediaRemote ) )
   464         && ( aDriveInfo.iMediaType == EMediaRemote ) )
   466         // 2 conditions used here just for sure
   465         // 2 conditions used here just for sure
   467         {
   466         {
   937             {
   936             {
   938             itemString.Format( KImageHeader, EIconExternalUSBDrive );
   937             itemString.Format( KImageHeader, EIconExternalUSBDrive );
   939             itemString.Append( KTabChar );
   938             itemString.Append( KTabChar );
   940 
   939 
   941             // 1st row text:
   940             // 1st row text:
   942             if( ( aDriveInfo.iDriveStatus == EDriveOK ) &&
   941             if( aDriveInfo.iDriveStatus == EDriveOK )
   943                 ( aDriveInfo.iVolumeLabel.Length() > 0 ) )
   942                 {
       
   943                 if( aDriveInfo.iVolumeLabel.Length() > 0 )
       
   944                     {
       
   945                     StringLoader::Format(
       
   946                         textString2,
       
   947                         *iLocStringArray[ ETextMMCNamed ],
       
   948                         KIndexFirst,
       
   949                         driveUnit.Name()
       
   950                         );
       
   951                     StringLoader::Format(
       
   952                         textString,
       
   953                         textString2,
       
   954                         KIndexSecond,
       
   955                         aDriveInfo.iVolumeLabel
       
   956                         );
       
   957                     }
       
   958                 else
       
   959                     {
       
   960                     StringLoader::Format(
       
   961                         textString,
       
   962                         *iLocStringArray[ ETextInternalMassStorage ],
       
   963                         KNoIndex,
       
   964                         driveUnit.Name()
       
   965                         );
       
   966                     }
       
   967                 }
       
   968             else
       
   969                 {
       
   970                 StringLoader::Format(
       
   971                     textString,
       
   972                     *iLocStringArray[ ETextInternalMassStorageUnavailable ],
       
   973                     KNoIndex,
       
   974                     driveUnit.Name()
       
   975                     );
       
   976                 }
       
   977             itemString.Append( textString );
       
   978 
       
   979             break;
       
   980             }
       
   981         case ELayoutSettingPage:
       
   982             {
       
   983             // 1st row text:
       
   984             if( aDriveInfo.iVolumeLabel.Length() > 0 )
       
   985                 {
       
   986                 // Append drive name if it has one
       
   987                 StringLoader::Format(
       
   988                     textString,
       
   989                     *iLocStringArray[ ETextMMCNamed ],
       
   990                     KIndexFirst,
       
   991                     driveUnit.Name()
       
   992                     );
       
   993                 StringLoader::Format(
       
   994                     itemString,
       
   995                     textString,
       
   996                     KIndexSecond,
       
   997                     aDriveInfo.iVolumeLabel
       
   998                     );
       
   999                 }
       
  1000             else
       
  1001                 {
       
  1002                 StringLoader::Format(
       
  1003                     itemString,
       
  1004                     *iLocStringArray[ ETextInternalMassStorage ],
       
  1005                     KNoIndex,
       
  1006                     driveUnit.Name()
       
  1007                     );
       
  1008                 }
       
  1009             break;
       
  1010             }
       
  1011         case ELayoutDoublePopup:
       
  1012             {
       
  1013             itemString.Format( KImageHeader, EIconExternalUSBDrive );
       
  1014             itemString.Append( KTabChar );
       
  1015 
       
  1016             // 1st row text:
       
  1017             if( aDriveInfo.iVolumeLabel.Length() > 0 )
   944                 {
  1018                 {
   945                 StringLoader::Format(
  1019                 StringLoader::Format(
   946                     textString2,
  1020                     textString2,
   947                     *iLocStringArray[ ETextMMCNamed ],
  1021                     *iLocStringArray[ ETextMMCNamed ],
   948                     KIndexFirst,
  1022                     KIndexFirst,
   953                     textString2,
  1027                     textString2,
   954                     KIndexSecond,
  1028                     KIndexSecond,
   955                     aDriveInfo.iVolumeLabel
  1029                     aDriveInfo.iVolumeLabel
   956                     );
  1030                     );
   957                 }
  1031                 }
   958             else if ( aDriveInfo.iDriveStatus == EDriveNotReady )
       
   959                 {
       
   960                 //textString.Format(
       
   961                 //    *iLocStringArray[ ETextMMCUnavailable ],
       
   962                 //    driveUnit.Name() );
       
   963                 StringLoader::Format(
       
   964                     textString,
       
   965                     *iLocStringArray[ ETextMMCUnavailable ],
       
   966                     KNoIndex,
       
   967                     driveUnit.Name()
       
   968                     );
       
   969                 }
       
   970             else if( aDriveInfo.iDriveStatus == EDriveLocked )
       
   971                 {
       
   972                 //textString.Format(
       
   973                 //    *iLocStringArray[ ETextMMCLocked ],
       
   974                 //    driveUnit.Name() );
       
   975                 StringLoader::Format(
       
   976                     textString,
       
   977                     *iLocStringArray[ ETextMMCLocked ],
       
   978                     KNoIndex,
       
   979                     driveUnit.Name()
       
   980                     );
       
   981                 }
       
   982             else
  1032             else
   983                 {
  1033                 {
   984                 // Use default drive description
  1034                 // Use default drive description
   985                 //textString.Format(
  1035                 StringLoader::Format(
   986                 //    *iLocStringArray[ ETextMMCDefaultName ],
  1036                     textString,
   987                 //    driveUnit.Name() );
  1037                     *iLocStringArray[ ETextInternalMassStorage ],
   988                 StringLoader::Format(
       
   989                     textString,
       
   990                     *iLocStringArray[ ETextMMCDefaultName ],
       
   991                     KNoIndex,
       
   992                     driveUnit.Name()
       
   993                     );
       
   994                 }
       
   995             itemString.Append( textString );
       
   996 
       
   997             break;
       
   998             }
       
   999         case ELayoutSettingPage:
       
  1000             {
       
  1001             // 1st row text:
       
  1002             if( aDriveInfo.iVolumeLabel.Length() > 0 )
       
  1003                 {
       
  1004                 // Append drive name if it has one
       
  1005                 //itemString.Format(
       
  1006                 //    *iLocStringArray[ ETextMMCNamed ],
       
  1007                 //    driveUnit.Name(),
       
  1008                 //    aDriveInfo.iVolumeLabel
       
  1009                 //    );
       
  1010                 StringLoader::Format(
       
  1011                     textString,
       
  1012                     *iLocStringArray[ ETextMMCNamed ],
       
  1013                     KIndexFirst,
       
  1014                     driveUnit.Name()
       
  1015                     );
       
  1016                 StringLoader::Format(
       
  1017                     itemString,
       
  1018                     textString,
       
  1019                     KIndexSecond,
       
  1020                     aDriveInfo.iVolumeLabel
       
  1021                     );
       
  1022                 }
       
  1023             else
       
  1024                 {
       
  1025                 //itemString.Format(
       
  1026                 //    *iLocStringArray[ ETextMMCDefaultName ],
       
  1027                 //    driveUnit.Name()
       
  1028                 //    );
       
  1029                 StringLoader::Format(
       
  1030                     itemString,
       
  1031                     *iLocStringArray[ ETextMMCDefaultName ],
       
  1032                     KNoIndex,
       
  1033                     driveUnit.Name()
       
  1034                     );
       
  1035                 }
       
  1036             break;
       
  1037             }
       
  1038         case ELayoutDoublePopup:
       
  1039             {
       
  1040             itemString.Format( KImageHeader, EIconExternalUSBDrive );
       
  1041             itemString.Append( KTabChar );
       
  1042 
       
  1043             // 1st row text:
       
  1044             if( aDriveInfo.iVolumeLabel.Length() > 0 )
       
  1045                 {
       
  1046                 StringLoader::Format(
       
  1047                     textString2,
       
  1048                     *iLocStringArray[ ETextMMCNamed ],
       
  1049                     KIndexFirst,
       
  1050                     driveUnit.Name()
       
  1051                     );
       
  1052                 StringLoader::Format(
       
  1053                     textString,
       
  1054                     textString2,
       
  1055                     KIndexSecond,
       
  1056                     aDriveInfo.iVolumeLabel
       
  1057                     );
       
  1058                 }
       
  1059             else
       
  1060                 {
       
  1061                 // Use default drive description
       
  1062                 //textString.Format(
       
  1063                 //    *iLocStringArray[ ETextMMCDefaultName ],
       
  1064                 //    driveUnit.Name()
       
  1065                 //   );
       
  1066                 StringLoader::Format(
       
  1067                     textString,
       
  1068                     *iLocStringArray[ ETextMMCDefaultName ],
       
  1069                     KNoIndex,
  1038                     KNoIndex,
  1070                     driveUnit.Name()
  1039                     driveUnit.Name()
  1071                     );
  1040                     );
  1072                 }
  1041                 }
  1073             itemString.Append( textString );
  1042             itemString.Append( textString );
  1074             itemString.Append( KTabChar );
  1043             itemString.Append( KTabChar );
  1075 
  1044 
  1076             // 2nd row text:
  1045             // 2nd row text:
  1077             switch( aDriveInfo.iDriveStatus )
  1046             if ( aDriveInfo.iDriveStatus == EDriveOK )
  1078                 {
  1047                 {
  1079                 case EDriveNotReady:
  1048                 HBufC* buffer;
  1080                     {
  1049                 TInt64 freeSpace = aDriveInfo.iDiskSpace;
  1081                     itemString.Append(
  1050                 if ( freeSpace >= 0 )
  1082                         *iLocStringArray[ ETextMMCUnavailable ] );
  1051                     {
  1083                     break;
  1052                     buffer = HBufC::NewLC( KListBoxEntryMaxLength );  
  1084                     }
  1053                     TPtr unitStr( buffer->Des() );
  1085                 case EDriveLocked:
  1054                     AknCFDUtility::SetSecondRowTextL( freeSpace, unitStr );
  1086                     {
  1055                     }
  1087                     itemString.Append( *iLocStringArray[ ETextMMCLocked ] );
  1056                 else
  1088                     break;
  1057                     {
  1089                     }
  1058                     // Disk space is unavailable
  1090                 case EDriveOK:
  1059                     buffer = StringLoader::LoadLC(
  1091                 default:
  1060                                 R_CFD_QTN_MEMC_SPACE_NOT_AVAILABLE,
  1092                     {
  1061                                 iCoeEnv);
  1093                     HBufC* buffer;
  1062                     }
  1094                     TInt64 freeSpace = aDriveInfo.iDiskSpace;
  1063                 itemString.Append( *buffer );//Free mem text
  1095                     if ( freeSpace >= 0 )
  1064                 CleanupStack::PopAndDestroy( buffer );
  1096                         {
  1065                 }
  1097                         buffer = HBufC::NewLC( KListBoxEntryMaxLength );  
  1066             else
  1098                         TPtr unitStr( buffer->Des() );
  1067                 {
  1099                         AknCFDUtility::SetSecondRowTextL( freeSpace, unitStr );
  1068                 itemString.Append(
  1100                         }
  1069                     *iLocStringArray[
  1101                     else
  1070                         ETextInternalMassStorageUnavailable ] );
  1102                         {
       
  1103                         // Disk space is unavailable
       
  1104                         buffer = StringLoader::LoadLC(
       
  1105                                     R_CFD_QTN_MEMC_SPACE_NOT_AVAILABLE,
       
  1106                                     iCoeEnv);
       
  1107                         }
       
  1108                     itemString.Append( *buffer );//Free mem text
       
  1109                     CleanupStack::PopAndDestroy( buffer );
       
  1110                     break;
       
  1111                     }
       
  1112                 }
  1071                 }
  1113             break;
  1072             break;
  1114             }
  1073             }
  1115         }
  1074         }
  1116 
  1075