906 CleanupStack::Pop( lbxItemBuf ); |
913 CleanupStack::Pop( lbxItemBuf ); |
907 _LOG1( "[CAknMemorySelectionModelMultiDrive] Item string added to lbx array: %S", &itemString ); |
914 _LOG1( "[CAknMemorySelectionModelMultiDrive] Item string added to lbx array: %S", &itemString ); |
908 _LOG1( "itemString length=%d", itemString.Length() ); |
915 _LOG1( "itemString length=%d", itemString.Length() ); |
909 } |
916 } |
910 |
917 |
|
918 // --------------------------------------------------------------------------- |
|
919 // CAknMemorySelectionModelMultiDrive::AddUSBItemToLbxL |
|
920 // --------------------------------------------------------------------------- |
|
921 // |
|
922 void CAknMemorySelectionModelMultiDrive::AddUSBItemToLbxL( |
|
923 const TCFDDriveInfo& aDriveInfo ) |
|
924 { |
|
925 HBufC* lbxItemBuf = HBufC::NewLC( KListBoxEntryMaxLength ); |
|
926 TPtr itemString( lbxItemBuf->Des() ); |
|
927 HBufC* textItemBuf = HBufC::NewLC( KListBoxEntryMaxLength ); |
|
928 TPtr textString( textItemBuf->Des() ); |
|
929 HBufC* textItemBuf2 = HBufC::NewLC( KListBoxEntryMaxLength ); |
|
930 TPtr textString2( textItemBuf2->Des() ); |
|
931 TDriveUnit driveUnit( aDriveInfo.iDriveNumber ); |
|
932 |
|
933 // Item text is affected by layout |
|
934 switch( iLayout ) |
|
935 { |
|
936 case ELayoutPopupMenu: |
|
937 { |
|
938 itemString.Format( KImageHeader, EIconExternalUSBDrive ); |
|
939 itemString.Append( KTabChar ); |
|
940 |
|
941 // 1st row text: |
|
942 if( ( aDriveInfo.iDriveStatus == EDriveOK ) && |
|
943 ( 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 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 |
|
983 { |
|
984 // Use default drive description |
|
985 //textString.Format( |
|
986 // *iLocStringArray[ ETextMMCDefaultName ], |
|
987 // driveUnit.Name() ); |
|
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, |
|
1070 driveUnit.Name() |
|
1071 ); |
|
1072 } |
|
1073 itemString.Append( textString ); |
|
1074 itemString.Append( KTabChar ); |
|
1075 |
|
1076 // 2nd row text: |
|
1077 switch( aDriveInfo.iDriveStatus ) |
|
1078 { |
|
1079 case EDriveNotReady: |
|
1080 { |
|
1081 itemString.Append( |
|
1082 *iLocStringArray[ ETextMMCUnavailable ] ); |
|
1083 break; |
|
1084 } |
|
1085 case EDriveLocked: |
|
1086 { |
|
1087 itemString.Append( *iLocStringArray[ ETextMMCLocked ] ); |
|
1088 break; |
|
1089 } |
|
1090 case EDriveOK: |
|
1091 default: |
|
1092 { |
|
1093 HBufC* buffer; |
|
1094 TInt64 freeSpace = aDriveInfo.iDiskSpace; |
|
1095 if ( freeSpace >= 0 ) |
|
1096 { |
|
1097 buffer = HBufC::NewLC( KListBoxEntryMaxLength ); |
|
1098 TPtr unitStr( buffer->Des() ); |
|
1099 AknCFDUtility::SetSecondRowTextL( freeSpace, unitStr ); |
|
1100 } |
|
1101 else |
|
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 } |
|
1113 break; |
|
1114 } |
|
1115 } |
|
1116 |
|
1117 // Finally!: append the formatted string to listbox |
|
1118 User::LeaveIfError( iListBoxArray.Append( lbxItemBuf ) ); |
|
1119 CleanupStack::PopAndDestroy( 2 ); // textItemBuf2, textItemBuf |
|
1120 CleanupStack::Pop( lbxItemBuf ); |
|
1121 _LOG1( "[CAknMemorySelectionModelMultiDrive] Item string added to lbx array: %S", &itemString ); |
|
1122 _LOG1( "itemString length=%d", itemString.Length() ); |
|
1123 } |
911 |
1124 |
912 // --------------------------------------------------------------------------- |
1125 // --------------------------------------------------------------------------- |
913 // CAknMemorySelectionModelMultiDrive::AddRemoteItemToLbxL |
1126 // CAknMemorySelectionModelMultiDrive::AddRemoteItemToLbxL |
914 // --------------------------------------------------------------------------- |
1127 // --------------------------------------------------------------------------- |
915 // |
1128 // |