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