phonebookengines/VirtualPhonebook/VPbkSimStore/inc/CFindOperation.h
changeset 0 e686773b3f54
equal deleted inserted replaced
-1:000000000000 0:e686773b3f54
       
     1 /*
       
     2 * Copyright (c) 2002-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:  A virtual phonebook operation for find feature
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef VPBKSIMSTORE_CFINDOPERATION_H
       
    21 #define VPBKSIMSTORE_CFINDOPERATION_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include <e32base.h>
       
    25 #include <MVPbkContactOperation.h>
       
    26 #include <MVPbkSimFindObserver.h>
       
    27 #include <RVPbkStreamedIntArray.h>
       
    28 #include <MVPbkContactFindObserver.h>
       
    29 
       
    30 // FORWARD DECLARATIONS
       
    31 class MVPbkFieldTypeList;
       
    32 class MVPbkSimStoreOperation;
       
    33 class CVPbkContactLinkArray;
       
    34 
       
    35 namespace VPbkSimStore {
       
    36 
       
    37 // FORWARD DECLARATIONS
       
    38 class CContactStore;
       
    39 
       
    40 // CLASS DECLARATION
       
    41 
       
    42 /**
       
    43 *  A virtual phonebook operation for find feature
       
    44 *
       
    45 */
       
    46 NONSHARABLE_CLASS( CFindOperation ): 
       
    47         public CActive,
       
    48         public MVPbkContactOperation,
       
    49         private MVPbkSimFindObserver
       
    50     {
       
    51     public:  // Constructors and destructor
       
    52         
       
    53         /**
       
    54         * Two-phased constructor.
       
    55         * @param aStore the target store for the find
       
    56         * @param aObserver the observer for the operation
       
    57         * @param aStringToFind the find text string
       
    58         * @param aFieldTypes types to check in find operation
       
    59         * @return a new instance of this class
       
    60         */
       
    61         static CFindOperation* NewL( CContactStore& aStore,
       
    62             MVPbkContactFindObserver& aObserver,
       
    63             const TDesC& aStringToFind,
       
    64             const MVPbkFieldTypeList& aFieldTypes );
       
    65         
       
    66         /**
       
    67         * Destructor.
       
    68         */
       
    69         ~CFindOperation();
       
    70 
       
    71     public: // Functions from base classes
       
    72         
       
    73         /**
       
    74         * From CActive
       
    75         */
       
    76         void RunL();
       
    77         
       
    78         /**
       
    79         * From CActive
       
    80         */
       
    81         void DoCancel();
       
    82         
       
    83         /**
       
    84         * From CActive
       
    85         */
       
    86         TInt RunError( TInt aError );
       
    87         
       
    88         /**
       
    89         * From MVPbkContactOperation
       
    90         */
       
    91         void StartL();
       
    92 
       
    93         /**
       
    94         * From MVPbkContactOperation
       
    95         */
       
    96         void Cancel();
       
    97     
       
    98     private:
       
    99 
       
   100         /**
       
   101         * C++ constructor.
       
   102         */
       
   103         CFindOperation( CContactStore& aStore, 
       
   104             MVPbkContactFindObserver& aObserver );
       
   105 
       
   106         /**
       
   107         * By default Symbian 2nd phase constructor is private.
       
   108         */
       
   109         void ConstructL( const TDesC& aStringToFind,
       
   110             const MVPbkFieldTypeList& aFieldTypes );
       
   111     
       
   112     private:  // Functions from base classes
       
   113         
       
   114         /**
       
   115         * From MVPbkSimFindObserver
       
   116         */
       
   117         void FindCompleted( MVPbkSimCntStore& aStore,
       
   118             const RVPbkStreamedIntArray& aSimIndexArray );
       
   119 
       
   120         /**
       
   121         * From MVPbkSimFindObserver
       
   122         */
       
   123         void FindError( MVPbkSimCntStore& aStore, TInt aError );
       
   124         
       
   125     private:    // New functions
       
   126         void HandleFindCompletedL( 
       
   127             const RVPbkStreamedIntArray& aSimIndexArray );
       
   128         void CompleteL();
       
   129         
       
   130     private:    // Data
       
   131         /// The target store for the find operation
       
   132         CContactStore& iStore;
       
   133         /// The observer for the operation
       
   134         MVPbkContactFindObserver& iObserver;
       
   135         /// Own the text string to use for find
       
   136         HBufC* iStringToFind;
       
   137         /// An array of sim field types for the find operation
       
   138         RVPbkSimFieldTypeArray iFieldTypes;
       
   139         /// Own: the sim store number match operation
       
   140         MVPbkSimStoreOperation* iSimOperation;
       
   141         /// Own: result array, owned until client gets the ownership
       
   142         CVPbkContactLinkArray* iLinkArray;
       
   143     };
       
   144 } // namespace VPbkSimStore
       
   145 #endif      // VPBKSIMSTORE_CFINDOPERATION_H
       
   146             
       
   147 // End of File