|
1 /* |
|
2 * Copyright (c) 2004-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: Virtual Phonebook Contact model find operation. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CFINDOPERATION_H |
|
20 #define CFINDOPERATION_H |
|
21 |
|
22 // INCLUDE FILES |
|
23 #include <e32base.h> |
|
24 #include <cntdb.h> |
|
25 #include <MVPbkContactOperation.h> |
|
26 |
|
27 // FORWARD DECLARATIONS |
|
28 class MVPbkContactFindObserver; |
|
29 class MVPbkContactLink; |
|
30 class MVPbkFieldTypeList; |
|
31 class CContactItemFieldDef; |
|
32 class CVPbkContactLinkArray; |
|
33 |
|
34 namespace VPbkCntModel { |
|
35 |
|
36 // FORWARD DECLARATIONS |
|
37 class CContactStore; |
|
38 |
|
39 /** |
|
40 * Virtual Phonebook Contact model find operation. |
|
41 */ |
|
42 NONSHARABLE_CLASS( CFindOperation ): |
|
43 public CActive, |
|
44 public MVPbkContactOperation, |
|
45 private MIdleFindObserver |
|
46 { |
|
47 public: |
|
48 /** |
|
49 * Creates a new instance of this class. |
|
50 * |
|
51 * @param aContactStore A store to search |
|
52 * @param aSearchString A string to be searched |
|
53 * @param aFieldTypes Field types where to search |
|
54 * @param aObserver Observer where to notify when done |
|
55 * @return A new instance of this class |
|
56 */ |
|
57 static CFindOperation* NewL( |
|
58 CContactStore& aContactStore, |
|
59 const TDesC& aSearchString, |
|
60 const MVPbkFieldTypeList& aFieldTypes, |
|
61 MVPbkContactFindObserver& aObserver); |
|
62 ~CFindOperation(); |
|
63 |
|
64 public: // From MVPbkContactOperation |
|
65 void StartL(); |
|
66 void Cancel(); |
|
67 |
|
68 private: // From CActive |
|
69 void DoCancel(); |
|
70 void RunL(); |
|
71 TInt RunError(TInt aError); |
|
72 |
|
73 private: // From MIdleFindObserver |
|
74 void IdleFindCallback(); |
|
75 |
|
76 private: // Implementation |
|
77 CFindOperation(CContactStore& aContactStore, |
|
78 MVPbkContactFindObserver& aObserver); |
|
79 void ConstructL(const TDesC& aSearchString, |
|
80 const MVPbkFieldTypeList& aFieldTypes); |
|
81 void IssueRequest(); |
|
82 |
|
83 private: // Data |
|
84 ///Ref: contact store |
|
85 CContactStore& iContactStore; |
|
86 ///Ref: find observer |
|
87 MVPbkContactFindObserver& iObserver; |
|
88 ///Own: search string |
|
89 HBufC* iSearchString; |
|
90 ///Own: contact item field definition |
|
91 CContactItemFieldDef* iFieldDef; |
|
92 ///Own: contact models asynchronous finder |
|
93 CIdleFinder* iAsyncFinder; |
|
94 ///Own: matching contact ids |
|
95 CContactIdArray* iContactIds; |
|
96 ///Own: find results |
|
97 CVPbkContactLinkArray* iResults; |
|
98 enum TState |
|
99 { |
|
100 EBuildLinks, |
|
101 EComplete, |
|
102 ECancelled |
|
103 }; |
|
104 ///Own: find operation state |
|
105 TState iState; |
|
106 }; |
|
107 |
|
108 } // namespace VPbkCntModel |
|
109 |
|
110 #endif // CFINDOPERATION_H |
|
111 |
|
112 //End of file |