|
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 the License "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: Encapsulates all the necessary information for a single page |
|
15 * to be able to re-display the page. |
|
16 * History Entry objects are stored on the History Stack. |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 |
|
22 #ifndef HISTORYENTRY_H |
|
23 #define HISTORYENTRY_H |
|
24 |
|
25 // INCLUDES |
|
26 #include <e32base.h> |
|
27 #include "HistoryInterface.h" |
|
28 |
|
29 // CONSTANTS |
|
30 //const ?type ?constant_var = ?constant; |
|
31 |
|
32 // MACROS |
|
33 |
|
34 // DATA TYPES |
|
35 //enum ?declaration |
|
36 //typedef ?declaration |
|
37 //extern ?data_type; |
|
38 |
|
39 // FUNCTION PROTOTYPES |
|
40 //?type ?function_name(?arg_list); |
|
41 |
|
42 // FORWARD DECLARATIONS |
|
43 namespace WebCore { |
|
44 class FormData; |
|
45 } |
|
46 |
|
47 // CLASS DECLARATION |
|
48 class CFbsBitmap; |
|
49 |
|
50 /** |
|
51 * HistoryEntry |
|
52 * |
|
53 * @lib ?library |
|
54 * @since ?Series60_version |
|
55 */ |
|
56 class HistoryEntry |
|
57 { |
|
58 public: |
|
59 /** |
|
60 * Two-phased constructor. |
|
61 * @return HistoryEntry * |
|
62 */ |
|
63 static HistoryEntry* initWithUrlAndFormData( const TPtrC8& url, const TPtrC8& requestUrl, |
|
64 TPtrC& formContentType, WebCore::FormData* formData, HistoryCallback* callback, TBool wmlType); |
|
65 |
|
66 /** |
|
67 * Overwrite the last request URL with a new one. |
|
68 * The original URL is released and the new one is added. |
|
69 */ |
|
70 void setRequestUrlL (const TDesC& requestUrl); |
|
71 |
|
72 /** |
|
73 * Overwrite the last URL response with a new one. |
|
74 * The original response is released and the new one is added. |
|
75 */ |
|
76 void setResponseUrlL (const TDesC& responseUrl); |
|
77 |
|
78 /** |
|
79 * Sets the new x and y coordinates |
|
80 */ |
|
81 void setPosition (const TPoint& position); |
|
82 /** |
|
83 * Sets the new zoom level |
|
84 */ |
|
85 void setZoomLevel (int zoomLevel); |
|
86 /** |
|
87 * Sets the new min zoom level |
|
88 */ |
|
89 void setMinZoomLevel (int zoomLevel); |
|
90 /** |
|
91 * Sets the page title |
|
92 */ |
|
93 void setPageTitle (const TDesC& pageTitle); |
|
94 |
|
95 /** |
|
96 * Set the field in focus |
|
97 */ |
|
98 void setActiveBoxId (int id); |
|
99 |
|
100 /** |
|
101 * Add a string to the list of post data |
|
102 * Leaves with error code KErrNoMemory if unable to allocate memory |
|
103 */ |
|
104 void addFormData (WebCore::FormData* formData); |
|
105 |
|
106 /** |
|
107 * Set post content type |
|
108 * Leaves with error code KErrNoMemory if unable to allocate memory |
|
109 */ |
|
110 void setPostContentTypeL (TPtrC postContentType); |
|
111 |
|
112 /** |
|
113 * Gets the URL Request |
|
114 * @return TPtrC to the request URL |
|
115 */ |
|
116 TPtrC8 requestUrl () const {return *m_requestUrl;} |
|
117 |
|
118 /** |
|
119 * Returns a pointer to the URL response |
|
120 * @return TPtrC to the response |
|
121 */ |
|
122 TPtrC8 responseUrl () const { return m_responseUrl ? *m_responseUrl : KNullDesC8(); } |
|
123 |
|
124 /** |
|
125 * Returns the x and y coordinates |
|
126 * @return TPoint |
|
127 */ |
|
128 |
|
129 TPoint position () const {return m_position;} |
|
130 /** |
|
131 * Returns zoom level |
|
132 * @return int |
|
133 */ |
|
134 int zoomLevel () const {return m_zoomLevel;} |
|
135 |
|
136 /** |
|
137 * Returns min zoom level |
|
138 * @return int |
|
139 */ |
|
140 int minZoomLevel () const {return m_minZoomLevel;} |
|
141 |
|
142 /** |
|
143 * Returns a pointer to the page title |
|
144 * @return TPtrC |
|
145 */ |
|
146 TPtrC pageTitle () const {return *m_pageTitle;} |
|
147 |
|
148 /** |
|
149 * Returns the id of the field in focus |
|
150 * @return int |
|
151 */ |
|
152 int activeBoxId () const {return m_activeBoxId;} |
|
153 |
|
154 /** |
|
155 * Returns a pointer to a post data string. |
|
156 * Returns null if no post data is found or if the index is out of range. |
|
157 * @return TPtrC8 |
|
158 */ |
|
159 WebCore::FormData* formData () const { return m_formData; } |
|
160 |
|
161 /** |
|
162 * Returns a post data content type. |
|
163 * Returns null if no post data is found or if the index is out of range. |
|
164 * @return TDesC |
|
165 */ |
|
166 TPtrC postContentType () const {return m_postContentType ? m_postContentType->Des() : KNullDesC();} |
|
167 |
|
168 /** |
|
169 * Sets page thumbnail |
|
170 * @param aThumbnail - page thumbnail |
|
171 * @return void |
|
172 */ |
|
173 void storeThumbnail(const CFbsBitmap* thumbnail, const TRect& area); |
|
174 |
|
175 /** |
|
176 * Returns page thumbnail |
|
177 * @return CFbsBitmap |
|
178 */ |
|
179 CFbsBitmap* thumbnail() const {return m_thumbnail;} |
|
180 |
|
181 /** |
|
182 * Returns page thumbnail |
|
183 * @return CFbsBitmap |
|
184 */ |
|
185 CFbsBitmap* constructThumbnailL(); |
|
186 |
|
187 /** |
|
188 * Delets page thumbnail |
|
189 * @return void |
|
190 */ |
|
191 void deleteThumbnail(); |
|
192 |
|
193 /** |
|
194 * Destructor |
|
195 */ |
|
196 ~HistoryEntry(); |
|
197 |
|
198 const TTime& creationTime() const { return m_creationTime; } |
|
199 |
|
200 /** |
|
201 * Changes the time during reload |
|
202 * @return void |
|
203 */ |
|
204 void touch() {m_creationTime.HomeTime();} |
|
205 |
|
206 /** |
|
207 * Returns boolean indicator if WML content WAS at one time |
|
208 * (things change and a different content type may be current on reload or back nav...like 404 error might be html) |
|
209 * associated with the url stored in the history stack |
|
210 * @return TBool |
|
211 */ |
|
212 TBool ifWml() { return m_ifWmlMode; } |
|
213 |
|
214 private: |
|
215 |
|
216 /** |
|
217 * Default constructor |
|
218 */ |
|
219 HistoryEntry(); |
|
220 |
|
221 /* Private Members */ |
|
222 |
|
223 private : |
|
224 |
|
225 // URL request string |
|
226 HBufC8* m_requestUrl; |
|
227 |
|
228 // HTML string response from URL request. Used for caching the page |
|
229 HBufC8* m_responseUrl; |
|
230 |
|
231 // String containing the page title |
|
232 HBufC* m_pageTitle; |
|
233 |
|
234 // X and y coordinates of last viewing position. |
|
235 TPoint m_position; |
|
236 |
|
237 // Id of box with focus |
|
238 int m_activeBoxId; |
|
239 |
|
240 // Post body buffer |
|
241 WebCore::FormData* m_formData; |
|
242 |
|
243 //Post Content Type |
|
244 HBufC* m_postContentType; |
|
245 |
|
246 //void CWebKitBridge::SaveDocumentState(const TArray<TPtrC>& aDocumentState) |
|
247 //TArray<TPtrC>* CWebKitBridge::DocumentState() const |
|
248 |
|
249 // Number of entries allowed in the stack |
|
250 int m_historyStackStackSize; |
|
251 |
|
252 // Page thumbnail |
|
253 CFbsBitmap* m_thumbnail; // owned |
|
254 |
|
255 // The time this entry was created |
|
256 TTime m_creationTime; |
|
257 |
|
258 CBufFlat* m_thumbnailBuf; //owned |
|
259 HistoryCallback* m_callback; |
|
260 |
|
261 // true = wml; false = other stuff |
|
262 TBool m_ifWmlMode; |
|
263 |
|
264 // zoom level |
|
265 int m_zoomLevel; |
|
266 |
|
267 // min zoom level |
|
268 int m_minZoomLevel; |
|
269 }; |
|
270 |
|
271 #endif // HISTORYENTRY_H |
|
272 |
|
273 // End of File |