PECengine/AttributeLibrary2/SrcWVAttributes/CPEngWVInfoLinkConstruct.cpp
changeset 0 094583676ce7
equal deleted inserted replaced
-1:000000000000 0:094583676ce7
       
     1 /*
       
     2 * Copyright (c) 2004 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:  WV InfoLink implementation.
       
    15 *
       
    16 */
       
    17 
       
    18 // INCLUDE FILES
       
    19 #include "CPEngWVAttributeConstructBase.h"
       
    20 #include "CPEngWVAttributeModelBase.h"
       
    21 #include "CPEngWVInfoLinkConstruct.h"
       
    22 #include "PEngWVAttributeModelDataHelper.h"
       
    23 
       
    24 #include "MPEngXMLSerializer.h"
       
    25 #include "MPEngXMLParser.h"
       
    26 
       
    27 #include <MPEngPresenceAttrModel2.h>
       
    28 #include <PEngWVPresenceAttributes2.h>
       
    29 
       
    30 #include <E32Base.h>
       
    31 #include <S32Strm.h>
       
    32 
       
    33 
       
    34 
       
    35 //  DATA TYPES
       
    36 /**
       
    37  * InfoLink WV CSP name table and size.
       
    38  */
       
    39 const TWVCspAttributeNameEntry KInfoLinkCspNameTable[] =
       
    40     {
       
    41         {
       
    42         EWVCspV12,
       
    43         LIT_AS_DESC8_PTR( KInfoLinkXMLTag ),
       
    44         LIT_AS_DESC8_PTR( KPresenceSubListAttributesNS_CSP12 )
       
    45         }
       
    46     };
       
    47 
       
    48 const TInt KInfoLinkCspNameTableCount = sizeof( KInfoLinkCspNameTable ) / sizeof( TWVCspAttributeNameEntry );
       
    49 
       
    50 
       
    51 
       
    52 
       
    53 // =============== CPEngWVInfoLinkConstruct MEMBER FUNCTIONS ===============
       
    54 
       
    55 // -----------------------------------------------------------------------------
       
    56 // CPEngWVInfoLinkConstruct::CPEngWVInfoLinkConstruct
       
    57 // C++ constructor can NOT contain any code, that
       
    58 // might leave.
       
    59 // -----------------------------------------------------------------------------
       
    60 //
       
    61 CPEngWVInfoLinkConstruct::CPEngWVInfoLinkConstruct( TPEngWVCspVersion aCurrentCspVer )
       
    62         : CPEngWVAttributeConstructBase( aCurrentCspVer,
       
    63                                          KInfoLinkCspNameTable,
       
    64                                          KInfoLinkCspNameTableCount )
       
    65     {
       
    66     }
       
    67 
       
    68 
       
    69 // Destructor
       
    70 CPEngWVInfoLinkConstruct::~CPEngWVInfoLinkConstruct()
       
    71     {
       
    72     }
       
    73 
       
    74 
       
    75 
       
    76 // -----------------------------------------------------------------------------
       
    77 // CPEngWVInfoLinkConstruct::NewAttributeInstanceLC()
       
    78 // -----------------------------------------------------------------------------
       
    79 //
       
    80 MPEngPresenceAttrModelTypeImp* CPEngWVInfoLinkConstruct::NewAttributeInstanceLC(
       
    81     TBool aUserOwnAttribute ) const
       
    82     {
       
    83     CPEngWVInfoLinkModel* model = new ( ELeave ) CPEngWVInfoLinkModel(
       
    84         aUserOwnAttribute );
       
    85     CleanupStack::PushL( model );
       
    86     model->ResetDataL();
       
    87     return model;
       
    88     }
       
    89 
       
    90 
       
    91 
       
    92 
       
    93 
       
    94 
       
    95 
       
    96 // ================= CPEngWVInfoLink MEMBER FUNCTIONS =================
       
    97 
       
    98 // -----------------------------------------------------------------------------
       
    99 // CPEngWVInfoLinkConstruct::CPEngWVInfoLink::NewL()
       
   100 // Two-phased constructor.
       
   101 // -----------------------------------------------------------------------------
       
   102 //
       
   103 CPEngWVInfoLinkConstruct::CPEngWVInfoLink*
       
   104 CPEngWVInfoLinkConstruct::CPEngWVInfoLink::NewLC()
       
   105     {
       
   106     CPEngWVInfoLink* self = new ( ELeave ) CPEngWVInfoLink();
       
   107     CleanupStack::PushL( self );
       
   108     return self;
       
   109     }
       
   110 
       
   111 CPEngWVInfoLinkConstruct::CPEngWVInfoLink*
       
   112 CPEngWVInfoLinkConstruct::CPEngWVInfoLink::NewLC( RReadStream& aStream )
       
   113     {
       
   114     CPEngWVInfoLink* self = new ( ELeave ) CPEngWVInfoLink();
       
   115     CleanupStack::PushL( self );
       
   116     self->InternalizeL( aStream );
       
   117     return self;
       
   118     }
       
   119 
       
   120 
       
   121 // -----------------------------------------------------------------------------
       
   122 // CPEngWVInfoLinkConstruct::CPEngWVInfoLink::CPEngWVInfoLink
       
   123 // C++ constructor can NOT contain any code, that
       
   124 // might leave.
       
   125 // -----------------------------------------------------------------------------
       
   126 //
       
   127 CPEngWVInfoLinkConstruct::CPEngWVInfoLink::CPEngWVInfoLink()
       
   128     {
       
   129     }
       
   130 
       
   131 
       
   132 // Destructor
       
   133 CPEngWVInfoLinkConstruct::CPEngWVInfoLink::~CPEngWVInfoLink()
       
   134     {
       
   135     delete iInfoLink;
       
   136     delete iInfoLinkDescr;
       
   137     delete iInfoLinkMimeType;
       
   138     }
       
   139 
       
   140 
       
   141 // -----------------------------------------------------------------------------
       
   142 // CPEngWVInfoLinkConstruct::CPEngWVInfoLink::SetUrlL()
       
   143 // -----------------------------------------------------------------------------
       
   144 //
       
   145 void CPEngWVInfoLinkConstruct::CPEngWVInfoLink::SetUrlL( const TDesC& aUrl )
       
   146     {
       
   147     DoSetDescL( iInfoLink, aUrl );
       
   148     }
       
   149 
       
   150 
       
   151 // -----------------------------------------------------------------------------
       
   152 // CPEngWVInfoLinkConstruct::CPEngWVInfoLink::SetDescriptionL()
       
   153 // -----------------------------------------------------------------------------
       
   154 //
       
   155 void CPEngWVInfoLinkConstruct::CPEngWVInfoLink::SetDescriptionL( const TDesC& aDescr )
       
   156     {
       
   157     DoSetDescL( iInfoLinkDescr, aDescr );
       
   158     }
       
   159 
       
   160 
       
   161 // -----------------------------------------------------------------------------
       
   162 // CPEngWVInfoLinkConstruct::CPEngWVInfoLink::SetMimeTypeL()
       
   163 // -----------------------------------------------------------------------------
       
   164 //
       
   165 void CPEngWVInfoLinkConstruct::CPEngWVInfoLink::SetMimeTypeL( const TDesC& aMimeType )
       
   166     {
       
   167     DoSetDescL( iInfoLinkMimeType, aMimeType );
       
   168     }
       
   169 
       
   170 
       
   171 // -----------------------------------------------------------------------------
       
   172 // CPEngWVInfoLinkConstruct::CPEngWVInfoLink::GetUrl()
       
   173 // -----------------------------------------------------------------------------
       
   174 //
       
   175 void CPEngWVInfoLinkConstruct::CPEngWVInfoLink::GetUrl( TPtrC16& aUrl ) const
       
   176     {
       
   177     DoGetDesc( iInfoLink, aUrl );
       
   178     }
       
   179 
       
   180 
       
   181 // -----------------------------------------------------------------------------
       
   182 // CPEngWVInfoLinkConstruct::CPEngWVInfoLink::GetDescription()
       
   183 // -----------------------------------------------------------------------------
       
   184 //
       
   185 void CPEngWVInfoLinkConstruct::CPEngWVInfoLink::GetDescription( TPtrC16& aDescr ) const
       
   186     {
       
   187     DoGetDesc( iInfoLinkDescr, aDescr );
       
   188     }
       
   189 
       
   190 
       
   191 // -----------------------------------------------------------------------------
       
   192 // CPEngWVInfoLinkConstruct::CPEngWVInfoLink::GetMimeType()
       
   193 // -----------------------------------------------------------------------------
       
   194 //
       
   195 void CPEngWVInfoLinkConstruct::CPEngWVInfoLink::GetMimeType( TPtrC16& aMimeType ) const
       
   196     {
       
   197     DoGetDesc( iInfoLinkMimeType, aMimeType );
       
   198     }
       
   199 
       
   200 
       
   201 // -----------------------------------------------------------------------------
       
   202 // CPEngWVInfoLinkConstruct::CPEngWVInfoLink::ExternalizeSize()
       
   203 // -----------------------------------------------------------------------------
       
   204 //
       
   205 TInt CPEngWVInfoLinkConstruct::CPEngWVInfoLink::ExternalizeSize() const
       
   206     {
       
   207     TInt size = DoGetBufExtSize( iInfoLink );
       
   208     size += DoGetBufExtSize( iInfoLinkDescr );
       
   209     size += DoGetBufExtSize( iInfoLinkMimeType );
       
   210     return size;
       
   211     }
       
   212 
       
   213 
       
   214 // -----------------------------------------------------------------------------
       
   215 // CPEngWVInfoLinkConstruct::CPEngWVInfoLink::ExternalizeL()
       
   216 // -----------------------------------------------------------------------------
       
   217 //
       
   218 void CPEngWVInfoLinkConstruct::CPEngWVInfoLink::ExternalizeL(
       
   219     RWriteStream& aStream ) const
       
   220     {
       
   221     DoExtrBufL( iInfoLink, aStream );
       
   222     DoExtrBufL( iInfoLinkDescr, aStream );
       
   223     DoExtrBufL( iInfoLinkMimeType, aStream );
       
   224     }
       
   225 
       
   226 
       
   227 // -----------------------------------------------------------------------------
       
   228 // CPEngWVInfoLinkConstruct::CPEngWVInfoLink::InternalizeL()
       
   229 // -----------------------------------------------------------------------------
       
   230 //
       
   231 void CPEngWVInfoLinkConstruct::CPEngWVInfoLink::InternalizeL( RReadStream& aStream )
       
   232     {
       
   233     TPtr16 dataStrait( NULL, 0 );
       
   234     DoIntrBufL( iInfoLink, dataStrait, aStream );
       
   235     DoIntrBufL( iInfoLinkDescr, dataStrait, aStream );
       
   236     DoIntrBufL( iInfoLinkMimeType, dataStrait, aStream );
       
   237     }
       
   238 
       
   239 
       
   240 
       
   241 
       
   242 
       
   243 
       
   244 // ================= CPEngWVInfoLinkModel MEMBER FUNCTIONS =================
       
   245 
       
   246 // -----------------------------------------------------------------------------
       
   247 // CPEngWVInfoLinkConstruct::CPEngWVInfoLinkConstruct::CPEngWVInfoLinkModel
       
   248 // C++ constructor can NOT contain any code, that
       
   249 // might leave.
       
   250 // -----------------------------------------------------------------------------
       
   251 //
       
   252 CPEngWVInfoLinkConstruct::CPEngWVInfoLinkModel::CPEngWVInfoLinkModel(
       
   253     TBool aUserOwnAttribute )
       
   254         : CPEngWVAttributeModelBase( aUserOwnAttribute )
       
   255     {
       
   256     }
       
   257 
       
   258 
       
   259 // Destructor
       
   260 CPEngWVInfoLinkConstruct::CPEngWVInfoLinkModel::~CPEngWVInfoLinkModel()
       
   261     {
       
   262     iInfoLinks.ResetAndDestroy();
       
   263     }
       
   264 
       
   265 
       
   266 
       
   267 // -----------------------------------------------------------------------------
       
   268 // CPEngWVInfoLinkConstruct::CPEngWVInfoLinkModel::SetDataL()
       
   269 // -----------------------------------------------------------------------------
       
   270 //
       
   271 TBool CPEngWVInfoLinkConstruct::CPEngWVInfoLinkModel::SetDataL( TInt* aIntData,
       
   272                                                                 const TDesC8* /*a8Data*/,
       
   273                                                                 const TDesC16* a16Data,
       
   274                                                                 TInt aField,
       
   275                                                                 TInt aGroup )
       
   276     {
       
   277     TBool handled = EFalse;
       
   278 
       
   279     if ( a16Data )
       
   280         {
       
   281         //Updating infoLink struct contents
       
   282 
       
   283         if ( aGroup == iInfoLinks.Count() )
       
   284             {
       
   285             // initialize the cell where the new data is about to be put
       
   286             CPEngWVInfoLink* link = CPEngWVInfoLink::NewLC();
       
   287             handled = SetInfoLinkDataL( *link, *a16Data, aField );
       
   288             if ( handled )
       
   289                 {
       
   290                 iInfoLinks.AppendL( link );
       
   291                 CleanupStack::Pop( link );
       
   292                 }
       
   293             else
       
   294                 {
       
   295                 CleanupStack::PopAndDestroy( link );
       
   296                 }
       
   297             }
       
   298         else
       
   299             {
       
   300             CPEngWVInfoLink* link = iInfoLinks[ aGroup ];
       
   301             handled = SetInfoLinkDataL( *link, *a16Data, aField );
       
   302             }
       
   303         }
       
   304 
       
   305 
       
   306 
       
   307     else if ( aIntData )
       
   308         {
       
   309         //Editing infoLink struct amount
       
   310         if ( ( aGroup == EPEngInfoLinkOperations ) &&
       
   311              ( aField == EPEngInfoLinkOpDeleteGroup ) )
       
   312             {
       
   313             TInt index = *aIntData;
       
   314 
       
   315             //If client gives special index -1, all existing infolinks are deleted
       
   316             if ( index == -1 )
       
   317                 {
       
   318                 iInfoLinks.ResetAndDestroy();
       
   319                 }
       
   320             else
       
   321                 {
       
   322                 delete iInfoLinks[ *aIntData ];
       
   323                 iInfoLinks.Remove( *aIntData );
       
   324                 }
       
   325             handled = ETrue;
       
   326             }
       
   327         }
       
   328 
       
   329     return handled;
       
   330     }
       
   331 
       
   332 
       
   333 // -----------------------------------------------------------------------------
       
   334 // CPEngWVInfoLinkConstruct::CPEngWVInfoLinkModel::GetData()
       
   335 // -----------------------------------------------------------------------------
       
   336 //
       
   337 TBool CPEngWVInfoLinkConstruct::CPEngWVInfoLinkModel::GetData( TInt* aIntData,
       
   338                                                                TPtrC8* /*a8Data*/,
       
   339                                                                TPtrC16* a16Data,
       
   340                                                                TInt aField,
       
   341                                                                TInt aGroup ) const
       
   342     {
       
   343     TBool handled = EFalse;
       
   344 
       
   345     if ( a16Data )
       
   346         {
       
   347         const CPEngWVInfoLink& infoLink = *iInfoLinks[ aGroup ];
       
   348         handled = GetInfoLinkData( infoLink, aField, *a16Data );
       
   349         }
       
   350 
       
   351     else if ( aIntData )
       
   352         {
       
   353         if ( ( aGroup == EPEngInfoLinkOperations ) &&
       
   354              ( aField == EPEngInfoLinkOpGetGroupCount ) )
       
   355             {
       
   356             *aIntData = iInfoLinks.Count();
       
   357             handled = ETrue;
       
   358             }
       
   359         }
       
   360 
       
   361 
       
   362     return handled;
       
   363     }
       
   364 
       
   365 
       
   366 
       
   367 // -----------------------------------------------------------------------------
       
   368 // CPEngWVInfoLinkConstruct::CPEngWVInfoLinkModel::EncodeDataToXmlL()
       
   369 // -----------------------------------------------------------------------------
       
   370 //
       
   371 void CPEngWVInfoLinkConstruct::CPEngWVInfoLinkModel::EncodeDataToXmlL(
       
   372     MPEngXMLSerializer& aSerializer ) const
       
   373     {
       
   374     const TInt infLinkCount = iInfoLinks.Count();
       
   375     for ( TInt ix = 0; ix < infLinkCount; ix++ )
       
   376         {
       
   377         const CPEngWVInfoLink& infoLink = *iInfoLinks[ ix ];
       
   378         TPtrC16 data( NULL, 0 );
       
   379 
       
   380         aSerializer.StartTagL( KInfoLinkXMLTagInf );
       
   381 
       
   382         infoLink.GetUrl( data );
       
   383         aSerializer.StartTagL( KInfoLinkXMLTagLink )
       
   384         .UnicodeTextL( data )
       
   385         .EndTagL( KInfoLinkXMLTagLink );
       
   386 
       
   387         infoLink.GetDescription( data );
       
   388         aSerializer.StartTagL( KInfoLinkXMLTagText )
       
   389         .UnicodeTextL( data )
       
   390         .EndTagL( KInfoLinkXMLTagText );
       
   391 
       
   392         infoLink.GetMimeType( data );
       
   393         aSerializer.StartTagL( KContentTypeXMLTag )
       
   394         .UnicodeTextL( data )
       
   395         .EndTagL( KContentTypeXMLTag );
       
   396 
       
   397 
       
   398         aSerializer.EndTagL( KInfoLinkXMLTagInf );
       
   399         }
       
   400     }
       
   401 
       
   402 
       
   403 
       
   404 // -----------------------------------------------------------------------------
       
   405 // CPEngWVInfoLinkConstruct::CPEngWVInfoLinkModel::DecodeDataFromXmlL()
       
   406 // -----------------------------------------------------------------------------
       
   407 //
       
   408 void CPEngWVInfoLinkConstruct::CPEngWVInfoLinkModel::DecodeDataFromXmlL(
       
   409     MPEngXMLParser& aParser,
       
   410     const TDesC8& aValueBlock )
       
   411     {
       
   412     RArray<TPtrC8> infoLinkDataBlocks;
       
   413     CleanupClosePushL( infoLinkDataBlocks );
       
   414 
       
   415     iInfoLinks.ResetAndDestroy();
       
   416 
       
   417     // parse the InfoLink attribute values
       
   418     if ( aParser.DecodeL( aValueBlock, KInfoLinkXMLTagInf, ETrue ) )
       
   419         {
       
   420         const TInt resCount( aParser.Count() );
       
   421         TInt ix;
       
   422         for ( ix = 0; ix < resCount; ix++ )
       
   423             {
       
   424             User::LeaveIfError( infoLinkDataBlocks.Append( aParser.ResultL( ix ) ) );
       
   425             }
       
   426 
       
   427 
       
   428         for ( ix = 0; ix < resCount; ix++ )
       
   429             {
       
   430             TPtrC8 infoLinkBlock( infoLinkDataBlocks[ ix ] );
       
   431             CPEngWVInfoLink* infoLink = CPEngWVInfoLink::NewLC();
       
   432 
       
   433             TBool mandatoryFieldsFound = EFalse;
       
   434             if ( aParser.DecodeL( infoLinkBlock, KInfoLinkXMLTagLink, EFalse ) )
       
   435                 {
       
   436                 HBufC* tmp = aParser.ResultAsUnicodeTextL();
       
   437 
       
   438                 CleanupStack::PushL( tmp );
       
   439                 infoLink->SetUrlL( *tmp );
       
   440                 CleanupStack::PopAndDestroy(); // tmp
       
   441 
       
   442                 mandatoryFieldsFound = ETrue;
       
   443                 }
       
   444 
       
   445 
       
   446             if ( aParser.DecodeL( infoLinkBlock, KInfoLinkXMLTagText, EFalse ) )
       
   447                 {
       
   448                 HBufC* tmp = aParser.ResultAsUnicodeTextL();
       
   449 
       
   450                 CleanupStack::PushL( tmp );
       
   451                 infoLink->SetDescriptionL( *tmp );
       
   452                 CleanupStack::PopAndDestroy(); // tmp
       
   453                 }
       
   454 
       
   455 
       
   456             if ( aParser.DecodeL( infoLinkBlock, KContentTypeXMLTag, EFalse ) )
       
   457                 {
       
   458                 HBufC* tmp = aParser.ResultAsUnicodeTextL();
       
   459 
       
   460                 CleanupStack::PushL( tmp );
       
   461                 infoLink->SetMimeTypeL( *tmp );
       
   462                 CleanupStack::PopAndDestroy(); // tmp
       
   463                 }
       
   464 
       
   465             if ( mandatoryFieldsFound )
       
   466                 {
       
   467                 iInfoLinks.AppendL( infoLink );
       
   468                 CleanupStack::Pop( infoLink );
       
   469                 }
       
   470             else
       
   471                 {
       
   472                 CleanupStack::PopAndDestroy( infoLink );
       
   473                 }
       
   474             }
       
   475         }
       
   476 
       
   477     CleanupStack::PopAndDestroy(); // infoLinks
       
   478     }
       
   479 
       
   480 
       
   481 
       
   482 // -----------------------------------------------------------------------------
       
   483 // CPEngWVInfoLinkConstruct::CPEngWVInfoLinkModel::ResetDataL()
       
   484 // -----------------------------------------------------------------------------
       
   485 //
       
   486 void CPEngWVInfoLinkConstruct::CPEngWVInfoLinkModel::ResetDataL()
       
   487     {
       
   488     iInfoLinks.ResetAndDestroy();
       
   489     }
       
   490 
       
   491 
       
   492 
       
   493 // -----------------------------------------------------------------------------
       
   494 // CPEngWVInfoLinkConstruct::CPEngWVInfoLinkModel::DataExternalizeSize()
       
   495 // -----------------------------------------------------------------------------
       
   496 //
       
   497 TInt CPEngWVInfoLinkConstruct::CPEngWVInfoLinkModel::DataExternalizeSize() const
       
   498     {
       
   499     TInt dataSize = 4; // 4 is the max size of the count
       
   500 
       
   501     const TInt infLinkCount( iInfoLinks.Count() );
       
   502     for ( TInt ix = 0; ix < infLinkCount; ix++ )
       
   503         {
       
   504         dataSize += iInfoLinks[ ix ]->ExternalizeSize();
       
   505         }
       
   506 
       
   507     return dataSize;
       
   508     }
       
   509 
       
   510 
       
   511 
       
   512 // -----------------------------------------------------------------------------
       
   513 // CPEngWVInfoLinkConstruct::CPEngWVInfoLinkModel::ExternalizeDataL()
       
   514 // -----------------------------------------------------------------------------
       
   515 //
       
   516 void CPEngWVInfoLinkConstruct::CPEngWVInfoLinkModel::ExternalizeDataL(
       
   517     RWriteStream& aStream ) const
       
   518     {
       
   519     const TInt infLinkCount( iInfoLinks.Count() );
       
   520     aStream << TCardinality( infLinkCount );
       
   521 
       
   522     for ( TInt ix = 0; ix < infLinkCount; ix++ )
       
   523         {
       
   524         iInfoLinks[ ix ]->ExternalizeL( aStream );
       
   525         }
       
   526     }
       
   527 
       
   528 
       
   529 // -----------------------------------------------------------------------------
       
   530 // CPEngWVInfoLinkConstruct::CPEngWVInfoLinkModel::InternalizeDataL()
       
   531 // -----------------------------------------------------------------------------
       
   532 //
       
   533 void CPEngWVInfoLinkConstruct::CPEngWVInfoLinkModel::InternalizeDataL(
       
   534     RReadStream& aStream )
       
   535     {
       
   536     iInfoLinks.ResetAndDestroy();
       
   537 
       
   538     TCardinality c;
       
   539     aStream >> c;   //read the length bits
       
   540     const TInt infLinkCount = c;
       
   541     for ( TInt ix = 0 ; ix < infLinkCount; ix++ )
       
   542         {
       
   543         CPEngWVInfoLink* infoLink = CPEngWVInfoLink::NewLC( aStream );
       
   544         User::LeaveIfError( iInfoLinks.Append( infoLink ) );
       
   545         CleanupStack::Pop( infoLink );
       
   546         }
       
   547     }
       
   548 
       
   549 
       
   550 
       
   551 // -----------------------------------------------------------------------------
       
   552 // CPEngWVInfoLinkConstruct::CPEngWVInfoLinkModel::SetInfoLinkDataL()
       
   553 // -----------------------------------------------------------------------------
       
   554 //
       
   555 TBool CPEngWVInfoLinkConstruct::CPEngWVInfoLinkModel::SetInfoLinkDataL(
       
   556     CPEngWVInfoLink& aInfoLink,
       
   557     const TDesC16& aData,
       
   558     TInt aInfoLinkFieldId )
       
   559     {
       
   560     TBool handled = EFalse;
       
   561     switch ( aInfoLinkFieldId )
       
   562         {
       
   563         case EPEngInfoLinkLink:
       
   564             {
       
   565             aInfoLink.SetUrlL( aData );
       
   566             handled = ETrue;
       
   567             break;
       
   568             }
       
   569 
       
   570         case EPEngInfoLinkDesc:
       
   571             {
       
   572             aInfoLink.SetDescriptionL( aData );
       
   573             handled = ETrue;
       
   574             break;
       
   575             }
       
   576 
       
   577         case EPEngInfoLinkMimeType:
       
   578             {
       
   579             aInfoLink.SetMimeTypeL( aData );
       
   580             handled = ETrue;
       
   581             break;
       
   582             }
       
   583         }
       
   584 
       
   585     return handled;
       
   586     }
       
   587 
       
   588 
       
   589 
       
   590 // -----------------------------------------------------------------------------
       
   591 // CPEngWVInfoLinkConstruct::CPEngWVInfoLinkModel::GetInfoLinkData()
       
   592 // -----------------------------------------------------------------------------
       
   593 //
       
   594 TBool CPEngWVInfoLinkConstruct::CPEngWVInfoLinkModel::GetInfoLinkData(
       
   595     const CPEngWVInfoLink& aInfoLink,
       
   596     TInt aInfoLinkFieldId,
       
   597     TPtrC16& aData ) const
       
   598     {
       
   599     TBool handled = EFalse;
       
   600     switch ( aInfoLinkFieldId )
       
   601         {
       
   602         case EPEngInfoLinkLink:
       
   603             {
       
   604             aInfoLink.GetUrl( aData );
       
   605             handled = ETrue;
       
   606             break;
       
   607             }
       
   608 
       
   609         case EPEngInfoLinkDesc:
       
   610             {
       
   611             aInfoLink.GetDescription( aData );
       
   612             handled = ETrue;
       
   613             break;
       
   614             }
       
   615 
       
   616         case EPEngInfoLinkMimeType:
       
   617             {
       
   618             aInfoLink.GetMimeType( aData );
       
   619             handled = ETrue;
       
   620             break;
       
   621             }
       
   622         }
       
   623 
       
   624     return handled;
       
   625     }
       
   626 
       
   627 
       
   628 //  End of File
       
   629 
       
   630 
       
   631