void CVBookmarkConverter::ResetL()
    {
    SetVersionL( KEmptyString );
    SetUrlL( KEmptyString );
    SetTitleL( KEmptyString );    
    SetInternetShortcutL( KEmptyString );    
    }
void CVBookmarkConverter::ImportDbItemL( const CFolderItem& aItem )
    {
    ResetL();
    
    if( aItem.IsFolder() )
        {
        User::Leave( KErrNotSupported );
        }
    
    SetVersionL( KVBMKVer );
    SetUrlL( aItem.SourceUrl() );
    SetInternetShortcutL( aItem.SourceUrl() );
    SetTitleL( aItem.Name() );
    }
void CVBookmarkConverter::ImportDbItemL( const CFavouritesItem& aItem )
    {
    ResetL();
    
    if( aItem.Type() != CFavouritesItem::EItem )
        {
        User::Leave( KErrNotSupported );
        }
    
    SetVersionL( KVBMKVer );
    SetUrlL( aItem.Url() );
    SetInternetShortcutL( aItem.Url() );
    SetTitleL( aItem.Name() );
    }
void CQueueEntry::InternalizeL( RReadStream& aStream )
    {
    TInt size;
    RBuf text;
	CleanupClosePushL( text );
    RBuf8 text8;
	CleanupClosePushL( text8 );

    size =  aStream.ReadInt32L( );
    text.ReAllocL( size );
    aStream.ReadL( text, size ); 
    SetUrlL(text);

    size =  aStream.ReadInt32L( );
    if( size > text.Length() ) text.ReAllocL( size );
    aStream.ReadL( text, size ); 
    SetTitleL(text);

    size =  aStream.ReadInt32L( );
    if( size > text.Length() ) text.ReAllocL( size );
    aStream.ReadL( text, size ); 
    SetTagsL(text);

    size =  aStream.ReadInt32L( );
    if( size > text.Length() ) text.ReAllocL( size );
    aStream.ReadL( text, size ); 
    SetDescriptionL( text );

    size =  aStream.ReadInt32L( );
    if( size > text.Length() ) text.ReAllocL( size );
    aStream.ReadL( text, size ); 
    SetFilename( text );

	CleanupStack::PopAndDestroy( &text8 );
	CleanupStack::PopAndDestroy( &text );
    
    iType = (TEntryType) aStream.ReadInt32L( );

	iStatus = (TEntryStatus) aStream.ReadInt32L( );

	iCategory = (TMovieCategory) aStream.ReadInt32L( );

	iPublic = aStream.ReadInt32L( );
		
	iSize = aStream.ReadInt32L( );

	iUid = aStream.ReadInt32L( );
    }
// ---------------------------------------------------------
// RFavouritesSrvTable::WriteItemDataL
// ---------------------------------------------------------
//
void RFavouritesSrvTable::WriteItemDataL( const CFavouritesItemImpl& aItem )
{
    // Fill standard attributes.
    __ASSERT_DEBUG( !ReadOnly(), FavouritesPanic( EFavouritesInternal ) );
    // Uid is *NOT* set. We update the current row.
    SetParentFolderL( aItem.ParentFolder() );
    SetTypeL( aItem.Type() );
    SetNameL( aItem.Name() );
    SetUrlL( aItem.Url() );
    SetUsernameL( aItem.UserName() );
    SetPasswordL( aItem.Password() );
    SetWapApL( aItem.WapAp() );
    // Note: read-only flag is *NOT* set. Setting that is accessible via
    // SetReadOnlyL.
    // Note: factory item flag is *NOT* set. Setting that is accessible via
    // SetFactoryItemL.
    SetContextIdL( aItem.ContextId() );
    // Note: last modification time is *NOT* set; PutL will do it.
    // Manual setting (override) is accessible via SetModifiedL.
    SetHiddenL( aItem.IsHidden() );
}
TInt CVBookmarkConverter::ImportVBookmarkL( const TDesC8& aBuffer )
    {
    LOGGER_ENTERFN( "CVBookmarkConverter::ImportVBookmarkL" );
    
    ResetL();
        
    TInt error = KErrNone;
    TInt position = 0;
    TPtrC8 tag;
    TPtrC8 value;
    TPtrC8 properties;
    error = ReadTagAndValue( aBuffer, position, tag, value, properties );
    if( error != KErrNone )
        {
        LOGGER_WRITE_1( "ReadTagAndValue err: %d", error );
        return error;
        }
        
    if ( ( tag != KVBMKBegin ) || ( value != KVBMKVbkm ) )
        {
        LOGGER_WRITE( "Invalid tag" );
        return KErrNotFound;
        }
    
    while ( ( error = ReadTagAndValue( aBuffer, position, tag, value, properties ) ) == KErrNone )
        {
        // Version
        if ( tag == KVBMKVersion )
            {
            SetVersionL( value );
            }
        
        // Url
        else if ( tag == KVBMKUrl )
            {
            SetUrlL( value );
            }
        
        // Title
        else if ( tag == KVBMKTitle )
            {
            TBookmarkEncoding encoding = Encoding( properties );
            SetTitleL( value, encoding );
            }
            
        // Beginning of envelope    
        else if ( ( tag == KVBMKBegin ) && ( value == KVBMKEnv ) )
            {
            // Read the envelope, quit if error
            error = ReadEnvelopeL( aBuffer, position );
            if( error != KErrNone )
                {
                return error;
                }
            }       
                
        // End of Bookmark
        else if ( ( tag == KVBMKEnd ) && ( value == KVBMKVbkm ) )
            {
            return error;
            }
        
        else
            {
            // Unknown data, skip
            }
        }

    LOGGER_LEAVEFN( "CVBookmarkConverter::ImportVBookmarkL" );      
    return error;
    }