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 // INCLUDE FILES |
|
26 #include <StringLoader.h> |
|
27 #include <aknlists.h> |
|
28 #include <aknsfld.h> |
|
29 #include <avkon.mbg> |
|
30 #include <AknsConstants.h> |
|
31 #include <AknIconArray.h> |
|
32 #include <lmkui.rsg> |
|
33 #include <locationvariationdomaincrkeys.h> |
|
34 #include <centralrepository.h> |
|
35 #include "LmkConsts.h" |
|
36 #include "CLmkUiUtils.h" |
|
37 #include "CLmkLmItemListProvider.h" |
|
38 #include "CLmkSelectorLBModelBase.h" |
|
39 #include "CLmkSingleGraphicLBModel.h" |
|
40 #include "CLmkMultiSelectionLBModel.h" |
|
41 #include "CLmkLmItemListMemento.h" |
|
42 #include "CLmkSelectorIconMgr.h" |
|
43 #include "CLmkSelectorDialog.h" |
|
44 #include "CLmkMultiSelectorDialog.h" |
|
45 #include "CLmkDlgSelectorImplBase.h" |
|
46 #include <lmkerrors.h> |
|
47 |
|
48 |
|
49 #if defined(_DEBUG) |
|
50 |
|
51 // CONSTANTS |
|
52 /// Unnamed namespace for local definitions |
|
53 namespace { |
|
54 |
|
55 _LIT( KPanicMsg, "CLmkDlgSelectorImplBase" ); |
|
56 |
|
57 void Panic( TPanicCode aReason ) |
|
58 { |
|
59 User::Panic( KPanicMsg, aReason ); |
|
60 } |
|
61 } // namespace |
|
62 #endif |
|
63 _LIT(KFetchingData, " "); |
|
64 // ============================ MEMBER FUNCTIONS =============================== |
|
65 |
|
66 // ----------------------------------------------------------------------------- |
|
67 // CLmkDlgSelectorImplBase::CLmkDlgSelectorImplBase |
|
68 // C++ default constructor can NOT contain any code, that |
|
69 // might leave. |
|
70 // ----------------------------------------------------------------------------- |
|
71 // |
|
72 CLmkDlgSelectorImplBase::CLmkDlgSelectorImplBase( CPosLandmarkDatabase& aDb ) |
|
73 : CLmkSelectorImplBase( aDb ), |
|
74 iDlgSelectorImplBaseLatestListEvent( ELmkEventNull ), |
|
75 iTitle(0) |
|
76 { |
|
77 } |
|
78 |
|
79 // ----------------------------------------------------------------------------- |
|
80 // CLmkDlgSelectorImplBase::BaseConstructL |
|
81 // Symbian 2nd phase constructor can leave. |
|
82 // ----------------------------------------------------------------------------- |
|
83 // |
|
84 void CLmkDlgSelectorImplBase::BaseConstructL() |
|
85 { |
|
86 CLmkSelectorImplBase::BaseConstructL(); |
|
87 |
|
88 // Check if the Coordinates has to be hidden |
|
89 CheckHideCoordinateL(); |
|
90 |
|
91 // CommonUi selector API promises that construction of a dialog leaves with |
|
92 // KErrNotSupported if the framework is not available. This is satisfied |
|
93 // since providers try to initialize the db during the construction. |
|
94 // However, it is not really even important since the selector API cannot |
|
95 // be even called if framework isn't available since the API requires |
|
96 // a landmark db reference, and user can't get it without the framework! |
|
97 } |
|
98 |
|
99 // ---------------------------------------------------- |
|
100 // CLmkDlgSelectorImplBase::~CLmkDlgSelectorImplBase |
|
101 // ---------------------------------------------------- |
|
102 // |
|
103 CLmkDlgSelectorImplBase::~CLmkDlgSelectorImplBase() |
|
104 { |
|
105 if( iTitle ) |
|
106 delete iTitle; |
|
107 } |
|
108 |
|
109 // ---------------------------------------------------- |
|
110 // CLmkDlgSelectorImplBase::SetSelectorImplParent |
|
111 // ---------------------------------------------------- |
|
112 // |
|
113 void CLmkDlgSelectorImplBase::SetSelectorImplParent( |
|
114 CLmkDlgSelectorImplBase* aParent ) |
|
115 { |
|
116 iSelectorImplParent = aParent; |
|
117 } |
|
118 |
|
119 // ----------------------------------------------------------------------------- |
|
120 // CLmkDlgSelectorImplBase::SetMopParent |
|
121 // ?implementation_description |
|
122 // (other items were commented in a header). |
|
123 // ----------------------------------------------------------------------------- |
|
124 // |
|
125 EXPORT_C void CLmkDlgSelectorImplBase::SetMopParent( MObjectProvider* aParent ) |
|
126 { |
|
127 iMopParent = aParent; |
|
128 } |
|
129 |
|
130 // ---------------------------------------------------- |
|
131 // CLmkDlgSelectorImplBase::ExecuteL |
|
132 // ---------------------------------------------------- |
|
133 // |
|
134 TInt CLmkDlgSelectorImplBase::ExecuteL( |
|
135 TPosLmItemId& aOpenedItem, |
|
136 TBool aAlwaysModifyOpened ) |
|
137 { |
|
138 const CLmkLmItemListProvider& provider = |
|
139 static_cast<const CLmkLmItemListProvider&>( ListProvider() ); |
|
140 |
|
141 // First item in the list will be highlighted when launching the |
|
142 // single item selector, regardless of aOpenedItem input value: |
|
143 TInt index( 0 ); |
|
144 TInt result = ExecuteL( index ); |
|
145 if ( result || aAlwaysModifyOpened ) |
|
146 { |
|
147 provider.GetSelectedItemId( aOpenedItem, index ); |
|
148 } |
|
149 return result; |
|
150 } |
|
151 |
|
152 // ---------------------------------------------------- |
|
153 // CLmkDlgSelectorImplBase::ExecuteL |
|
154 // ---------------------------------------------------- |
|
155 // |
|
156 TInt CLmkDlgSelectorImplBase::ExecuteL( |
|
157 RArray<TPosLmItemId>& aSelectedItems, |
|
158 TBool aAlwaysModifySelected ) |
|
159 { |
|
160 const CLmkLmItemListProvider& provider = |
|
161 static_cast<const CLmkLmItemListProvider&>( ListProvider() ); |
|
162 |
|
163 // If provider is not ready yet then selectedIndexes will not |
|
164 // contain any/all pre-selected indexes but this is still |
|
165 // a safe way to create an array for selections: |
|
166 CArrayFix<TInt>* selectedIndexes = |
|
167 provider.SelectedIndexesL( aSelectedItems ); |
|
168 |
|
169 // If provider is not ready yet we will need to set pre-selected |
|
170 // indexes again later when it gets ready: |
|
171 if ( iDlgSelectorImplBaseLatestListEvent != ELmkEventListReady ) |
|
172 { |
|
173 // Pre-selected items will be set marked when provider is ready: |
|
174 iInputSelectedItems = &aSelectedItems; |
|
175 } |
|
176 |
|
177 CleanupStack::PushL( selectedIndexes ); |
|
178 |
|
179 TInt result = ExecuteL( *selectedIndexes ); |
|
180 |
|
181 if ( result || aAlwaysModifySelected ) |
|
182 { |
|
183 provider.GetSelectedItemIdsL( aSelectedItems, |
|
184 *selectedIndexes ); |
|
185 } |
|
186 else |
|
187 { |
|
188 //Below code, if user might have passed some |
|
189 //pre-selection, which needs to be retunred |
|
190 //back to the user in case of cancel. |
|
191 RArray<TPosLmItemId> tempIdArray; |
|
192 TInt count = aSelectedItems.Count(); |
|
193 for ( TInt i = 0; i < count; i++ ) |
|
194 { |
|
195 TInt found = provider.SelectedIndex(aSelectedItems[i]); |
|
196 if ( found < 0 ) |
|
197 { |
|
198 tempIdArray.Append(aSelectedItems[i]); |
|
199 } |
|
200 } |
|
201 count = tempIdArray.Count(); |
|
202 for ( TInt i = 0; i < count; i++ ) |
|
203 { |
|
204 TInt found = aSelectedItems.Find(tempIdArray[i]); |
|
205 if ( found != KErrNotFound ) |
|
206 { |
|
207 aSelectedItems.Remove(found); |
|
208 } |
|
209 } |
|
210 tempIdArray.Close(); |
|
211 } |
|
212 CleanupStack::PopAndDestroy( selectedIndexes ); |
|
213 return result; |
|
214 } |
|
215 |
|
216 // ----------------------------------------------------------------------------- |
|
217 // CLmkDlgSelectorImplBase::ExecuteL |
|
218 // ?implementation_description |
|
219 // (other items were commented in a header). |
|
220 // ----------------------------------------------------------------------------- |
|
221 // |
|
222 TInt CLmkDlgSelectorImplBase::ExecuteL( TInt& aOpenedItem ) |
|
223 { |
|
224 TInt menuBarResource( KZeroResourceId ); |
|
225 TInt dialogResource( KZeroResourceId ); |
|
226 TInt titleResource( KZeroResourceId ); |
|
227 GetDlgResources( ETrue, titleResource, menuBarResource, dialogResource ); |
|
228 |
|
229 CLmkSelectorLBModelBase* lbModel = |
|
230 CLmkSingleGraphicLBModel::NewL( *iListProvider ); |
|
231 CleanupStack::PushL( lbModel ); |
|
232 |
|
233 CLmkSelectorDialog* dialog = CLmkSelectorDialog::NewL( aOpenedItem, |
|
234 lbModel, |
|
235 menuBarResource, |
|
236 this,iMemento, iListProvider ); |
|
237 |
|
238 dialog->SetNavigationObserver( *this ); |
|
239 dialog->SetMopParent( iMopParent ); |
|
240 dialog->PrepareLC( dialogResource ); |
|
241 dialog->SetHelpContext( HelpContext() ); |
|
242 dialog->SetDlgEmptyResource(iCurrentLabelPrimResource,iCurrentLabelSecResource); |
|
243 |
|
244 HBufC* textForFetchingData; |
|
245 textForFetchingData = HBufC::NewL(20); |
|
246 CleanupStack::PushL(textForFetchingData); // textForFetchingData |
|
247 *textForFetchingData = KFetchingData; |
|
248 dialog->ListBox()->View()->SetListEmptyTextL( *textForFetchingData); |
|
249 |
|
250 CleanupStack::PopAndDestroy(); // textForFetchingData. |
|
251 |
|
252 CAknIconArray* icons = SetupIconMgrLC(); |
|
253 |
|
254 dialog->SetIconArrayL( icons ); |
|
255 CleanupStack::Pop(); // icons |
|
256 |
|
257 // pointer needs to be stored in a member during exection: |
|
258 iDialog = dialog; |
|
259 iLmkUiUtils->StoreTitlePaneL(); |
|
260 if (iTitle) { |
|
261 HBufC* titleTextBuf = iTitle->AllocL(); |
|
262 iLmkUiUtils->ChangeTitlePaneL(titleTextBuf); // iLmkUiUtils takes ownership |
|
263 } |
|
264 else { |
|
265 iLmkUiUtils->ChangeTitlePaneL( titleResource ); |
|
266 } |
|
267 TInt result = iDialog->RunLD(); |
|
268 iDialog = NULL; // dialog was popped and destroyed |
|
269 iLmkUiUtils->RestoreOldTitlePane(); |
|
270 CleanupStack::PopAndDestroy( lbModel ); |
|
271 |
|
272 return result; |
|
273 } |
|
274 |
|
275 // ----------------------------------------------------------------------------- |
|
276 // CLmkDlgSelectorImplBase::ExecuteL |
|
277 // ?implementation_description |
|
278 // (other items were commented in a header). |
|
279 // ----------------------------------------------------------------------------- |
|
280 // |
|
281 TInt CLmkDlgSelectorImplBase::ExecuteL( CArrayFix<TInt>& aSelectedItems ) |
|
282 { |
|
283 TInt openedItemIndex( 0 ); |
|
284 TInt menuBarResource( KZeroResourceId ); |
|
285 TInt dialogResource( KZeroResourceId ); |
|
286 TInt titleResource( KZeroResourceId ); |
|
287 |
|
288 |
|
289 GetDlgResources( EFalse, titleResource, menuBarResource, dialogResource ); |
|
290 |
|
291 CLmkSelectorLBModelBase* lbModel = |
|
292 CLmkMultiSelectionLBModel::NewL( *iListProvider ); |
|
293 CleanupStack::PushL( lbModel ); |
|
294 |
|
295 CLmkSelectorDialog* dialog = CLmkMultiSelectorDialog::NewL( |
|
296 openedItemIndex, &aSelectedItems, lbModel, |
|
297 menuBarResource, NULL, this, this,iMemento ); |
|
298 |
|
299 dialog->SetNavigationObserver( *this ); |
|
300 dialog->SetMopParent( iMopParent ); |
|
301 dialog->PrepareLC( dialogResource ); |
|
302 dialog->SetHelpContext( HelpContext() ); |
|
303 dialog->SetDlgEmptyResource(iCurrentLabelPrimResource,iCurrentLabelSecResource); |
|
304 |
|
305 HBufC* textForFetchingData; |
|
306 textForFetchingData = HBufC::NewL(20); |
|
307 CleanupStack::PushL(textForFetchingData); // textForFetchingData |
|
308 *textForFetchingData = KFetchingData; |
|
309 dialog->ListBox()->View()->SetListEmptyTextL( *textForFetchingData); |
|
310 CleanupStack::PopAndDestroy(); // textForFetchingData. |
|
311 |
|
312 |
|
313 CAknIconArray* icons = SetupIconMgrLC(); |
|
314 TFileName* iconFile = CLmkUiUtils::AvkonIconFileLC(); |
|
315 iIconMgr->SetIconAtIndexZeroL( *iconFile, |
|
316 KAknsIIDQgnPropCheckboxOn, |
|
317 EMbmAvkonQgn_prop_checkbox_on, |
|
318 EMbmAvkonQgn_prop_checkbox_on_mask ); |
|
319 |
|
320 iIconMgr->SetIconAtIndexOneL( *iconFile, |
|
321 KAknsIIDQgnPropCheckboxOff, |
|
322 EMbmAvkonQgn_prop_checkbox_off, |
|
323 EMbmAvkonQgn_prop_checkbox_off_mask ); |
|
324 |
|
325 dialog->SetIconArrayL( icons ); |
|
326 CleanupStack::PopAndDestroy(); // iconFile |
|
327 CleanupStack::Pop(); // icons |
|
328 |
|
329 // pointer needs to be stored in a member during exection: |
|
330 iDialog = dialog; |
|
331 iLmkUiUtils->StoreTitlePaneL(); |
|
332 if (iTitle) { |
|
333 HBufC* titleTextBuf = iTitle->AllocL(); |
|
334 iLmkUiUtils->ChangeTitlePaneL(titleTextBuf); // iLmkUiUtils takes ownership |
|
335 } |
|
336 else { |
|
337 iLmkUiUtils->ChangeTitlePaneL( titleResource ); |
|
338 } |
|
339 |
|
340 TInt result = iDialog->RunLD(); |
|
341 iDialog = NULL; // dialog was popped and destroyed |
|
342 iLmkUiUtils->RestoreOldTitlePane(); |
|
343 CleanupStack::PopAndDestroy( lbModel ); |
|
344 |
|
345 return result; |
|
346 } |
|
347 |
|
348 // ----------------------------------------------------------------------------- |
|
349 // CLmkDlgSelectorImplBase::ExecuteL |
|
350 // ?implementation_description |
|
351 // (other items were commented in a header). |
|
352 // ----------------------------------------------------------------------------- |
|
353 // |
|
354 TInt CLmkDlgSelectorImplBase::ExecuteL( CArrayFix<TInt>& aSelectedItems, TPtrC aTitlePaneText ) |
|
355 { |
|
356 TInt openedItemIndex( 0 ); |
|
357 TInt menuBarResource( KZeroResourceId ); |
|
358 TInt dialogResource( KZeroResourceId ); |
|
359 TInt titleResource( KZeroResourceId ); |
|
360 |
|
361 GetDlgResources( EFalse, titleResource, menuBarResource, dialogResource ); |
|
362 |
|
363 |
|
364 CLmkSelectorLBModelBase* lbModel = |
|
365 CLmkMultiSelectionLBModel::NewL( *iListProvider ); |
|
366 CleanupStack::PushL( lbModel ); |
|
367 |
|
368 CLmkSelectorDialog* dialog = CLmkMultiSelectorDialog::NewL( |
|
369 openedItemIndex, &aSelectedItems, lbModel, |
|
370 menuBarResource, NULL, this, this,iMemento ); |
|
371 |
|
372 dialog->SetNavigationObserver( *this ); |
|
373 dialog->SetMopParent( iMopParent ); |
|
374 dialog->PrepareLC( dialogResource ); |
|
375 dialog->SetHelpContext( HelpContext() ); |
|
376 dialog->SetDlgEmptyResource(iCurrentLabelPrimResource,iCurrentLabelSecResource); |
|
377 |
|
378 HBufC* textForFetchingData; |
|
379 textForFetchingData = HBufC::NewL(20); |
|
380 CleanupStack::PushL(textForFetchingData); // textForFetchingData |
|
381 *textForFetchingData = KFetchingData; |
|
382 dialog->ListBox()->View()->SetListEmptyTextL( *textForFetchingData); |
|
383 CleanupStack::PopAndDestroy(); // textForFetchingData. |
|
384 |
|
385 CAknIconArray* icons = SetupIconMgrLC(); |
|
386 TFileName* iconFile = CLmkUiUtils::AvkonIconFileLC(); |
|
387 iIconMgr->SetIconAtIndexZeroL( *iconFile, |
|
388 KAknsIIDQgnPropCheckboxOn, |
|
389 EMbmAvkonQgn_prop_checkbox_on, |
|
390 EMbmAvkonQgn_prop_checkbox_on_mask ); |
|
391 |
|
392 iIconMgr->SetIconAtIndexOneL( *iconFile, |
|
393 KAknsIIDQgnPropCheckboxOff, |
|
394 EMbmAvkonQgn_prop_checkbox_off, |
|
395 EMbmAvkonQgn_prop_checkbox_off_mask ); |
|
396 |
|
397 dialog->SetIconArrayL( icons ); |
|
398 CleanupStack::PopAndDestroy(); // iconFile |
|
399 CleanupStack::Pop(); // icons |
|
400 |
|
401 // pointer needs to be stored in a member during exection: |
|
402 iDialog = dialog; |
|
403 iLmkUiUtils->StoreTitlePaneL(); |
|
404 |
|
405 HBufC* titleText = NULL; |
|
406 |
|
407 titleText = aTitlePaneText.AllocL(); |
|
408 |
|
409 iLmkUiUtils->ChangeTitlePaneL(titleText ); |
|
410 |
|
411 TInt result = iDialog->RunLD(); |
|
412 iDialog = NULL; // dialog was popped and destroyed |
|
413 iLmkUiUtils->RestoreOldTitlePane(); |
|
414 CleanupStack::PopAndDestroy( lbModel ); |
|
415 |
|
416 return result; |
|
417 } |
|
418 |
|
419 |
|
420 // ---------------------------------------------------- |
|
421 // CLmkDlgSelectorImplBase::HelpContext |
|
422 // ---------------------------------------------------- |
|
423 // |
|
424 TCoeHelpContext CLmkDlgSelectorImplBase::HelpContext() const |
|
425 { |
|
426 // Default null help context: |
|
427 return TCoeHelpContext(); |
|
428 } |
|
429 |
|
430 // ---------------------------------------------------- |
|
431 // CLmkDlgSelectorImplBase::StopExecutionL |
|
432 // ---------------------------------------------------- |
|
433 // |
|
434 void CLmkDlgSelectorImplBase::StopExecutionL() |
|
435 { |
|
436 delete iDialog; |
|
437 iDialog = NULL; |
|
438 } |
|
439 |
|
440 // ----------------------------------------------------------------------------- |
|
441 // CLmkDlgSelectorImplBase::MementoL |
|
442 // ----------------------------------------------------------------------------- |
|
443 // |
|
444 MLmkListMemento* CLmkDlgSelectorImplBase::MementoL() |
|
445 { |
|
446 CLmkLmItemListMemento* memento = CLmkLmItemListMemento::NewL(); |
|
447 return memento; |
|
448 } |
|
449 |
|
450 // ----------------------------------------------------------------------------- |
|
451 // CLmkDlgSelectorImplBase::ListVisibleItemCount |
|
452 // ----------------------------------------------------------------------------- |
|
453 // |
|
454 TInt CLmkDlgSelectorImplBase::ListVisibleItemCount() |
|
455 { |
|
456 TInt retval( 0 ); |
|
457 if ( iDialog ) |
|
458 { |
|
459 retval = iDialog->NumberOfItems(); |
|
460 } |
|
461 return retval; |
|
462 } |
|
463 |
|
464 // ----------------------------------------------------------------------------- |
|
465 // CLmkDlgSelectorImplBase::ListMarkedItemCountL |
|
466 // ----------------------------------------------------------------------------- |
|
467 // |
|
468 TInt CLmkDlgSelectorImplBase::ListMarkedItemCountL() |
|
469 { |
|
470 TInt retval( 0 ); |
|
471 if ( iDialog ) |
|
472 { |
|
473 const CArrayFix<TInt>* markedIndexes = iDialog->SelectionIndexes(); |
|
474 retval = markedIndexes->Count(); |
|
475 } |
|
476 return retval; |
|
477 } |
|
478 |
|
479 // ---------------------------------------------------- |
|
480 // CLmkDlgSelectorImplBase::ProcessCommandL |
|
481 // ---------------------------------------------------- |
|
482 // |
|
483 void CLmkDlgSelectorImplBase::ProcessCommandL( TInt aCommandId ) |
|
484 { |
|
485 if ( iSelectorImplParent ) |
|
486 { |
|
487 iSelectorImplParent->ProcessCommandL( aCommandId ); |
|
488 } |
|
489 } |
|
490 |
|
491 // ---------------------------------------------------- |
|
492 // CLmkDlgSelectorImplBase::DynInitDlgMenuPaneL |
|
493 // ---------------------------------------------------- |
|
494 // |
|
495 void CLmkDlgSelectorImplBase::DynInitDlgMenuPaneL( |
|
496 TInt aResourceId, |
|
497 CEikMenuPane* aMenuPane ) |
|
498 { |
|
499 if ( iSelectorImplParent ) |
|
500 { |
|
501 iSelectorImplParent->DynInitDlgMenuPaneL( aResourceId, aMenuPane ); |
|
502 } |
|
503 } |
|
504 |
|
505 // ---------------------------------------------------- |
|
506 // CLmkDlgSelectorImplBase::HandleListProviderEvent |
|
507 // ---------------------------------------------------- |
|
508 // |
|
509 void CLmkDlgSelectorImplBase::HandleListProviderEvent( |
|
510 TLmkListProviderEventType aEvent ) |
|
511 { |
|
512 iDlgSelectorImplBaseLatestListEvent = aEvent; |
|
513 |
|
514 if ( ( iDlgSelectorImplBaseLatestListEvent == ELmkEventListReady || |
|
515 iDlgSelectorImplBaseLatestListEvent == ELmkEventItemAdditionComplete ) && |
|
516 iInputSelectedItems ) |
|
517 { // First attempt to set pre-selected items wasn't successful, |
|
518 // but now list provider is ready so let's try again: |
|
519 TRAPD( ignore, RetrySetPreSelectedL() ); |
|
520 if (ignore != KErrNone) |
|
521 { |
|
522 ignore = KErrNone; |
|
523 } |
|
524 iInputSelectedItems = NULL; |
|
525 } |
|
526 if (iDialog) |
|
527 { |
|
528 TRAP_IGNORE(iDialog->UpdateMskL()); |
|
529 } |
|
530 if ( iSelectorImplParent ) |
|
531 { |
|
532 iSelectorImplParent->HandleListProviderEvent( aEvent ); |
|
533 } |
|
534 // It's better do this as last step as base class restores memento |
|
535 // which should be done AFTER event has been handled otherwise: |
|
536 if(iDialog && iDialog->ListBox()->View() && iDialog->ListBox()->Model()) |
|
537 { |
|
538 CLmkSelectorImplBase::HandleListProviderEvent( aEvent ); |
|
539 } |
|
540 if( iDialog ) |
|
541 { |
|
542 TInt index = iDialog->ListBox()->CurrentItemIndex(); |
|
543 TInt count = iDialog->ListBox()->Model()->NumberOfItems(); |
|
544 |
|
545 if ( index == KErrNotFound && count > 0) |
|
546 { |
|
547 iDialog->ListBox()->SetCurrentItemIndex(count - 1); |
|
548 } |
|
549 } |
|
550 if(iDialog && (iDialog->ListBox()->Model()->NumberOfItems() == 0)) |
|
551 { |
|
552 if(iMemento) |
|
553 { |
|
554 CLmkLmItemListMemento* memento = |
|
555 static_cast<CLmkLmItemListMemento*>(iMemento); |
|
556 memento->UpdateModelAvailability(ETrue); |
|
557 } |
|
558 |
|
559 if(aEvent != ELmkEventFindListReady) |
|
560 { |
|
561 iDialog->ShowFindBox(EFalse); |
|
562 } |
|
563 iDialog->EnableLeftSoftKey(EFalse); |
|
564 } |
|
565 else if (iDialog && (iDialog->ListBox()->Model()->NumberOfItems() > 0)) |
|
566 { |
|
567 if(iMemento) |
|
568 { |
|
569 CLmkLmItemListMemento* memento = |
|
570 static_cast<CLmkLmItemListMemento*>(iMemento); |
|
571 memento->UpdateModelAvailability(ETrue); |
|
572 } |
|
573 // Enable the find box |
|
574 if(aEvent != ELmkEventFindListReady) |
|
575 { |
|
576 iDialog->ShowFindBox(ETrue); |
|
577 } |
|
578 iDialog->EnableLeftSoftKey(ETrue); |
|
579 } |
|
580 if(iDialog) |
|
581 { |
|
582 iDialog->ListBox()->DrawDeferred(); |
|
583 } |
|
584 } |
|
585 |
|
586 // ---------------------------------------------------- |
|
587 // CLmkDlgSelectorImplBase::HandleListProviderError |
|
588 // ---------------------------------------------------- |
|
589 // |
|
590 void CLmkDlgSelectorImplBase::HandleListProviderError( TInt aError ) |
|
591 { |
|
592 if ( iSelectorImplParent ) |
|
593 { |
|
594 iSelectorImplParent->HandleListProviderError( aError ); |
|
595 } |
|
596 } |
|
597 |
|
598 // ---------------------------------------------------- |
|
599 // CLmkDlgSelectorImplBase::HandleNavigationEventL |
|
600 // ---------------------------------------------------- |
|
601 // |
|
602 TKeyResponse CLmkDlgSelectorImplBase::HandleNavigationEventL( |
|
603 const TKeyEvent& aKeyEvent ) |
|
604 { |
|
605 if ( iSelectorImplParent ) |
|
606 { |
|
607 return iSelectorImplParent->HandleNavigationEventL( aKeyEvent ); |
|
608 } |
|
609 else |
|
610 { |
|
611 return EKeyWasNotConsumed; |
|
612 } |
|
613 } |
|
614 |
|
615 // ---------------------------------------------------- |
|
616 // CLmkDlgSelectorImplBase::HandleLaunchingEventL |
|
617 // ---------------------------------------------------- |
|
618 // |
|
619 void CLmkDlgSelectorImplBase::HandleLaunchingEventL() |
|
620 { |
|
621 if ( iSelectorImplParent ) |
|
622 { |
|
623 iSelectorImplParent->HandleLaunchingEventL(); |
|
624 } |
|
625 // listbox always exists when HandleLaunchingEventL() is called: |
|
626 __ASSERT_DEBUG( iDialog && iDialog->ListBox(), |
|
627 Panic( KLmkPanicNullListBox ) ); |
|
628 Restore( *( iDialog->ListBox() ), *iListProvider, iDialog->HasFindBox() ); |
|
629 } |
|
630 |
|
631 // ---------------------------------------------------- |
|
632 // CLmkDlgSelectorImplBase::HandleClosingEventL |
|
633 // ---------------------------------------------------- |
|
634 // |
|
635 void CLmkDlgSelectorImplBase::HandleClosingEventL() |
|
636 { |
|
637 if ( iSelectorImplParent ) |
|
638 { |
|
639 iSelectorImplParent->HandleClosingEventL(); |
|
640 } |
|
641 // listbox always exists when HandleClosingEventL() is called: |
|
642 __ASSERT_DEBUG( iDialog->ListBox(), Panic( KLmkPanicNullListBox ) ); |
|
643 Store( *( iDialog->ListBox() ), *iListProvider, iDialog->HasFindBox() ); |
|
644 } |
|
645 |
|
646 // ---------------------------------------------------- |
|
647 // CLmkDlgSelectorImplBase::RetrySetPreSelectedL |
|
648 // ---------------------------------------------------- |
|
649 // |
|
650 void CLmkDlgSelectorImplBase::RetrySetPreSelectedL() |
|
651 { |
|
652 const CLmkLmItemListProvider& provider = |
|
653 static_cast<const CLmkLmItemListProvider&>( ListProvider() ); |
|
654 CArrayFix<TInt>* selectedIndexes = |
|
655 provider.SelectedIndexesL( *iInputSelectedItems ); |
|
656 CleanupStack::PushL( selectedIndexes ); |
|
657 __ASSERT_DEBUG( iDialog && iDialog->ListBox(), |
|
658 Panic( KLmkPanicNullListBox ) ); |
|
659 iDialog->ListBox()->SetSelectionIndexesL( selectedIndexes ); |
|
660 CAknFilteredTextListBoxModel* model = |
|
661 static_cast<CAknFilteredTextListBoxModel*>( iDialog->ListBox()->Model() ); |
|
662 model->Filter()->UpdateSelectionIndexesL(); |
|
663 model->Filter()->HandleItemArrayChangeL(); |
|
664 // Listbox made a copy of selection indexes |
|
665 CleanupStack::PopAndDestroy( selectedIndexes ); |
|
666 } |
|
667 |
|
668 // ---------------------------------------------------- |
|
669 // CLmkDlgSelectorImplBase::SetEmptyDlgLabel |
|
670 // ---------------------------------------------------- |
|
671 // |
|
672 void CLmkDlgSelectorImplBase::SetEmptyDlgLabel(TInt aLabelPrimRes, TInt aLabelSecRes) |
|
673 { |
|
674 iCurrentLabelPrimResource = aLabelPrimRes; |
|
675 iCurrentLabelSecResource = aLabelSecRes; |
|
676 } |
|
677 |
|
678 // --------------------------------------------------------- |
|
679 // CLmkDlgSelectorImplBase::CheckHideCoordinateL() |
|
680 // --------------------------------------------------------- |
|
681 // |
|
682 void CLmkDlgSelectorImplBase::CheckHideCoordinateL() |
|
683 { |
|
684 TInt helpSettingValue = ELocHelpNotHidden; |
|
685 CRepository* repository = CRepository::NewL( TUid::Uid( KCRUidLocLocalVariation) ); |
|
686 CleanupStack::PushL( repository ); |
|
687 User::LeaveIfError( repository->Get( KLocHideHelp, |
|
688 helpSettingValue )); |
|
689 CleanupStack::PopAndDestroy( repository ); |
|
690 |
|
691 if( ELocHelpHidden == helpSettingValue ) |
|
692 iIsHideHelp = ETrue; |
|
693 else |
|
694 iIsHideHelp = EFalse; |
|
695 |
|
696 } |
|
697 |
|
698 // --------------------------------------------------------- |
|
699 // CLmkDlgSelectorImplBase::SetDialogTitleL |
|
700 // --------------------------------------------------------- |
|
701 // |
|
702 void CLmkDlgSelectorImplBase::SetDialogTitleL(const TDesC& aTitle) |
|
703 { |
|
704 delete iTitle; |
|
705 iTitle = NULL; |
|
706 iTitle = aTitle.AllocL(); |
|
707 } |
|
708 // End of File |
|