wvuing/wvuieng/EngSrc/CCASearchManager.h
changeset 0 094583676ce7
equal deleted inserted replaced
-1:000000000000 0:094583676ce7
       
     1 /*
       
     2 * Copyright (c) 2002-2005 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:  This class offers the search services
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CCASEARCHMANAGER_H
       
    21 #define CCASEARCHMANAGER_H
       
    22 
       
    23 // INCLUDES
       
    24 #include "MCASearchInterface.h"
       
    25 #include "MCAImpsFundClient.h"
       
    26 
       
    27 #include <e32base.h>
       
    28 
       
    29 // FORWARD DECLARATIONS
       
    30 class CCARequestMapper;
       
    31 class CCASearchData;
       
    32 class MCAImpsFundClient;
       
    33 class MCAImpsFactory;
       
    34 class MCASearchObserverInterface;
       
    35 
       
    36 // CLASS DECLARATION
       
    37 
       
    38 /**
       
    39  *  This class offers the search services.
       
    40  *
       
    41  *  @lib CAEngine.lib
       
    42  *  @since 2.1
       
    43  */
       
    44 class CCASearchManager : public CBase,
       
    45             public MCASearchInterface,
       
    46             public MImpsSearchHandler2
       
    47     {
       
    48     private:  // Enumerations
       
    49 
       
    50         // Search states
       
    51         enum TSearchState
       
    52             {
       
    53             ENoActivity             = 0,
       
    54             ESearchStartRequested   = 1,
       
    55             ESearchGoingOn          = 2
       
    56             };
       
    57 
       
    58     public:  // Constructors and destructor
       
    59 
       
    60         /**
       
    61          * Two-phased constructor.
       
    62          * @param aImpsFundAPI Interface of wrapped Imps fundamental client
       
    63          * @param aRequestMapper Interface of request mapper
       
    64          */
       
    65         static CCASearchManager* NewL(
       
    66             MCAImpsFactory* aIMPSFactory,
       
    67             CCARequestMapper* aRequestMapper );
       
    68 
       
    69         /**
       
    70          * Destructor.
       
    71          */
       
    72         virtual ~CCASearchManager();
       
    73 
       
    74     public: // New functions
       
    75 
       
    76         /**
       
    77          * Sets the search support flag.
       
    78          * @param aSearchSupported specifies whether the search support is on
       
    79          * or not.
       
    80          */
       
    81         void SetSearchSupported( TBool aSearchSupported );
       
    82 
       
    83     public: // Functions derived from MCASearchInterface
       
    84 
       
    85         /**
       
    86          * From MCASearchInterface.
       
    87          * @see MCASearchInterface::StartSearchL.
       
    88          */
       
    89         IMPORT_C TInt StartSearchL(
       
    90             const CSearchPairs& aPairs,
       
    91             TInt aSearchLimit,
       
    92             MCASearchObserverInterface* aObserver
       
    93         );
       
    94 
       
    95         /**
       
    96          * From MCASearchInterface.
       
    97          * @see MCASearchInterface::EndSearchL.
       
    98          */
       
    99         IMPORT_C TInt EndSearchL();
       
   100 
       
   101         /**
       
   102          * From MCASearchInterface.
       
   103          * @see MCASearchInterface::SearchNextL.
       
   104          */
       
   105         IMPORT_C TInt SearchNextL( TInt aIndex,
       
   106                                    MCASearchObserverInterface* aObserver
       
   107                                  );
       
   108 
       
   109         /**
       
   110          * From MCASearchInterface.
       
   111          * @see MCASearchInterface::SearchDataInterface.
       
   112          */
       
   113         IMPORT_C MCASearchData* SearchDataInterface() const;
       
   114 
       
   115     private: // Functions derived from MImpsSearchHandler
       
   116 
       
   117         /**
       
   118          * @see MImpsSearchHandler2
       
   119          */
       
   120         void HandleSearchL( TInt aId,
       
   121                             TInt aSearchId,
       
   122                             TInt aIndex,
       
   123                             TInt aResultsFound,
       
   124                             TBool aCompleted,
       
   125                             TImpsSearchResultType aType,
       
   126                             MDesCArray* aResults ,
       
   127                             TImpsCspIdentifier& aCspId );
       
   128 
       
   129         /**
       
   130          * @see MImpsSearchHandler2
       
   131          */
       
   132         void HandleSearchStoppedL( TInt aId,
       
   133                                    TInt aSearchId,
       
   134                                    TImpsCspIdentifier& aCspId );
       
   135 
       
   136     private:
       
   137 
       
   138         /**
       
   139          * C++ default constructor.
       
   140          */
       
   141         CCASearchManager(
       
   142             MCAImpsFactory* aIMPSFactory,
       
   143             CCARequestMapper*   aRequestMapper );
       
   144 
       
   145         /**
       
   146          * By default Symbian OS constructor is private.
       
   147          */
       
   148         void ConstructL();
       
   149 
       
   150         /**
       
   151          * Saves the results obtained from the search so that we do not
       
   152          * have to obtain them everytime.
       
   153          * @see CCASearchManager::HandleSearchL.
       
   154          * Leaves
       
   155          *   EECouldntSaveSearchResults if unable to save results.
       
   156          */
       
   157         void SaveResultsL( TInt aIndex,
       
   158                            TBool aCompleted,
       
   159                            TImpsSearchResultType aType,
       
   160                            MDesCArray* aResults );
       
   161 
       
   162     private:    // Data
       
   163 
       
   164         // not owned
       
   165         MCAImpsFactory* iImpsFactory;
       
   166 
       
   167         // Not owned: API to the search interface
       
   168         MCAImpsFundClient* iImpsFundClient;
       
   169 
       
   170         // Owns: Results
       
   171         CCASearchData* iResults;
       
   172 
       
   173         // 10 digit search id
       
   174         TInt iSearchID;
       
   175 
       
   176         // State of the search
       
   177         TSearchState iState;
       
   178 
       
   179         // Search limit I.e. results to the search observer.
       
   180         TInt iSearchLimit;
       
   181 
       
   182         // Doesn't own. Synchronous request mapper.
       
   183         CCARequestMapper* iRequestMapper;
       
   184 
       
   185         // Owns. Array of groups created by given user
       
   186         CDesCArray* iCreatedGroups;
       
   187 
       
   188         TBool iOwnGrouplistReady;
       
   189         // Owns. wvid of user whose grouplist is cached
       
   190         HBufC* iOwnGrouplistCreatorId;
       
   191 
       
   192         // Does the server support searching.
       
   193         TBool iSearchSupported;
       
   194 
       
   195         // current observer
       
   196         MCASearchObserverInterface* iObserver;      // not owned
       
   197     };
       
   198 
       
   199 #endif      // CCASEARCHMANAGER_H
       
   200 
       
   201 // End of File