browserui/browser/BrowserAppInc/AHLEInterface.h
branchRCL_3
changeset 48 8e6fa1719340
parent 0 84ad3b177aa3
equal deleted inserted replaced
47:6385c4c93049 48:8e6fa1719340
       
     1 /*
       
     2 * Copyright (c) 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 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:  This file contains the header file of the CAHLEInterface class.
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 // This is a wrapper class for the AHLE client. Its intent is to defer
       
    20 // the construction until after the browser startup is
       
    21 // complete. Documentation is not duplicated. Only new functions or
       
    22 // those modified are described here. See AHLE.h for the detailed
       
    23 // descriptions.
       
    24 
       
    25 
       
    26 #ifndef AHLEINTERFACE_H
       
    27 #define AHLEINTERFACE_H
       
    28 
       
    29 #include <AHLE.h>
       
    30 
       
    31 _LIT(KAHLEInterfaceDummyFile, "dummy_file");
       
    32 
       
    33 class CAHLEInterface: public CBase, public MAHLEClientAPI
       
    34     {
       
    35     public:
       
    36 
       
    37     enum TAHLENewType
       
    38       {
       
    39         EAHLENewNoArgs,
       
    40         EAHLENewAllArgs,
       
    41         EAHLENewDbOnlyArgs,
       
    42         EAHLENewPrimarySizeOnlyArgs
       
    43       };
       
    44 
       
    45     virtual ~CAHLEInterface();
       
    46 
       
    47     /** Engine start. */
       
    48     IMPORT_C static CAHLEInterface* NewL();
       
    49     IMPORT_C static CAHLEInterface* NewL( const TDesC& aDatabase );
       
    50     IMPORT_C static CAHLEInterface* NewL( TUint aPrimarySize );
       
    51     IMPORT_C static CAHLEInterface* NewL( const TDesC& aDatabase,
       
    52                                           TUint aPrimarySize,
       
    53                                           TUint aSecondarySize,
       
    54                                           TAHLEScore aAdaptationSpeed );
       
    55 
       
    56 
       
    57     /** Check if the client has been connected to the server */
       
    58     IMPORT_C TBool IsConnected();
       
    59 
       
    60     /** Set Observer */
       
    61     IMPORT_C void SetObserverL( const MAHLEClientObserver* aObserver );
       
    62 
       
    63     /** Engine reconfiguration. */
       
    64     IMPORT_C TInt ReconfigureL( TUint aPrimarySize,
       
    65                                 TUint aSecondarySize,
       
    66                                 TAHLEScore aAdaptationSpeed );
       
    67 
       
    68     /** Current engine configuration. */
       
    69     IMPORT_C void GetConfigurationL( TUint& aPrimarySize,
       
    70                                      TUint& aSecondarySize,
       
    71                                      TAHLEScore& aAdaptationSpeed );
       
    72 
       
    73     /** Get adaptive list parameters. */
       
    74     IMPORT_C TInt GetParameters( TAHLESortOrder& aOrder ) const;
       
    75     IMPORT_C TInt GetParameters( TAHLESortOrder& aOrder,
       
    76                                  TAny* aReserved ) const;
       
    77 
       
    78 
       
    79     /** Set adaptive list parameters. */
       
    80     IMPORT_C TInt SetParameters( TAHLESortOrder aOrder );
       
    81     IMPORT_C TInt SetParameters( TAHLESortOrder aOrder,
       
    82                                  TAny* aReserved );
       
    83 
       
    84 
       
    85     ////////////////////////////////////////////////////////////////
       
    86     // ADAPTIVE LIST METHODS
       
    87     ////////////////////////////////////////////////////////////////
       
    88 
       
    89     /** Logging of new access. Synchronous. Used for string data. */
       
    90     IMPORT_C TInt NewAccessL( const TDesC& aItem,
       
    91                               const TDesC& aItemName );
       
    92 
       
    93     /** Asynchronous version of NewAccessL(). */
       
    94     IMPORT_C void NewAccessL( TRequestStatus& aStatus,
       
    95                               const TDesC& aItem,
       
    96                               const TDesC& aItemName );
       
    97 
       
    98    /** Get adaptive list. Here the user has the option of selecting sites/groups  */
       
    99     IMPORT_C TInt AdaptiveListL( CDesCArray&  aItems,
       
   100                                  CDesCArray&  aItemNames,
       
   101                                  const TInt  aSize,
       
   102                                  const TDesC& aMatch,
       
   103                                  const TAHLEState aState );
       
   104 
       
   105     /**
       
   106      * Sorts items by their scores. Used e.g. in Favorite
       
   107      * Links in Page feature within browser application.
       
   108      */
       
   109     IMPORT_C TInt OrderByScoreL( CDesCArray& aItems, CDesCArray& aItemsSorted );
       
   110     IMPORT_C TInt OrderByScoreL( CDesCArray& aItems, RArray<TInt>& aItemsSorted );
       
   111 
       
   112 
       
   113     /** Remove item(s). */
       
   114     IMPORT_C TInt RemoveL( const TDesC& aItem );
       
   115     IMPORT_C void RemoveL( const TDesC& aItem, TRequestStatus& aStatus );
       
   116     IMPORT_C TInt RemoveL( const CDesCArray& aItems );
       
   117     IMPORT_C void RemoveL( const CDesCArray& aItems, TRequestStatus& aStatus );
       
   118 
       
   119 
       
   120     /** Remove matching items. */
       
   121     IMPORT_C TInt RemoveMatchingL( const TDesC& aMatch );
       
   122     IMPORT_C void RemoveMatchingL( const TDesC& aMatch, TRequestStatus& aStatus );
       
   123 
       
   124 
       
   125     /**  Rename item. */
       
   126     IMPORT_C TInt RenameL( const TDesC& aItem, const TDesC& aNewName );
       
   127 
       
   128 
       
   129     /** Get item name. */
       
   130     IMPORT_C TInt GetNameL( const TDesC& aItem, TDesC& aName );
       
   131 
       
   132 
       
   133     /** Clear all adaptive list items. */
       
   134     IMPORT_C TInt Clear();
       
   135 
       
   136 
       
   137     /** Flush cached items to persistent storage. */
       
   138     IMPORT_C TInt Flush();
       
   139 
       
   140 
       
   141     private:
       
   142 
       
   143     CAHLEInterface();
       
   144 
       
   145     static TInt AHLEInitializationCB(TAny* thisObj);
       
   146 
       
   147 
       
   148     void ConstructL( TAHLENewType aNewType,
       
   149                      const TDesC& aDatabase,
       
   150                      TUint aPrimarySize,
       
   151                      TUint aSecondarySize,
       
   152                      TAHLEScore aAdaptationSpeed );
       
   153 
       
   154      static CAHLEInterface* NewL( TAHLENewType aNewType,
       
   155                                   const TDesC& aDatabase,
       
   156                                   TUint aPrimarySize,
       
   157                                   TUint aSecondarySize,
       
   158                                   TAHLEScore aAdaptationSpeed );
       
   159 
       
   160     // This final section contains the modifications from the CAHLE
       
   161     // class. The only new method facilitates lazy construction. If not
       
   162     // needed it will still work.
       
   163 
       
   164     private:
       
   165 
       
   166     /**
       
   167      * AHLE Engine Initialization
       
   168      * Performs the deferred loading of the AHLE dll and its
       
   169      * initialization.  Throws an exception on failure. Does nothing if
       
   170      * already initialized.
       
   171      */
       
   172     void InitializeAHLEL();
       
   173 
       
   174 
       
   175     //This private data allows the actual construction of the AHLE
       
   176     //object to be deferred until actually needed. This will defer the
       
   177     //loading of the server dll.
       
   178 
       
   179     private:
       
   180 
       
   181     CAHLE* iAHLE;
       
   182     TUint iPrimarySize;
       
   183     TUint iSecondarySize;
       
   184     TAHLEScore iAdaptationSpeed;
       
   185     TUint iDeferPrimarySize;
       
   186     TUint iDeferSecondarySize;
       
   187     TAHLEScore iDeferAdaptationSpeed;
       
   188     HBufC* iDatabase;
       
   189     TAHLENewType iNewType;
       
   190     CIdle* iIdle;
       
   191     };
       
   192 
       
   193 #endif /*  AHLEINTERFACE_H */