browserui/browser/FeedsInc/FeedsFolderContainer.h
branchRCL_3
changeset 65 8e6fa1719340
equal deleted inserted replaced
64:6385c4c93049 65:8e6fa1719340
       
     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 user's list of feeds.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef FEEDS_FOLDER_CONTAINER_H
       
    20 #define FEEDS_FOLDER_CONTAINER_H
       
    21 
       
    22 
       
    23 // INCLUDES
       
    24 #include <coecntrl.h>
       
    25 #include <coemop.h>
       
    26 #include <eiklbo.h>
       
    27 
       
    28 #include "FeedsEditFeedDialog.h"
       
    29 #include "FeedsEditFolderDialog.h"
       
    30 
       
    31 // CONSTANTS
       
    32 
       
    33 // MACROS
       
    34 
       
    35 // DATA TYPES
       
    36 
       
    37 // FUNCTION PROTOTYPES
       
    38 
       
    39 // FORWARD DECLARATIONS
       
    40 class CAknDoubleGraphicStyleListBox;
       
    41 class CAknNavigationDecorator;
       
    42 class CAknIconArray;
       
    43 class CAknPopupList;
       
    44 class CAknSingleGraphicPopupMenuStyleListBox;
       
    45 class CFeedsFolderView;
       
    46 class CFeedsEntity;
       
    47 class CGulIcon;
       
    48 class TAknsItemID;
       
    49 class MApiProvider;
       
    50 
       
    51 // CLASS DECLARATION
       
    52 
       
    53 
       
    54 /**
       
    55 *  A container to browse a user's list of feeds.
       
    56 *  @lib FeedsEngine.lib
       
    57 *  @since 3.0
       
    58 */
       
    59 class CFeedsFolderContainer : public CCoeControl, public MEikListBoxObserver,
       
    60         public MFeedsEditFeedDialogObserver, public MFeedsEditFolderDialogObserver
       
    61     {
       
    62     private:
       
    63         enum TIcons
       
    64             {
       
    65             EIconMark = 0,
       
    66             EIconFolder,
       
    67             EIconErrorFolder,
       
    68             EIconFeed,
       
    69             EIconFeedUnread,
       
    70             EIconErrorFeed
       
    71             };
       
    72 
       
    73 
       
    74     public:
       
    75         /**
       
    76         * Two-phased constructor.
       
    77         */
       
    78         static CFeedsFolderContainer* NewL(
       
    79         	CFeedsFolderView* aView,
       
    80             MApiProvider& aApiProvider,
       
    81             const TRect& aRect);
       
    82 
       
    83         /**
       
    84         * Destructor.
       
    85         */        
       
    86         virtual ~CFeedsFolderContainer();
       
    87 
       
    88 
       
    89     public: // From CoeControl
       
    90 	    /**
       
    91 	    * Handles key event.
       
    92 	    *
       
    93         * @param aKeyEvent The key event.
       
    94         * @param aType The type of the event.
       
    95         * @return Indicates whether the key event was used by this control or not
       
    96         */
       
    97         TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType);
       
    98 
       
    99 #ifdef __SERIES60_HELP
       
   100         /**
       
   101         * Get help context for the control.
       
   102         *
       
   103         * @since ?
       
   104         * @param aContext The context that is filled in.
       
   105         * @return None.
       
   106         */
       
   107         virtual void GetHelpContext(TCoeHelpContext& aContext) const;
       
   108 #endif // __SERIES60_HELP
       
   109 
       
   110 
       
   111     protected: // From CoeControl
       
   112         /**
       
   113         * Called by framework when the view size is changed.
       
   114         *
       
   115         * @since ?
       
   116         * @return void.
       
   117         */
       
   118         virtual void SizeChanged();
       
   119 
       
   120         /**
       
   121         * Called by the framework when a display resource changes (i.e. skin or layout).
       
   122         *
       
   123         * @since ?
       
   124         * @return void.
       
   125         */
       
   126         virtual void HandleResourceChange(TInt aType);
       
   127 
       
   128         /**
       
   129         * Returns number of components.
       
   130 	    *
       
   131         * @since ?
       
   132         * @return Number of component controls.
       
   133         */
       
   134         virtual TInt CountComponentControls() const;
       
   135 
       
   136         /**
       
   137         * Returns pointer to particular component.
       
   138 	    *
       
   139         * @since ?
       
   140         * @param aIndex Index whose control's pointer has to returned.
       
   141         * @return Pointer to component control
       
   142         */
       
   143         virtual CCoeControl* ComponentControl(TInt aIndex) const;
       
   144 
       
   145 
       
   146     public: // MEikListBoxObserver
       
   147         /**
       
   148         * Processes key events from the listbox.
       
   149         *
       
   150         * @since ?
       
   151         * @param aListBox Listbox being observed.
       
   152         * @param aEventType Event observed.
       
   153         * @return void
       
   154         */
       
   155         virtual void HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType);
       
   156 
       
   157 
       
   158     public:  // From MFeedEditFeedDialogObserver
       
   159         /**
       
   160         * Called when a feed's name and/or url is changed -- this is called 
       
   161         * after both IsValidFeedName and IsValidFeedUrl are called.
       
   162         *
       
   163         * @since 3.0
       
   164         * @param aName The feed's new name.
       
   165         * @param aUrl The feed's new url.
       
   166         * @param aFreq The frequency for auto updating.
       
   167         * @return void.
       
   168         */
       
   169         virtual void UpdateFeedL(const TDesC& aName, const TDesC& aUrl, TInt aFreq);
       
   170 
       
   171         /**
       
   172         * Called when a new feed is created -- this is called after both
       
   173         * IsValidFeedName and IsValidFeedUrl are called.
       
   174         *
       
   175         * @since 3.0
       
   176         * @param aName The feed's new name.
       
   177         * @param aUrl The feed's new url.
       
   178         * @param aFreq The frequency for auto updating.
       
   179         * @return void.
       
   180         */
       
   181         virtual void NewFeedL(const TDesC& aName, const TDesC& aUrl,TInt aFreq);
       
   182 
       
   183         /**
       
   184         * Validates the Feed's updated name.
       
   185         *
       
   186         * @since 3.0
       
   187         * @param aName The feed's new name.
       
   188         * @param aIsEditing True if the edit dialog was opened to edit a feed.
       
   189         * @return ETrue if the value is valid.
       
   190         */
       
   191         virtual TBool IsFeedNameValidL(const TDesC* aName, TBool aIsEditing);
       
   192 
       
   193         /**
       
   194         * Validates the Feed's updated url.
       
   195         *
       
   196         * @since 3.0
       
   197         * @param aUrl The feed's new url.
       
   198         * @return ETrue if the value is valid.
       
   199         */
       
   200         virtual TBool IsFeedUrlValidL(const TDesC* aUrl);
       
   201 
       
   202 
       
   203     public:  // From MFeedEditFolderDialogObserver
       
   204         /**
       
   205         * Called when a folder's name is changed -- this is called 
       
   206         * after IsValidFolderName is called.
       
   207         *
       
   208         * @since 3.0
       
   209         * @param aName The feed's new name.
       
   210         * @return void.
       
   211         */
       
   212         virtual void UpdateFolderL(const TDesC& aName);
       
   213 
       
   214         /**
       
   215         * Called when a new folder is created -- this is called 
       
   216         * after IsValidFolderName is called.
       
   217         *
       
   218         * @since 3.0
       
   219         * @param aName The feed's new name.
       
   220         * @return void.
       
   221         */
       
   222         virtual void NewFolderL(const TDesC& aName);
       
   223 
       
   224         /**
       
   225         * Validates the folder's updated name.
       
   226         *
       
   227         * @since 3.0
       
   228         * @param aName The feed's new name.
       
   229         * @param aIsEditing True if the edit dialog was opened to edit a folder.        
       
   230         * @return ETrue if the value is valid.
       
   231         */
       
   232         virtual TBool IsFolderNameValidL(const TDesC* aName, TBool aIsEditing);
       
   233 
       
   234 
       
   235     public: // New methods
       
   236         /**
       
   237         * Called to notify the container that root folder has changed.
       
   238         *
       
   239         * @since 3.1
       
   240         * @param aRootFolder The new root folder.
       
   241         * @return Void.
       
   242         */
       
   243         void RootFolderChangedL(const CFeedsEntity& aRootFolder);
       
   244     
       
   245         /**
       
   246         * Update the view's title.
       
   247         *
       
   248         * @since 3.0
       
   249         * @return void.
       
   250         */
       
   251         void UpdateTitleL();
       
   252 
       
   253         /**
       
   254         * Returns the current folder-item.
       
   255         *
       
   256         * @since 3.0
       
   257         * @return The current folder-item..
       
   258         */
       
   259         CFeedsEntity* CurrentItem() const;
       
   260 
       
   261 
       
   262         /**
       
   263         * Returns the index of the current folder-item.
       
   264         *
       
   265         * @since 3.0
       
   266         * @return The index of the current folder-item..
       
   267         */
       
   268         TInt CurrentItemIndex() const;
       
   269 
       
   270         /**
       
   271         * Updates the current folder-item.
       
   272         *
       
   273         * @since 3.0
       
   274         * @param aName The new name.
       
   275         * @param aUrl The new url.
       
   276         * @param aFreq The frequency for auto updating.
       
   277         * @return void.
       
   278         */
       
   279         void UpdateCurrentItemL(const TDesC* aName, const TDesC* aUrl, TInt aFreq);
       
   280 
       
   281         /**
       
   282         * Add a new feed.
       
   283         *
       
   284         * @since 3.0
       
   285         * @param aName The new name.
       
   286         * @param aUrl The new url.
       
   287         * @param aFreq The frequency for auto updating.
       
   288         * @return void.
       
   289         */
       
   290         void AddNewFeedL(const TDesC& aName, const TDesC& aUrl, TInt aFreq);
       
   291 
       
   292         /**
       
   293         * Add a folder feed.
       
   294         *
       
   295         * @since 3.0
       
   296         * @param aName The new name.
       
   297         * @return void.
       
   298         */
       
   299         void AddNewFolderL(const TDesC& aName);
       
   300 
       
   301         /**
       
   302         * Delete the current feed or folder
       
   303         *
       
   304         * @since 3.0
       
   305         * @return void.
       
   306         */
       
   307         void DeleteCurrentItemL();
       
   308 
       
   309         /**
       
   310         * Returns an array containing the indexes of the marked items.
       
   311         *
       
   312         * @since 3.0
       
   313         * @return The array.
       
   314         */
       
   315         const CArrayFix<TInt>* MarkedItems();
       
   316 
       
   317         /**
       
   318         * Replaces the current folder with its parent.
       
   319         *
       
   320         * @since 3.0
       
   321         * @return Returns ETrue if iCurrentFolder != iRootFoler.
       
   322         */
       
   323         TBool HandleShowParentFolderL(void);
       
   324 
       
   325         /**
       
   326         * Refreshes the root folder.
       
   327         *
       
   328         * @since 3.0
       
   329         * @return void
       
   330         */
       
   331         //void HandleRefreshRootFolderL(void);
       
   332 
       
   333         /**
       
   334         * Handles selections and open commands
       
   335         *
       
   336         * @since 3.0
       
   337         * @return void
       
   338         */
       
   339         void HandleSelectionL(void);
       
   340 
       
   341         /**
       
   342         * Handles updating the current Feed.
       
   343         *
       
   344         * @since 3.1
       
   345         * @return void
       
   346         */
       
   347         void HandleUpdateFeedL(TBool aUpdateAll = EFalse);
       
   348 
       
   349         /**
       
   350         * Handles the add-feed command.
       
   351         *
       
   352         * @since 3.0
       
   353         * @return void.
       
   354         */
       
   355         void HandleNewFeedL();
       
   356 
       
   357         /**
       
   358         * Handles the add-folder command.
       
   359         *
       
   360         * @since 3.0
       
   361         * @return void.
       
   362         */
       
   363         void HandleNewFolderL();
       
   364 
       
   365         /**
       
   366         * Handles the edit command.
       
   367         *
       
   368         * @since 3.0
       
   369         * @return void.
       
   370         */
       
   371         void HandleEditL();
       
   372 
       
   373         /**
       
   374         * Handles the delete command.
       
   375         *
       
   376         * @since 3.0
       
   377         * @return void.
       
   378         */
       
   379         void HandleDeleteL();
       
   380 
       
   381         /**
       
   382         * Handles the move command.
       
   383         *
       
   384         * @since 3.0
       
   385         * @return void.
       
   386         */
       
   387         void HandleMoveL();
       
   388 
       
   389         /**
       
   390         * Handles the move to folder command.
       
   391         *
       
   392         * @since 3.0
       
   393         * @return void.
       
   394         */
       
   395         void HandleMoveToFolderL();
       
   396 
       
   397         /**
       
   398         * Handles the mark-related commands.
       
   399         *
       
   400         * @since 3.0
       
   401         * @param aCommand The command to process.
       
   402         * @return void.
       
   403         */
       
   404         void HandleMarkL(TInt aCommand);
       
   405 
       
   406         /**
       
   407         * Handles the ok commands.
       
   408         *
       
   409         * @since 3.1
       
   410         * @return void.
       
   411         */
       
   412         void HandleOkL();
       
   413 
       
   414         /**
       
   415         * Handles the cancel commands.
       
   416         *
       
   417         * @since 3.0
       
   418         * @return void.
       
   419         */
       
   420         void HandleCancelL();
       
   421         
       
   422         /**
       
   423         * Handles the export command.
       
   424         *
       
   425         * @since 3.2
       
   426         * @return void.
       
   427         */
       
   428         void HandleExportL();
       
   429 
       
   430         /**
       
   431         * Calculate the unread count based on delta.
       
   432         *
       
   433         * @since 3.1
       
   434         * @return the calculated value.
       
   435         */
       
   436         TInt UnreadCountChangedL( TInt aUnreadCountDelta );
       
   437 
       
   438         /**
       
   439         * Set the unread count.
       
   440         *
       
   441         * @since 3.1
       
   442         * @return void.
       
   443         */
       
   444         void SetUnreadCountL( TInt aUnreadCount );
       
   445 
       
   446         /**
       
   447         * Count the number of folders in a given feeds folder
       
   448         *
       
   449         * @since 5.0
       
   450         * @param folder to count
       
   451         * @param total count folders
       
   452         * @return void 
       
   453         */
       
   454         void CountFolderFolders(const CFeedsEntity* aFolder, TInt &aFolderCount);
       
   455 
       
   456         /**
       
   457         * Update the toolbar buttons' state
       
   458         *
       
   459         * @since 5.0
       
   460         * @return void
       
   461         */
       
   462         void UpdateToolbarButtonsState();
       
   463 
       
   464         /**
       
   465         * Recursive loop to find a feed
       
   466         *
       
   467         * @since 5.0
       
   468         * @return ETrue if feed item is found
       
   469         */
       
   470         TBool SearchForFeedL(const CFeedsEntity* item);
       
   471 		
       
   472 #ifdef BRDO_SINGLE_CLICK_ENABLED_FF
       
   473 		/**
       
   474         * To know Whether any feed item selected for move
       
   475         *
       
   476         * @since 7.2
       
   477         * @return ETrue if feed item is selected for move
       
   478         */
       
   479         TBool isMoveActive(){ return iMoveActive;}
       
   480 #endif        
       
   481 
       
   482     private:
       
   483         /**
       
   484         * C++ default constructor.
       
   485         */
       
   486         CFeedsFolderContainer
       
   487                     ( CFeedsFolderView* aView,
       
   488                              MApiProvider& aApiProvider );
       
   489         
       
   490         /**
       
   491         * By default Symbian 2nd phase constructor is private.
       
   492         */
       
   493         void ConstructL(const TRect& aRect);
       
   494 
       
   495         /**
       
   496         * Inits the container.
       
   497         *
       
   498         * @since 3.0
       
   499         * @param aRect The drawing rect.
       
   500         * @return void
       
   501         */
       
   502         void InitContainerL(const TRect& aRect);
       
   503 
       
   504         /**
       
   505         * Inits the array of needed icons.
       
   506         *
       
   507         * @since 3.0
       
   508         * @return void.
       
   509         */
       
   510         void InitIconArrayL();
       
   511 
       
   512         /**
       
   513         * Loads and appends an icon to the icon array..
       
   514         *
       
   515         * @since 3.0
       
   516         * @param aIcons The icon array.
       
   517         * @param aID Item ID of the masked bitmap to be created.
       
   518         * @param aFilename Filename to be used to construct the item, 
       
   519         *        if no matching item was found in the currently active skin.
       
   520         * @param aFileBitmapId ID of the bitmap in the file. 
       
   521         *        Used only if no matching item was found in the currently 
       
   522         *        active skin.
       
   523         * @param aFileMaskId ID of the mask in the file.
       
   524         *        Used only if no matching item was found in the currently
       
   525         *        active skin.
       
   526         * @return void.
       
   527         */
       
   528         void AppendIconL(CArrayPtr<CGulIcon>* aIcons, const TAknsItemID& aID, 
       
   529                 const TDesC& aFilename, const TInt aFileBitmapId, const TInt aFileMaskId);
       
   530         
       
   531         /**
       
   532         * Sets the list-box's values.
       
   533         *
       
   534         * @since 3.0
       
   535         * @param aInitialSelection The index of the selection after the update.
       
   536         * @return void
       
   537         */
       
   538         void UpdateListBoxL(TInt aInitialSelection = 0);
       
   539 
       
   540         /**
       
   541         * Inits the move-to-folder pop-up.
       
   542         *
       
   543         * @since 3.0
       
   544         * @param aListBox The pop-up's listbox.
       
   545         * @param aPopupList The pop-up.
       
   546         * @return void
       
   547         */
       
   548         void MoveToFolderInitL(CAknSingleGraphicPopupMenuStyleListBox*& aListBox, 
       
   549                 CAknPopupList*& aPopupList);
       
   550 
       
   551         /**
       
   552         * Sets the move-to-folder list-box's values.
       
   553         *
       
   554         * @since 3.0
       
   555         * @param aListBoxRows Holds the values in the pop-up.
       
   556         * @return void
       
   557         */
       
   558         void MoveToFolderSetItemsL(CDesCArraySeg& aListBoxRows);
       
   559         
       
   560         void AddFoldersToListL(const CFeedsEntity& aFolder, CDesCArraySeg& aListBoxRows);
       
   561 
       
   562         /**
       
   563         * Moves the marked items into the target-folder.
       
   564         *
       
   565         * @since 3.0
       
   566         * @param aTargetFolder The folder where the items will be moved.
       
   567         * @return void
       
   568         */
       
   569         void MoveToFolderMoveL(const CFeedsEntity& aTargetFolder);
       
   570 
       
   571         /**
       
   572         * Show the feed in the TopicView.
       
   573         *
       
   574         * @since 3.0
       
   575         * @param aFolderItem The folder item to show.
       
   576         * @return void
       
   577         */
       
   578         void ShowFeedL(const CFeedsEntity& aFolderItem);
       
   579 
       
   580         /**
       
   581         * Moves the current or marked items -- called after the move-cmd is confirmed.
       
   582         *
       
   583         * @since 3.0
       
   584         * @return void
       
   585         */        
       
   586         void PostHandleMoveL();
       
   587 
       
   588         /**
       
   589         * Updates the options softkey to reflect the current state.
       
   590         *
       
   591         * @since 3.0
       
   592         * @return void.
       
   593         */
       
   594         void UpdateCbaL();
       
   595         
       
   596         /**
       
   597         * Changes the current folder.
       
   598         *
       
   599         * @since 3.1
       
   600         * @param aFolder The new current folder.
       
   601         * @param aResetSelection If ETrue the current selection is set to the first item.
       
   602         * @return void.
       
   603         */
       
   604         void SetCurrentFolder(const CFeedsEntity* aFolder, 
       
   605                 TBool aResetSelection = EFalse);
       
   606 
       
   607         /**
       
   608         * Dynamically initializes the Mark/Unmark submenu.
       
   609         *
       
   610         * @since 3.2
       
   611         * @param aMenu Pointer to the Menu Pane
       
   612         * @return - iListBox.
       
   613         */
       
   614 
       
   615         void DynInitMarkUnmarkMenuPane(CEikMenuPane* aMenuPane);
       
   616 
       
   617         /**
       
   618         * Dim or Undim toolbar
       
   619         * 
       
   620         * @since 5.0
       
   621         * @param aDim - is ETrue, then dim toolbar ; else undim toolbar
       
   622         * @return - void
       
   623         */
       
   624 
       
   625         void DimToolbar(TBool aDim);
       
   626         
       
   627         /**
       
   628         * Check for Marked items are folder or feed
       
   629         * 
       
   630         * @since 5.0
       
   631         * @return - bool
       
   632         */
       
   633 
       
   634         TBool IsMarkedItemFolder();        
       
   635 
       
   636         /**
       
   637         * Clears the navigation pane.
       
   638         *
       
   639         * @since 7.1
       
   640         * @return void
       
   641         */
       
   642         void ClearNavigationPane();
       
   643 
       
   644         /**
       
   645         * Handles the changes needed to the Navigation Pane.
       
   646         *
       
   647         * @since 7.1
       
   648         * @return void
       
   649         */
       
   650         void UpdateNavigationPaneL();
       
   651     public:
       
   652         friend class CFeedsFolderView;
       
   653         
       
   654         
       
   655     private:
       
   656     	CFeedsFolderView* 				iView;				// not owned
       
   657     	MApiProvider& 					iApiProvider;       // not owned
       
   658         CAknDoubleGraphicStyleListBox*  iListBox;
       
   659         CDesCArraySeg*                  iListBoxRows;
       
   660         CAknIconArray*                  iListBoxIcons;
       
   661         TBool                           iOwnsListBoxIcons;
       
   662 
       
   663         TBool                           iMoveActive;
       
   664 
       
   665         const CFeedsEntity*              iRootFolder;
       
   666         const CFeedsEntity*              iCurrentFolder;
       
   667         TInt                            iCurrentFolderId;
       
   668         RPointerArray<CFeedsEntity>      iTargetFolderList;  // pointers not owned
       
   669         CAknNavigationDecorator*        iNaviDecorator;
       
   670     };
       
   671 
       
   672 #endif      // FEEDS_FOLDER_CONTAINER_H
       
   673             
       
   674 // End of File