diff -r aecbbf00d063 -r d48ab3b357f1 commonuis/CommonDialogs/src/caknmemoryselectionmodelmultidrive.cpp --- a/commonuis/CommonDialogs/src/caknmemoryselectionmodelmultidrive.cpp Tue Aug 31 15:28:30 2010 +0300 +++ b/commonuis/CommonDialogs/src/caknmemoryselectionmodelmultidrive.cpp Wed Sep 01 12:16:19 2010 +0100 @@ -22,6 +22,7 @@ #include #include #include +#include #include //PathInfo #include // TResourceReader #include //DriveInfo @@ -302,6 +303,18 @@ resource = R_CFD_QTN_MEMC_REMOTE_DRIVE; break; } + case ETextUSBDefaultName: + { + // qtn.memc.usb.available.single.list + resource = R_CFD_QTN_MEMC_USB_AVAILABLE_SINGLE_LIST; + break; + } + case ETextUSBUnavailable: + { + // qtn.memc.usb.unavailable.single.list + resource = R_CFD_QTN_MEMC_USB_UNAVAILABLE_SINGLE_LIST; + break; + } } return resource; } @@ -352,6 +365,13 @@ resource = R_CFD_QTN_MEMC_REMOTE_DRIVE; break; } + case ETextUSBDefaultName: + case ETextUSBUnavailable: + { + // qtn.memc.usb.available.single.list + resource = R_CFD_QTN_MEMC_USB_AVAILABLE_SINGLE_LIST; + break; + } } return resource; } @@ -379,13 +399,6 @@ resource = R_CFD_QTN_MEM_MASS_STORAGE_DOUBLE_LIST; break; } - case ETextInternalMassStorageUnavailable: - { - // Unavailable:qtn.memc.mmc.unavailable.double - // Only for second row - resource = R_CFD_QTN_MEMC_MMC_UNAVAILABLE_DOUBLE; - break; - } case ETextMMCNamed: { // If MMC's name is given. @@ -406,18 +419,27 @@ resource = R_CFD_QTN_MEMC_MMC_LOCKED_DOUBLE; break; } - case ETextMMCUnavailable: - { - // qtn.memc.mmc.unavailable.double - resource = R_CFD_QTN_MEMC_MMC_UNAVAILABLE_DOUBLE; - break; - } case ETextRemoteDrive: { // TODO: To be checked because of missing data in UI spec. resource = R_CFD_QTN_MEMC_REMOTE_DRIVE_DOUBLE_LIST; break; } + case ETextUSBDefaultName: + { + // qtn.memc.usb.available.double + resource = R_CFD_QTN_MEMC_USB_AVAILABLE_DOUBLE; + break; + } + case ETextMMCUnavailable: + case ETextUSBUnavailable: + case ETextInternalMassStorageUnavailable: + { + // Unavailable:qtn.memc.mmc.unavailable.double + // Only for second row + resource = R_CFD_QTN_MEMC_MMC_UNAVAILABLE_DOUBLE; + break; + } } return resource; @@ -449,9 +471,15 @@ else if( aDriveInfo.iStatus & DriveInfo::EDriveRemovable ) { // External mass storage drive, like external MMC - AddMMCItemToLbxL( aDriveInfo ); - - iHasMMCUnavailable = ( aDriveInfo.iDriveStatus == EDriveNotReady ); + if( aDriveInfo.iStatus & DriveInfo::EDriveUsbMemory ) + { + AddUSBItemToLbxL( aDriveInfo ); + } + else + { + AddMMCItemToLbxL( aDriveInfo ); + iHasMMCUnavailable = ( aDriveInfo.iDriveStatus == EDriveNotReady ); + } } else if ( ( aDriveInfo.iStatus & DriveInfo::EDriveRemote ) && ( aDriveInfo.iMediaType == EMediaRemote ) ) @@ -907,6 +935,171 @@ _LOG1( "itemString length=%d", itemString.Length() ); } +// --------------------------------------------------------------------------- +// CAknMemorySelectionModelMultiDrive::AddUSBItemToLbxL +// --------------------------------------------------------------------------- +// +void CAknMemorySelectionModelMultiDrive::AddUSBItemToLbxL( + const TCFDDriveInfo& aDriveInfo ) + { + HBufC* lbxItemBuf = HBufC::NewLC( KListBoxEntryMaxLength ); + TPtr itemString( lbxItemBuf->Des() ); + HBufC* textItemBuf = HBufC::NewLC( KListBoxEntryMaxLength ); + TPtr textString( textItemBuf->Des() ); + HBufC* textItemBuf2 = HBufC::NewLC( KListBoxEntryMaxLength ); + TPtr textString2( textItemBuf2->Des() ); + TDriveUnit driveUnit( aDriveInfo.iDriveNumber ); + + // Item text is affected by layout + switch( iLayout ) + { + case ELayoutPopupMenu: + { + itemString.Format( KImageHeader, EIconExternalUSBDrive ); + itemString.Append( KTabChar ); + + // 1st row text: + if( aDriveInfo.iDriveStatus == EDriveOK ) + { + if( aDriveInfo.iVolumeLabel.Length() > 0 ) + { + StringLoader::Format( + textString2, + *iLocStringArray[ ETextMMCNamed ], + KIndexFirst, + driveUnit.Name() + ); + StringLoader::Format( + textString, + textString2, + KIndexSecond, + aDriveInfo.iVolumeLabel + ); + } + else + { + StringLoader::Format( + textString, + *iLocStringArray[ ETextUSBDefaultName ], + KNoIndex, + driveUnit.Name() + ); + } + } + else + { + StringLoader::Format( + textString, + *iLocStringArray[ ETextUSBUnavailable ], + KNoIndex, + driveUnit.Name() + ); + } + itemString.Append( textString ); + + break; + } + case ELayoutSettingPage: + { + // 1st row text: + if( aDriveInfo.iVolumeLabel.Length() > 0 ) + { + // Append drive name if it has one + StringLoader::Format( + textString, + *iLocStringArray[ ETextMMCNamed ], + KIndexFirst, + driveUnit.Name() + ); + StringLoader::Format( + itemString, + textString, + KIndexSecond, + aDriveInfo.iVolumeLabel + ); + } + else + { + StringLoader::Format( + itemString, + *iLocStringArray[ ETextUSBDefaultName ], + KNoIndex, + driveUnit.Name() + ); + } + break; + } + case ELayoutDoublePopup: + { + itemString.Format( KImageHeader, EIconExternalUSBDrive ); + itemString.Append( KTabChar ); + + // 1st row text: + if( aDriveInfo.iVolumeLabel.Length() > 0 ) + { + StringLoader::Format( + textString2, + *iLocStringArray[ ETextMMCNamed ], + KIndexFirst, + driveUnit.Name() + ); + StringLoader::Format( + textString, + textString2, + KIndexSecond, + aDriveInfo.iVolumeLabel + ); + } + else + { + // Use default drive description + StringLoader::Format( + textString, + *iLocStringArray[ ETextUSBDefaultName ], + KNoIndex, + driveUnit.Name() + ); + } + itemString.Append( textString ); + itemString.Append( KTabChar ); + + // 2nd row text: + if ( aDriveInfo.iDriveStatus == EDriveOK ) + { + HBufC* buffer; + TInt64 freeSpace = aDriveInfo.iDiskSpace; + if ( freeSpace >= 0 ) + { + buffer = HBufC::NewLC( KListBoxEntryMaxLength ); + TPtr unitStr( buffer->Des() ); + AknCFDUtility::SetSecondRowTextL( freeSpace, unitStr ); + } + else + { + // Disk space is unavailable + buffer = StringLoader::LoadLC( + R_CFD_QTN_MEMC_SPACE_NOT_AVAILABLE, + iCoeEnv); + } + itemString.Append( *buffer );//Free mem text + CleanupStack::PopAndDestroy( buffer ); + } + else + { + itemString.Append( + *iLocStringArray[ ETextUSBUnavailable ] ); + } + break; + } + } + + // Finally!: append the formatted string to listbox + User::LeaveIfError( iListBoxArray.Append( lbxItemBuf ) ); + CleanupStack::PopAndDestroy( 2 ); // textItemBuf2, textItemBuf + CleanupStack::Pop( lbxItemBuf ); + _LOG1( "[CAknMemorySelectionModelMultiDrive] Item string added to lbx array: %S", &itemString ); + _LOG1( "itemString length=%d", itemString.Length() ); + } // --------------------------------------------------------------------------- // CAknMemorySelectionModelMultiDrive::AddRemoteItemToLbxL @@ -982,18 +1175,18 @@ _LIT( KEmptySpace, " "); itemString.Append( KEmptySpace ); - //if( aDriveInfo.iConnectionState == KMountStronglyConnected ) - // { - // D-column icon: Show active icon if drive has no error - // itemString.Append( KTabChar ); - // itemString.AppendFormat( - // KImageHeader, EIconRemoteDriveActive ); - // } - //else // KMountNotConnected - // { + if( aDriveInfo.iConnectionState == KMountStronglyConnected ) + { // D-column icon: Show active icon if drive has no error - itemString.Append( KTabChar ); - // } + itemString.Append( KTabChar ); + itemString.AppendFormat( + KImageHeader, EIconRemoteDriveActive ); + } + else // KMountNotConnected + { + // D-column icon: Show active icon if drive has no error + itemString.Append( KTabChar ); + } } else { @@ -1148,6 +1341,21 @@ driveNumber = TDriveNumber( i ); rootPath.Zero(); memoryType = AknCFDUtility::DriveMemoryTypeL( driveNumber ); + if ( memoryType == AknCommonDialogsDynMem::EMemoryTypeMMCExternal && + ( iIncludedMedias & AknCommonDialogsDynMem::EMemoryTypeMMCExternalInDevice ) ) + { + // Hide usb memory + TCFDDriveInfo info; + AknCFDUtility::DriveInfoL( driveNumber, info ); + if ( info.iStatus & DriveInfo::EDriveUsbMemory ) + { + continue; + } + else + { + memoryType = AknCommonDialogsDynMem::EMemoryTypeMMCExternalInDevice; + } + } if( memoryType & iIncludedMedias ) { User::LeaveIfError( @@ -1195,6 +1403,21 @@ if (drive) { memoryType = AknCFDUtility::DriveMemoryTypeL( driveNumber ); + if ( memoryType == AknCommonDialogsDynMem::EMemoryTypeMMCExternal && + ( iIncludedMedias & AknCommonDialogsDynMem::EMemoryTypeMMCExternalInDevice ) ) + { + // Hide usb memory + TCFDDriveInfo info; + AknCFDUtility::DriveInfoL( driveNumber, info ); + if ( info.iStatus & DriveInfo::EDriveUsbMemory ) + { + continue; + } + else + { + memoryType = AknCommonDialogsDynMem::EMemoryTypeMMCExternalInDevice; + } + } if( memoryType & iIncludedMedias ) { User::LeaveIfError(