|
1 /* |
|
2 * Copyright (c) 2005-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: Bookmark object conversion routines |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef __VBOOKMARKCONVERTER_H__ |
|
20 #define __VBOOKMARKCONVERTER_H__ |
|
21 |
|
22 #include <e32base.h> |
|
23 |
|
24 class CFavouritesItem; |
|
25 class CFolderItem; |
|
26 |
|
27 typedef enum |
|
28 { |
|
29 ENoEncoding = 0, |
|
30 EQuotedPrintable |
|
31 } TBookmarkEncoding; |
|
32 |
|
33 class CVBookmarkConverter : public CBase |
|
34 { |
|
35 public: |
|
36 |
|
37 static CVBookmarkConverter* NewL(); |
|
38 static CVBookmarkConverter* NewLC(); |
|
39 ~CVBookmarkConverter(); |
|
40 |
|
41 // Get |
|
42 const TDesC& GetVersion() const; |
|
43 const TDesC& GetUrl() const; |
|
44 const TDesC& GetTitle() const; |
|
45 const TDesC& GetInternetShortcut() const; |
|
46 |
|
47 // Set |
|
48 void SetVersionL( const TDesC& aVersion ); |
|
49 void SetVersionL( const TDesC8& aVersion ); |
|
50 |
|
51 void SetUrlL( const TDesC& aUrl ); |
|
52 void SetUrlL( const TDesC8& aUrl ); |
|
53 |
|
54 void SetTitleL( const TDesC& aTitle ); |
|
55 void SetTitleL( const TDesC8& aTitle, TBookmarkEncoding aEncoding = ENoEncoding ); |
|
56 |
|
57 void SetInternetShortcutL( const TDesC& aInternetShortcut ); |
|
58 void SetInternetShortcutL( const TDesC8& aInternetShortcut ); |
|
59 |
|
60 void ExportDbItemL( CFavouritesItem& aItem ); |
|
61 void ImportDbItemL( const CFavouritesItem& aItem ); |
|
62 void ImportDbItemL( const CFolderItem& aItem ); |
|
63 |
|
64 |
|
65 // Export / Import VBookmark info from/to this object |
|
66 void ExportVBookmarkL( TDes8& aBuffer ); |
|
67 void ExportVBookmarkL( CBufBase& aBuffer ); |
|
68 |
|
69 TInt ImportVBookmarkL( const TDesC8& aBuffer ); |
|
70 |
|
71 private: |
|
72 |
|
73 CVBookmarkConverter(); |
|
74 void ConstructL(); |
|
75 |
|
76 void WriteMessageLineL( const TDesC8& aMsgLineTag, const TDesC8& aMsgLineData, |
|
77 const TDesC8& aSeparator ); |
|
78 |
|
79 void WriteEnvelopeL(); |
|
80 |
|
81 void ExportL(); |
|
82 |
|
83 void ResetL(); |
|
84 |
|
85 TInt ReadTagAndValue( const TDesC8& aBuffer, TInt& aPosition, |
|
86 TPtrC8& aTag, TPtrC8& aValue, TPtrC8& aProperties ); |
|
87 |
|
88 TInt ReadEnvelopeL( const TDesC8& aBuffer, TInt& aPosition ); |
|
89 |
|
90 TInt ReadAssignment( const TDesC8& aBuffer, TInt& aPosition, |
|
91 TPtrC8& aTag, TPtrC8& aValue ); |
|
92 |
|
93 void WriteL( const TDesC8 &aData ); |
|
94 |
|
95 void IgnoreSpaces( TPtrC8& aData ); |
|
96 |
|
97 TBookmarkEncoding Encoding( TPtrC8& aProperties ); |
|
98 |
|
99 HBufC8* DecodeQuotedPrintableLC( const TDesC8& aEncodedData ); |
|
100 |
|
101 private: |
|
102 |
|
103 HBufC* iVersion; |
|
104 HBufC* iUrl; |
|
105 HBufC* iTitle; |
|
106 HBufC* iInternetShortcut; |
|
107 CBufBase* iBuffer; |
|
108 TInt iWriteBufPosition; |
|
109 TInt iWriteBufSize; |
|
110 TDes8* iDesc; |
|
111 }; |
|
112 |
|
113 #endif |