48
|
1 |
/*
|
|
2 |
* Copyright (c) 2005-2008 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: A container to browse a given feed.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#ifndef FEED_CONTAINER_H
|
|
20 |
#define FEED_CONTAINER_H
|
|
21 |
|
|
22 |
|
|
23 |
// INCLUDES
|
|
24 |
#include <coecntrl.h>
|
|
25 |
#include <coemop.h>
|
|
26 |
#include <aknnavidecoratorobserver.h>
|
|
27 |
#include <brctlspecialloadobserver.h>
|
|
28 |
|
|
29 |
// CONSTANTS
|
|
30 |
|
|
31 |
// MACROS
|
|
32 |
|
|
33 |
// DATA TYPES
|
|
34 |
|
|
35 |
// FUNCTION PROTOTYPES
|
|
36 |
|
|
37 |
// FORWARD DECLARATIONS
|
|
38 |
class CAknNavigationDecorator;
|
|
39 |
class CBrCtlInterface;
|
|
40 |
//class CBufFlat;
|
|
41 |
class CFeed;
|
|
42 |
class CFeedsFeedView;
|
|
43 |
//class CXmlEncoding;
|
|
44 |
class MApiProvider;
|
|
45 |
class CFeedsEntity;
|
|
46 |
|
|
47 |
// CLASS DECLARATION
|
|
48 |
|
|
49 |
|
|
50 |
/**
|
|
51 |
* A container to browse a given feed.
|
|
52 |
* @lib FeedsEngine.lib
|
|
53 |
* @since 3.0
|
|
54 |
*/
|
|
55 |
class CFeedsFeedContainer : public CCoeControl, public MBrCtlSpecialLoadObserver
|
|
56 |
{
|
|
57 |
public:
|
|
58 |
/**
|
|
59 |
* Two-phased constructor.
|
|
60 |
*/
|
|
61 |
static CFeedsFeedContainer* NewL(
|
|
62 |
CFeedsFeedView* aView,
|
|
63 |
MApiProvider& aApiProvider);
|
|
64 |
|
|
65 |
/**
|
|
66 |
* Destructor.
|
|
67 |
*/
|
|
68 |
virtual ~CFeedsFeedContainer();
|
|
69 |
|
|
70 |
|
|
71 |
public: // From CoeControl
|
|
72 |
/**
|
|
73 |
* Handles key event.
|
|
74 |
*
|
|
75 |
* @param aKeyEvent The key event.
|
|
76 |
* @param aType The type of the event.
|
|
77 |
* @return Indicates whether the key event was used by this control or not
|
|
78 |
*/
|
|
79 |
virtual TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType);
|
|
80 |
|
|
81 |
/**
|
|
82 |
* HandlePointerEventL
|
|
83 |
* From CCoeControl
|
|
84 |
*
|
|
85 |
*/
|
|
86 |
void HandlePointerEventL(const TPointerEvent& aPointerEvent);
|
|
87 |
#ifdef __SERIES60_HELP
|
|
88 |
/**
|
|
89 |
* Get help context for the control.
|
|
90 |
*
|
|
91 |
* @since ?
|
|
92 |
* @param aContext The context that is filled in.
|
|
93 |
* @return None.
|
|
94 |
*/
|
|
95 |
virtual void GetHelpContext(TCoeHelpContext& aContext) const;
|
|
96 |
#endif // __SERIES60_HELP
|
|
97 |
|
|
98 |
/**
|
|
99 |
* Sets this control as visible or invisible.
|
|
100 |
*
|
|
101 |
* @since ?
|
|
102 |
* @param aVisible ETrue to make the control visible, EFalse to make it invisible.
|
|
103 |
* @return Void
|
|
104 |
*/
|
|
105 |
virtual void MakeVisible(TBool aVisible);
|
|
106 |
|
|
107 |
|
|
108 |
protected: // From CoeControl
|
|
109 |
/**
|
|
110 |
* Called by framework when the view size is changed.
|
|
111 |
*
|
|
112 |
* @since ?
|
|
113 |
* @return void.
|
|
114 |
*/
|
|
115 |
virtual void SizeChanged();
|
|
116 |
|
|
117 |
/**
|
|
118 |
* Called by the framework when a display resource changes (i.e. skin or layout).
|
|
119 |
*
|
|
120 |
* @since ?
|
|
121 |
* @return void.
|
|
122 |
*/
|
|
123 |
virtual void HandleResourceChange(TInt aType);
|
|
124 |
|
|
125 |
/**
|
|
126 |
* Returns number of components.
|
|
127 |
*
|
|
128 |
* @since ?
|
|
129 |
* @return Number of component controls.
|
|
130 |
*/
|
|
131 |
virtual TInt CountComponentControls() const;
|
|
132 |
|
|
133 |
/**
|
|
134 |
* Returns pointer to particular component.
|
|
135 |
*
|
|
136 |
* @since ?
|
|
137 |
* @param aIndex Index whose control's pointer has to returned.
|
|
138 |
* @return Pointer to component control
|
|
139 |
*/
|
|
140 |
virtual CCoeControl* ComponentControl(TInt aIndex) const;
|
|
141 |
|
|
142 |
|
|
143 |
public: // From MBrCtlSpecialLoadObserver
|
|
144 |
/**
|
|
145 |
* Request to create a network connection.
|
|
146 |
*
|
|
147 |
* @since 2.8
|
|
148 |
* @param aConnectionPtr A pointer to the new connection. If NULL, the
|
|
149 |
proxy filter will automatically create a network connection
|
|
150 |
* @param aSockSvrHandle A handle to the socket server.
|
|
151 |
* @param aNewConn A flag if a new connection was created. If the
|
|
152 |
connection is not new, proxy filter optimization will not
|
|
153 |
read the proxy again from CommsBd.
|
|
154 |
* @param aBearerType The bearer type of the new connection
|
|
155 |
* @return void
|
|
156 |
*/
|
|
157 |
virtual void NetworkConnectionNeededL(TInt* aConnectionPtr, TInt* aSockSvrHandle,
|
|
158 |
TBool* aNewConn, TApBearerType* aBearerType);
|
|
159 |
|
|
160 |
/**
|
|
161 |
* Request the host applicaion to handle non-http request.
|
|
162 |
*
|
|
163 |
* @since 2.8
|
|
164 |
* @param aUrl The non-http(s) or file URL
|
|
165 |
* @param aParamList Parameters to pass to the host application.
|
|
166 |
Contain referer header. It could be NULL
|
|
167 |
* @return ETrue is handled by the host application. EFlase if not
|
|
168 |
*/
|
|
169 |
virtual TBool HandleRequestL(RArray<TUint>* aTypeArray, CDesCArrayFlat* aDesArray);
|
|
170 |
|
|
171 |
/**
|
|
172 |
* Request the host applicaion to handle downloads
|
|
173 |
*
|
|
174 |
* @since 2.8
|
|
175 |
* @param aTypeArray array of download parameter types
|
|
176 |
* @param aDesArray array of values associated with the types in the type array
|
|
177 |
* @return ETrue is handled by the host application. EFlase if not
|
|
178 |
*/
|
|
179 |
virtual TBool HandleDownloadL(RArray<TUint>* aTypeArray, CDesCArrayFlat* aDesArray);
|
|
180 |
|
|
181 |
public: // New methods.
|
|
182 |
/**
|
|
183 |
* Clears the navigation pane.
|
|
184 |
*
|
|
185 |
* @since 3.0
|
|
186 |
* @return void
|
|
187 |
*/
|
|
188 |
void ClearNavigationPane();
|
|
189 |
|
|
190 |
/**
|
|
191 |
* Sets the current feed
|
|
192 |
*
|
|
193 |
* @since 3.0
|
|
194 |
* @param aFeed The new feed.
|
|
195 |
* @param aInitialItem The initial item to show.
|
|
196 |
* @return Void
|
|
197 |
*/
|
|
198 |
void SetCurrentFeedL(CFeedsEntity& aFeed, TInt aInitialItem);
|
|
199 |
|
|
200 |
/**
|
|
201 |
* Returns the current item's url.
|
|
202 |
*
|
|
203 |
* @since 3.0
|
|
204 |
* @return void
|
|
205 |
*/
|
|
206 |
const TDesC& GetItemUrl();
|
|
207 |
|
|
208 |
/**
|
|
209 |
* Returns the index of the current item.
|
|
210 |
*
|
|
211 |
* @since 3.0
|
|
212 |
* @return The index.
|
|
213 |
*/
|
|
214 |
TInt CurrentItem();
|
|
215 |
|
|
216 |
/**
|
|
217 |
* Returns the number of items.
|
|
218 |
*
|
|
219 |
* @since 5.0
|
|
220 |
* @return The number of items
|
|
221 |
*/
|
|
222 |
TInt ItemCount() const;
|
|
223 |
|
|
224 |
/**
|
|
225 |
* Shows the next item if possible.
|
|
226 |
*
|
|
227 |
* @since 3.0
|
|
228 |
* @return The index.
|
|
229 |
*/
|
|
230 |
void ShowNextItemL();
|
|
231 |
|
|
232 |
/**
|
|
233 |
* Shows the prev item if possible.
|
|
234 |
*
|
|
235 |
* @since 3.0
|
|
236 |
* @return The index.
|
|
237 |
*/
|
|
238 |
void ShowPrevItemL();
|
|
239 |
|
|
240 |
|
|
241 |
private: // New methods.
|
|
242 |
/**
|
|
243 |
* C++ default constructor.
|
|
244 |
*/
|
|
245 |
CFeedsFeedContainer
|
|
246 |
( CFeedsFeedView* aView,
|
|
247 |
MApiProvider& aApiProvider );
|
|
248 |
/**
|
|
249 |
* By default Symbian 2nd phase constructor is private.
|
|
250 |
*/
|
|
251 |
void ConstructL();
|
|
252 |
|
|
253 |
/**
|
|
254 |
* Handles the changes needed to the Navigation Pane.
|
|
255 |
*
|
|
256 |
* @since 3.0
|
|
257 |
* @return void
|
|
258 |
*/
|
|
259 |
void UpdateNavigationPaneL();
|
|
260 |
|
|
261 |
/**
|
|
262 |
* Shows the given feed item.
|
|
263 |
*
|
|
264 |
* @since 3.0
|
|
265 |
* @return void
|
|
266 |
*/
|
|
267 |
void ShowFeedItemL();
|
|
268 |
|
|
269 |
/**
|
|
270 |
* Loads the template html file.
|
|
271 |
*
|
|
272 |
* @since 3.1
|
|
273 |
* @param aTemplateName The name of the template.
|
|
274 |
* @return void.
|
|
275 |
*/
|
|
276 |
void LoadTemplateL(const TDesC& aTemplateName);
|
|
277 |
|
|
278 |
/**
|
|
279 |
* Loads and resolves the tokens in the template html file.
|
|
280 |
*
|
|
281 |
* @since 3.1
|
|
282 |
* @param aTitle The title.
|
|
283 |
* @param aTimestamp The timestamp.
|
|
284 |
* @param aDescription The description.
|
|
285 |
* @param aUrl The url.
|
|
286 |
* @param aShowFullStory The "show full story" string.
|
|
287 |
* @param aShowPrev If ETrue the "prev" element is shown.
|
|
288 |
* @param aShowNext If ETrue the "next" element is shown.
|
|
289 |
* @return The resolved buffer.
|
|
290 |
*/
|
|
291 |
HBufC* ResolveTemplateL(const TDesC& aTitle, const TDesC& aTimestamp,
|
|
292 |
const TDesC& aDescription, const TDesC& aUrl,
|
|
293 |
const TDesC& aEnclosure);
|
|
294 |
|
|
295 |
/**
|
|
296 |
* If need be copy the template from ROM.
|
|
297 |
*
|
|
298 |
* @since 3.1
|
|
299 |
* @param aName The name of the template file.
|
|
300 |
* @return void
|
|
301 |
*/
|
|
302 |
void EnsureTemplateL(const TDesC& aName);
|
|
303 |
|
|
304 |
/**
|
|
305 |
* Extract the given BrCtl parameter from the list.
|
|
306 |
* @param aParamTypeToFind Extract this parameter.
|
|
307 |
* @param aTypeArray array of download parameter types.
|
|
308 |
* @param aDesArray array of values associated with the types in the type array.
|
|
309 |
* @param aParamFound Output: ETrue if the parameter was found.
|
|
310 |
* @return A TPtrC pointer for the value.
|
|
311 |
* @since 3.1
|
|
312 |
*/
|
|
313 |
TPtrC ExtractBrCtlParam(
|
|
314 |
TUint aParamTypeToFind,
|
|
315 |
RArray<TUint>* aTypeArray,
|
|
316 |
CDesCArrayFlat* aDesArray,
|
|
317 |
TBool& aParamFound ) const;
|
|
318 |
|
|
319 |
public: // Friends
|
|
320 |
friend class CFeedsFeedView;
|
|
321 |
|
|
322 |
|
|
323 |
protected:
|
|
324 |
CFeedsFeedView* iView; // not owned
|
|
325 |
MApiProvider& iApiProvider; // not owned
|
|
326 |
CBrCtlInterface* iBrowserControl;
|
|
327 |
CAknNavigationDecorator* iNaviPaneTabsGroup;
|
|
328 |
|
|
329 |
HBufC* iTemplate;
|
|
330 |
TInt iTitleCount;
|
|
331 |
TInt iWebUrlCount;
|
|
332 |
TInt iDateCount;
|
|
333 |
TInt iDescriptionCount;
|
|
334 |
TInt iEnclosureCount;
|
|
335 |
TInt iShowPrevCount;
|
|
336 |
TInt iShowNextCount;
|
|
337 |
|
|
338 |
CFeedsEntity* iFeed;
|
|
339 |
TInt iCurrentItem;
|
|
340 |
TPtrC iUrl;
|
|
341 |
};
|
|
342 |
|
|
343 |
#endif // FEED_CONTAINER_H
|
|
344 |
|
|
345 |
// End of File |