|
1 /* |
|
2 * Copyright (c) 2002 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: |
|
15 * Fetch dialog for Phonebook. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef __CPbkFetchDlg_H__ |
|
21 #define __CPbkFetchDlg_H__ |
|
22 |
|
23 // INCLUDES |
|
24 #include <AknDialog.h> // CEikDialog |
|
25 #include "MPbkFetchDlg.h" |
|
26 #include <eikcmobs.h> |
|
27 #include <cntdef.h> |
|
28 #include <MPbkContactViewListControlObserver.h> |
|
29 |
|
30 |
|
31 // FORWARD DECLARATIONS |
|
32 class CAknNavigationDecorator; |
|
33 class CPbkContactEngine; |
|
34 class CPbkContactIdSet; |
|
35 class MPbkFetchDlgAccept; |
|
36 class CPbkContextPaneIcon; |
|
37 class MPbkFetchDlgPages; |
|
38 class MPbkFetchKeyCallback; |
|
39 class CPbkExtGlobals; |
|
40 class MPbkFetchDlgSelection; |
|
41 |
|
42 |
|
43 // CLASS DECLARATION |
|
44 |
|
45 /** |
|
46 * Generic Phonebook fetch dialog -- do not use directly! |
|
47 * Use CPbkSingleEntryFetch for Single Entry Fetch or |
|
48 * CPbkMultipleEntryFetch for Multiple entry Fetch. |
|
49 */ |
|
50 NONSHARABLE_CLASS(CPbkFetchDlg) : |
|
51 public CAknDialog, |
|
52 private MPbkFetchDlg, |
|
53 private MPbkContactViewListControlObserver |
|
54 { |
|
55 public: // data structures |
|
56 /** |
|
57 * Fetch parameter flags. |
|
58 */ |
|
59 enum TFetchFlags |
|
60 { |
|
61 FETCH_FOCUSED = 0x0001, |
|
62 FETCH_MARKED = 0x0002 |
|
63 }; |
|
64 |
|
65 /** |
|
66 * Fetch paramters struct. |
|
67 * Parameters specify the fetch return value. |
|
68 */ |
|
69 class TParams |
|
70 { |
|
71 public: // Input parameters |
|
72 /** |
|
73 * Fetch flags, see TFetchFlags. |
|
74 * Defaults to FETCH_FOCUSED. |
|
75 */ |
|
76 TUint iFlags; |
|
77 |
|
78 /** |
|
79 * PBK_FETCHENTRY_DIALOG resource id. |
|
80 * Defaults to Single entry fetch. |
|
81 */ |
|
82 TInt iResId; |
|
83 |
|
84 /** |
|
85 * MANDATORY: Contacts to display. |
|
86 */ |
|
87 CContactViewBase* iContactView; |
|
88 |
|
89 /** |
|
90 * Optional fetch key event callback. |
|
91 */ |
|
92 MPbkFetchKeyCallback* iKeyCallback; |
|
93 |
|
94 /** |
|
95 * Optional fetch accept callback. |
|
96 */ |
|
97 MPbkFetchDlgAccept* iAcceptCallback; |
|
98 |
|
99 /** |
|
100 * Optional fetch selection callback. |
|
101 */ |
|
102 MPbkFetchDlgSelection* iFetchSelection; |
|
103 |
|
104 /** |
|
105 * Optional Fetch Softkey resource ID |
|
106 */ |
|
107 TInt iCbaId; |
|
108 |
|
109 public: // Output parameters |
|
110 /** |
|
111 * Returns the focused entry if iFlags has FETCH_FOCUSED set. |
|
112 */ |
|
113 TContactItemId iFocusedEntry; |
|
114 |
|
115 /** |
|
116 * Returns the marked entries if iFlags has FETCH_MARKED set. |
|
117 * Caller must delete iMarkedEntries when no longer needed. |
|
118 */ |
|
119 CContactIdArray* iMarkedEntries; |
|
120 |
|
121 public: // Interface |
|
122 /** |
|
123 * C++ Constructor. Inits this object for single entry fetch. |
|
124 */ |
|
125 TParams(); |
|
126 |
|
127 /** |
|
128 * Returns a cleanup item which will release all resources |
|
129 * held by this object in case a leave occurs. |
|
130 */ |
|
131 operator TCleanupItem(); |
|
132 |
|
133 // Compiler-generated destructor is ok for this class |
|
134 |
|
135 private: // Implementation |
|
136 static void Cleanup(TAny* aPtr); |
|
137 |
|
138 private: // Unimplemented |
|
139 /// Unimplemented copy constructor |
|
140 TParams(const TParams&); |
|
141 /// Unimplemented assignment operator |
|
142 TParams& operator=(const TParams&); |
|
143 }; |
|
144 |
|
145 public: // Constructors and destructor |
|
146 /** |
|
147 * Creates a fetch dialog with specified parameters. |
|
148 * |
|
149 * @param aParams Fetch parameters, see TParams. |
|
150 * @param aEngine Phonebook engine. |
|
151 * @return a new instace of this class. |
|
152 */ |
|
153 static CPbkFetchDlg* NewL(TParams& aParams, CPbkContactEngine& aEngine); |
|
154 |
|
155 /** |
|
156 * Sets aSelfPtr to NULL when this dialog is destroyed. |
|
157 * @precond !aSelfPtr || *aSelfPtr==this |
|
158 */ |
|
159 void ResetWhenDestroyed(CPbkFetchDlg** aSelfPtr); |
|
160 |
|
161 /** |
|
162 * Destructor. |
|
163 */ |
|
164 ~CPbkFetchDlg(); |
|
165 |
|
166 public: // Interface |
|
167 /** |
|
168 * Executes and deletes (also if a leave occurs) this dialog. |
|
169 * |
|
170 * @return !=0 if dialog was accepted, 0 if canceled. |
|
171 */ |
|
172 TInt ExecuteLD(); |
|
173 |
|
174 private: // from CEikDialog |
|
175 SEikControlInfo CreateCustomControlL(TInt aControlType); |
|
176 void PreLayoutDynInitL(); |
|
177 TBool OkToExitL(TInt aButtonId); |
|
178 void PageChangedL(TInt aPageId); |
|
179 TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType); |
|
180 void HandleResourceChange(TInt aType); |
|
181 void LineChangedL(TInt aControlId); |
|
182 public: // MEikCommandObserver |
|
183 void ProcessCommandL(TInt aCommandId); |
|
184 |
|
185 private: // from MPbkFetchDlg |
|
186 CCoeControl* FetchDlgControl(TInt aCtrlId) const; |
|
187 CContactViewBase& FetchDlgNamesView() const; |
|
188 CPbkContactIdSet& FetchDlgSelection(); |
|
189 void FetchDlgHandleError(TInt aError); |
|
190 TRect FetchDlgClientRect() const; |
|
191 CPbkContactEngine& PbkEngine(); |
|
192 void FetchDlgPageChangedL(MPbkFetchDlgPage& aPage); |
|
193 void UpdateMSKL( TInt aIndex ); |
|
194 |
|
195 private: // from MPbkContactViewListControlObserver |
|
196 void HandleContactViewListControlEventL( |
|
197 CPbkContactViewListControl& aControl, |
|
198 const TPbkContactViewListControlEvent& aEvent); |
|
199 |
|
200 private: // Implementation |
|
201 CPbkFetchDlg(TParams& aParams, CPbkContactEngine& aEngine); |
|
202 void ConstructL(); |
|
203 void SetCbaCommandSetL(TInt aResourceId); |
|
204 void SetupStatusPaneL(); |
|
205 void UpdateCbasL(); |
|
206 static TInt TryAcceptSelectionL( TAny* aSelf ); |
|
207 void SkinTabsL(); |
|
208 static TInt DelaySkinning(TAny* aFetchDlg); |
|
209 |
|
210 private: // types |
|
211 /** |
|
212 * Resource data, see PBK_FETCHENTRY_DIALOG. |
|
213 */ |
|
214 struct TResData |
|
215 { |
|
216 TInt iDialogId; |
|
217 TInt iCbaId; |
|
218 TInt iEmptyCbaId; |
|
219 TInt iNaviPaneId; |
|
220 void ReadFromResource(TResourceReader& aReader); |
|
221 }; |
|
222 |
|
223 private: // data |
|
224 /// Ref: paramters |
|
225 TParams& iParams; |
|
226 /// Ref: Contact engine |
|
227 CPbkContactEngine& iEngine; |
|
228 /// Own: Resource data |
|
229 TResData iResData; |
|
230 /// Own: Navi pane control |
|
231 CAknNavigationDecorator* iNaviDecorator; |
|
232 /// Own: Selected contacts array |
|
233 CPbkContactIdSet* iSelectedIdSet; |
|
234 /// Ref: is the dialog canceled |
|
235 TBool* iCanceledPtr; |
|
236 /// Ref: Set to NULL when this dialog is destroyed. |
|
237 CPbkFetchDlg** iSelfPtr; |
|
238 /// Own: Phonebooks application icon |
|
239 CPbkContextPaneIcon* iContextPaneIcon; |
|
240 /// Own: dialog pages |
|
241 MPbkFetchDlgPages* iPages; |
|
242 /// Ref: currently active page |
|
243 MPbkFetchDlgPage* iCurrentPage; |
|
244 /// Own: current CBA command set |
|
245 TInt iCbaCommandSet; |
|
246 /// Own: handle to UI extension factory |
|
247 CPbkExtGlobals* iExtGlobals; |
|
248 /// Own: Resource id of the caller's status pane |
|
249 TInt iPreviousStatusPaneLayout; |
|
250 /// Own: Asynchronous dialog accepter callback |
|
251 CAsyncCallBack* iDialogAccepter; |
|
252 /// Own: Delay for tab skinning |
|
253 CIdle* iTabSkinDelay; |
|
254 }; |
|
255 |
|
256 #endif // __CPbkFetchDlg_H__ |
|
257 |
|
258 // End of File |