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