browserui/browser/BrowserAppInc/BrowserPopupEngine.h
changeset 51 48e827313edd
parent 37 481242ead638
child 53 f427d27b98d8
equal deleted inserted replaced
37:481242ead638 51:48e827313edd
     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:  Header file for CBrowserPopupEngine
       
    15 *
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef __BROWSERPOPUPENGINE_H
       
    21 #define __BROWSERPOPUPENGINE_H
       
    22 
       
    23 // INCLUDE FILES 
       
    24 #include <f32file.h>
       
    25 #include <e32base.h>
       
    26 #include <badesca.h>
       
    27 
       
    28 // CLASS DECLARATION
       
    29 
       
    30 /**
       
    31 *  CBrowserPopupEngine.
       
    32 * 
       
    33 *  @lib Browser.app
       
    34 *  @since Series 60 3.0 
       
    35 */
       
    36 class CBrowserPopupEngine : public CBase
       
    37 {
       
    38 	public:// Constructors and destructor
       
    39         /**
       
    40         * Default constructor.
       
    41         */
       
    42     	CBrowserPopupEngine();
       
    43         /**
       
    44         * Destructor.
       
    45         */
       
    46     	~CBrowserPopupEngine();
       
    47         static CBrowserPopupEngine* NewLC();
       
    48         static CBrowserPopupEngine* NewL();	
       
    49     public:// New functions
       
    50         /**
       
    51         * Adds url to white list
       
    52         * @param aUrl url to ad to white list
       
    53         */
       
    54     	void AddUrlToWhiteListL(const TDesC& aUrl);
       
    55         /**
       
    56         * Checks whether the url is on the white list
       
    57         * @param aUrl url to check
       
    58         * @return ETrue if the url is on white list
       
    59         */
       
    60     	TBool IsUrlOnWhiteListL(const TDesC& aUrl);
       
    61 
       
    62         void RemoveUrlFromWhiteListL(const TDesC& aUrl);
       
    63    	
       
    64 	private:
       
    65     	void ConstructL();
       
    66         /**
       
    67         * Checks whether the url is in white cache
       
    68         * @param aUrl url to check
       
    69         * @return ETrue if the url is in white cache
       
    70         */
       
    71         TBool IsUrlInWhiteCacheL(const TDesC& aUrl);
       
    72         /**
       
    73         * Checks whether the url is in the white file
       
    74         * @param aUrl url to check
       
    75         * @return ETrue if the url is in white file
       
    76         */
       
    77         TBool IsUrlInWhiteFileL(const TDesC& aUrl);
       
    78         /**
       
    79         * Checks whether the url is in file
       
    80         * @param aUrl url to check
       
    81         * @return ETrue if the url is in file
       
    82         */
       
    83         TBool IsUrlInFileL(const RFile* aFile, const TDesC& aUrl);
       
    84         /**
       
    85         * Checks whether the url is in the cache
       
    86         * @param aUrl url to check
       
    87         * @return ETrue if the url is in cache
       
    88         */
       
    89         TBool IsUrlInCacheL( const CDesCArrayFlat* aCacheArray, const TDesC& aUrl, const TInt aLoadedurlno );
       
    90         /**
       
    91         * Loads urls to cache
       
    92         * @param aFile file where from the urls will be loaded
       
    93         * @param aCacheArray where to load the urls
       
    94         * @param aLoadedUrlNo number of loaded urls
       
    95         */
       
    96         void LoadUrlsToCacheL(const RFile* aFile, CDesCArrayFlat* aCacheArray, TInt* aLoadedUrlNo);
       
    97         /**
       
    98         * Adds url to cache
       
    99         * @param aCacheArray array where to add the url
       
   100         * @param aUrl url to add to cache
       
   101         */
       
   102         void AddUrlToCacheL( CDesCArrayFlat* aCacheArray, const TDesC& aUrl );
       
   103         /**
       
   104         * Converts TDesc16 to TPtrC8
       
   105         * @param aString string to convert
       
   106         * @return a TPtrC8
       
   107         */
       
   108         TPtrC8 TDesC16ToTPtrC8(const TDesC16 &aString);
       
   109         /**
       
   110         * Converts TDesc8 to TPtrC16
       
   111         * @param aString string to convert
       
   112         * @return a TPtrC16
       
   113         */
       
   114         TPtrC16 TDesC8ToTPtrC16(const TDesC8 &aString);
       
   115         /**
       
   116         * Converts TDesc16 to HBufC8
       
   117         * @param aString string to convert
       
   118         * @return a pointer to HBufC8
       
   119         */       
       
   120         HBufC8 *TDesC16ToHBufC8LC(const TDesC16 &string);        
       
   121         /**
       
   122         * Converts TDesc8 to HBufC16
       
   123         * @param aString string to convert
       
   124         * @return a pointer to HBufC16
       
   125         */       
       
   126         HBufC16 *TDesC8ToHBufC16LC(const TDesC8 &aString);
       
   127         /**
       
   128         * Opens the database
       
   129         * @param aFile pointer to the file handle
       
   130         * @param aIsBlack whether the databas is black 
       
   131         * @return 
       
   132         */
       
   133         void OpenDatabaseL(RFile* aFile);
       
   134         /**
       
   135         * Handles order changes in the database
       
   136         * @param aFile database file
       
   137         * @param aUrl the url which cause the hange
       
   138         * @param aExists whether the url exists in the database allready
       
   139         * @param aIsBlack whether the database is black
       
   140         * @param aToAdd whether to add the url to the database
       
   141         * @return 
       
   142         */
       
   143         void HandleUrlOrderChangeL(RFile* aFile, const TDesC& aUrl, const TBool aExists,const TBool aToAdd );
       
   144         /**
       
   145         * Removes Url from the cache
       
   146         * @param aCacheArray 
       
   147         * @param aUrl
       
   148         * @param aCacheNo
       
   149         * @return 
       
   150         */
       
   151         void RemoveUrlFromCacheL( CDesCArrayFlat* aCacheArray, const TDesC& aUrl, TInt &aCacheNo );
       
   152         /**
       
   153         * Checks whether the database is valid
       
   154         * @param aFile pointer to the file which will be checked
       
   155         * @return ETrue if the file is OK
       
   156         */
       
   157         TBool CheckDbValidity(RFile* aFile);
       
   158         //member variables
       
   159     	RFs iFs;
       
   160     	RFile iWhiteListFile;//stores the white urls
       
   161         CDesCArrayFlat* iCachedWhiteUrls;//owned
       
   162         TInt iWhiteCacheNo;//number of white urls loaded to cache
       
   163 };
       
   164 
       
   165 
       
   166 
       
   167 #endif //__BROWSERPOPUPENGINE_H