omacpadapters/WAPAdapter/Inc/CWPWAPBookmarkItem.h
changeset 47 d316aecb87fd
equal deleted inserted replaced
46:b9b00b134b0d 47:d316aecb87fd
       
     1 /*
       
     2 * Copyright (c) 2002-2006 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:  One bookmark item in browser settings.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CWPWAPBOOKMARKITEM_H
       
    20 #define CWPWAPBOOKMARKITEM_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <e32base.h>
       
    24 #include <MWPVisitor.h>
       
    25 
       
    26 #include "CWPWAPItemBAse.h"
       
    27 
       
    28 
       
    29 // FORWARD DECLARATIONS
       
    30 class CBookmarkDb;
       
    31 
       
    32 // CLASS DECLARATION
       
    33 
       
    34 /**
       
    35  * CWPWAPBookmarkItem handles one bookmark item in browser settings.
       
    36  *
       
    37  * @lib WPWAPAdapter
       
    38  * @since 2.0
       
    39  */ 
       
    40 class CWPWAPBookmarkItem : public CBase, public MWPWAPItemBase, private MWPVisitor
       
    41     {
       
    42     public:  // Constructors and destructor
       
    43 
       
    44         /**
       
    45         * Two-phased constructor.
       
    46         * @param aTitle The title to be returned in Name().
       
    47         * @param aDefaultName The default name for bookmarks.
       
    48         * @param aCharacteristic The RESOURCE characteristic.
       
    49         * @param aLink Link to NAPDEF
       
    50         * @param aDb The bookmark database to use. Created if NULL.
       
    51         * @return CWPWAPBookmarkItem instance
       
    52         */
       
    53         static CWPWAPBookmarkItem* NewL(  const TDesC& aTitle, 
       
    54             const TDesC& aDefaultName, 
       
    55             CWPCharacteristic& aCharacteristic, 
       
    56             CWPCharacteristic*& aLink
       
    57             );
       
    58 
       
    59 
       
    60         /**
       
    61         * Destructor.
       
    62         */
       
    63         ~CWPWAPBookmarkItem();
       
    64 
       
    65     public:   // From MWPMMSItemBase
       
    66 
       
    67         const TDesC& Name() const;
       
    68         const TDesC& Title() const;
       
    69         TBool CanSetAsDefault() const;
       
    70         void SaveL();
       
    71         void SetAsDefaultL();
       
    72         TBool ValidateL();
       
    73         void AddL( RPointerArray<MWPWAPItemBase>& aShownItems, 
       
    74             RPointerArray<MWPWAPItemBase>& aHiddenItems );
       
    75         const TDesC8& SaveData() const;
       
    76         const TDesC& Address() const;
       
    77 
       
    78     public:  // From MWPVisitor
       
    79 
       
    80         void VisitL(CWPCharacteristic& aCharacteristic);
       
    81         void VisitL(CWPParameter& aParameter);
       
    82         void VisitLinkL(CWPCharacteristic& aCharacteristic );
       
    83 
       
    84     private:  // New functions
       
    85         /**
       
    86         * C++ constructor.
       
    87         * @param aTitle The title to be returned in Name().
       
    88         * @param aDefaultName The default name for bookmarks.
       
    89         * @param aLink Link to access point
       
    90         * @param aDb The bookmark database to use. Created if NULL.
       
    91         */
       
    92         CWPWAPBookmarkItem( const TDesC& aTitle, 
       
    93             const TDesC& aDefaultName, 
       
    94             CWPCharacteristic*& aLink
       
    95              );
       
    96 
       
    97         /**
       
    98         * By default Symbian 2nd phase constructor is private.
       
    99         * @param aCharacteristic The RESOURCE characteristic 
       
   100         * to scan.
       
   101         */
       
   102         void ConstructL( CWPCharacteristic& aCharacteristic );
       
   103 
       
   104         /**
       
   105         * Create the bookmarks db.
       
   106         */
       
   107         void CreateDbL();
       
   108 
       
   109     private:
       
   110         // The title for bookmark items
       
   111         const TDesC& iTitle;
       
   112 
       
   113         // The default name for bookmarks.
       
   114         const TDesC& iDefaultName;
       
   115 
       
   116         // The access point characteristic. Refs.
       
   117         CWPCharacteristic*& iLink;
       
   118 
       
   119         // The name of the bookmark
       
   120         TPtrC iName;
       
   121 
       
   122         // The URI of the bookmark
       
   123         TPtrC iURI;
       
   124 
       
   125         // Startpage parameter
       
   126         TBool iHasStartPage;
       
   127 
       
   128         //RFavouritesDb       iBookmarkDb;
       
   129         //RFavouritesSession  iSession;
       
   130 
       
   131         // Access point uid.
       
   132         TUint32 iUID;
       
   133 
       
   134         // UIDs of the saved items
       
   135         TPckgBuf<TWPWAPSaveItem> iSaveItem;
       
   136     };
       
   137 
       
   138 #endif  // CWPWAPBOOKMARKITEM_H
       
   139             
       
   140 // End of File