|
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 find operation that loops the contact data |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef VPBKSIMSTOREIMPL_CFINDOPERATION_H |
|
21 #define VPBKSIMSTOREIMPL_CFINDOPERATION_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32base.h> |
|
25 #include "MVPbkSimStoreOperation.h" |
|
26 #include "RVPbkStreamedIntArray.h" |
|
27 |
|
28 // FORWARD DECLARATIONS |
|
29 class MVPbkSimFindObserver; |
|
30 class MVPbkSimContact; |
|
31 class CVPbkContactFindPolicy; |
|
32 |
|
33 namespace VPbkSimStoreImpl { |
|
34 |
|
35 // FORWARD DECLARATIONS |
|
36 class CStoreBase; |
|
37 |
|
38 // CLASS DECLARATION |
|
39 |
|
40 /** |
|
41 * A command that finds the contacts that matches to given number |
|
42 * |
|
43 */ |
|
44 NONSHARABLE_CLASS(CFindOperation) : public CActive, |
|
45 public MVPbkSimStoreOperation |
|
46 { |
|
47 public: // Constructors and destructor |
|
48 |
|
49 /** |
|
50 * Two-phased constructor. |
|
51 * @param aObserver the observer to notify results |
|
52 * @param aStore the sim store |
|
53 * @return a new instance of this class |
|
54 */ |
|
55 static CFindOperation* NewL( MVPbkSimFindObserver& aObserver, |
|
56 CStoreBase& aStore, const TDesC& aStringToFind, |
|
57 RVPbkSimFieldTypeArray& aFieldTypes ); |
|
58 |
|
59 /** |
|
60 * Destructor. |
|
61 */ |
|
62 ~CFindOperation(); |
|
63 |
|
64 public: // New functions |
|
65 |
|
66 /** |
|
67 * Executes the operation. |
|
68 */ |
|
69 void Execute(); |
|
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 private: |
|
89 |
|
90 /** |
|
91 * C++ default constructor. |
|
92 */ |
|
93 CFindOperation( MVPbkSimFindObserver& aObserver, |
|
94 CStoreBase& aStore ); |
|
95 |
|
96 /** |
|
97 * By default Symbian 2nd phase constructor is private. |
|
98 */ |
|
99 void ConstructL( const TDesC& aStringToFind, |
|
100 RVPbkSimFieldTypeArray& aFieldTypes ); |
|
101 |
|
102 private: // New functions |
|
103 /// Activate the object |
|
104 void NextCycle(); |
|
105 /// Returns ETrue if contact matches to the iStringToFind |
|
106 TBool IsMatch( MVPbkSimContact& aContact ); |
|
107 /// Returns ETrue if the string matches to the iStringToFind |
|
108 TBool IsMatch( const TDesC& aString ); |
|
109 |
|
110 private: // Data |
|
111 ///Ref: The observer to notify when ready |
|
112 MVPbkSimFindObserver& iObserver; |
|
113 ///Ref: The store that is used to find |
|
114 CStoreBase& iStore; |
|
115 ///Own: the string to search for |
|
116 HBufC* iStringToFind; |
|
117 ///Own: field types of the fields that are checked |
|
118 RVPbkSimFieldTypeArray iFieldTypes; |
|
119 ///Own: The current contact index to search for |
|
120 TInt iNextSimIndex; |
|
121 ///An array of sim indexes that matched |
|
122 RVPbkStreamedIntArray iResults; |
|
123 ///Own: virtual phonebook find policy |
|
124 CVPbkContactFindPolicy* iFindPolicy; |
|
125 }; |
|
126 |
|
127 } // namespace VPbkSimStoreImpl |
|
128 |
|
129 #endif // VPBKSIMSTOREIMPL_CFINDOPERATION_H |
|
130 |
|
131 // End of File |