|
1 /* |
|
2 * Copyright (c) 2005-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: Phonebook 2 server app contact fetch phase. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CPBK2CONTACTFETCHPHASE_H |
|
20 #define CPBK2CONTACTFETCHPHASE_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32base.h> |
|
24 #include <CPbk2FetchDlg.h> |
|
25 #include <MPbk2FetchDlgObserver.h> |
|
26 #include <MVPbkSingleContactOperationObserver.h> |
|
27 #include <MPbk2ExitCallback.h> |
|
28 #include "MPbk2ServicePhase.h" |
|
29 |
|
30 // FORWARD DECLARATIONS |
|
31 class CVPbkContactLinkArray; |
|
32 class CPbk2FetchDlg; |
|
33 class MPbk2DialogEliminator; |
|
34 class MPbk2ServicePhaseObserver; |
|
35 class CVPbkFieldTypeSelector; |
|
36 class CVPbkContactStoreUriArray; |
|
37 class CVPbkFieldTypeSelector; |
|
38 class MVPbkContactViewBase; |
|
39 class CPbk2ServerAppStoreManager; |
|
40 class CPbk2StoreManager; |
|
41 |
|
42 // CLASS DECLARATION |
|
43 |
|
44 /** |
|
45 * Phonebook 2 server app contact fetch phase. |
|
46 * Responsible for fetching contacts. |
|
47 */ |
|
48 class CPbk2ContactFetchPhase : public CBase, |
|
49 public MPbk2ServicePhase, |
|
50 private MPbk2FetchDlgObserver, |
|
51 private MPbk2ExitCallback, |
|
52 private MVPbkSingleContactOperationObserver |
|
53 { |
|
54 public: // Construction |
|
55 |
|
56 /** |
|
57 * Creates a new instance of this class. |
|
58 * |
|
59 * @param aObserver Observer. |
|
60 * @param aStoreManager Store manager. |
|
61 * @param aFetchParams Fetch parameters. |
|
62 * @param aFetchOkToExit Indicates whether it is ok |
|
63 * to exit fetch right away. |
|
64 * @param aFetchAcceptPolicy Default fetch accept policy. |
|
65 * @param aViewFilter Reference to field type selector. |
|
66 * @param aUsingDefaultConfig ETrue if using device store URIs. |
|
67 * @param aStoreUris Reference to store URIs. |
|
68 * @return A new instance of this class. |
|
69 */ |
|
70 static CPbk2ContactFetchPhase* NewL( |
|
71 MPbk2ServicePhaseObserver& aObserver, |
|
72 CPbk2ServerAppStoreManager& aStoreManager, |
|
73 CPbk2FetchDlg::TParams aFetchParams, |
|
74 TBool aFetchOkToExit, |
|
75 MPbk2FetchDlgObserver::TPbk2FetchAcceptSelection aFetchAcceptPolicy, |
|
76 CVPbkFieldTypeSelector* aViewFilter, |
|
77 TBool aUsingDefaultConfig, |
|
78 const CVPbkContactStoreUriArray* aStoreUris ); |
|
79 |
|
80 /** |
|
81 * Destructor. |
|
82 */ |
|
83 ~CPbk2ContactFetchPhase(); |
|
84 |
|
85 public: // From MPbk2ServicePhase |
|
86 void LaunchServicePhaseL(); |
|
87 void CancelServicePhase(); |
|
88 void RequestCancelL( |
|
89 TInt aExitCommandId ); |
|
90 void AcceptDelayedL( |
|
91 const TDesC8& aContactLinkBuffer ); |
|
92 MVPbkContactLinkArray* Results() const; |
|
93 TInt ExtraResultData() const; |
|
94 MVPbkStoreContact* TakeStoreContact(); |
|
95 HBufC* FieldContent() const; |
|
96 |
|
97 private: // From MPbk2FetchDlgObserver |
|
98 TPbk2FetchAcceptSelection AcceptFetchSelectionL( |
|
99 TInt aNumMarkedEntries, |
|
100 MVPbkContactLink& aLastSelection ); |
|
101 void FetchCompletedL( |
|
102 MVPbkContactLinkArray* aMarkedEntries ); |
|
103 void FetchCanceled(); |
|
104 void FetchAborted(); |
|
105 TBool FetchOkToExit(); |
|
106 |
|
107 private: // From MPbk2ExitCallback |
|
108 TBool OkToExitL( |
|
109 TInt aCommandId ); |
|
110 |
|
111 private: // From MVPbkSingleContactOperationObserver |
|
112 void VPbkSingleContactOperationComplete( |
|
113 MVPbkContactOperationBase& aOperation, |
|
114 MVPbkStoreContact* aContact ); |
|
115 void VPbkSingleContactOperationFailed( |
|
116 MVPbkContactOperationBase& aOperation, |
|
117 TInt aError ); |
|
118 |
|
119 private: // Implementation |
|
120 CPbk2ContactFetchPhase( |
|
121 MPbk2ServicePhaseObserver& aObserver, |
|
122 CPbk2ServerAppStoreManager& aStoreManager, |
|
123 CPbk2FetchDlg::TParams aFetchParams, |
|
124 TBool aFetchOkToExit, |
|
125 MPbk2FetchDlgObserver::TPbk2FetchAcceptSelection aFetchAcceptPolicy, |
|
126 CVPbkFieldTypeSelector* aViewFilter, |
|
127 TBool aUsingDefaultConfig, |
|
128 const CVPbkContactStoreUriArray* aStoreUris ); |
|
129 void HandleContactOperationCompleteL( |
|
130 MVPbkStoreContact* aContact ); |
|
131 void RetrieveContactL(); |
|
132 void VerifyContactL( |
|
133 MVPbkStoreContact* aContact ); |
|
134 |
|
135 private: // Data |
|
136 /// Ref: Observer |
|
137 MPbk2ServicePhaseObserver& iObserver; |
|
138 /// Ref: Server app store manager |
|
139 CPbk2ServerAppStoreManager& iServerAppStoreManager; |
|
140 /// Own: Fetch results |
|
141 CVPbkContactLinkArray* iFetchResults; |
|
142 /// Ref: Fetch dialog |
|
143 CPbk2FetchDlg* iFetchDlg; |
|
144 /// Ref: For fetch dialog's exit handling |
|
145 MPbk2DialogEliminator* iFetchDialogEliminator; |
|
146 /// Own: Fetch parameters |
|
147 CPbk2FetchDlg::TParams iFetchParams; |
|
148 /// Own: Indicates whether it is ok to exit fetch right away |
|
149 TBool iFetchOkToExit; |
|
150 /// Own: Default fetch accept policy |
|
151 MPbk2FetchDlgObserver::TPbk2FetchAcceptSelection iFetchAcceptPolicy; |
|
152 /// Ref: View filter reference for fetch dialog builder |
|
153 CVPbkFieldTypeSelector* iViewFilter; |
|
154 /// Ref: Device config flag for reference for fetch dialog builder |
|
155 TBool iUsingDefaultConfig; |
|
156 /// Ref: Store uris reference for fetch dialog builder |
|
157 const CVPbkContactStoreUriArray* iStoreUris; |
|
158 /// Own: View for fetch names list |
|
159 MVPbkContactViewBase* iFetchNamesListView; |
|
160 /// Own: View for fetch groups list |
|
161 MVPbkContactViewBase* iFetchGroupsListView; |
|
162 /// Own: Contact links |
|
163 CVPbkContactLinkArray* iContactLinks; |
|
164 /// Own: Contact retrieve operation |
|
165 MVPbkContactOperationBase* iRetrieveOperation; |
|
166 }; |
|
167 |
|
168 #endif // CPBK2CONTACTFETCHPHASE_H |
|
169 |
|
170 // End of File |