browserui/browser/FavouritesInc/BrowserBookmarksEditDialog.h
branchRCL_3
changeset 48 8e6fa1719340
equal deleted inserted replaced
47:6385c4c93049 48:8e6fa1719340
       
     1 /*
       
     2 * Copyright (c) 2002 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:  
       
    15 *      Declaration of class CWmlBrowserBookmarkEditDialog.
       
    16 *      
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 #ifndef BROWSER_BOOKMARKS_EDIT_DIALOG_H
       
    22 #define BROWSER_BOOKMARKS_EDIT_DIALOG_H
       
    23 
       
    24 // INCLUDE FILES
       
    25 
       
    26 #include <AknForm.h>
       
    27 // #include <favouriteslimits.h>
       
    28 #include <bldvariant.hrh>
       
    29 
       
    30 // FORWARD DECLARATION
       
    31 
       
    32 class CFavouritesItem;
       
    33 class CBrowserFavouritesModel;
       
    34 class CBrowserBookmarksEditFormApModel;
       
    35 class MApiProvider;
       
    36 //class MCommsModel;
       
    37 // class CAknsListBoxBackgroundControlContext;
       
    38 class CAknNavigationControlContainer;
       
    39 
       
    40 
       
    41 // CLASS DECLARATION
       
    42 
       
    43 /**
       
    44 * Dialog to edit and save bookmark attributes.
       
    45 */
       
    46 class CBrowserBookmarkEditDialog: public CAknForm
       
    47     {
       
    48     public:     // construct / destruct
       
    49 
       
    50         /**
       
    51         * Two-phased constructor. Leaves on failure.
       
    52         * @param aItem Item to edit. Not owned.
       
    53         * @param aModel Model containing data (actual database handling).
       
    54         * @param aUid Uid of the edited item. When it is KFavouritesNullUid, the
       
    55         * item is new (not yet added to the database). Otherwise, it is the Uid
       
    56         * of the existing item.
       
    57         * @param aCommsModel Access Point model. Not owned.
       
    58         * @return The constructed dialog.
       
    59         */
       
    60         static CBrowserBookmarkEditDialog* NewL
       
    61             (
       
    62             CFavouritesItem& aItem,
       
    63             CBrowserFavouritesModel& aModel,
       
    64 			MApiProvider& aApiProvider,
       
    65             //MCommsModel& aCommsModel,
       
    66             TInt aUid = KFavouritesNullUid
       
    67             );
       
    68 
       
    69         /**
       
    70         * Destructor.
       
    71         */
       
    72         virtual ~CBrowserBookmarkEditDialog();
       
    73 
       
    74     public:     // from CAknForm
       
    75 
       
    76         /**
       
    77         * Handle menu commands.
       
    78         * @param aCommandId Command to handle.
       
    79         */
       
    80     	void ProcessCommandL( TInt aCommandId );
       
    81 
       
    82     public:     // from base classes    	
       
    83     	void HandleResourceChange( TInt aType );
       
    84 
       
    85         void HandleResourceChangeL( TInt aType );
       
    86 
       
    87 
       
    88     protected:  // Construct / destruct
       
    89 
       
    90         /**
       
    91         * Constructor.
       
    92         * @param aItem Item to edit. Not owned.
       
    93         * @param aModel Model containing data (actual database handling).
       
    94         * handling.
       
    95         * @param aUid Uid of the edited item. When it is KFavouritesNullUid, the item
       
    96         * is new (not yet added to the database). Otherwise, it is the Uid
       
    97         * of the existing item.
       
    98         * @return The constructed dialog.
       
    99         */
       
   100         CBrowserBookmarkEditDialog
       
   101             (
       
   102             CFavouritesItem& aItem,
       
   103             CBrowserFavouritesModel& aModel,
       
   104             MApiProvider& aApiProvider,
       
   105 			TInt aUid
       
   106             );
       
   107 
       
   108         /**
       
   109         * Second phase constructor. Leaves on failure.
       
   110         * @param aApModel Access Point model. Not owned.
       
   111         */
       
   112         void ConstructL( /*MCommsModel& aCommsModel*/ );
       
   113 
       
   114     protected:  // from CAknForm (CEikDialog)
       
   115 
       
   116         /**
       
   117         * Handle button press. Same as base class method, except displays note
       
   118         * "Bookmark saved" or "Not saved", as appropriate, if exiting.
       
   119         * @param aButtonId Button pressed.
       
   120         * @return ETrue if the dialog should exit.
       
   121         */
       
   122         TBool OkToExitL( TInt aButtonId );
       
   123 
       
   124     protected:  // From CAknForm
       
   125         /**
       
   126         * Get data from the editor back to the item and try to save it
       
   127         * to the database.
       
   128         * @return ETrue if successfully saved, EFalse otherwise.
       
   129         */
       
   130 	    TBool SaveFormDataL() ;
       
   131 
       
   132         /**
       
   133         * Initialize context-sensitive menu.
       
   134         * @param aResourceId Resource id of the menu pane.
       
   135         * @param aMenuPane Menu pane object being initialized.
       
   136         */
       
   137         void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ) ;
       
   138 
       
   139     private:    // From CAknForm
       
   140 
       
   141         /**
       
   142         * Fill the dialog controls with data from the item.
       
   143         */
       
   144 	    void PreLayoutDynInitL();
       
   145 
       
   146     private:    // new methods
       
   147 
       
   148         /**
       
   149         * Fill the dialog controls with data from the item.
       
   150         */
       
   151         void LoadFormDataL();
       
   152 
       
   153         /**
       
   154         * Try to do the database update with the item.
       
   155         * @return ETrue if successfully saved, EFalse otherwise.
       
   156         */
       
   157         TBool SaveItemL();
       
   158         
       
   159         /**
       
   160         * Check if host part of url is too long.
       
   161         * Cant be over 255 characters.
       
   162         * @return ETrue if 255 or under, EFalse otherwise.
       
   163         */
       
   164         TBool IsValidUrlHost( const TDesC& aUrl );
       
   165 
       
   166         /**
       
   167         * Get the text from an edwin control. This method is a workaround for
       
   168         * an AVKON form bug; the form goes into read-only state BEFORE
       
   169         * SaveFormDataL is called. So the control there is no longer edwin.
       
   170         * *** Remove this method when forms are fixed. ***
       
   171         * @param aText Buffer to receive text.
       
   172         * @param aControlId Control id.
       
   173         */
       
   174         void GetEdwinText( TDes& aText, TInt aControlId );
       
   175 
       
   176 #ifdef __SERIES60_HELP
       
   177 
       
   178         /**
       
   179         * Get help context for the control.
       
   180         * @param aContext The context that is filled in.
       
   181         * @return None.
       
   182         */
       
   183         void GetHelpContext( TCoeHelpContext& aContext ) const;
       
   184 #endif // __SERIES60_HELP
       
   185 
       
   186 		inline MApiProvider& ApiProvider() { return iApiProvider; }
       
   187 
       
   188     private:    // data
       
   189         
       
   190         CFavouritesItem* iItem;             ///< Item to edit. Not owned.
       
   191         CBrowserFavouritesModel* iModel; ///< Model containing data.
       
   192         TInt iUid;  ///< Uid of the item. KFavouritesNullUid for new items.
       
   193         TBool iExitDialog;  ///< ETrue if the dialog must be dismissed.
       
   194         CBrowserBookmarksEditFormApModel* iFormApModel;  ///< AP model.
       
   195         TInt iExitNoteResourceId;   ///< Resource id to show at exit, or 0.
       
   196         CAknNavigationControlContainer* iNaviPane;
       
   197         CAknNavigationDecorator* iNaviDecorator; //Owned
       
   198 		MApiProvider& iApiProvider;
       
   199     };
       
   200  
       
   201 #endif
       
   202 
       
   203 // End of file