|
1 /* |
|
2 * Copyright (c) 2007-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: Adapter between Pbk2 commands and command users. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 /// Unnamed namespace for local definitions |
|
20 namespace { |
|
21 |
|
22 #ifdef _DEBUG |
|
23 |
|
24 enum TPanicCode |
|
25 { |
|
26 EPbk2AdapterPanic1 = 1, |
|
27 EPbk2AdapterPanic2, |
|
28 EPbk2AdapterPanic3, |
|
29 EPbk2AdapterPanic4, |
|
30 EPbk2AdapterPanic5, |
|
31 EPbk2AdapterPanic6, |
|
32 EPbk2AdapterPanic7, |
|
33 EPbk2AdapterPanic8, |
|
34 EPbk2AdapterPanic9, |
|
35 EPbk2AdapterPanic10, |
|
36 EPbk2AdapterPanic11, |
|
37 EPbk2AdapterPanic12, |
|
38 EPbk2AdapterPanic13, |
|
39 EPbk2AdapterPanic14, |
|
40 EPbk2AdapterPanic15, |
|
41 EPbk2AdapterPanic16, |
|
42 EPbk2AdapterPanic17, |
|
43 EPbk2AdapterPanic18, |
|
44 EPbk2AdapterPanic19, |
|
45 EPbk2AdapterPanic20, |
|
46 EPbk2AdapterPanic21, |
|
47 EPbk2AdapterPanic22, |
|
48 EPbk2AdapterPanic23, |
|
49 EPbk2AdapterPanic24, |
|
50 EPbk2AdapterPanic25, |
|
51 EPbk2AdapterPanic26, |
|
52 EPbk2AdapterPanic27, |
|
53 EPbk2AdapterPanic28, |
|
54 EPbk2AdapterPanic29 |
|
55 }; |
|
56 |
|
57 void Panic(TPanicCode aReason) |
|
58 { |
|
59 _LIT( KPanicText, "CPbk2CtrlAdapter" ); |
|
60 User::Panic( KPanicText, aReason ); |
|
61 } |
|
62 |
|
63 #endif // _DEBUG |
|
64 |
|
65 } // namespace |
|
66 |
|
67 inline void TPbk2UiControlEventAdapter::SetContact( MVPbkStoreContact& aStoreContact ) |
|
68 { |
|
69 iStoreContact = &aStoreContact; |
|
70 } |
|
71 |
|
72 inline void TPbk2UiControlEventAdapter::SetObserver( MPbk2UiControlAdapterObserver & aObserver ) |
|
73 { |
|
74 iObserver = &aObserver; |
|
75 } |
|
76 |
|
77 inline MPbk2ContactUiControl* TPbk2UiControlEventAdapter::ParentControl() const |
|
78 { |
|
79 __ASSERT_DEBUG( EFalse, Panic( EPbk2AdapterPanic1 ) ); |
|
80 return NULL; |
|
81 } |
|
82 |
|
83 inline TInt TPbk2UiControlEventAdapter::NumberOfContacts() const |
|
84 { |
|
85 return iStoreContact ? 1 : 0; // If iStoreContact has been set, then one, otherwise zero. |
|
86 } |
|
87 |
|
88 inline const MVPbkBaseContact* TPbk2UiControlEventAdapter::FocusedContactL() const |
|
89 { |
|
90 return iStoreContact; |
|
91 } |
|
92 |
|
93 inline const MVPbkViewContact* TPbk2UiControlEventAdapter::FocusedViewContactL() const |
|
94 { |
|
95 __ASSERT_DEBUG( EFalse, Panic( EPbk2AdapterPanic2 ) ); |
|
96 return NULL; |
|
97 } |
|
98 |
|
99 inline const MVPbkStoreContact* TPbk2UiControlEventAdapter::FocusedStoreContact() const |
|
100 { |
|
101 return iStoreContact; |
|
102 } |
|
103 |
|
104 inline void TPbk2UiControlEventAdapter::SetFocusedContactL( |
|
105 const MVPbkBaseContact& aContact ) |
|
106 { |
|
107 if ( iObserver ) |
|
108 { |
|
109 iObserver->ContactContextChanged( aContact ); |
|
110 } |
|
111 } |
|
112 |
|
113 inline void TPbk2UiControlEventAdapter::SetFocusedContactL( |
|
114 const MVPbkContactBookmark& /*aContactBookmark*/ ) |
|
115 { |
|
116 __ASSERT_DEBUG( EFalse, Panic( EPbk2AdapterPanic3 ) ); |
|
117 } |
|
118 |
|
119 inline void TPbk2UiControlEventAdapter::SetFocusedContactL( |
|
120 const MVPbkContactLink& /*aContactLink*/ ) |
|
121 { |
|
122 __ASSERT_DEBUG( EFalse, Panic( EPbk2AdapterPanic4 ) ); |
|
123 } |
|
124 |
|
125 inline TInt TPbk2UiControlEventAdapter::FocusedContactIndex() const |
|
126 { |
|
127 __ASSERT_DEBUG( EFalse, Panic( EPbk2AdapterPanic5 ) ); |
|
128 return 0; |
|
129 } |
|
130 |
|
131 inline void TPbk2UiControlEventAdapter::SetFocusedContactIndexL( |
|
132 TInt /*aIndex*/ ) |
|
133 { |
|
134 __ASSERT_DEBUG( EFalse, Panic( EPbk2AdapterPanic1 ) ); |
|
135 } |
|
136 |
|
137 inline TInt TPbk2UiControlEventAdapter::NumberOfContactFields() const |
|
138 { |
|
139 __ASSERT_DEBUG( EFalse, Panic( EPbk2AdapterPanic6 ) ); |
|
140 return 0; |
|
141 } |
|
142 |
|
143 inline const MVPbkBaseContactField* TPbk2UiControlEventAdapter::FocusedField() const |
|
144 { |
|
145 __ASSERT_DEBUG( EFalse, Panic( EPbk2AdapterPanic7 ) ); |
|
146 return NULL; |
|
147 } |
|
148 |
|
149 inline TInt TPbk2UiControlEventAdapter::FocusedFieldIndex() const |
|
150 { |
|
151 __ASSERT_DEBUG( EFalse, Panic( EPbk2AdapterPanic8 ) ); |
|
152 return 0; |
|
153 } |
|
154 |
|
155 inline void TPbk2UiControlEventAdapter::SetFocusedFieldIndex( |
|
156 TInt /*aIndex*/ ) |
|
157 { |
|
158 __ASSERT_DEBUG( EFalse, Panic( EPbk2AdapterPanic9 ) ); |
|
159 } |
|
160 |
|
161 inline TBool TPbk2UiControlEventAdapter::ContactsMarked() const |
|
162 { |
|
163 //TODO |
|
164 return EFalse; |
|
165 } |
|
166 |
|
167 inline MVPbkContactLinkArray* TPbk2UiControlEventAdapter::SelectedContactsL() const |
|
168 { |
|
169 //TODO |
|
170 return NULL; |
|
171 } |
|
172 |
|
173 inline MVPbkContactLinkArray* |
|
174 TPbk2UiControlEventAdapter::SelectedContactsOrFocusedContactL() const |
|
175 { |
|
176 //TODO THIS FUNCTION IS IMPORTANT!!! |
|
177 return NULL; |
|
178 } |
|
179 |
|
180 inline MPbk2ContactLinkIterator* |
|
181 TPbk2UiControlEventAdapter::SelectedContactsIteratorL() const |
|
182 { |
|
183 //TODO |
|
184 //TODO THIS FUNCTION IS IMPORTANT FOR CERTAIN COMMANDS, BUT NOT FOR DEFAULTS. |
|
185 return NULL; |
|
186 } |
|
187 |
|
188 inline |
|
189 CArrayPtr<MVPbkContactStore>* TPbk2UiControlEventAdapter::SelectedContactStoresL() const |
|
190 { |
|
191 __ASSERT_DEBUG( EFalse, Panic( EPbk2AdapterPanic10 ) ); |
|
192 return NULL; //TODO |
|
193 } |
|
194 |
|
195 inline void TPbk2UiControlEventAdapter::ClearMarks() |
|
196 { |
|
197 __ASSERT_DEBUG( EFalse, Panic( EPbk2AdapterPanic11 ) ); |
|
198 } |
|
199 |
|
200 inline void TPbk2UiControlEventAdapter::SetSelectedContactL( |
|
201 TInt /*aIndex*/, |
|
202 TBool /*aSelected*/ ) |
|
203 { |
|
204 __ASSERT_DEBUG( EFalse, Panic( EPbk2AdapterPanic12 ) ); |
|
205 } |
|
206 |
|
207 inline TInt TPbk2UiControlEventAdapter::CommandItemCount() const |
|
208 { |
|
209 __ASSERT_DEBUG( EFalse, Panic( EPbk2AdapterPanic13 ) ); |
|
210 return 0; |
|
211 } |
|
212 |
|
213 inline const MPbk2UiControlCmdItem& TPbk2UiControlEventAdapter::CommandItemAt( TInt /*aIndex*/ ) const |
|
214 { |
|
215 __ASSERT_DEBUG( EFalse, Panic( EPbk2AdapterPanic14 ) ); |
|
216 MPbk2UiControlCmdItem* dummyItem = NULL; |
|
217 return *dummyItem; |
|
218 } |
|
219 |
|
220 inline const MPbk2UiControlCmdItem* TPbk2UiControlEventAdapter::FocusedCommandItem() const |
|
221 { |
|
222 __ASSERT_DEBUG( EFalse, Panic( EPbk2AdapterPanic15 ) ); |
|
223 const MPbk2UiControlCmdItem* dummyItem = NULL; |
|
224 return dummyItem; |
|
225 } |
|
226 |
|
227 inline void TPbk2UiControlEventAdapter::DeleteCommandItemL( TInt /*aIndex*/ ) |
|
228 { |
|
229 __ASSERT_DEBUG( EFalse, Panic( EPbk2AdapterPanic16 ) ); |
|
230 } |
|
231 |
|
232 inline void TPbk2UiControlEventAdapter::AddCommandItemL(MPbk2UiControlCmdItem* /*aCommand*/, TInt /*aIndex*/) |
|
233 { |
|
234 __ASSERT_DEBUG( EFalse, Panic( EPbk2AdapterPanic17 ) ); |
|
235 } |
|
236 |
|
237 inline void TPbk2UiControlEventAdapter::SetSelectedContactL( |
|
238 const MVPbkContactBookmark& /*aContactBookmark*/, |
|
239 TBool /*aSelected*/ ) |
|
240 { |
|
241 __ASSERT_DEBUG( EFalse, Panic( EPbk2AdapterPanic18 ) ); |
|
242 } |
|
243 |
|
244 inline void TPbk2UiControlEventAdapter::SetSelectedContactL( |
|
245 const MVPbkContactLink& /*aContactLink*/, |
|
246 TBool /*aSelected*/ ) |
|
247 { |
|
248 __ASSERT_DEBUG( EFalse, Panic( EPbk2AdapterPanic19 ) ); |
|
249 } |
|
250 |
|
251 inline void TPbk2UiControlEventAdapter::DynInitMenuPaneL( |
|
252 TInt /*aResourceId*/, |
|
253 CEikMenuPane* /*aMenuPane*/ ) const |
|
254 { |
|
255 __ASSERT_DEBUG( EFalse, Panic( EPbk2AdapterPanic20 ) ); |
|
256 } |
|
257 |
|
258 inline void TPbk2UiControlEventAdapter::ProcessCommandL( |
|
259 TInt /*aCommandId*/ ) const |
|
260 { |
|
261 } |
|
262 |
|
263 inline void TPbk2UiControlEventAdapter::UpdateAfterCommandExecution() |
|
264 { |
|
265 if ( iObserver ) |
|
266 { |
|
267 iObserver->Pbk2CommandFinished(); |
|
268 } |
|
269 } |
|
270 |
|
271 inline TInt TPbk2UiControlEventAdapter::GetMenuFilteringFlagsL() const |
|
272 { |
|
273 __ASSERT_DEBUG( EFalse, Panic( EPbk2AdapterPanic21 ) ); |
|
274 return 0; |
|
275 } |
|
276 |
|
277 inline CPbk2ViewState* TPbk2UiControlEventAdapter::ControlStateL() const |
|
278 { |
|
279 __ASSERT_DEBUG( EFalse, Panic( EPbk2AdapterPanic22 ) ); |
|
280 return NULL; |
|
281 } |
|
282 |
|
283 inline void TPbk2UiControlEventAdapter::RestoreControlStateL( |
|
284 CPbk2ViewState* /*aState*/ ) |
|
285 { |
|
286 __ASSERT_DEBUG( EFalse, Panic( EPbk2AdapterPanic23 ) ); |
|
287 } |
|
288 |
|
289 inline const TDesC& TPbk2UiControlEventAdapter::FindTextL() |
|
290 { |
|
291 __ASSERT_DEBUG( EFalse, Panic( EPbk2AdapterPanic24 ) ); |
|
292 return KNullDesC; |
|
293 } |
|
294 |
|
295 inline void TPbk2UiControlEventAdapter::ResetFindL() |
|
296 { |
|
297 __ASSERT_DEBUG( EFalse, Panic( EPbk2AdapterPanic25 ) ); |
|
298 } |
|
299 |
|
300 inline void TPbk2UiControlEventAdapter::HideThumbnail() |
|
301 { |
|
302 __ASSERT_DEBUG( EFalse, Panic( EPbk2AdapterPanic26 ) ); |
|
303 } |
|
304 |
|
305 inline void TPbk2UiControlEventAdapter::ShowThumbnail() |
|
306 { |
|
307 __ASSERT_DEBUG( EFalse, Panic( EPbk2AdapterPanic27 ) ); |
|
308 } |
|
309 |
|
310 inline void TPbk2UiControlEventAdapter::SetBlank( |
|
311 TBool /*aBlank*/ ) |
|
312 { |
|
313 __ASSERT_DEBUG( EFalse, Panic( EPbk2AdapterPanic28 ) ); |
|
314 } |
|
315 |
|
316 inline void TPbk2UiControlEventAdapter::RegisterCommand( |
|
317 MPbk2Command* /*aCommand*/ ) |
|
318 { |
|
319 } |
|
320 |
|
321 inline void TPbk2UiControlEventAdapter::SetTextL( |
|
322 const TDesC& /*aText*/ ) |
|
323 { |
|
324 __ASSERT_DEBUG( EFalse, Panic( EPbk2AdapterPanic29 ) ); |
|
325 } |
|
326 |
|
327 // End of File |