368 ( aMessage[0] == EFtpLISTSIZES || |
368 ( aMessage[0] == EFtpLISTSIZES || |
369 aMessage[0] == EFtpLISTSIZES_u ) ); |
369 aMessage[0] == EFtpLISTSIZES_u ) ); |
370 } |
370 } |
371 } |
371 } |
372 break; |
372 break; |
|
373 case EFtpListDetail: |
|
374 case EFtpListDetail_u: |
|
375 { |
|
376 if ( GetDirectoryL( aMessage.Mid( 1 ), |
|
377 unicode ) ) |
|
378 { |
|
379 HandleListDetailL( unicode, |
|
380 KEntryAttHidden| KEntryAttSystem|KEntryAttNormal); |
|
381 } |
|
382 } |
|
383 break; |
373 case EFtpLISTDIR: |
384 case EFtpLISTDIR: |
374 case EFtpLISTDIR_u: |
385 case EFtpLISTDIR_u: |
375 { |
386 { |
376 if ( GetDirectoryL( aMessage.Mid( 1 ), |
387 if ( GetDirectoryL( aMessage.Mid( 1 ), |
377 unicode ) ) |
388 unicode ) ) |
378 { |
389 { |
379 HandleListL( unicode, |
390 HandleListL( unicode, |
380 (KEntryAttMatchExclusive| |
391 (KEntryAttMatchExclusive| |
381 KEntryAttHidden|KEntryAttSystem| |
392 KEntryAttHidden|KEntryAttSystem| |
382 KEntryAttDir), EFalse ); |
393 KEntryAttDir), EFalse ); |
|
394 } |
|
395 } |
|
396 break; |
|
397 case EFtpListDirDetail: |
|
398 case EFtpListDirDetail_u: |
|
399 { |
|
400 if ( GetDirectoryL( aMessage.Mid( 1 ), |
|
401 unicode ) ) |
|
402 { |
|
403 HandleListDetailL( unicode, |
|
404 KEntryAttMatchExclusive|KEntryAttHidden| |
|
405 KEntryAttSystem|KEntryAttDir); |
383 } |
406 } |
384 } |
407 } |
385 break; |
408 break; |
386 case EFtpMKD: |
409 case EFtpMKD: |
387 case EFtpMKD_u: |
410 case EFtpMKD_u: |
988 |
1011 |
989 CleanupStack::PopAndDestroy();//dir |
1012 CleanupStack::PopAndDestroy();//dir |
990 HTI_LOG_FUNC_OUT("HandleListL"); |
1013 HTI_LOG_FUNC_OUT("HandleListL"); |
991 } |
1014 } |
992 |
1015 |
|
1016 void CHtiFtpServicePlugin::HandleListDetailL( TBool aUnicodText, TUint aReadingAtt) |
|
1017 { |
|
1018 HTI_LOG_FUNC_IN("HandleListDetailL"); |
|
1019 CDir* dir; |
|
1020 TInt err = iFs.GetDir( iFileName, aReadingAtt, ESortNone, dir ); |
|
1021 if ( err != KErrNone ) |
|
1022 { |
|
1023 User::LeaveIfError( SendErrorMsg( err, KErrDescrFailedGetDir ) ); |
|
1024 return; |
|
1025 } |
|
1026 |
|
1027 CleanupStack::PushL( dir ); |
|
1028 //build list |
|
1029 delete iSendBuffer; |
|
1030 iSendBuffer = NULL; |
|
1031 TInt bufferLen = dir->Count()*KMaxFileName; |
|
1032 if ( aUnicodText ) |
|
1033 { |
|
1034 bufferLen *= 2; |
|
1035 } |
|
1036 // 1 bytes for name length, 4 bytes for file size, |
|
1037 // 6 bytes for date time, 3 bytes for attributes(hide, readonly and system) |
|
1038 bufferLen += (1 + 4 + 6 + 3) * dir->Count(); |
|
1039 |
|
1040 iSendBuffer = HBufC8::NewL( bufferLen ); |
|
1041 TInt dirNameLen = 0; |
|
1042 for ( TInt i = 0; i < dir->Count(); ++i) |
|
1043 { |
|
1044 dirNameLen = (*dir)[i].iName.Length(); |
|
1045 iSendBuffer->Des().Append( dirNameLen ); |
|
1046 if ( aUnicodText ) |
|
1047 { |
|
1048 iSendBuffer->Des().Append( (TUint8*)((*dir)[i].iName.Ptr()), |
|
1049 dirNameLen*2 ); |
|
1050 } |
|
1051 else |
|
1052 { |
|
1053 iSendBuffer->Des().Append( (*dir)[i].iName ); |
|
1054 } |
|
1055 TInt year = (*dir)[i].iModified.DateTime().Year(); |
|
1056 iSendBuffer->Des().Append((TUint8*)(&year), 2 ); |
|
1057 iSendBuffer->Des().Append( (*dir)[i].iModified.DateTime().Month()+1); |
|
1058 iSendBuffer->Des().Append( (*dir)[i].iModified.DateTime().Day()+1); |
|
1059 iSendBuffer->Des().Append( (*dir)[i].iModified.DateTime().Hour()); |
|
1060 iSendBuffer->Des().Append( (*dir)[i].iModified.DateTime().Minute()); |
|
1061 iSendBuffer->Des().Append( (*dir)[i].iModified.DateTime().Second()); |
|
1062 iSendBuffer->Des().Append( (*dir)[i].IsHidden()); |
|
1063 iSendBuffer->Des().Append( (*dir)[i].IsReadOnly()); |
|
1064 iSendBuffer->Des().Append( (*dir)[i].IsSystem()); |
|
1065 if((*dir)[i].IsDir() == EFalse) |
|
1066 { |
|
1067 TInt size = (*dir)[i].iSize; |
|
1068 iSendBuffer->Des().Append( (TUint8*)(&size), 4 ); |
|
1069 } |
|
1070 } |
|
1071 |
|
1072 err = iDispatcher->DispatchOutgoingMessage(iSendBuffer, |
|
1073 KFtpServiceUid, |
|
1074 EFalse, |
|
1075 EHtiPriorityControl); |
|
1076 |
|
1077 if ( err != KErrNone ) |
|
1078 { |
|
1079 //wait for a memory |
|
1080 iState = EListBusy; |
|
1081 iDispatcher->AddMemoryObserver( this ); |
|
1082 } |
|
1083 else |
|
1084 { |
|
1085 iSendBuffer = NULL; |
|
1086 } |
|
1087 |
|
1088 CleanupStack::PopAndDestroy();//dir |
|
1089 HTI_LOG_FUNC_OUT("HandleListDetailL"); |
|
1090 } |
|
1091 |
993 void CHtiFtpServicePlugin::HandleDataMessageL( const TDesC8& aMessage ) |
1092 void CHtiFtpServicePlugin::HandleDataMessageL( const TDesC8& aMessage ) |
994 { |
1093 { |
995 switch ( iState ) |
1094 switch ( iState ) |
996 { |
1095 { |
997 case EStorWait: |
1096 case EStorWait: |