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: Provides Categorized Landmarks view class methods. |
|
15 * |
|
16 */ |
|
17 |
|
18 // INCLUDE FILES |
|
19 #include <EPos_CPosLandmarkDatabase.h> |
|
20 #include "CLmkDocument.h" |
|
21 #include <eiktxlbx.h> |
|
22 #include <eikmenup.h> |
|
23 #include <aknViewAppUi.h> |
|
24 #include <featmgr.h> |
|
25 #include <sendnorm.rsg> // R_SENDUI_MENU |
|
26 #include <landmarks.rsg> |
|
27 #include <EPos_CPosLandmark.h> |
|
28 #include <lbsposition.h> |
|
29 #include "CLmkCategoryContentsView.h" |
|
30 #include "landmarks.hrh" |
|
31 #include "CLmkCategoryContentsContainer.h" |
|
32 #include "CLmkAppSelectorImplBase.h" |
|
33 #include "MLmkListMemento.h" |
|
34 #include "CLmkAppUi.h" |
|
35 #include "CLmkSender.h" |
|
36 #include "CLmkLmItemListMemento.h" |
|
37 #include "CLmkByCategoryView.h" |
|
38 #include "clmkmapnavigationinterface.h" |
|
39 #include <StringLoader.h> |
|
40 #include "Debug.h" |
|
41 |
|
42 // ================= LOCAL FUNCTIONS ======================= |
|
43 static void CleanupArray(TAny* aArray) |
|
44 { |
|
45 (static_cast<RPointerArray<CPosLandmark>*> (aArray))->ResetAndDestroy(); |
|
46 } |
|
47 |
|
48 // ================= MEMBER FUNCTIONS ======================= |
|
49 // ---------------------------------------------------------------------------- |
|
50 // CLmkCategoryContentsView::NewLC |
|
51 // Two-phased constructor. |
|
52 // ---------------------------------------------------------------------------- |
|
53 // |
|
54 CLmkCategoryContentsView* CLmkCategoryContentsView::NewLC( |
|
55 MLmkKeyProcessor& aKeyProcessor, CLmkSender& aLmkSender) |
|
56 { |
|
57 CLmkCategoryContentsView* self = new (ELeave) CLmkCategoryContentsView( |
|
58 aKeyProcessor, aLmkSender); |
|
59 CleanupStack::PushL(self); |
|
60 self->ConstructL(); |
|
61 return self; |
|
62 } |
|
63 |
|
64 // ---------------------------------------------------------------------------- |
|
65 // CLmkCategoryContentsView::CLmkCategoryContentsView |
|
66 // C++ default constructor can NOT contain any code, that |
|
67 // might leave. |
|
68 // ---------------------------------------------------------------------------- |
|
69 // |
|
70 CLmkCategoryContentsView::CLmkCategoryContentsView( |
|
71 MLmkKeyProcessor& aKeyProcessor, CLmkSender& aLmkSender) : |
|
72 CLmkBaseView(aKeyProcessor), iLmkSender(aLmkSender) |
|
73 { |
|
74 } |
|
75 |
|
76 // ---------------------------------------------------------------------------- |
|
77 // CLmkCategoryContentsView::ConstructL |
|
78 // Symbian 2nd phase constructor can leave. |
|
79 // ---------------------------------------------------------------------------- |
|
80 // |
|
81 void CLmkCategoryContentsView::ConstructL() |
|
82 { |
|
83 BaseConstructL(R_LMK_CATEGORY_CONTENTS_VIEW); |
|
84 CLmkAppUi* lmkAppUi = static_cast<CLmkAppUi*> (AppUi()); |
|
85 CPosLandmarkDatabase& db = lmkAppUi->Document().LmDbL(); |
|
86 iMapNavInterface = CLmkMapNavigationInterface::NewL(db); |
|
87 AttachAIWMenuInterestL(); |
|
88 } |
|
89 |
|
90 // ---------------------------------------------------------------------------- |
|
91 // CLmkCategoryContentsView::~CLmkCategoryContentsView |
|
92 // ---------------------------------------------------------------------------- |
|
93 // |
|
94 CLmkCategoryContentsView::~CLmkCategoryContentsView() |
|
95 { |
|
96 if (iContainer) |
|
97 { |
|
98 AppUi()->RemoveFromViewStack(*this, iContainer); |
|
99 } |
|
100 |
|
101 delete iContainer; |
|
102 delete iListMemento; |
|
103 } |
|
104 |
|
105 // ---------------------------------------------------------------------------- |
|
106 // CLmkCategoryContentsView::AttachAIWMenuInterestL |
|
107 // ---------------------------------------------------------------------------- |
|
108 // |
|
109 void CLmkCategoryContentsView::AttachAIWMenuInterestL() |
|
110 { |
|
111 iMapNavInterface->AttachAIWInterestL(R_LMK_NEW_LANDMARK_SUBMENU, |
|
112 R_LMK_AIW_INTEREST_SELECTFROMMAP); |
|
113 iMapNavInterface->AttachAIWInterestL(R_LMK_BYLM_MENU1, |
|
114 R_LMK_AIW_INTEREST_SHOWONMAP); |
|
115 iMapNavInterface->AttachAIWInterestL(R_LMK_BYLM_MENU1, |
|
116 R_LMK_AIW_INTEREST_NAVIGATETO); |
|
117 } |
|
118 |
|
119 // ---------------------------------------------------------------------------- |
|
120 // CLmkCategoryContentsView::ProcessKeyEventL |
|
121 // ---------------------------------------------------------------------------- |
|
122 // |
|
123 TBool CLmkCategoryContentsView::ProcessKeyEventL(const TKeyEvent& aKeyEvent, |
|
124 TEventCode aType) |
|
125 { |
|
126 return CLmkBaseView::ProcessKeyEventL(aKeyEvent, aType); |
|
127 } |
|
128 |
|
129 // ---------------------------------------------------------------------------- |
|
130 // TUid CLmkCategoryContentsView::Id |
|
131 // ---------------------------------------------------------------------------- |
|
132 // |
|
133 TUid CLmkCategoryContentsView::Id() const |
|
134 { |
|
135 return TUid::Uid(ELmkCategoryContentsView); |
|
136 } |
|
137 |
|
138 // ---------------------------------------------------------------------------- |
|
139 // CLmkCategoryContentsView::HandleCommandL |
|
140 // ---------------------------------------------------------------------------- |
|
141 // |
|
142 void CLmkCategoryContentsView::HandleCommandL(TInt aCommand) |
|
143 { |
|
144 DEBUG1( CLmkCategoryContentsView::HandleCommandL entered with aCommand=%d, aCommand); |
|
145 |
|
146 AknSelectionService::HandleMarkableListProcessCommandL(aCommand, |
|
147 &(iContainer->ListBox())); |
|
148 CLmkAppSelectorImplBase& selector = iContainer->SelectorImpl(); |
|
149 //first give a chance to M&N framework. |
|
150 TInt aiwCmd = iMapNavInterface->GetServiceCmdByMenuCmd(aCommand); |
|
151 if (KAiwCmdNone == aiwCmd) |
|
152 { |
|
153 aiwCmd = selector.ServiceCmdByMenuCmd(aCommand); |
|
154 } |
|
155 //Handle AIW command |
|
156 if (HandleAIWserviceCommandsL(aiwCmd, aCommand)) |
|
157 { |
|
158 iContainer->ListBox().ClearSelection(); |
|
159 EnableMskLabelL(ETrue); |
|
160 return; |
|
161 } |
|
162 |
|
163 switch (aCommand) |
|
164 { |
|
165 case ELmkCmdNewLmCurrentLocation: |
|
166 case ELmkCmdNewLmEmpty: |
|
167 case ELmkCmdEditLm: |
|
168 case ELmkCmdDeleteLm: |
|
169 case ELmkCmdAddToCat: |
|
170 case ELmkCmdChangeIcon: |
|
171 case ELmkCmdSendVia1: // These commands are used by SendUi |
|
172 case ELmkCmdSendVia2: |
|
173 case ELmkCmdSendVia3: |
|
174 case ELmkCmdSendVia4: |
|
175 case ELmkCmdSendVia5: |
|
176 case ELmkCmdSendVia6: |
|
177 case ELmkCmdSendVia7: |
|
178 case ELmkCmdSendVia8: |
|
179 case ELmkCmdSendVia9: |
|
180 case ELmkCmdSendVia10: |
|
181 case ELmkCmdSend: |
|
182 case ELmkCmdOpenLm: |
|
183 case EAknCmdMark: |
|
184 case EAknCmdUnmark: |
|
185 case EAknMarkAll: |
|
186 case EAknUnmarkAll: |
|
187 case ELmkCmdLaunchPositionSettings: |
|
188 { |
|
189 TInt markedCount( |
|
190 iContainer->SelectorImpl().ListMarkedItemCountL()); |
|
191 DEBUG1( CLmkCategoryContentsView::HandleCommandL markedcount=%d,markedCount ); |
|
192 |
|
193 if (markedCount > 0 && aCommand == ELmkCmdOpenLm |
|
194 && !iContainer->IsEditorOpened()) |
|
195 { |
|
196 DEBUG( CLmkCategoryContentsView::HandleCommandL ELmkCmdOpenLm showing c menu); |
|
197 if (MenuBar()) |
|
198 { |
|
199 MenuBar()->SetContextMenuTitleResourceId(R_LMK_OK_MENUBAR); |
|
200 MenuBar()->TryDisplayContextMenuBarL(); |
|
201 } |
|
202 } |
|
203 else if (aCommand == ELmkCmdOpenLm |
|
204 && !iContainer->IsEditorOpened()) |
|
205 { |
|
206 DEBUG( CLmkCategoryContentsView::HandleCommandL ELmkCmdOpenLm ); |
|
207 iContainer->SelectorImpl().ProcessCommandL(aCommand); |
|
208 iContainer->SetEditorOpenedBool(ETrue); |
|
209 } |
|
210 else |
|
211 { |
|
212 DEBUG( CLmkCategoryContentsView::HandleCommandL ProcessCommandL aCommand ); |
|
213 iContainer->SelectorImpl().ProcessCommandL(aCommand); |
|
214 } |
|
215 |
|
216 if (static_cast<CTextListBoxModel*> (iContainer->ListBox().Model())->ItemTextArray()->MdcaCount() |
|
217 == 0) |
|
218 { |
|
219 DEBUG( CLmkCategoryContentsView::HandleCommandL listbx count = 0 ); |
|
220 AppUi()->ActivateLocalViewL(TUid::Uid(ELmkByCategoryView)); |
|
221 } |
|
222 break; |
|
223 } |
|
224 case EAknSoftkeyBack: |
|
225 { |
|
226 DEBUG( CLmkCategoryContentsView::HandleCommandL Back Button ); |
|
227 AppUi()->ActivateLocalViewL(TUid::Uid(ELmkByCategoryView)); |
|
228 break; |
|
229 } |
|
230 |
|
231 case ERemoveFromCat: |
|
232 { |
|
233 DEBUG( CLmkCategoryContentsView::HandleCommandL ERemoveFromCat ); |
|
234 iContainer->RemoveFromThisCategoryL(); |
|
235 if (static_cast<CTextListBoxModel*> (iContainer->ListBox().Model())->ItemTextArray()->MdcaCount() |
|
236 == 0) |
|
237 { |
|
238 AppUi()->ActivateLocalViewL(TUid::Uid(ELmkByCategoryView)); |
|
239 } |
|
240 break; |
|
241 } |
|
242 default: |
|
243 { |
|
244 DEBUG( CLmkCategoryContentsView::HandleCommandL default ); |
|
245 (static_cast<CLmkAppUi*> (AppUi()))->HandleCommandL(aCommand); |
|
246 break; |
|
247 } |
|
248 } |
|
249 DEBUG( CLmkCategoryContentsView::HandleCommandL End ); |
|
250 } |
|
251 |
|
252 // --------------------------------------------------------- |
|
253 // CLmkCategoryContentsView::DynInitMenuPaneL |
|
254 // --------------------------------------------------------- |
|
255 // |
|
256 void CLmkCategoryContentsView::DynInitMenuPaneL(TInt aResourceId, |
|
257 CEikMenuPane* aMenuPane) |
|
258 { |
|
259 DEBUG( CLmkCategoryContentsView::DynInitMenuPaneL entered ); |
|
260 iMapNavInterface->HandleMenuOperationL(aResourceId, aMenuPane, |
|
261 ELmkCmdMnNav); |
|
262 AknSelectionService::HandleMarkableListDynInitMenuPane(aResourceId, |
|
263 aMenuPane, &(iContainer->ListBox())); |
|
264 |
|
265 CLmkAppSelectorImplBase& selector = iContainer->SelectorImpl(); |
|
266 TInt markedCount(selector.ListMarkedItemCountL()); |
|
267 TInt visibleCount(selector.ListVisibleItemCount()); |
|
268 DEBUG1( CLmkCategoryContentsView::DynInitMenuPaneL markedCount=%d,markedCount ); |
|
269 DEBUG1( CLmkCategoryContentsView::DynInitMenuPaneL visibleCount=%d,visibleCount ); |
|
270 |
|
271 switch (aResourceId) |
|
272 { |
|
273 case R_LMK_BYLM_MENU1: |
|
274 { |
|
275 if (iContainer->IsUncategorizedCategory() || visibleCount == 0) |
|
276 { |
|
277 aMenuPane->SetItemDimmed(ERemoveFromCat, ETrue); |
|
278 } |
|
279 aMenuPane->SetItemDimmed(ELmkCmdSendDummy, ETrue); |
|
280 |
|
281 // Send menu is handled by the sender: |
|
282 if ( FeatureManager::FeatureSupported( KFeatureIdLandmarksConverter ) ) |
|
283 { |
|
284 iLmkSender.DisplaySendMenuL( *aMenuPane, visibleCount ); |
|
285 if( visibleCount > 0 ) |
|
286 { |
|
287 TInt pos( 0 ); |
|
288 aMenuPane->ItemAndPos( ELmkCmdSend, pos ); |
|
289 if( pos > 0 ) |
|
290 { |
|
291 aMenuPane->SetItemDimmed(ELmkCmdSend,EFalse ); |
|
292 aMenuPane->SetItemSpecific(ELmkCmdSend,ETrue); |
|
293 } |
|
294 } |
|
295 } |
|
296 |
|
297 /* |
|
298 If multiple landmarks are selected then we have to dim |
|
299 Navigate To option. |
|
300 if only one landmark is in focus then we have to dim |
|
301 Navigate To & Show On Map options if the particular landmark |
|
302 does not either have address or coordinates. |
|
303 */ |
|
304 |
|
305 TBool isLandmarkDataEmpty = EFalse; |
|
306 if (visibleCount == 0) |
|
307 { |
|
308 isLandmarkDataEmpty = ETrue; |
|
309 } |
|
310 else |
|
311 { |
|
312 if (markedCount == 1 || markedCount == 0) |
|
313 { |
|
314 // Get the selected landmark and check if it is empty |
|
315 RPointerArray<CPosLandmark> lmkArray; |
|
316 TInt retVal = iContainer->GetSelectedLandmarksL(lmkArray); |
|
317 if (retVal != KErrNotFound) |
|
318 { |
|
319 CleanupStack::PushL(TCleanupItem(CleanupArray, |
|
320 &lmkArray)); |
|
321 isLandmarkDataEmpty |
|
322 = iContainer->IsLandmarkDataEmptyL( |
|
323 lmkArray[0]); |
|
324 CleanupStack::PopAndDestroy();// lmkArray |
|
325 } |
|
326 } |
|
327 } |
|
328 |
|
329 TInt showOnMapCmd = -1; |
|
330 TInt navigateToCmd = -1; |
|
331 |
|
332 TInt cnt = aMenuPane->NumberOfItemsInPane(); |
|
333 |
|
334 for (TInt i = 0; i < cnt; ++i) |
|
335 { |
|
336 CEikMenuPaneItem::SData& itemData = |
|
337 aMenuPane->ItemDataByIndexL(i); |
|
338 |
|
339 if (iMapNavInterface->GetServiceCmdByMenuCmd( |
|
340 itemData.iCommandId) == KAiwCmdMnShowMap) |
|
341 { |
|
342 showOnMapCmd = itemData.iCommandId; |
|
343 } |
|
344 if (iMapNavInterface->GetServiceCmdByMenuCmd( |
|
345 itemData.iCommandId) == KAiwCmdMnNavigateTo) |
|
346 { |
|
347 navigateToCmd = itemData.iCommandId; |
|
348 } |
|
349 } |
|
350 if (showOnMapCmd < 0 && navigateToCmd < 0) |
|
351 { |
|
352 break; |
|
353 } |
|
354 // dimming navigate to item |
|
355 aMenuPane->SetItemDimmed(navigateToCmd, ETrue); |
|
356 |
|
357 // handling of showonmap item |
|
358 if (isLandmarkDataEmpty || markedCount > 1) |
|
359 { |
|
360 aMenuPane->SetItemDimmed(showOnMapCmd, ETrue); |
|
361 } |
|
362 else |
|
363 { |
|
364 aMenuPane->SetItemDimmed(showOnMapCmd, EFalse); |
|
365 aMenuPane->SetItemSpecific(showOnMapCmd, ETrue); |
|
366 } |
|
367 break; |
|
368 } |
|
369 case R_LMK_OK_MENU: |
|
370 { |
|
371 DEBUG( CLmkCategoryContentsView::DynInitMenuPaneL R_LMK_OK_MENU ); |
|
372 // Let send ui add the send menu if MTMs are available: |
|
373 if (FeatureManager::FeatureSupported(KFeatureIdLandmarksConverter)) |
|
374 { |
|
375 aMenuPane->SetItemDimmed(ELmkCmdSendDummy, EFalse); |
|
376 iLmkSender.DisplaySendMenuL(*aMenuPane, visibleCount); |
|
377 } |
|
378 else |
|
379 { |
|
380 aMenuPane->SetItemDimmed(ELmkCmdSendDummy, ETrue); |
|
381 } |
|
382 |
|
383 if (visibleCount == 0) |
|
384 { |
|
385 aMenuPane->SetItemDimmed(ELmkCmdAddToCat, ETrue); |
|
386 aMenuPane->SetItemDimmed(ELmkCmdDeleteLm, ETrue); |
|
387 aMenuPane->SetItemDimmed(ELmkCmdNewLm, EFalse); |
|
388 } |
|
389 break; |
|
390 } |
|
391 case R_LMK_MAIN_MENU: |
|
392 { |
|
393 CLmkBaseView::HandleHelpFeature(aMenuPane); |
|
394 break; |
|
395 } |
|
396 case R_SENDUI_MENU: // Dynamically created send ui menu |
|
397 { |
|
398 // Send menu is handled by the sender: |
|
399 if (FeatureManager::FeatureSupported(KFeatureIdLandmarksConverter)) |
|
400 { |
|
401 iLmkSender.DisplaySendCascadeMenuL(*aMenuPane); |
|
402 } |
|
403 break; |
|
404 } |
|
405 case R_LMK_NEW_LANDMARK_SUBMENU: |
|
406 { |
|
407 if (FeatureManager::FeatureSupported( |
|
408 KFeatureIdLocationFrameworkCore)) |
|
409 { |
|
410 aMenuPane->SetItemDimmed(ELmkCmdNewLmCurrentLocation, EFalse); |
|
411 } |
|
412 else |
|
413 { |
|
414 aMenuPane->SetItemDimmed(ELmkCmdNewLmCurrentLocation, ETrue); |
|
415 } |
|
416 |
|
417 if (iIsHideCoordinate) |
|
418 { |
|
419 aMenuPane->SetItemDimmed(ELmkCmdNewLmEmpty, ETrue); |
|
420 } |
|
421 else |
|
422 { |
|
423 aMenuPane->SetItemDimmed(ELmkCmdNewLmEmpty, EFalse); |
|
424 } |
|
425 break; |
|
426 } |
|
427 default: |
|
428 { |
|
429 break; |
|
430 } |
|
431 } |
|
432 DEBUG( CLmkCategoryContentsView::DynInitMenuPaneL end ); |
|
433 } |
|
434 |
|
435 // ---------------------------------------------------------------------------- |
|
436 // CLmkCategoryContentsView::DoActivateL |
|
437 // ---------------------------------------------------------------------------- |
|
438 // |
|
439 void CLmkCategoryContentsView::DoActivateL(const TVwsViewId& /*aPrevViewId*/, |
|
440 TUid /*aCustomMessageId*/, const TDesC8& /*aCustomMessage*/) |
|
441 { |
|
442 DEBUG( CLmkCategoryContentsView::DoActivateL entered ); |
|
443 if (!iContainer) |
|
444 { |
|
445 // FOr Full landscape support |
|
446 TRAPD( err, iContainer = CLmkCategoryContentsContainer::NewL( |
|
447 *this, this, ClientRect(), *this ) ); |
|
448 if (err != KErrNone) |
|
449 { // Cagegory deleted, go back to "by category" view |
|
450 AppUi()->ActivateLocalViewL(TUid::Uid(ELmkByCategoryView)); |
|
451 return; |
|
452 } |
|
453 |
|
454 CLmkAppSelectorImplBase& selector = iContainer->SelectorImpl(); |
|
455 AppUi()->AddToStackL(*this, iContainer); |
|
456 |
|
457 #ifdef RD_SCALABLE_UI_V2 |
|
458 //for touch event |
|
459 iContainer->SetListBoxObserver(this); |
|
460 #endif//RD_SCALABLE_UI_V2 |
|
461 if (!iListMemento) |
|
462 { // Memento not created yet, create it now: |
|
463 iListMemento = selector.MementoL(); |
|
464 } |
|
465 selector.SetMemento(*iListMemento); |
|
466 selector.RestoreMemento(); |
|
467 EnableMskMenuL(EFalse); |
|
468 EnableMskLabelL(EFalse); |
|
469 } |
|
470 DEBUG( CLmkCategoryContentsView::DoActivateL End ); |
|
471 } |
|
472 |
|
473 // ---------------------------------------------------------------------------- |
|
474 // CLmkCategoryContentsView::DoDeactivate |
|
475 // ---------------------------------------------------------------------------- |
|
476 // |
|
477 void CLmkCategoryContentsView::DoDeactivate() |
|
478 { |
|
479 if (iContainer) |
|
480 { |
|
481 iContainer->SelectorImpl().StoreMemento(); |
|
482 AppUi()->RemoveFromViewStack(*this, iContainer); |
|
483 } |
|
484 TRAP_IGNORE(EnableMskMenuL(EFalse)); |
|
485 TRAP_IGNORE(EnableMskLabelL(EFalse)); |
|
486 delete iContainer; |
|
487 iContainer = NULL; |
|
488 } |
|
489 |
|
490 // ---------------------------------------------------------------------------- |
|
491 // CLmkCategoryContentsView::Update() |
|
492 // ---------------------------------------------------------------------------- |
|
493 // |
|
494 void CLmkCategoryContentsView::Update() |
|
495 { |
|
496 iContainer->SetRect(ClientRect()); |
|
497 } |
|
498 |
|
499 // ---------------------------------------------------------------------------- |
|
500 // CLmkCategoryContentsView::IsContainerPtrValid() |
|
501 // ---------------------------------------------------------------------------- |
|
502 // |
|
503 TBool CLmkCategoryContentsView::IsContainerPtrValid() |
|
504 { |
|
505 TBool lResult = ETrue; |
|
506 if (!iContainer) |
|
507 { |
|
508 // FOr Full landscape support |
|
509 TRAPD( err, iContainer = CLmkCategoryContentsContainer::NewL( |
|
510 *this, this, ClientRect(), *this ) ); |
|
511 if (err != KErrNone) |
|
512 { // Cagegory deleted, go back to "by category" view |
|
513 lResult = EFalse; |
|
514 } |
|
515 else |
|
516 { |
|
517 lResult = ETrue; |
|
518 delete iContainer; |
|
519 iContainer = NULL; |
|
520 } |
|
521 } |
|
522 return lResult; |
|
523 } |
|
524 |
|
525 // --------------------------------------------------------- |
|
526 // CLmkCategoryContentsView::EnableMskMenuL() |
|
527 // --------------------------------------------------------- |
|
528 // |
|
529 void CLmkCategoryContentsView::EnableMskMenuL(TBool aEnable) |
|
530 { |
|
531 CEikButtonGroupContainer* cbaGrp = Cba(); |
|
532 if (cbaGrp) |
|
533 { |
|
534 if (aEnable) |
|
535 { |
|
536 cbaGrp->RemoveCommandFromStack(KMskCommandPos, ELmkCmdOpenLm); |
|
537 cbaGrp->SetCommandSetL(R_LMK_SOFTKEYS_OPTIONS_BACK_CONTEXTOPTIONS); |
|
538 cbaGrp->MakeCommandVisible(EAknSoftkeyContextOptions, ETrue); |
|
539 if (MenuBar()) |
|
540 MenuBar()->SetContextMenuTitleResourceId(R_LMK_OK_MENUBAR); |
|
541 } |
|
542 else |
|
543 { |
|
544 cbaGrp->MakeCommandVisible(EAknSoftkeyContextOptions, EFalse); |
|
545 } |
|
546 } |
|
547 } |
|
548 |
|
549 // --------------------------------------------------------- |
|
550 // CLmkCategoryContentsView::EnableMskLabelL() |
|
551 // --------------------------------------------------------- |
|
552 // |
|
553 void CLmkCategoryContentsView::EnableMskLabelL(TBool aEnable) |
|
554 { |
|
555 CEikButtonGroupContainer* cbaGrp = Cba(); |
|
556 if (cbaGrp) |
|
557 { |
|
558 if (aEnable) |
|
559 { |
|
560 HBufC* mskOpenTxt = NULL; |
|
561 mskOpenTxt = StringLoader::LoadLC(R_LMK_MSK_OPEN, iEikonEnv); |
|
562 cbaGrp->RemoveCommandFromStack(KMskCommandPos, |
|
563 EAknSoftkeyContextOptions); |
|
564 cbaGrp->AddCommandToStackL(KMskCommandPos, ELmkCmdOpenLm, |
|
565 mskOpenTxt->Des()); |
|
566 cbaGrp->MakeCommandVisible(ELmkCmdOpenLm, ETrue); |
|
567 CleanupStack::PopAndDestroy(mskOpenTxt); |
|
568 } |
|
569 else |
|
570 { |
|
571 cbaGrp->MakeCommandVisible(ELmkCmdOpenLm, EFalse); |
|
572 } |
|
573 } |
|
574 } |
|
575 |
|
576 #ifdef RD_SCALABLE_UI_V2 |
|
577 // --------------------------------------------------------- |
|
578 // CLmkCategoryContentsView::HandleListBoxEventL() |
|
579 // --------------------------------------------------------- |
|
580 // |
|
581 void CLmkCategoryContentsView::HandleListBoxEventL(CEikListBox* /*aListBox*/, |
|
582 TListBoxEvent aEventType) |
|
583 { |
|
584 TLmkMskDispItem dispItem = iContainer->ResolveMskDisplayItem(); |
|
585 |
|
586 switch (aEventType) |
|
587 { |
|
588 //case EEventItemDoubleClicked: |
|
589 case EEventItemSingleClicked: |
|
590 { |
|
591 if (dispItem == EContextMenu) |
|
592 { |
|
593 UpdateMskViewL(dispItem); |
|
594 CEikMenuBar |
|
595 * menubar = |
|
596 static_cast<CAknViewAppUi*> (iAvkonAppUi)->View( |
|
597 TUid::Uid(ELmkCategoryContentsView))->MenuBar(); |
|
598 if (menubar) |
|
599 { |
|
600 TRAPD( err, menubar->TryDisplayContextMenuBarL() ); |
|
601 User::LeaveIfError(err); |
|
602 } |
|
603 } |
|
604 else if (dispItem == ELabel) |
|
605 { |
|
606 UpdateMskViewL(dispItem); |
|
607 HandleCommandL(ELmkCmdOpenLm); |
|
608 } |
|
609 break; |
|
610 } |
|
611 |
|
612 //case EEventItemClicked: |
|
613 case EEventPanningStarted: |
|
614 case EEventPanningStopped: |
|
615 case EEventFlickStarted: |
|
616 case EEventFlickStopped: |
|
617 case EEventPenDownOnItem: |
|
618 case EEventItemDraggingActioned: |
|
619 { |
|
620 if (dispItem == EContextMenu) |
|
621 { |
|
622 UpdateMskViewL(dispItem); |
|
623 } |
|
624 else if (dispItem == ELabel) |
|
625 { |
|
626 UpdateMskViewL(dispItem); |
|
627 } |
|
628 break; |
|
629 } |
|
630 } |
|
631 } |
|
632 #endif//RD_SCALABLE_UI_V2 |
|
633 |
|
634 // --------------------------------------------------------- |
|
635 // CLmkCategoryContentsView::HandleAIWserviceCommandsL() |
|
636 // --------------------------------------------------------- |
|
637 // |
|
638 TBool CLmkCategoryContentsView::HandleAIWserviceCommandsL( |
|
639 TInt aServiceCommand, TInt aMenuCommand) |
|
640 { |
|
641 TBool result = ETrue; |
|
642 RPointerArray<CPosLandmark> lmkArray; |
|
643 switch (aServiceCommand) |
|
644 { |
|
645 case KAiwCmdMnNavigateTo: |
|
646 { |
|
647 if (iContainer->GetSelectedLandmarksL(lmkArray) == KErrNone) |
|
648 { |
|
649 CleanupStack::PushL(TCleanupItem(CleanupArray, &lmkArray)); |
|
650 iMapNavInterface->NavigateToLandmarkL(lmkArray[0], |
|
651 aMenuCommand); |
|
652 CleanupStack::PopAndDestroy(); // lmkArray |
|
653 } |
|
654 break; |
|
655 } |
|
656 case KAiwCmdMnShowMap: |
|
657 { |
|
658 if (iContainer->GetSelectedLandmarksL(lmkArray) == KErrNone) |
|
659 { |
|
660 CleanupStack::PushL(TCleanupItem(CleanupArray, &lmkArray)); |
|
661 iMapNavInterface->ShowLandmarksOnMapL(lmkArray, aMenuCommand, |
|
662 CLmkMapNavigationInterface::EByLmkView); |
|
663 CleanupStack::PopAndDestroy(); // lmkArray |
|
664 } |
|
665 break; |
|
666 } |
|
667 case KAiwCmdMnSelectFromMap: |
|
668 { |
|
669 // category view |
|
670 CLmkByCategoryView* categoryView = |
|
671 static_cast<CLmkByCategoryView*> (AppUi()->View( |
|
672 TUid::Uid(ELmkByCategoryView))); |
|
673 const CLmkLmItemListMemento |
|
674 & categoryMemento = |
|
675 static_cast<const CLmkLmItemListMemento&> (categoryView->BorrowMemento()); |
|
676 iMapNavInterface->SetObserver(&iContainer->SelectorImpl()); |
|
677 TPosLmItemId categoryId = categoryMemento.MemorizedItemId(); |
|
678 iMapNavInterface->GetLandmarkFromMapForCategoryL(aMenuCommand, |
|
679 categoryId); |
|
680 break; |
|
681 } |
|
682 default: |
|
683 { |
|
684 result = EFalse; |
|
685 break; |
|
686 } |
|
687 } |
|
688 return result; |
|
689 } |
|
690 |
|
691 // End of File |
|