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