mmappcomponents/mmmtpdataprovider/src/mmmtpdputility.cpp
changeset 64 92dbd2a406d9
parent 51 e61a04404bdf
equal deleted inserted replaced
61:3b098142db83 64:92dbd2a406d9
   210     date = fileInfo.iModified;
   210     date = fileInfo.iModified;
   211     date.FormatL( aDateModified, KMtpDateTimeFormat );
   211     date.FormatL( aDateModified, KMtpDateTimeFormat );
   212     }
   212     }
   213 
   213 
   214 // -----------------------------------------------------------------------------
   214 // -----------------------------------------------------------------------------
       
   215 // MmMtpDpUtility::DesToTTimeL
       
   216 // Converts a MTP format (YYYYMMDDTHHMMSS) date time string to a TTime.
       
   217 // -----------------------------------------------------------------------------
       
   218 //
       
   219 TInt MmMtpDpUtility::DesToTTime( const TDesC& aDateTime, TTime& aTime )
       
   220     {
       
   221     PRINT1( _L ( "MM MTP => MmMtpDpUtility::DesToTTime aDateTime=%S" ), &aDateTime );
       
   222 
       
   223     TInt err = KErrNone;
       
   224     if ( aDateTime.Length() < KMtpMaxDateTimeStringLength )
       
   225         {
       
   226         err =  KErrGeneral;
       
   227         }
       
   228     else
       
   229         {
       
   230         TLex dateBuf( aDateTime.Left( 4 ) );
       
   231         TInt year;
       
   232         dateBuf.Val( year );
       
   233 
       
   234         dateBuf = aDateTime.Mid( 4, 2 );
       
   235         TInt month;
       
   236         dateBuf.Val( month );
       
   237 
       
   238         dateBuf = aDateTime.Mid( 6, 2 );
       
   239         TInt day;
       
   240         dateBuf.Val( day );
       
   241 
       
   242         dateBuf = aDateTime.Mid( 9, 2 );
       
   243         TInt hour;
       
   244         dateBuf.Val( hour );
       
   245 
       
   246         dateBuf = aDateTime.Mid( 11, 2 );
       
   247         TInt minute;
       
   248         dateBuf.Val( minute );
       
   249 
       
   250         dateBuf = aDateTime.Mid( 13, 2 );
       
   251         TInt second;
       
   252         dateBuf.Val( second );
       
   253 
       
   254         PRINT3( _L ( "MM MTP <> MmMtpDpUtility::DesToTTime Year = %d, Month = %d, Day = %d" ), year, month, day );
       
   255         PRINT3( _L ( "MM MTP <> MmMtpDpUtility::DesToTTime Hour = %d, Minute = %d, Second = %d" ), hour, minute, second );
       
   256 
       
   257         if ( ( month > 0 && month < 13 )
       
   258             && ( day > 0 && day < 32 )
       
   259             && ( hour >= 0 && hour < 60 )
       
   260             && ( minute >= 0 && minute < 60 )
       
   261             && ( second >= 0 && second < 60 ) )
       
   262             {
       
   263             // microsecond is ignored because MPX doesn't support it, following s60
       
   264             TDateTime dateTime( year, TMonth( --month ), --day, hour, minute, second, 0 );
       
   265             aTime = dateTime;
       
   266             }
       
   267         else
       
   268             {
       
   269             // date string syntax is wrong
       
   270             err =  KErrGeneral;
       
   271             }
       
   272         }
       
   273     PRINT1( _L ( "MM MTP <= MmMtpDpUtility::DesToTTime err = %d" ), err );
       
   274     return err;
       
   275     }
       
   276 
       
   277 // -----------------------------------------------------------------------------
   215 // MmMtpDpUtility::GetProtectionStatusL
   278 // MmMtpDpUtility::GetProtectionStatusL
   216 // Get the file protection status.
   279 // Get the file protection status.
   217 // -----------------------------------------------------------------------------
   280 // -----------------------------------------------------------------------------
   218 //
   281 //
   219 TUint16 MmMtpDpUtility::GetProtectionStatusL( RFs& aFs, const TDesC& aFullFileName )
   282 TUint16 MmMtpDpUtility::GetProtectionStatusL( RFs& aFs, const TDesC& aFullFileName )