ImagePrint/ImagePrintEngine/DeviceProtocols/xhtmlfilecomposer/src/cimageinfo.cpp
branchGCC_SURGE
changeset 25 59ea2209bb67
parent 23 08cc4cc059d4
parent 15 a92d00fca574
equal deleted inserted replaced
23:08cc4cc059d4 25:59ea2209bb67
     1 /*
       
     2 * Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Contains the declarations for miscellanous image information.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <uri8.h> // curi8
       
    20 #include <uri16.h> // curi16
       
    21 #include <uriutils.h> // uriutils
       
    22 #include <escapeutils.h> //utf8 conversions
       
    23 
       
    24 #include "cimageinfo.h"
       
    25 #include "cxfclogger.h"
       
    26 
       
    27 // log macros for static methods
       
    28 
       
    29 #ifdef ENABLE_LOGGING
       
    30 //#define LOCAL_LOGGING
       
    31 #endif
       
    32 
       
    33 #ifdef LOCAL_LOGGING
       
    34 
       
    35 #define I_LOG(a) LOG(a)            
       
    36 #define I_LOG1(s, v) LOG1(s, v)        
       
    37 #define I_LOG2(s, v1, v2) LOG2(s, v1, v2)   
       
    38                                               
       
    39 #define I_LOG8(a) LOG8(a)           
       
    40 #define I_LOG81(s, v) LOG81(s, v)       
       
    41 #define I_LOG82(s, v1, v2) LOG82(s, v1, v2)  
       
    42 
       
    43 #else
       
    44 
       
    45 #ifdef ENABLE_LOGGING
       
    46 #undef ENABLE_LOGGING
       
    47 #endif
       
    48 
       
    49 #define I_LOG(a)
       
    50 #define I_LOG1(s, v)
       
    51 #define I_LOG2(s, v1, v2)
       
    52 
       
    53 #define I_LOG8(a)
       
    54 #define I_LOG81(s, v)
       
    55 #define I_LOG82(s, v1, v2)
       
    56 
       
    57 
       
    58 #endif
       
    59 
       
    60 //--------------------------------------------------------------------------------------------
       
    61 //
       
    62 // CImageInfo::CImageInfo
       
    63 //
       
    64 //--------------------------------------------------------------------------------------------
       
    65 EXPORT_C CImageInfo* CImageInfo::NewL()
       
    66 {
       
    67 	CImageInfo *self = NewLC();
       
    68 	CleanupStack::Pop();	// self
       
    69 	return self;
       
    70 }
       
    71 
       
    72 //--------------------------------------------------------------------------------------------
       
    73 //
       
    74 // CImageInfo::CImageInfo
       
    75 //
       
    76 //--------------------------------------------------------------------------------------------
       
    77 EXPORT_C CImageInfo* CImageInfo::NewL(const CImageInfo& a)
       
    78 {
       
    79 	CImageInfo *self = NewLC(a);
       
    80 	CleanupStack::Pop();	// self
       
    81 	return self;
       
    82 }
       
    83 
       
    84 //--------------------------------------------------------------------------------------------
       
    85 //
       
    86 // CImageInfo::CImageInfo
       
    87 //
       
    88 //--------------------------------------------------------------------------------------------
       
    89 EXPORT_C CImageInfo* CImageInfo::NewLC()
       
    90 {
       
    91 	CImageInfo *self = new (ELeave) CImageInfo();
       
    92 	CleanupStack::PushL(self);
       
    93 	self->ConstructL();
       
    94 	return self;
       
    95 }
       
    96 
       
    97 //--------------------------------------------------------------------------------------------
       
    98 //
       
    99 // CImageInfo::CImageInfo
       
   100 //
       
   101 //--------------------------------------------------------------------------------------------
       
   102 EXPORT_C CImageInfo* CImageInfo::NewLC(const CImageInfo& a)
       
   103 {
       
   104 	CImageInfo *self = new (ELeave) CImageInfo(a);
       
   105 	CleanupStack::PushL(self);
       
   106 	self->ConstructL();
       
   107 	return self;
       
   108 }
       
   109 
       
   110 //--------------------------------------------------------------------------------------------
       
   111 //
       
   112 // CImageInfo::CImageInfo
       
   113 //
       
   114 //--------------------------------------------------------------------------------------------
       
   115 EXPORT_C void CImageInfo::ConstructL()
       
   116 {
       
   117 
       
   118 }
       
   119 
       
   120 //--------------------------------------------------------------------------------------------
       
   121 //
       
   122 // CImageInfo::CImageInfo
       
   123 //
       
   124 //--------------------------------------------------------------------------------------------
       
   125 EXPORT_C CImageInfo::CImageInfo() :
       
   126 	iUri(KNullDesC8()),
       
   127 	iEncoded(EFalse),
       
   128 	iFilePath(KNullDesC8()),
       
   129 	iId(KErrNotFound),
       
   130 	iCopies(1),
       
   131 	iIndex(KErrNotFound)
       
   132 {
       
   133 
       
   134 }
       
   135 
       
   136 //--------------------------------------------------------------------------------------------
       
   137 //
       
   138 // CImageInfo::CImageInfo
       
   139 //
       
   140 //--------------------------------------------------------------------------------------------
       
   141 EXPORT_C CImageInfo::CImageInfo(const CImageInfo &a) :
       
   142 	iUri(a.iUri),
       
   143 	iEncoded(a.iEncoded),
       
   144 	iFilePath(a.iFilePath),
       
   145 	iId(a.iId),
       
   146 	iCopies(a.iCopies),
       
   147 	iIndex(a.iIndex)
       
   148 {
       
   149 
       
   150 }
       
   151 
       
   152 //--------------------------------------------------------------------------------------------
       
   153 //
       
   154 // CImageInfo::CImageInfo
       
   155 //
       
   156 //--------------------------------------------------------------------------------------------
       
   157 EXPORT_C CImageInfo::~CImageInfo()
       
   158 {
       
   159 
       
   160 }
       
   161 
       
   162 //--------------------------------------------------------------------------------------------
       
   163 //
       
   164 // CImageInfo::UriLog
       
   165 //
       
   166 //--------------------------------------------------------------------------------------------
       
   167 EXPORT_C void CImageInfo::UriLog(const TDesC8& aUri)
       
   168 {
       
   169 #ifdef ENABLE_LOGGING
       
   170 	TFileName8 uri;
       
   171     UriLog(aUri, uri);
       
   172     LOG81("[CImageInfo::UriLog]\t \"%S\"", &uri);
       
   173 #else // prevent warning in compiler
       
   174 	aUri.Length();
       
   175 #endif
       
   176 }
       
   177 
       
   178 //--------------------------------------------------------------------------------------------
       
   179 //
       
   180 // CImageInfo::UriLog
       
   181 //
       
   182 //--------------------------------------------------------------------------------------------
       
   183 EXPORT_C void CImageInfo::UriLog(const TDesC& aUri)
       
   184 {
       
   185 #ifdef ENABLE_LOGGING
       
   186 	TFileName uri;
       
   187     UriLog(aUri, uri);
       
   188     LOG1("[CImageInfo::UriLog(const TDesC&)]\t \"%S\"", &uri);
       
   189 #else // prevent warning in compiler
       
   190 	aUri.Length();
       
   191 #endif
       
   192 }
       
   193 
       
   194 //--------------------------------------------------------------------------------------------
       
   195 //
       
   196 // CImageInfo::UriLog
       
   197 //
       
   198 //--------------------------------------------------------------------------------------------
       
   199 EXPORT_C void CImageInfo::UriLog(const TDesC8& aUri, TDes8& aConvert)
       
   200 {
       
   201 #ifdef ENABLE_LOGGING
       
   202 
       
   203     I_LOG2("[CImageInfo::UriLog(const TDesC8&, TDes8&)]\t %d - %d", aConvert.MaxLength(), aUri.Length());
       
   204 	if(aUri.Length() >= aConvert.MaxLength())
       
   205 	{
       
   206     	aConvert.Copy(aUri.Left(aConvert.MaxLength()));
       
   207 	}
       
   208 	else
       
   209 	{
       
   210 		aConvert.Copy(aUri);
       
   211 	}
       
   212 
       
   213 	TInt pos = aConvert.Find(KPros8());
       
   214 	while(pos != KErrNotFound)
       
   215 	{
       
   216 		if(KErrNotFound != pos && pos < aConvert.Length())
       
   217 			aConvert.Replace(pos, KPros8().Length(), KUnderScore8());
       
   218 	
       
   219 		pos = aConvert.Find(KPros8());
       
   220 	}
       
   221 #else // prevent warning in compiler
       
   222 	aUri.Length();
       
   223 	aConvert.Length();
       
   224 #endif
       
   225 }
       
   226 
       
   227 //--------------------------------------------------------------------------------------------
       
   228 //
       
   229 // CImageInfo::UriLog
       
   230 //
       
   231 //--------------------------------------------------------------------------------------------
       
   232 EXPORT_C void CImageInfo::UriLog(const TDesC& aUri, TDes& aConvert)
       
   233 {
       
   234 #ifdef ENABLE_LOGGING
       
   235     I_LOG2("[CImageInfo::UriLog(const TDesC&, TDes&)]\t %d - %d", aConvert.MaxLength(), aUri.Length());
       
   236 	if(aUri.Length() >= aConvert.MaxLength())
       
   237 	{
       
   238     	aConvert.Copy(aUri.Left(aConvert.MaxLength()));
       
   239 	}
       
   240 	else
       
   241 	{
       
   242 		aConvert.Copy(aUri);
       
   243 	}
       
   244 
       
   245 	TInt pos = aConvert.Find(KPros());
       
   246 	while(pos != KErrNotFound)
       
   247 	{
       
   248 		if(KErrNotFound != pos && pos < aConvert.Length())
       
   249 			aConvert.Replace(pos, KPros().Length(), KUnderScore());
       
   250 	
       
   251 		pos = aConvert.Find(KPros());
       
   252 	}
       
   253 #else // prevent warning in compiler
       
   254 	aUri.Length();
       
   255 	aConvert.Length();
       
   256 #endif
       
   257 }
       
   258 
       
   259 //--------------------------------------------------------------------------------------------
       
   260 //
       
   261 // CImageInfo::ConvertL
       
   262 //
       
   263 //--------------------------------------------------------------------------------------------
       
   264 EXPORT_C void CImageInfo::ConvertToUTF8L(const TDesC& aSource, TDes8& aResult)
       
   265 {
       
   266 	HBufC8* buf = EscapeUtils::ConvertFromUnicodeToUtf8L(aSource);
       
   267 	if(buf)
       
   268 	{
       
   269 	    I_LOG2("[CImageInfo::ConvertToUTF8L]\t %d - %d", aResult.MaxLength(), buf->Des().Length());
       
   270 		aResult.Copy(buf->Des());
       
   271 		delete buf;
       
   272 	}
       
   273 }
       
   274 
       
   275 //--------------------------------------------------------------------------------------------
       
   276 //
       
   277 // CImageInfo::ConvertL
       
   278 //
       
   279 //--------------------------------------------------------------------------------------------
       
   280 EXPORT_C void CImageInfo::ConvertToUnicodeL(const TDesC8& aSource, TDes& aResult)
       
   281 {
       
   282 	HBufC16* buf = EscapeUtils::ConvertToUnicodeFromUtf8L(aSource);
       
   283 	if(buf)
       
   284 	{
       
   285 	    I_LOG2("[CImageInfo::ConvertToUnicodeL]\t %d - %d", aResult.MaxLength(), buf->Des().Length());
       
   286 		aResult.Copy(buf->Des());
       
   287 		delete buf;
       
   288 	}
       
   289 }
       
   290 
       
   291 //--------------------------------------------------------------------------------------------
       
   292 //
       
   293 // CImageInfo::EncodeUriL
       
   294 //
       
   295 //--------------------------------------------------------------------------------------------
       
   296 EXPORT_C void CImageInfo::EncodeUriL(const TDesC8& aDecodedUri, TDes8& aEncodedUri)
       
   297 {
       
   298     TFileName unicodeUri;
       
   299     ConvertToUnicodeL( aDecodedUri, unicodeUri );
       
   300     EncodeUriL(unicodeUri, aEncodedUri);
       
   301 }
       
   302 //--------------------------------------------------------------------------------------------
       
   303 //
       
   304 // CImageInfo::EncodeUriL
       
   305 //
       
   306 //--------------------------------------------------------------------------------------------
       
   307 EXPORT_C void CImageInfo::EncodeUriL(const TDesC16& aDecodedUri, TDes8& aEncodedUri)
       
   308 {
       
   309     I_LOG("[CImageInfo::EncodeUriL]");
       
   310     CUri8* uri8 = UriUtils::CreateUriL( aDecodedUri );
       
   311     CleanupStack::PushL( uri8 );
       
   312     HBufC16* uriBuf = uri8->Uri().DisplayFormL();
       
   313     CleanupStack::PushL( uriBuf );
       
   314 
       
   315     //alloc enough memory: encoding replaces one char with three: '%XX'
       
   316     HBufC8* uriBuf8 = HBufC8::NewLC(KMaxFileName*3);
       
   317 
       
   318    	TPtr8 buf8Ptr(uriBuf8->Des());
       
   319     ConvertToUTF8L( uriBuf->Des(), buf8Ptr );
       
   320     I_LOG("[CImageInfo::EncodeUriL]\t <-ConvertToUTF8L");
       
   321 
       
   322     // encode additionally the following characters
       
   323     //";"  | "?"  | "@" | "&" | "=" | "+" | "$" | ","
       
   324     // no encoding of "/" or ":" for paths
       
   325 
       
   326 	TInt pos = buf8Ptr.LocateReverse('/');
       
   327     I_LOG1("[CImageInfo::EncodeUriL]\t pos %d", pos);
       
   328     if(KErrNotFound != pos)
       
   329     {
       
   330 		TPtr8 namePtr(buf8Ptr.LeftTPtr(pos));
       
   331 	    I_LOG1("[CImageInfo::EncodeUriL]\t namePtr.Length() %d", namePtr.Length());
       
   332 	    UriLog(namePtr);
       
   333 
       
   334 	    I_LOG("[CImageInfo::EncodeUriL]\t ->EncodeFileNameL");
       
   335 	    EncodeFileNameL(namePtr);
       
   336     }
       
   337 
       
   338     if(buf8Ptr.Length() > aEncodedUri.MaxLength())
       
   339     	User::Leave(KErrOverflow);
       
   340 
       
   341     aEncodedUri.Copy(buf8Ptr);
       
   342     I_LOG("[CImageInfo::EncodeUriL]\t aEncodedUri:");
       
   343     UriLog(aEncodedUri);
       
   344 
       
   345     CleanupStack::PopAndDestroy( uriBuf8 );
       
   346     CleanupStack::PopAndDestroy( uriBuf );
       
   347     CleanupStack::PopAndDestroy( uri8 );
       
   348 }
       
   349 
       
   350 
       
   351 //--------------------------------------------------------------------------------------------
       
   352 //
       
   353 // CImageInfo::SetUri
       
   354 //
       
   355 //--------------------------------------------------------------------------------------------
       
   356 EXPORT_C void CImageInfo::SetUri(const TDesC8& aUri, const TBool aEncoded)
       
   357 {
       
   358 	iUri.Copy(aUri);
       
   359 	iEncoded = aEncoded;
       
   360 }
       
   361 
       
   362 //--------------------------------------------------------------------------------------------
       
   363 //
       
   364 // CImageInfo::SetUri
       
   365 //
       
   366 //--------------------------------------------------------------------------------------------
       
   367 EXPORT_C void CImageInfo::SetUriL(const TDesC& aUri)
       
   368 {
       
   369 	ConvertToUTF8L(aUri, iUri);
       
   370 }
       
   371 
       
   372 //--------------------------------------------------------------------------------------------
       
   373 //
       
   374 // CImageInfo::GetUri
       
   375 //
       
   376 //--------------------------------------------------------------------------------------------
       
   377 EXPORT_C void CImageInfo::GetUri(TDes8& aUri) const
       
   378 {
       
   379 	aUri.Copy(iUri);
       
   380 }
       
   381 
       
   382 //--------------------------------------------------------------------------------------------
       
   383 //
       
   384 // CImageInfo::GetUri
       
   385 //
       
   386 //--------------------------------------------------------------------------------------------
       
   387 EXPORT_C void CImageInfo::GetUriL(TDes& aUri) const
       
   388 {
       
   389 	ConvertToUnicodeL( iUri, aUri );
       
   390 }
       
   391 
       
   392 //--------------------------------------------------------------------------------------------
       
   393 //
       
   394 // CImageInfo::GetUri
       
   395 //
       
   396 //--------------------------------------------------------------------------------------------
       
   397 EXPORT_C void CImageInfo::GetEncodedUriL(TDes8& aUri)
       
   398 {
       
   399     I_LOG1("[CImageInfo::EncodeUriL]\t iEncoded = %d", iEncoded);
       
   400 
       
   401 	if(iEncoded)
       
   402 		GetUri(aUri);
       
   403 	else
       
   404 		EncodeUriL(iUri, aUri);
       
   405 }
       
   406 
       
   407 //--------------------------------------------------------------------------------------------
       
   408 //
       
   409 // CImageInfo::CompareUri
       
   410 //
       
   411 //--------------------------------------------------------------------------------------------
       
   412 EXPORT_C TBool CImageInfo::CompareUri(const TDesC& aUri)
       
   413 {
       
   414 	if(KNullDesC() == aUri && KNullDesC8() == iUri)
       
   415 		return ETrue;
       
   416 
       
   417 	TFileName8 tmpUri8;
       
   418 	//First try copy (if earlier copied 8->16 the conversion cannot be done anymore):
       
   419 	tmpUri8.Copy(aUri);
       
   420 	if(CompareUri(tmpUri8))
       
   421 		return ETrue;
       
   422 	
       
   423 	//Then convert:
       
   424 	TRAPD(err, ConvertToUTF8L(aUri, tmpUri8));
       
   425 	if(KErrNone == err)
       
   426 		return CompareUri(tmpUri8);
       
   427 
       
   428 	return EFalse;
       
   429 }
       
   430 
       
   431 //--------------------------------------------------------------------------------------------
       
   432 //
       
   433 // CImageInfo::CompareUri
       
   434 //
       
   435 //--------------------------------------------------------------------------------------------
       
   436 EXPORT_C TBool CImageInfo::CompareUri(const TDesC8& aUri)
       
   437 {
       
   438 	if(0 == iUri.Compare(aUri))
       
   439 		return ETrue;
       
   440 
       
   441 	TFileName8 encodedUri;
       
   442 	TRAPD(err, EncodeUriL(iUri, encodedUri));
       
   443 	if(KErrNone == err && 0 == encodedUri.Compare(aUri))
       
   444 		return ETrue;
       
   445 
       
   446 	return EFalse;
       
   447 }
       
   448 
       
   449 //--------------------------------------------------------------------------------------------
       
   450 //
       
   451 // CImageInfo::SetUri
       
   452 //
       
   453 //--------------------------------------------------------------------------------------------
       
   454 EXPORT_C void CImageInfo::SetFilePath(const TDesC8& aFilePath)
       
   455 {
       
   456 	iFilePath = aFilePath;
       
   457 }
       
   458 
       
   459 //--------------------------------------------------------------------------------------------
       
   460 //
       
   461 // CImageInfo::SetUri
       
   462 //
       
   463 //--------------------------------------------------------------------------------------------
       
   464 EXPORT_C void CImageInfo::SetFilePathL(const TDesC& aFilePath)
       
   465 {
       
   466 	ConvertToUTF8L(aFilePath, iFilePath);
       
   467 }
       
   468 
       
   469 //--------------------------------------------------------------------------------------------
       
   470 //
       
   471 // CImageInfo::SetUri
       
   472 //
       
   473 //--------------------------------------------------------------------------------------------
       
   474 EXPORT_C void CImageInfo::GetFilePath(TDes8& aFilePath) const
       
   475 {
       
   476 	aFilePath.Copy(iFilePath);
       
   477 }
       
   478 
       
   479 //--------------------------------------------------------------------------------------------
       
   480 //
       
   481 // CImageInfo::SetUri
       
   482 //
       
   483 //--------------------------------------------------------------------------------------------
       
   484 EXPORT_C void CImageInfo::GetFilePathL(TDes& aFilePath) const
       
   485 {
       
   486 	ConvertToUnicodeL(iFilePath, aFilePath);
       
   487 }
       
   488 
       
   489 //--------------------------------------------------------------------------------------------
       
   490 //
       
   491 // CImageInfo::CompareFilePath
       
   492 //
       
   493 //--------------------------------------------------------------------------------------------
       
   494 EXPORT_C TBool CImageInfo::CompareFilePath(const TDesC& aFilePath)
       
   495 {
       
   496 	if(KNullDesC() == aFilePath && KNullDesC8() == iFilePath)
       
   497 		return ETrue;
       
   498 
       
   499 	TFileName8 tmpFile8;
       
   500 	TRAPD(err, ConvertToUTF8L(aFilePath, tmpFile8));
       
   501 	if(KErrNone == err)
       
   502 		return CompareFilePath(tmpFile8);
       
   503 
       
   504 	return EFalse;
       
   505 }
       
   506 
       
   507 //--------------------------------------------------------------------------------------------
       
   508 //
       
   509 // CImageInfo::CompareFilePath
       
   510 //
       
   511 //--------------------------------------------------------------------------------------------
       
   512 EXPORT_C TBool CImageInfo::CompareFilePath(const TDesC8& aFilePath)
       
   513 {
       
   514 	if(0 == iFilePath.Compare(aFilePath))
       
   515 		return ETrue;
       
   516 
       
   517 	return EFalse;
       
   518 }
       
   519 
       
   520 //--------------------------------------------------------------------------------------------
       
   521 //
       
   522 // CImageInfo::SetUri
       
   523 //
       
   524 //--------------------------------------------------------------------------------------------
       
   525 EXPORT_C void CImageInfo::SetId(const TInt aId)
       
   526 {
       
   527 	iId = aId;
       
   528 }
       
   529 
       
   530 //--------------------------------------------------------------------------------------------
       
   531 //
       
   532 // CImageInfo::SetUri
       
   533 //
       
   534 //--------------------------------------------------------------------------------------------
       
   535 EXPORT_C TInt CImageInfo::Id() const
       
   536 {
       
   537 	return iId;
       
   538 }
       
   539 
       
   540 //--------------------------------------------------------------------------------------------
       
   541 //
       
   542 // CImageInfo::SetUri
       
   543 //
       
   544 //--------------------------------------------------------------------------------------------
       
   545 EXPORT_C void CImageInfo::SetCopies(const TInt aCopies)
       
   546 {
       
   547 	iCopies = aCopies;
       
   548 }
       
   549 
       
   550 //--------------------------------------------------------------------------------------------
       
   551 //
       
   552 // CImageInfo::SetUri
       
   553 //
       
   554 //--------------------------------------------------------------------------------------------
       
   555 EXPORT_C TInt CImageInfo::Copies() const
       
   556 {
       
   557 	return iCopies;
       
   558 }
       
   559 
       
   560 //--------------------------------------------------------------------------------------------
       
   561 //
       
   562 // CImageInfo::SetUri
       
   563 //
       
   564 //--------------------------------------------------------------------------------------------
       
   565 EXPORT_C void CImageInfo::SetIndex(const TInt aIndex)
       
   566 {
       
   567 	iIndex = aIndex;
       
   568 }
       
   569 
       
   570 //--------------------------------------------------------------------------------------------
       
   571 //
       
   572 // CImageInfo::SetUri
       
   573 //
       
   574 //--------------------------------------------------------------------------------------------
       
   575 EXPORT_C TInt CImageInfo::Index() const
       
   576 {
       
   577 	return iIndex;
       
   578 }
       
   579 
       
   580 //--------------------------------------------------------------------------------------------
       
   581 //
       
   582 // CImageInfo::EncodeFileNameL
       
   583 //
       
   584 //--------------------------------------------------------------------------------------------
       
   585 EXPORT_C void CImageInfo::EncodeFileNameL(TDes8& aFileName)
       
   586 {
       
   587 
       
   588 	HBufC8* result = HBufC8::NewLC(aFileName.MaxLength());
       
   589 
       
   590 	for(TInt i = 0; i < result->Length(); ++i)
       
   591 	{
       
   592 		TUint8 ch = aFileName[i];
       
   593 		switch(ch)
       
   594 		{
       
   595 			case ':':
       
   596 				AppendL(result, KColonUrlEncoded());
       
   597 				break;
       
   598 			case '/':
       
   599 				AppendL(result, KSlashUrlEncoded());
       
   600 				break;
       
   601 			default:
       
   602 				TBufC8<1> character(&ch);
       
   603 				AppendL(result, character);
       
   604 				break;
       
   605 		}
       
   606 	}
       
   607 	aFileName.Copy(result->Des());
       
   608 	CleanupStack::PopAndDestroy(result);
       
   609 }
       
   610 
       
   611 //--------------------------------------------------------------------------------------------
       
   612 //
       
   613 // CImageInfo::Append
       
   614 //
       
   615 //--------------------------------------------------------------------------------------------
       
   616 EXPORT_C void CImageInfo::AppendL(HBufC8* aWhere, const TDesC8& aWhat)
       
   617 {
       
   618 	if( (aWhere->Length() + aWhat.Length()) >= aWhere->Des().MaxLength())
       
   619 	{
       
   620     	I_LOG2("[CImageInfo::AppendL]\t %d - %d", aWhat.Length(), aWhere->Length());
       
   621 		aWhere = aWhere->ReAllocL(aWhere->Des().MaxLength() + aWhat.Length());
       
   622 	}
       
   623 
       
   624 	aWhere->Des().Append(aWhat);
       
   625 }
       
   626 
       
   627 //  End of File