contacts_plat/predictivesearch_client_api/tsrc/PsClientTestSuite/inc/pstestqueryhandler.h
branchRCL_3
changeset 63 f4a778e096c2
child 64 c1e8ba0c2b16
equal deleted inserted replaced
62:5b6f26637ad3 63:f4a778e096c2
       
     1 /*
       
     2 * Copyright (c) 2006-2007 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:
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef PSTEST_QUERY_HANDLER_H
       
    20 #define PSTEST_QUERY_HANDLER_H
       
    21 
       
    22 
       
    23 //SYSTEM INCLUDES
       
    24 #include <CPsRequestHandler.h>
       
    25 #include <MPsResultsObserver.h>
       
    26 
       
    27 //User INCLUDES
       
    28 #include "pstestdefs.h"
       
    29 
       
    30 // FORWARD DECLARATION
       
    31 class CPsSettings;
       
    32 
       
    33 // CLASS DECLARATION
       
    34 /**
       
    35  *  @lib
       
    36  *  @since S60 v3.2
       
    37  */
       
    38 class CPsTestQueryHandler: public CBase,
       
    39                            public MPsResultsObserver
       
    40 {
       
    41 
       
    42     public: // Constructors and destructor
       
    43 
       
    44         /**
       
    45         * Two-phased constructor.
       
    46         */
       
    47         static CPsTestQueryHandler* NewL();
       
    48 
       
    49         /**
       
    50         * Destructor.
       
    51         */
       
    52         virtual ~CPsTestQueryHandler();
       
    53 
       
    54     public: // New functions
       
    55 
       
    56         /**
       
    57         * Sets the test case currently being executed
       
    58         *
       
    59         * @param aCurrentTestCase Current test case.
       
    60         */
       
    61         void SetCurrentTestCase(TTestCase aCurrentTestCase);
       
    62 
       
    63         /**
       
    64         * Sets the error code for test case
       
    65         *
       
    66         * @param aCurrentErrorCode Error code for the test case.
       
    67         */
       
    68         void SetCurrentErrorCode(TInt aCurrentErrorCode);
       
    69 
       
    70         /**
       
    71         * Returns the error code for test case
       
    72         *
       
    73         * @return Error code for the test case.
       
    74         */
       
    75         TInt CurrentErrorCode();
       
    76 
       
    77         void GetAllContentsL();
       
    78 
       
    79         void StartSearchL(const CPsQuery& aSearchQuery);
       
    80 
       
    81         void TestSearchL(const TDesC& aBuf, TKeyboardModes aMode);
       
    82 
       
    83         void InputSearchL(const CPsQuery& aSearchQuery, const TDesC& aInput, RPointerArray<TDesC>& aResultSet);
       
    84 
       
    85         void SetSearchSettingsL(RPointerArray<TDesC>& aSearchUri, RArray<TInt>& aDisplayFields, TInt aMaxResults);
       
    86 
       
    87         void ShutDownL();
       
    88 
       
    89         void Cancel();
       
    90 
       
    91         TVersion Version();
       
    92 
       
    93         TBool IsLanguageSupportedL(TLanguage aLang);
       
    94 
       
    95     public: // Function from base class MPsResultsObserver
       
    96 
       
    97         /**
       
    98         * HandlePsResultsUpdateL.
       
    99         * Handle updates from the server.
       
   100         *
       
   101         * @param searchResults Search results returned from the server.
       
   102         * @param searchSeqs    List of matching character sequences.
       
   103         */
       
   104         void HandlePsResultsUpdate(RPointerArray<CPsClientData>& searchResults, RPointerArray<TDesC>& searchSeqs);
       
   105 
       
   106         /**
       
   107         * HandlePsError.
       
   108         * Handle errors from the server.
       
   109         *
       
   110         * @param aErrorCode Search errors returned from the server.
       
   111         */
       
   112         void HandlePsError(TInt aErrorCode);
       
   113 
       
   114         /**
       
   115         * CachingStatus
       
   116         * Gets called when caching is completed.
       
   117         * Observers need to implement this function accordingly
       
   118         * to take action after cache completion
       
   119         * @param aStatus - caching status, 20 - Caching completes succesfully, 30 - Caching completed with errors
       
   120         * @param aError - Any error that occurred while caching. KErrNone if no error else the error code
       
   121         */
       
   122         void CachingStatus(TCachingStatus& aStatus, TInt& aError);
       
   123 
       
   124     public:
       
   125 
       
   126         /**
       
   127         * Sets the list of contacts created for test case
       
   128         *
       
   129         * @param aContactsList List of contacts (each contact as CPsClientData).
       
   130         */
       
   131         void SetContactsDetails(RPointerArray<CPsClientData>& aContactsList);
       
   132 
       
   133         TInt IndexForGroupDataL();
       
   134 
       
   135     private:
       
   136 
       
   137         /**
       
   138         * C++ default constructor.
       
   139         */
       
   140         CPsTestQueryHandler();
       
   141 
       
   142         /**
       
   143         * Symbian 2nd phase constructor.
       
   144         */
       
   145         void ConstructL();
       
   146 
       
   147     private:
       
   148 
       
   149         void FormTestSearchQueryL(const TDesC& aBuf, TKeyboardModes aMode);
       
   150 
       
   151         void VerifyResult(RPointerArray<CPsClientData>& aSearchResults, TBool aResultType);
       
   152 
       
   153         TBool VerifySortResult(RPointerArray<CPsClientData>& aSearchResults);
       
   154 
       
   155         void SwitchEPsData(RPointerArray<CPsClientData>& searchResults);
       
   156 
       
   157         TInt CompareByData ( const CPsClientData& aObject1, const CPsClientData& aObject2 );
       
   158 
       
   159     private: // data
       
   160 
       
   161         TTestCase iCurrentTestCase;
       
   162 
       
   163         TInt iCurrentErrorCode;
       
   164 
       
   165         CPSRequestHandler* iAsyncHandler;
       
   166 
       
   167         CPsSettings* iSettings;
       
   168 
       
   169         CPsQuery *iPsQuery;
       
   170 
       
   171         RPointerArray<CPsClientData> iContactsList;
       
   172 };
       
   173 
       
   174 #endif //PSTEST_QUERY_HANDLER_H