idlefw/plugins/mcsplugin/settings/inc/mcspluginsettingsbkmlist.h
branchRCL_3
changeset 114 a5a39a295112
child 122 6cadd6867c17
equal deleted inserted replaced
113:0efa10d348c0 114:a5a39a295112
       
     1 /*
       
     2 * Copyright (c) 2009 - 2010 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 list for settings listbox.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CMCSPLUGINSETTINGSBKMLIST_H
       
    20 #define CMCSPLUGINSETTINGSBKMLIST_H
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <bamdesca.h>               // For MDesCArray
       
    24 #include <favouritesdb.h>           // For RFavouritesDb
       
    25 #include <mcsmenu.h>                // For MenuContentService
       
    26 #include <propertymap.h>
       
    27 
       
    28 struct TSettingItem;
       
    29 /**
       
    30  *  @ingroup group_mcsplugin
       
    31  *
       
    32  * Bookmark list for settings listbox
       
    33  *
       
    34  * @since S60 v3.2
       
    35  */
       
    36 class CMCSPluginSettingsBkmList : public CBase, public MDesCArray
       
    37 {
       
    38 
       
    39     /**
       
    40      * TBookmarkType
       
    41      */
       
    42     enum TBookmarkType
       
    43         {
       
    44         EFavBookmark,
       
    45         EMCSBookmark
       
    46         };
       
    47 
       
    48 public:
       
    49 
       
    50     /**
       
    51      * Part of the two phased constuction
       
    52      */
       
    53     static CMCSPluginSettingsBkmList* NewL();
       
    54 
       
    55     /**
       
    56      * Destructor
       
    57      */
       
    58     virtual ~CMCSPluginSettingsBkmList();
       
    59 
       
    60     // from base class MDesCArray
       
    61 
       
    62     /**
       
    63      * From MDesCArray
       
    64      * Returns the number of descriptor elements in a descriptor array.
       
    65      *
       
    66      * @since S60 v3.2
       
    67      * @return The number of descriptor elements in a descriptor array.
       
    68      */
       
    69     TInt MdcaCount() const;
       
    70 
       
    71     /**
       
    72      * From MDesCArray
       
    73      * Indexes into a descriptor array.
       
    74      *
       
    75      * @since S60 v3.2
       
    76      * @param aIndex The position of the descriptor element within a descriptor 
       
    77      *               array.
       
    78      * @return A 16 bit non-modifiable pointer descriptor representing the 
       
    79      *         descriptor element located at position aIndex within a descriptor 
       
    80      *         array.
       
    81      */
       
    82     TPtrC MdcaPoint(TInt aIndex) const;
       
    83 
       
    84     /**
       
    85      * Gets the bookmark list.
       
    86      *
       
    87      * @since S60 v3.2
       
    88      */
       
    89     void GetBookmarkListL();
       
    90 
       
    91     /**
       
    92      * 
       
    93      *
       
    94      * @since S60 
       
    95      * @param aIndex Setting item to find
       
    96      * @return MCS menu item
       
    97      */
       
    98     CMenuItem* ItemL( TInt aIndex );
       
    99 
       
   100     /**
       
   101      * Returns target bookmark data from the given index
       
   102      *
       
   103      * @since S60 v3.2
       
   104      * @param aIndex Index of the bookmark in the list
       
   105      * @param aParams On return, the bookmark parameters
       
   106      * @param aCaption On return, the bookmark caption
       
   107      * @return KErrNotFound if the bookmark cannot be found, KErrNone otherwise
       
   108      */    
       
   109     TSettingItem FindItemL( 
       
   110         RPointerArray<HSPluginSettingsIf::CPropertyMap>& aProperties );
       
   111 
       
   112 
       
   113 protected:
       
   114 
       
   115 private:
       
   116 
       
   117     /**
       
   118      * Constructor
       
   119      */
       
   120     CMCSPluginSettingsBkmList();
       
   121     
       
   122     /**
       
   123      * Second-phase constructor.
       
   124      */
       
   125     void ConstructL();
       
   126 
       
   127     /**
       
   128      * Adds an bookmark to the list
       
   129      *
       
   130      * @since S60 v3.2
       
   131      * @param aBkmInfo Bookmark information object
       
   132      */
       
   133     void AddBookmarkL( const TDesC&  aUid, const TDesC& aCaption, 
       
   134         const TDesC& aUrl, TBookmarkType aType );
       
   135 
       
   136     /**
       
   137      * Get bookmarks from favourites
       
   138      */
       
   139     void GetBookmarksFromFavouritesL();
       
   140 
       
   141     /**
       
   142      * Get bookmarks from MCS
       
   143      */
       
   144     void GetBookmarksFromMCSL();
       
   145 
       
   146     /**
       
   147      * Create menu item
       
   148      * 
       
   149      * @param aUid
       
   150      * @param aName
       
   151      * @param aUrl
       
   152      * @return pointer to the created CMenuItem object 
       
   153      */
       
   154     CMenuItem* CreateMenuItemL( const TDesC& aUid,const TDesC& aName,
       
   155         const TDesC& aUrl );
       
   156 
       
   157     /**
       
   158      * MCSMenuItemL
       
   159      * 
       
   160      * @param aUid
       
   161      * @param aName
       
   162      * @param aUrl
       
   163      * @return pointer to the CMenuItem object
       
   164      */
       
   165     CMenuItem* MCSMenuItemL( const TDesC& aUid,const TDesC& aName,
       
   166         const TDesC& aUrl );
       
   167 
       
   168 private:
       
   169 
       
   170     /**
       
   171      * Nested class to store individual bookmark list items
       
   172      *
       
   173      * @since S60 v3.2
       
   174      */
       
   175     class CBkmListItem : public CBase
       
   176     {
       
   177     public:
       
   178 
       
   179         /**
       
   180          * Part of the two phased constuction
       
   181          * 
       
   182          * @param aUid
       
   183          * @param aCaption
       
   184          */
       
   185         static CBkmListItem* NewLC( const TDesC&  aUid, const TDesC& aCaption);
       
   186 
       
   187         /**
       
   188          * Destructor
       
   189          */
       
   190         ~CBkmListItem();
       
   191 
       
   192         /**
       
   193          * Compare method used to add the items to the list in sorted order
       
   194          *
       
   195          * @since S60 v3.2
       
   196          * @param aFirst The first item to be compared
       
   197          * @param aSecond The second item to be compared
       
   198          * @return Negative if first comes before second, zero if equal and
       
   199          *         positive if first comes after second
       
   200          */
       
   201         static TInt CompareCaption(const CBkmListItem& aFirst,
       
   202             const CBkmListItem& aSecond);
       
   203 
       
   204         /**
       
   205          * Returns the item target bookmark uid
       
   206          *
       
   207          * @since S60 v3.2
       
   208          * @return Target bookmark uid
       
   209          */
       
   210         //TUid Uid() const;
       
   211 
       
   212         /**
       
   213          * Returns the item target bookmark caption
       
   214          *
       
   215          * @since S60 v3.2
       
   216          * @return Target bookmark caption
       
   217          */
       
   218         TPtrC Caption() const;
       
   219 
       
   220         /**
       
   221          * iType
       
   222          */
       
   223         TBookmarkType iType;
       
   224 
       
   225         /**
       
   226          * Target bookmark uid
       
   227          */
       
   228         HBufC* iUid;
       
   229 
       
   230         /**
       
   231          * Target bookmark caption
       
   232          */
       
   233         HBufC* iCaption;
       
   234 
       
   235         /**
       
   236          * Target bookmark parameters
       
   237          */
       
   238         HBufC* iUrl;
       
   239 
       
   240     private:
       
   241 
       
   242         /**
       
   243          * Constructor
       
   244          */
       
   245         CBkmListItem();
       
   246 
       
   247         /**
       
   248          * Second-phase constructor.
       
   249          * 
       
   250          * @param aUid
       
   251          * @param aCaption
       
   252          */
       
   253         void ConstructL( const TDesC&  aUid, const TDesC& aCaption);
       
   254 
       
   255     };
       
   256 
       
   257 private:  // data
       
   258 
       
   259     /**
       
   260      * List of bookmark items
       
   261      * Own.
       
   262      */
       
   263     RPointerArray<CBkmListItem> iListItems;
       
   264 
       
   265     /**
       
   266      * Runtime created CMenuItems must be stored,
       
   267      * because those are refered later, own.  
       
   268      */
       
   269     RPointerArray<CMenuItem> iMenuItems;
       
   270 
       
   271     /**
       
   272      * Bookmark database session.
       
   273      * Own.
       
   274      */
       
   275     RFavouritesSession iBookmarkSess;
       
   276 
       
   277     /**
       
   278      * Bookmark database.
       
   279      * Own.
       
   280      */
       
   281     RFavouritesDb iBookmarkDb;
       
   282 
       
   283     /**
       
   284      * iMenu
       
   285      * Own.
       
   286      */
       
   287     RMenu iMenu;
       
   288 };
       
   289 
       
   290 #endif // CMCSPLUGINSETTINGSBKMLIST_H
       
   291 
       
   292 // End of File.