|
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 UI control substitute. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include <CPbk2ContactUiControlSubstitute.h> |
|
21 |
|
22 // Virtual Phonebook |
|
23 #include <MVPbkStoreContact.h> |
|
24 #include <MVPbkBaseContact.h> |
|
25 |
|
26 // System includes |
|
27 #include <e32base.h> |
|
28 #include <AknsSkinInstance.h> |
|
29 #include <AknsUtils.h> |
|
30 #include <AknsControlContext.h> |
|
31 #include <AknsDrawUtils.h> |
|
32 #include <AknsBasicBackgroundControlContext.h> |
|
33 |
|
34 /// Unnamed namespace for local definitions |
|
35 namespace { |
|
36 |
|
37 const TInt KOnlyOneContactStore = 1; |
|
38 |
|
39 } /// namespace |
|
40 |
|
41 |
|
42 // -------------------------------------------------------------------------- |
|
43 // CPbk2ContactUiControlSubstitute::CPbk2ContactUiControlSubstitute |
|
44 // -------------------------------------------------------------------------- |
|
45 // |
|
46 inline CPbk2ContactUiControlSubstitute::CPbk2ContactUiControlSubstitute() : |
|
47 iFocusedFieldIndex( KErrNotFound ) |
|
48 { |
|
49 } |
|
50 |
|
51 // -------------------------------------------------------------------------- |
|
52 // CPbk2ContactUiControlSubstitute::~CPbk2ContactUiControlSubstitute |
|
53 // -------------------------------------------------------------------------- |
|
54 // |
|
55 EXPORT_C CPbk2ContactUiControlSubstitute::~CPbk2ContactUiControlSubstitute() |
|
56 { |
|
57 delete iBgSkinContext; |
|
58 } |
|
59 |
|
60 // -------------------------------------------------------------------------- |
|
61 // CPbk2ContactUiControlSubstitute::NewL |
|
62 // -------------------------------------------------------------------------- |
|
63 // |
|
64 EXPORT_C CPbk2ContactUiControlSubstitute* |
|
65 CPbk2ContactUiControlSubstitute::NewL() |
|
66 { |
|
67 CPbk2ContactUiControlSubstitute* self = |
|
68 new ( ELeave ) CPbk2ContactUiControlSubstitute; |
|
69 CleanupStack::PushL( self ); |
|
70 self->ConstructL(); |
|
71 CleanupStack::Pop( self ); |
|
72 return self; |
|
73 } |
|
74 |
|
75 // -------------------------------------------------------------------------- |
|
76 // CPbk2ContactUiControlSubstitute::ConstructL |
|
77 // -------------------------------------------------------------------------- |
|
78 // |
|
79 inline void CPbk2ContactUiControlSubstitute::ConstructL() |
|
80 { |
|
81 // Create background control context for skinning the background |
|
82 iBgSkinContext = CAknsBasicBackgroundControlContext::NewL |
|
83 ( KAknsIIDQsnBgAreaMain, Rect(), EFalse ); |
|
84 } |
|
85 |
|
86 // -------------------------------------------------------------------------- |
|
87 // CPbk2ContactUiControlSubstitute::SetParentUiControl |
|
88 // -------------------------------------------------------------------------- |
|
89 // |
|
90 EXPORT_C void CPbk2ContactUiControlSubstitute::SetParentUiControl |
|
91 ( MPbk2ContactUiControl& aParentUiControl ) |
|
92 { |
|
93 iParentUiControl = &aParentUiControl; |
|
94 } |
|
95 |
|
96 // -------------------------------------------------------------------------- |
|
97 // CPbk2ContactUiControlSubstitute::SetSelectedStore |
|
98 // -------------------------------------------------------------------------- |
|
99 // |
|
100 EXPORT_C void CPbk2ContactUiControlSubstitute::SetSelectedStore |
|
101 ( MVPbkContactStore& aContactStore ) |
|
102 { |
|
103 iContactStore = &aContactStore; |
|
104 } |
|
105 |
|
106 // -------------------------------------------------------------------------- |
|
107 // CPbk2ContactUiControlSubstitute::SetFocusedStoreContact |
|
108 // -------------------------------------------------------------------------- |
|
109 // |
|
110 EXPORT_C void CPbk2ContactUiControlSubstitute::SetFocusedStoreContact |
|
111 ( const MVPbkStoreContact& aContact ) |
|
112 { |
|
113 iStoreContact = &aContact; |
|
114 } |
|
115 |
|
116 // -------------------------------------------------------------------------- |
|
117 // CPbk2ContactUiControlSubstitute::SetFocusedField |
|
118 // -------------------------------------------------------------------------- |
|
119 // |
|
120 EXPORT_C void CPbk2ContactUiControlSubstitute::SetFocusedField |
|
121 ( const MVPbkBaseContactField& aContactField ) |
|
122 { |
|
123 iContactField = &aContactField; |
|
124 } |
|
125 |
|
126 // -------------------------------------------------------------------------- |
|
127 // CPbk2ContactUiControlSubstitute::SetFocusedFieldIndex |
|
128 // -------------------------------------------------------------------------- |
|
129 // |
|
130 EXPORT_C void CPbk2ContactUiControlSubstitute::SetFocusedFieldIndex |
|
131 ( TInt aFieldIndex ) |
|
132 { |
|
133 iFocusedFieldIndex = aFieldIndex; |
|
134 } |
|
135 |
|
136 // -------------------------------------------------------------------------- |
|
137 // CPbk2ContactUiControlSubstitute::ParentControl |
|
138 // -------------------------------------------------------------------------- |
|
139 // |
|
140 MPbk2ContactUiControl* CPbk2ContactUiControlSubstitute::ParentControl() const |
|
141 { |
|
142 return iParentUiControl; |
|
143 } |
|
144 |
|
145 // -------------------------------------------------------------------------- |
|
146 // CPbk2ContactUiControlSubstitute::NumberOfContacts |
|
147 // -------------------------------------------------------------------------- |
|
148 // |
|
149 TInt CPbk2ContactUiControlSubstitute::NumberOfContacts() const |
|
150 { |
|
151 return KOnlyOneContactStore; |
|
152 } |
|
153 |
|
154 // -------------------------------------------------------------------------- |
|
155 // CPbk2ContactUiControlSubstitute::FocusedContactL |
|
156 // -------------------------------------------------------------------------- |
|
157 // |
|
158 const MVPbkBaseContact* |
|
159 CPbk2ContactUiControlSubstitute::FocusedContactL() const |
|
160 { |
|
161 return static_cast<const MVPbkBaseContact*>( iStoreContact ); |
|
162 } |
|
163 |
|
164 // -------------------------------------------------------------------------- |
|
165 // CPbk2ContactUiControlSubstitute::FocusedViewContactL |
|
166 // -------------------------------------------------------------------------- |
|
167 // |
|
168 const MVPbkViewContact* |
|
169 CPbk2ContactUiControlSubstitute::FocusedViewContactL() const |
|
170 { |
|
171 return NULL; |
|
172 } |
|
173 |
|
174 // -------------------------------------------------------------------------- |
|
175 // CPbk2ContactUiControlSubstitute::FocusedStoreContact |
|
176 // -------------------------------------------------------------------------- |
|
177 // |
|
178 const MVPbkStoreContact* |
|
179 CPbk2ContactUiControlSubstitute::FocusedStoreContact() const |
|
180 { |
|
181 return iStoreContact; |
|
182 } |
|
183 |
|
184 // -------------------------------------------------------------------------- |
|
185 // CPbk2ContactUiControlSubstitute::SetFocusedContactL |
|
186 // -------------------------------------------------------------------------- |
|
187 // |
|
188 void CPbk2ContactUiControlSubstitute::SetFocusedContactL |
|
189 ( const MVPbkBaseContact& /*aContact*/ ) |
|
190 { |
|
191 // Do nothing |
|
192 } |
|
193 |
|
194 // -------------------------------------------------------------------------- |
|
195 // CPbk2ContactUiControlSubstitute::SetFocusedContactL |
|
196 // -------------------------------------------------------------------------- |
|
197 // |
|
198 void CPbk2ContactUiControlSubstitute::SetFocusedContactL( |
|
199 const MVPbkContactBookmark& /*aContactBookmark*/ ) |
|
200 { |
|
201 // Do nothing |
|
202 } |
|
203 |
|
204 // -------------------------------------------------------------------------- |
|
205 // CPbk2ContactUiControlSubstitute::SetFocusedContactL |
|
206 // -------------------------------------------------------------------------- |
|
207 // |
|
208 void CPbk2ContactUiControlSubstitute::SetFocusedContactL( |
|
209 const MVPbkContactLink& /*aContactLink*/ ) |
|
210 { |
|
211 // Do nothing |
|
212 } |
|
213 |
|
214 // -------------------------------------------------------------------------- |
|
215 // CPbk2ContactUiControlSubstitute::FocusedContactIndex |
|
216 // -------------------------------------------------------------------------- |
|
217 // |
|
218 TInt CPbk2ContactUiControlSubstitute::FocusedContactIndex() const |
|
219 { |
|
220 return KErrNotFound; |
|
221 } |
|
222 |
|
223 // -------------------------------------------------------------------------- |
|
224 // CPbk2ContactUiControlSubstitute::SetFocusedContactIndexL |
|
225 // -------------------------------------------------------------------------- |
|
226 // |
|
227 void CPbk2ContactUiControlSubstitute::SetFocusedContactIndexL |
|
228 ( TInt /*aIndex*/ ) |
|
229 { |
|
230 // Do nothing |
|
231 } |
|
232 |
|
233 // -------------------------------------------------------------------------- |
|
234 // CPbk2ContactUiControlSubstitute::NumberOfContactFields |
|
235 // -------------------------------------------------------------------------- |
|
236 // |
|
237 TInt CPbk2ContactUiControlSubstitute::NumberOfContactFields() const |
|
238 { |
|
239 return KErrNotSupported; |
|
240 } |
|
241 |
|
242 // -------------------------------------------------------------------------- |
|
243 // CPbk2ContactUiControlSubstitute::FocusedField |
|
244 // -------------------------------------------------------------------------- |
|
245 // |
|
246 const MVPbkBaseContactField* |
|
247 CPbk2ContactUiControlSubstitute::FocusedField() const |
|
248 { |
|
249 return iContactField; |
|
250 } |
|
251 |
|
252 // -------------------------------------------------------------------------- |
|
253 // CPbk2ContactUiControlSubstitute::FocusedFieldIndex |
|
254 // -------------------------------------------------------------------------- |
|
255 // |
|
256 TInt CPbk2ContactUiControlSubstitute::FocusedFieldIndex() const |
|
257 { |
|
258 return iFocusedFieldIndex; |
|
259 } |
|
260 |
|
261 // -------------------------------------------------------------------------- |
|
262 // CPbk2ContactUiControlSubstitute::ContactsMarked |
|
263 // -------------------------------------------------------------------------- |
|
264 // |
|
265 TBool CPbk2ContactUiControlSubstitute::ContactsMarked() const |
|
266 { |
|
267 return EFalse; |
|
268 } |
|
269 |
|
270 // -------------------------------------------------------------------------- |
|
271 // CPbk2ContactUiControlSubstitute::SelectedContactsL |
|
272 // -------------------------------------------------------------------------- |
|
273 // |
|
274 MVPbkContactLinkArray* |
|
275 CPbk2ContactUiControlSubstitute::SelectedContactsL() const |
|
276 { |
|
277 return NULL; |
|
278 } |
|
279 |
|
280 // -------------------------------------------------------------------------- |
|
281 // CPbk2ContactUiControlSubstitute::SelectedContactsOrFocusedContactL |
|
282 // -------------------------------------------------------------------------- |
|
283 // |
|
284 MVPbkContactLinkArray* CPbk2ContactUiControlSubstitute:: |
|
285 SelectedContactsOrFocusedContactL() const |
|
286 { |
|
287 return NULL; |
|
288 } |
|
289 |
|
290 // -------------------------------------------------------------------------- |
|
291 // CPbk2ContactUiControlSubstitute::SelectedContactsIteratorL |
|
292 // -------------------------------------------------------------------------- |
|
293 // |
|
294 MPbk2ContactLinkIterator* |
|
295 CPbk2ContactUiControlSubstitute::SelectedContactsIteratorL() const |
|
296 { |
|
297 return NULL; |
|
298 } |
|
299 |
|
300 // -------------------------------------------------------------------------- |
|
301 // CPbk2ContactUiControlSubstitute::SelectedContactStoresL |
|
302 // -------------------------------------------------------------------------- |
|
303 // |
|
304 CArrayPtr<MVPbkContactStore>* |
|
305 CPbk2ContactUiControlSubstitute::SelectedContactStoresL() const |
|
306 { |
|
307 CArrayPtr<MVPbkContactStore>* array = |
|
308 new CArrayPtrFlat<MVPbkContactStore>( KOnlyOneContactStore ); |
|
309 CleanupStack::PushL( array ); |
|
310 array->AppendL( iContactStore ); |
|
311 CleanupStack::Pop( array ); |
|
312 return array; |
|
313 } |
|
314 |
|
315 // -------------------------------------------------------------------------- |
|
316 // CPbk2ContactUiControlSubstitute::ClearMarks |
|
317 // -------------------------------------------------------------------------- |
|
318 // |
|
319 void CPbk2ContactUiControlSubstitute::ClearMarks() |
|
320 { |
|
321 } |
|
322 |
|
323 // -------------------------------------------------------------------------- |
|
324 // CPbk2ContactUiControlSubstitute::SetSelectedContactL |
|
325 // -------------------------------------------------------------------------- |
|
326 // |
|
327 void CPbk2ContactUiControlSubstitute::SetSelectedContactL |
|
328 ( TInt /*aIndex*/, TBool /*aSelected*/ ) |
|
329 { |
|
330 } |
|
331 |
|
332 // -------------------------------------------------------------------------- |
|
333 // CPbk2ContactUiControlSubstitute::SetSelectedContactL |
|
334 // -------------------------------------------------------------------------- |
|
335 // |
|
336 void CPbk2ContactUiControlSubstitute::SetSelectedContactL( |
|
337 const MVPbkContactBookmark& /*aContactBookmark*/, |
|
338 TBool /*aSelected*/ ) |
|
339 { |
|
340 // Not supported |
|
341 } |
|
342 |
|
343 // -------------------------------------------------------------------------- |
|
344 // CPbk2ContactUiControlSubstitute::SetSelectedContactL |
|
345 // -------------------------------------------------------------------------- |
|
346 // |
|
347 void CPbk2ContactUiControlSubstitute::SetSelectedContactL( |
|
348 const MVPbkContactLink& /*aContactLink*/, |
|
349 TBool /*aSelected*/ ) |
|
350 { |
|
351 // Not supported |
|
352 } |
|
353 |
|
354 TInt CPbk2ContactUiControlSubstitute::CommandItemCount() const |
|
355 { |
|
356 return 0; // No command items. |
|
357 } |
|
358 |
|
359 const MPbk2UiControlCmdItem& CPbk2ContactUiControlSubstitute::CommandItemAt( |
|
360 TInt /*aIndex*/ ) const |
|
361 { |
|
362 // There are no command items in this control |
|
363 __ASSERT_ALWAYS( EFalse, User::Panic( _L("Pbk2"), 5)); //TODO |
|
364 MPbk2UiControlCmdItem* item = NULL; // For compiler only |
|
365 return *item; // For compiler only |
|
366 } |
|
367 |
|
368 const MPbk2UiControlCmdItem* CPbk2ContactUiControlSubstitute::FocusedCommandItem() const |
|
369 { |
|
370 // No command items in this control. |
|
371 return NULL; |
|
372 } |
|
373 |
|
374 void CPbk2ContactUiControlSubstitute::DeleteCommandItemL( TInt /*aIndex*/ ) |
|
375 { |
|
376 // Ignore |
|
377 } |
|
378 |
|
379 void CPbk2ContactUiControlSubstitute::AddCommandItemL(MPbk2UiControlCmdItem* /*aCommand*/, TInt /*aIndex*/) |
|
380 { |
|
381 // Ignore |
|
382 } |
|
383 |
|
384 // -------------------------------------------------------------------------- |
|
385 // CPbk2ContactUiControlSubstitute::DynInitMenuPaneL |
|
386 // -------------------------------------------------------------------------- |
|
387 // |
|
388 void CPbk2ContactUiControlSubstitute::DynInitMenuPaneL |
|
389 ( TInt /*aResourceId*/, CEikMenuPane* /*aMenuPane*/ ) const |
|
390 { |
|
391 } |
|
392 |
|
393 // -------------------------------------------------------------------------- |
|
394 // CPbk2ContactUiControlSubstitute::ProcessCommandL |
|
395 // -------------------------------------------------------------------------- |
|
396 // |
|
397 void CPbk2ContactUiControlSubstitute::ProcessCommandL |
|
398 ( TInt /*aCommandId*/ ) const |
|
399 { |
|
400 } |
|
401 |
|
402 // -------------------------------------------------------------------------- |
|
403 // CPbk2ContactUiControlSubstitute::UpdateAfterCommandExecution |
|
404 // -------------------------------------------------------------------------- |
|
405 // |
|
406 void CPbk2ContactUiControlSubstitute::UpdateAfterCommandExecution() |
|
407 { |
|
408 // Do nothing |
|
409 } |
|
410 |
|
411 // -------------------------------------------------------------------------- |
|
412 // CPbk2ContactUiControlSubstitute::GetMenuFilteringFlagsL |
|
413 // -------------------------------------------------------------------------- |
|
414 // |
|
415 TInt CPbk2ContactUiControlSubstitute::GetMenuFilteringFlagsL() const |
|
416 { |
|
417 return 0; |
|
418 } |
|
419 |
|
420 // -------------------------------------------------------------------------- |
|
421 // CPbk2ContactUiControlSubstitute::ControlStateL |
|
422 // -------------------------------------------------------------------------- |
|
423 // |
|
424 CPbk2ViewState* CPbk2ContactUiControlSubstitute::ControlStateL() const |
|
425 { |
|
426 return NULL; |
|
427 } |
|
428 |
|
429 // -------------------------------------------------------------------------- |
|
430 // CPbk2ContactUiControlSubstitute::RestoreControlStateL |
|
431 // -------------------------------------------------------------------------- |
|
432 // |
|
433 void CPbk2ContactUiControlSubstitute::RestoreControlStateL |
|
434 ( CPbk2ViewState* /*aState*/ ) |
|
435 { |
|
436 } |
|
437 |
|
438 // -------------------------------------------------------------------------- |
|
439 // CPbk2ContactUiControlSubstitute::FindTextL |
|
440 // -------------------------------------------------------------------------- |
|
441 // |
|
442 const TDesC& CPbk2ContactUiControlSubstitute::FindTextL() |
|
443 { |
|
444 return KNullDesC; |
|
445 } |
|
446 |
|
447 // -------------------------------------------------------------------------- |
|
448 // CPbk2ContactUiControlSubstitute::ResetFindL |
|
449 // -------------------------------------------------------------------------- |
|
450 // |
|
451 void CPbk2ContactUiControlSubstitute::ResetFindL() |
|
452 { |
|
453 // Do nothing |
|
454 } |
|
455 |
|
456 // -------------------------------------------------------------------------- |
|
457 // CPbk2ContactUiControlSubstitute::ShowThumbnail |
|
458 // -------------------------------------------------------------------------- |
|
459 // |
|
460 void CPbk2ContactUiControlSubstitute::ShowThumbnail() |
|
461 { |
|
462 // Do nothing |
|
463 } |
|
464 |
|
465 // -------------------------------------------------------------------------- |
|
466 // CPbk2ContactUiControlSubstitute::HideThumbnail |
|
467 // -------------------------------------------------------------------------- |
|
468 // |
|
469 void CPbk2ContactUiControlSubstitute::HideThumbnail() |
|
470 { |
|
471 // Do nothing |
|
472 } |
|
473 |
|
474 // -------------------------------------------------------------------------- |
|
475 // CPbk2ContactUiControlSubstitute::SetBlank |
|
476 // -------------------------------------------------------------------------- |
|
477 // |
|
478 void CPbk2ContactUiControlSubstitute::SetBlank( TBool /*aBlank*/ ) |
|
479 { |
|
480 // Do nothing |
|
481 } |
|
482 |
|
483 // -------------------------------------------------------------------------- |
|
484 // CPbk2ContactUiControlSubstitute::RegisterCommand |
|
485 // -------------------------------------------------------------------------- |
|
486 // |
|
487 void CPbk2ContactUiControlSubstitute::RegisterCommand( |
|
488 MPbk2Command* /*aCommand*/) |
|
489 { |
|
490 // Do nothing |
|
491 } |
|
492 |
|
493 // -------------------------------------------------------------------------- |
|
494 // CPbk2ContactUiControlSubstitute::SetTextL |
|
495 // -------------------------------------------------------------------------- |
|
496 // |
|
497 void CPbk2ContactUiControlSubstitute::SetTextL( |
|
498 const TDesC& /*aText*/ ) |
|
499 { |
|
500 // Do nothing |
|
501 } |
|
502 |
|
503 // -------------------------------------------------------------------------- |
|
504 // CPbk2ContactUiControlSubstitute::ContactUiControlExtension |
|
505 // -------------------------------------------------------------------------- |
|
506 // |
|
507 TAny* CPbk2ContactUiControlSubstitute::ContactUiControlExtension(TUid aExtensionUid ) |
|
508 { |
|
509 if( aExtensionUid == KMPbk2ContactUiControlExtension2Uid ) |
|
510 { |
|
511 return static_cast<MPbk2ContactUiControl2*>( this ); |
|
512 } |
|
513 |
|
514 return NULL; |
|
515 } |
|
516 |
|
517 // -------------------------------------------------------------------------- |
|
518 // CPbk2ContactUiControlSubstitute::Draw |
|
519 // -------------------------------------------------------------------------- |
|
520 // |
|
521 void CPbk2ContactUiControlSubstitute::Draw( const TRect& aRect ) const |
|
522 { |
|
523 CWindowGc& gc = SystemGc(); |
|
524 |
|
525 // Set the layout rectangle for the skin bitmap |
|
526 iBgSkinContext->SetRect( aRect ); |
|
527 |
|
528 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
529 AknsDrawUtils::Background( skin, iBgSkinContext, this, gc, aRect, |
|
530 KAknsDrawParamNoClearUnderImage ); |
|
531 } |
|
532 |
|
533 // End of File |