|
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: LandmarksUi Content File - |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 // INCLUDE FILES |
|
27 #include <StringLoader.h> |
|
28 #include <lmkui.rsg> |
|
29 #include <aknsfld.h> |
|
30 #include <aknlists.h> |
|
31 #include "CLmkSelectorDialog.h" |
|
32 #include "MLmkNavigationObserver.h" |
|
33 #include "CLmkLmItemListMemento.h" |
|
34 #include "LmkConsts.h" |
|
35 #include "CLmkListProviderBase.h" |
|
36 #include <Landmarks.rsg> |
|
37 #include <eikclbd.h> |
|
38 |
|
39 _LIT(KWildCard, "*"); |
|
40 |
|
41 // ============================ MEMBER FUNCTIONS =============================== |
|
42 |
|
43 // ----------------------------------------------------------------------------- |
|
44 // CLmkSelectorDialog::CLmkSelectorDialog |
|
45 // C++ default constructor can NOT contain any code, that |
|
46 // might leave. |
|
47 // ----------------------------------------------------------------------------- |
|
48 // |
|
49 CLmkSelectorDialog::CLmkSelectorDialog( |
|
50 TInt& aOpenedItemIndex, |
|
51 MDesCArray* aLbModel, |
|
52 MEikCommandObserver* aCmdObserver, |
|
53 MLmkListMemento* aMemento, CLmkListProviderBase* aListProvider) |
|
54 : CAknSelectionListDialog( aOpenedItemIndex, aLbModel, aCmdObserver ) |
|
55 { |
|
56 iMemento = aMemento; |
|
57 iExited = EFalse; |
|
58 iListProvider = aListProvider; |
|
59 } |
|
60 |
|
61 // ----------------------------------------------------------------------------- |
|
62 // CLmkSelectorDialog::NewL |
|
63 // Two-phased constructor. |
|
64 // ----------------------------------------------------------------------------- |
|
65 // |
|
66 CLmkSelectorDialog* CLmkSelectorDialog::NewL( |
|
67 TInt& aOpenedItemIndex, |
|
68 MDesCArray* aLbModel, |
|
69 TInt aMenuBarResourceId, |
|
70 MEikCommandObserver* aCmdObserver, |
|
71 MLmkListMemento* aMemento, |
|
72 CLmkListProviderBase* aListProvider) |
|
73 { |
|
74 CLmkSelectorDialog* self = |
|
75 new( ELeave ) CLmkSelectorDialog( aOpenedItemIndex, aLbModel, |
|
76 aCmdObserver, aMemento, aListProvider ); |
|
77 |
|
78 CleanupStack::PushL( self ); |
|
79 self->ConstructL( aMenuBarResourceId ); |
|
80 CleanupStack::Pop(); |
|
81 |
|
82 return self; |
|
83 } |
|
84 |
|
85 // ---------------------------------------------------- |
|
86 // CLmkSelectorDialog::ConstructL |
|
87 // ---------------------------------------------------- |
|
88 // |
|
89 void CLmkSelectorDialog::ConstructL( TInt aMenuBarResourceId ) |
|
90 { |
|
91 CAknSelectionListDialog::ConstructL( aMenuBarResourceId ); |
|
92 } |
|
93 // ---------------------------------------------------- |
|
94 // CLmkSelectorDialog::~CLmkSelectorDialog |
|
95 // ---------------------------------------------------- |
|
96 // |
|
97 CLmkSelectorDialog::~CLmkSelectorDialog() |
|
98 { |
|
99 } |
|
100 |
|
101 // ---------------------------------------------------- |
|
102 // CLmkSelectorDialog::HasFindBox |
|
103 // ---------------------------------------------------- |
|
104 // |
|
105 TBool CLmkSelectorDialog::HasFindBox() const |
|
106 { |
|
107 if ( FindBox() ) |
|
108 { |
|
109 return ETrue; |
|
110 } |
|
111 else |
|
112 { |
|
113 return EFalse; |
|
114 } |
|
115 } |
|
116 |
|
117 // ----------------------------------------------------------------------------- |
|
118 // CLmkSelectorDialog::NumberOfItems |
|
119 // ----------------------------------------------------------------------------- |
|
120 // |
|
121 TInt CLmkSelectorDialog::NumberOfItems() const |
|
122 { |
|
123 return ListBox()->Model()->NumberOfItems(); |
|
124 } |
|
125 |
|
126 // ----------------------------------------------------------------------------- |
|
127 // CLmkSelectorDialog::CurrentItemIndex |
|
128 // ----------------------------------------------------------------------------- |
|
129 // |
|
130 TInt CLmkSelectorDialog::CurrentItemIndex() const |
|
131 { |
|
132 return ListBox()->CurrentItemIndex(); |
|
133 } |
|
134 |
|
135 // ----------------------------------------------------------------------------- |
|
136 // CLmkSelectorDialog::SelectionIndexes |
|
137 // ----------------------------------------------------------------------------- |
|
138 // |
|
139 const CArrayFix<TInt>* CLmkSelectorDialog::SelectionIndexes() const |
|
140 { |
|
141 return ListBox()->SelectionIndexes(); |
|
142 } |
|
143 |
|
144 // ----------------------------------------------------------------------------- |
|
145 // CLmkSelectorDialog::SetHelpContext |
|
146 // ----------------------------------------------------------------------------- |
|
147 // |
|
148 void CLmkSelectorDialog::SetHelpContext( TCoeHelpContext aContext ) |
|
149 { |
|
150 iHelpContext = aContext; |
|
151 } |
|
152 |
|
153 // ---------------------------------------------------- |
|
154 // CLmkSelectorDialog::ListBox |
|
155 // ---------------------------------------------------- |
|
156 // |
|
157 CEikListBox* CLmkSelectorDialog::ListBox() const |
|
158 { |
|
159 return CAknSelectionListDialog::ListBox(); |
|
160 } |
|
161 |
|
162 // ---------------------------------------------------- |
|
163 // CLmkSelectorDialog::SetNavigationObserver |
|
164 // ---------------------------------------------------- |
|
165 // |
|
166 void CLmkSelectorDialog::SetNavigationObserver( |
|
167 MLmkNavigationObserver& aObserver ) |
|
168 { |
|
169 iNavigationObserver = &aObserver; |
|
170 } |
|
171 |
|
172 // ---------------------------------------------------- |
|
173 // CLmkSelectorDialog::HandleListProviderEvent |
|
174 // ---------------------------------------------------- |
|
175 // |
|
176 void CLmkSelectorDialog::HandleListProviderEvent( |
|
177 TLmkListProviderEventType aEvent ) |
|
178 { |
|
179 CEikListBox* listbox = ListBox(); |
|
180 if ( listbox && ( aEvent == ELmkEventListReady || aEvent == ELmkEventItemAdditionComplete || aEvent == ELmkEventFindListReady ) ) |
|
181 { |
|
182 TRAPD( error, listbox->HandleItemAdditionL() ); |
|
183 if ( error != KErrNone ) |
|
184 { |
|
185 listbox->Reset(); |
|
186 listbox->DrawNow(); |
|
187 } |
|
188 } |
|
189 if (ListBox()->Model()->NumberOfItems()== 0) |
|
190 { |
|
191 if (aEvent == ELmkEventFindListReady) |
|
192 { |
|
193 TRAP_IGNORE(MakeEmptyTextListBoxL(iDlgEmptyLabelPrimResource,iDlgEmptyLabelSecResource, ETrue)); |
|
194 } |
|
195 else |
|
196 { |
|
197 TRAP_IGNORE(MakeEmptyTextListBoxL(iDlgEmptyLabelPrimResource,iDlgEmptyLabelSecResource)); |
|
198 } |
|
199 } |
|
200 else |
|
201 { |
|
202 ShowFindBox(ETrue); |
|
203 } |
|
204 } |
|
205 |
|
206 // ---------------------------------------------------- |
|
207 // CLmkSelectorDialog::HandleListProviderError |
|
208 // ---------------------------------------------------- |
|
209 // |
|
210 void CLmkSelectorDialog::HandleListProviderError( TInt /*aError*/ ) |
|
211 { |
|
212 CEikListBox* listbox = ListBox(); |
|
213 if ( listbox ) |
|
214 { |
|
215 listbox->Reset(); |
|
216 listbox->DrawNow(); |
|
217 } |
|
218 } |
|
219 |
|
220 // ----------------------------------------------------------------------------- |
|
221 // CLmkSelectorDialog::GetHelpContext |
|
222 // ----------------------------------------------------------------------------- |
|
223 // |
|
224 void CLmkSelectorDialog::GetHelpContext( TCoeHelpContext& aContext ) const |
|
225 { |
|
226 aContext.iContext = iHelpContext.iContext; |
|
227 aContext.iMajor = iHelpContext.iMajor; |
|
228 } |
|
229 |
|
230 // ----------------------------------------------------------------------------- |
|
231 // CLmkSelectorDialog::OfferKeyEventL |
|
232 // ----------------------------------------------------------------------------- |
|
233 // |
|
234 TKeyResponse CLmkSelectorDialog::OfferKeyEventL( const TKeyEvent& aKeyEvent, |
|
235 TEventCode aType ) |
|
236 { |
|
237 // Do not process navigation handling till UI gets from engine |
|
238 if (!ListBox()) |
|
239 { |
|
240 return EKeyWasConsumed; |
|
241 } |
|
242 if (aKeyEvent.iRepeats == 0 || aKeyEvent.iCode == EKeyLeftArrow || aKeyEvent.iCode == EKeyRightArrow ) |
|
243 { |
|
244 if (KeyEventForNavigationL(aKeyEvent, aType) == EKeyWasConsumed) |
|
245 { |
|
246 TryExitL(EAknSoftkeyCancel); |
|
247 return EKeyWasConsumed; |
|
248 } |
|
249 if (!FindBox()->IsVisible()) |
|
250 { |
|
251 return EKeyWasConsumed; |
|
252 } |
|
253 |
|
254 } |
|
255 TKeyResponse keyResponce; |
|
256 keyResponce = CAknSelectionListDialog::OfferKeyEventL(aKeyEvent, aType); |
|
257 CEikButtonGroupContainer &buttonContainer = ButtonGroupContainer(); |
|
258 if(!iExited) |
|
259 { |
|
260 UpdateMskL(); |
|
261 } |
|
262 return keyResponce; |
|
263 } |
|
264 |
|
265 // ----------------------------------------------------------------------------- |
|
266 // CLmkSelectorDialog::PreLayoutDynInitL |
|
267 // ----------------------------------------------------------------------------- |
|
268 // |
|
269 void CLmkSelectorDialog::PreLayoutDynInitL() |
|
270 { |
|
271 CAknSelectionListDialog::PreLayoutDynInitL(); |
|
272 if ( iNavigationObserver ) |
|
273 { |
|
274 iNavigationObserver->HandleLaunchingEventL(); |
|
275 } |
|
276 ((CEikColumnListBox*)ListBox())->ItemDrawer()->ColumnData()->EnableMarqueeL( ETrue ); |
|
277 } |
|
278 // ----------------------------------------------------------------------------- |
|
279 // CLmkSelectorDialog::PostLayoutDynInitL |
|
280 // ----------------------------------------------------------------------------- |
|
281 void CLmkSelectorDialog::PostLayoutDynInitL() |
|
282 { |
|
283 CAknSelectionListDialog::PostLayoutDynInitL(); |
|
284 ShowFindBox(EFalse); |
|
285 if (iMemento) |
|
286 { |
|
287 EnableLeftSoftKey(EFalse); |
|
288 CLmkLmItemListMemento* memento = |
|
289 static_cast<CLmkLmItemListMemento*>(iMemento); |
|
290 /* |
|
291 When launching any application which uses selector dialog, |
|
292 initially, the find box is updated from the HandleListProviderEvent |
|
293 of the CLmkDlgSelectorImplBase class,but once the selector's model is updated |
|
294 dialog has to update the findbox by itself. |
|
295 the |
|
296 */ |
|
297 if(memento->IsModelAvailable()) |
|
298 { |
|
299 iListProvider->StartSearchingLandmarksL(KWildCard,EFalse); |
|
300 if(ListBox()->Model()->NumberOfItems()== 0) |
|
301 { |
|
302 // Disable the find box |
|
303 ShowFindBox(EFalse); |
|
304 MakeEmptyTextListBoxL(iDlgEmptyLabelPrimResource ,iDlgEmptyLabelSecResource); |
|
305 } |
|
306 else |
|
307 { |
|
308 ShowFindBox(ETrue); |
|
309 } |
|
310 UpdateMskL(); |
|
311 } |
|
312 } |
|
313 } |
|
314 |
|
315 // ----------------------------------------------------------------------------- |
|
316 // CLmkSelectorDialog::OkToExitL |
|
317 // ----------------------------------------------------------------------------- |
|
318 // |
|
319 TBool CLmkSelectorDialog::OkToExitL( TInt aButtonId ) |
|
320 { |
|
321 if (!ListBox()) |
|
322 { |
|
323 return EFalse; |
|
324 } |
|
325 |
|
326 if (NumberOfItems() <= 0 && aButtonId == EAknSoftkeyOk) |
|
327 { |
|
328 return EFalse; |
|
329 } |
|
330 TBool b = CAknSelectionListDialog::OkToExitL( aButtonId ); |
|
331 if ( b && iNavigationObserver ) |
|
332 { |
|
333 iNavigationObserver->HandleClosingEventL(); |
|
334 } |
|
335 iExited = b; |
|
336 return b; |
|
337 } |
|
338 // ---------------------------------------------------- |
|
339 // CLmkSelectorDialog::KeyEventForNavigationL |
|
340 // ---------------------------------------------------- |
|
341 // |
|
342 TKeyResponse CLmkSelectorDialog::KeyEventForNavigationL( |
|
343 const TKeyEvent& aKeyEvent, |
|
344 TEventCode aType ) |
|
345 { |
|
346 if ( iNavigationObserver && ( aType == EEventKey ) && |
|
347 ( aKeyEvent.iCode == EKeyLeftArrow || |
|
348 aKeyEvent.iCode == EKeyRightArrow ) ) |
|
349 { |
|
350 return iNavigationObserver->HandleNavigationEventL( aKeyEvent ); |
|
351 } |
|
352 return EKeyWasNotConsumed; |
|
353 } |
|
354 |
|
355 // ---------------------------------------------------- |
|
356 // CLmkSelectorDialog::FindBox() |
|
357 // ---------------------------------------------------- |
|
358 // |
|
359 CAknSearchField* CLmkSelectorDialog::FindBox() const |
|
360 { |
|
361 return CAknSelectionListDialog::FindBox(); |
|
362 } |
|
363 |
|
364 // ---------------------------------------------------- |
|
365 // CLmkSelectorDialog::ShowFindBox() |
|
366 // ---------------------------------------------------- |
|
367 // |
|
368 void CLmkSelectorDialog::ShowFindBox(TBool aVisible) |
|
369 { |
|
370 |
|
371 CEikListBox* iListBox = ListBox(); |
|
372 CAknSearchField* iSearchBox = FindBox(); |
|
373 const TRect rect(Rect()); |
|
374 if (iSearchBox) |
|
375 { |
|
376 iSearchBox->SetFocus(aVisible); |
|
377 iSearchBox->MakeVisible(aVisible); |
|
378 #ifdef RD_SCALABLE_UI_V2 |
|
379 CAknFilteredTextListBoxModel* model = |
|
380 static_cast<CAknFilteredTextListBoxModel*> ( iListBox->Model() ); |
|
381 |
|
382 iFilter = model->Filter(); |
|
383 iSearchBox->SetObserver(this); |
|
384 #endif// RD_SCALABLE_UI_V2 |
|
385 static_cast<CAknColumnListBoxView*> |
|
386 (iListBox->View())->SetFindEmptyListState(aVisible); |
|
387 |
|
388 if (iListBox && iSearchBox) |
|
389 { |
|
390 AknLayoutUtils::LayoutControl(iListBox, rect, |
|
391 AKN_LAYOUT_WINDOW_list_gen_pane(1)); |
|
392 AknLayoutUtils::LayoutControl(iSearchBox, rect, |
|
393 AKN_LAYOUT_WINDOW_find_pane); |
|
394 if (iSearchBox->IsVisible() && iListBox->IsVisible()) |
|
395 { |
|
396 // The correct line position to use is 2, which corresponds |
|
397 // EABColumn in Avkon (not a public enumeration, |
|
398 // hence hard-coding used here) |
|
399 const TInt KSeparatorLinePos = 2; |
|
400 iSearchBox->SetLinePos(KSeparatorLinePos); |
|
401 } |
|
402 } |
|
403 else if (iListBox) |
|
404 { |
|
405 AknLayoutUtils::LayoutControl(iListBox, rect, |
|
406 AKN_LAYOUT_WINDOW_list_gen_pane(0)); |
|
407 } |
|
408 } |
|
409 |
|
410 if ( !aVisible ) |
|
411 { |
|
412 iListBox->SetRect(rect); |
|
413 iListBox->DrawDeferred(); |
|
414 } |
|
415 } |
|
416 // ---------------------------------------------------- |
|
417 // CLmkSelectorDialog::MakeEmptyTextListBoxL |
|
418 // ---------------------------------------------------- |
|
419 // |
|
420 void CLmkSelectorDialog::MakeEmptyTextListBoxL( TInt aResourcePrimText,TInt aResourceSecText, TBool aRequestFromFindBox ) const |
|
421 { |
|
422 if (aRequestFromFindBox) |
|
423 { |
|
424 HBufC* text1 = StringLoader::LoadLC( R_LMK_EMPTY_NO_MATCH, iCoeEnv ); |
|
425 TPtr ptr1 = text1->Des(); |
|
426 ListBox()->View()->SetListEmptyTextL( ptr1 ); |
|
427 CleanupStack::PopAndDestroy(text1); |
|
428 } |
|
429 else if (aResourcePrimText && aResourceSecText) |
|
430 { |
|
431 _LIT(KNChar,"\n"); |
|
432 HBufC* text1 = StringLoader::LoadLC( aResourcePrimText, iCoeEnv ); |
|
433 HBufC* text2 = StringLoader::LoadLC( aResourceSecText, iCoeEnv ); |
|
434 TPtr ptr1 = text1->Des(); |
|
435 TPtr ptr2 = text2->Des(); |
|
436 |
|
437 HBufC* buffer = HBufC::NewLC(text1->Length() + text2->Length() + 2); |
|
438 TPtr textFromResourceFile = buffer->Des(); |
|
439 textFromResourceFile.Copy(ptr1); |
|
440 textFromResourceFile.Append(KNChar); |
|
441 textFromResourceFile.Append(ptr2); |
|
442 |
|
443 ListBox()->View()->SetListEmptyTextL( textFromResourceFile ); |
|
444 CleanupStack::PopAndDestroy(3);//buffer,text2,text1 |
|
445 } |
|
446 } |
|
447 |
|
448 // ----------------------------------------------------------------------------- |
|
449 // CLmkSelectorDialog::HandleResourceChange() |
|
450 // ----------------------------------------------------------------------------- |
|
451 // |
|
452 void CLmkSelectorDialog::HandleResourceChange (TInt aType) |
|
453 { |
|
454 if(aType==KEikDynamicLayoutVariantSwitch) |
|
455 { |
|
456 CAknSelectionListDialog::HandleResourceChange(aType); |
|
457 if (iMemento) |
|
458 { |
|
459 CLmkLmItemListMemento* memento = |
|
460 static_cast<CLmkLmItemListMemento*>(iMemento); |
|
461 if(memento->IsModelAvailable()) |
|
462 { |
|
463 if(ListBox()->Model()->NumberOfItems()== 0 && FindBox()->TextLength() <= 0 ) |
|
464 { |
|
465 ShowFindBox(EFalse); |
|
466 } |
|
467 } |
|
468 } |
|
469 } |
|
470 else if (aType == KAknsMessageSkinChange ) |
|
471 { |
|
472 CAknSelectionListDialog::HandleResourceChange(aType); |
|
473 } |
|
474 } |
|
475 |
|
476 |
|
477 // ----------------------------------------------------------------------------- |
|
478 // CLmkSelectorDialog::UpdateMskL() |
|
479 // ----------------------------------------------------------------------------- |
|
480 // |
|
481 void CLmkSelectorDialog::UpdateMskL() |
|
482 { |
|
483 CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current(); |
|
484 if (ListBox()->Model()->NumberOfItems()== 0) |
|
485 { |
|
486 cba->MakeCommandVisible(EAknSoftkeyOk, EFalse); |
|
487 cba->MakeCommandVisibleByPosition(CEikButtonGroupContainer::EMiddleSoftkeyPosition,EFalse); |
|
488 } |
|
489 else |
|
490 { |
|
491 cba->SetCommandSetL(iCbaResourceId); |
|
492 cba->MakeCommandVisible(EAknSoftkeyOk, ETrue); |
|
493 cba->MakeCommandVisibleByPosition(CEikButtonGroupContainer::EMiddleSoftkeyPosition,ETrue); |
|
494 } |
|
495 cba->DrawDeferred(); |
|
496 } |
|
497 // ----------------------------------------------------------------------------- |
|
498 // CLmkSelectorDialog::PrepareLC() |
|
499 // ----------------------------------------------------------------------------- |
|
500 // |
|
501 void CLmkSelectorDialog::PrepareLC(TInt aDlgResourceId) |
|
502 { |
|
503 CAknSelectionListDialog::PrepareLC(aDlgResourceId); |
|
504 SetCbaResourceAndCommandId(aDlgResourceId); |
|
505 } |
|
506 |
|
507 // ----------------------------------------------------------------------------- |
|
508 // CLmkSelectorDialog::SetCbaResourceAndCommandId() |
|
509 // ----------------------------------------------------------------------------- |
|
510 // |
|
511 void CLmkSelectorDialog::SetCbaResourceAndCommandId(TInt aaDlgResourceId) |
|
512 { |
|
513 switch(aaDlgResourceId) |
|
514 { |
|
515 case R_LMK_SELECTOR_OK_BACK_DLG://R_AVKON_SOFTKEYS_OK_BACK |
|
516 case R_LMK_SELECTOR_OK_BACK_MULTI_DLG://R_AVKON_SOFTKEYS_OK_BACK |
|
517 { |
|
518 iCbaResourceId = R_LMK_SELECTOR_SOFTKEYS_OK_BACK_OK; |
|
519 iMskCmdId = EAknSoftkeyOk; |
|
520 break; |
|
521 } |
|
522 case R_LMK_CATEGORY_SELECTOR_OK_CANCEL_MULTI_DLG://r_lmk_catsel_softkeys_done_cancel |
|
523 { |
|
524 iCbaResourceId = R_LMK_SELECTOR_SOFTKEYS_DONE_CANCEL_DONE; |
|
525 iMskCmdId = EAknSoftkeyDone; |
|
526 break; |
|
527 } |
|
528 case R_LMK_SELECTOR_OPEN_CANCEL_DLG://r_lmk_softkeys_open(ok)_cancel |
|
529 { |
|
530 iCbaResourceId = R_LMK_SELECTOR_SOFTKEYS_OPEN_CANCEL_OPEN; |
|
531 iMskCmdId = EAknSoftkeyOk; |
|
532 break; |
|
533 } |
|
534 case R_LMK_SELECTOR_OK_CANCEL_DLG://R_AVKON_SOFTKEYS_OK_CANCEL |
|
535 case R_LMK_SELECTOR_OK_CANCEL_MULTI_DLG://R_AVKON_SOFTKEYS_OK_CANCEL |
|
536 iCbaResourceId = R_LMK_SELECTOR_SOFTKEYS_OK_CANCEL_OK; |
|
537 iMskCmdId = EAknSoftkeyOk; |
|
538 default: |
|
539 break; |
|
540 } |
|
541 } |
|
542 |
|
543 // ----------------------------------------------------------------------------- |
|
544 // CLmkSelectorDialog::SetDlgEmptyResource() |
|
545 // ----------------------------------------------------------------------------- |
|
546 // |
|
547 void CLmkSelectorDialog::SetDlgEmptyResource(TInt aEmptyPrimLabel ,TInt aEmptySecLabel) |
|
548 { |
|
549 iDlgEmptyLabelPrimResource = aEmptyPrimLabel; |
|
550 iDlgEmptyLabelSecResource = aEmptySecLabel; |
|
551 } |
|
552 |
|
553 // ----------------------------------------------------------------------------- |
|
554 // CLmkSelectorDialog::EnableLeftSoftKey() |
|
555 // ----------------------------------------------------------------------------- |
|
556 // |
|
557 void CLmkSelectorDialog::EnableLeftSoftKey(TBool aEnable) |
|
558 { |
|
559 CEikButtonGroupContainer &pButtonContainer = ButtonGroupContainer(); |
|
560 TInt id = pButtonContainer.ButtonGroup()->CommandId(0); |
|
561 pButtonContainer.MakeCommandVisible(id,aEnable); |
|
562 } |
|
563 |
|
564 #ifdef RD_SCALABLE_UI_V2 |
|
565 // ----------------------------------------------------------------------------- |
|
566 // CLmkSelectorDialog::HandleControlEventL() |
|
567 // ----------------------------------------------------------------------------- |
|
568 // |
|
569 void CLmkSelectorDialog::HandleControlEventL( CCoeControl* aControl,TCoeEvent aEventType ) |
|
570 { |
|
571 //Update the listbox as per the search criteria |
|
572 if (!iListProvider) |
|
573 { |
|
574 if( iFilter ) |
|
575 { |
|
576 iFilter->HandleControlEventL(aControl, aEventType); |
|
577 UpdateMskL(); |
|
578 } |
|
579 return; |
|
580 } |
|
581 |
|
582 CEikButtonGroupContainer &buttonContainer = ButtonGroupContainer(); |
|
583 //Update the msk depending upon the search results while using the virtual keyboard. |
|
584 if( aEventType == EEventStateChanged) |
|
585 { |
|
586 if ( aControl == FindBox() ) |
|
587 { |
|
588 if(FindBox()->IsVisible()) |
|
589 { |
|
590 if( NumberOfItems() == 0 ) |
|
591 { |
|
592 buttonContainer.MakeCommandVisible(EAknSoftkeyOk, EFalse); |
|
593 } |
|
594 else |
|
595 { |
|
596 buttonContainer.MakeCommandVisible(EAknSoftkeyOk, ETrue); |
|
597 } |
|
598 UpdateMskL(); |
|
599 |
|
600 // Fetch filter from search field |
|
601 TInt searchTextLength = FindBox()->TextLength(); |
|
602 HBufC* filterBuf = HBufC::NewLC(searchTextLength+1); |
|
603 TPtr filter = filterBuf->Des(); |
|
604 FindBox()->GetSearchText(filter); |
|
605 |
|
606 // If filter has changed repopulate list box. (It is necessary to check |
|
607 // if filter has changed since each filter change generates several |
|
608 // EEventStateChanged events for find box) |
|
609 |
|
610 if (iListProvider) |
|
611 { |
|
612 filter.Append(KWildCard); |
|
613 if ( iListProvider->StartSearchingLandmarksL(filter,EFalse) == EFalse) |
|
614 { |
|
615 //Update the listbox as per the search criteria |
|
616 if( iFilter ) |
|
617 { |
|
618 iFilter->HandleControlEventL(aControl, aEventType); |
|
619 } |
|
620 } |
|
621 } |
|
622 CleanupStack::PopAndDestroy(filterBuf); |
|
623 } |
|
624 } |
|
625 } |
|
626 } |
|
627 #endif //RD_SCALABLE_UI_V2 |
|
628 // End of File |