landmarksui/uicontrols/src/CLmkDlgPackageSelectorImpl.cpp
branchRCL_3
changeset 17 1fc85118c3ae
parent 16 8173571d354e
child 18 870918037e16
equal deleted inserted replaced
16:8173571d354e 17:1fc85118c3ae
     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 Packaged Landmarks Selector View Implementation
       
    15  *
       
    16  */
       
    17 
       
    18 // SYSTEM INCLUDE FILES
       
    19 #include <featmgr.h>
       
    20 #include <AknDef.h>
       
    21 #include <StringLoader.h>
       
    22 #include <AknQueryDialog.h>
       
    23 #include <EPos_CPosLmCategoryManager.h>
       
    24 #include <AknsConstants.h>
       
    25 #include <AknIconArray.h>
       
    26 #include <eikmenup.h>
       
    27 #include <eikspane.h>
       
    28 #include <AknWaitDialog.h>
       
    29 #include <e32math.h>
       
    30 #include <hlplch.h>
       
    31 #include <csxhelp/lmmes.hlp.hrh>
       
    32 #include <avkon.mbg>
       
    33 #include <lmkui.rsg>
       
    34 
       
    35 // USER INCLUDE FILES
       
    36 #include "CLmkSaveLandmarkUtils.h"
       
    37 #include "CLmkDlgPackageSelectorImpl.h"
       
    38 #include "CLmkLmItemListProvider.h"
       
    39 #include "LmkListProviderFactory.h"
       
    40 #include "CLmkMultiSelectorDialog.h"
       
    41 #include "CLmkParser.h"
       
    42 #include "LmkConsts.h"
       
    43 #include "LmkUID.h"
       
    44 #include "CLmkSender.h"
       
    45 #include "CLmkPackageEditorImpl.h"
       
    46 #include "CLmkDlgSelectorImplBase.h"
       
    47 #include "CLmkUiUtils.h"
       
    48 #include "CLmkSelectorDialog.h"
       
    49 #include "CLmkSelectorLBModelBase.h"
       
    50 #include "CLmkSingleGraphicLBModel.h"
       
    51 #include "CLmkMultiSelectionLBModel.h"
       
    52 #include "CLmkLmItemListMemento.h"
       
    53 #include "CLmkSelectorIconMgr.h"
       
    54 #include "CLmkAOOperation.h"
       
    55 
       
    56 // ================= LOCAL FUNCTIONS =======================
       
    57 static void CleanupArray(TAny* aArray)
       
    58     {
       
    59     ( static_cast<RPointerArray<CPosLandmark>*>( aArray ) )->ResetAndDestroy();
       
    60     }
       
    61 // ============================ MEMBER FUNCTIONS ===============================
       
    62 
       
    63 // -----------------------------------------------------------------------------
       
    64 // CLmkDlgPackageSelectorImpl::CLmkDlgPackageSelectorImpl
       
    65 // C++ default constructor can NOT contain any code, that
       
    66 // might leave.
       
    67 // -----------------------------------------------------------------------------
       
    68 //
       
    69 CLmkDlgPackageSelectorImpl::CLmkDlgPackageSelectorImpl(
       
    70     CPosLandmarkDatabase& aDb,
       
    71     CLmkParser& aParser,
       
    72     CLmkSender& aSender )
       
    73     : CLmkDlgLmSelectorImpl( aDb ),
       
    74       iParser( aParser ),
       
    75       iSender( aSender ),
       
    76       iDb(aDb)
       
    77     {
       
    78     }
       
    79 
       
    80 // -----------------------------------------------------------------------------
       
    81 // CLmkDlgPackageSelectorImpl::ConstructL
       
    82 // Symbian 2nd phase constructor can leave.
       
    83 // -----------------------------------------------------------------------------
       
    84 //
       
    85 void CLmkDlgPackageSelectorImpl::ConstructL()
       
    86     {
       
    87     CLmkDlgLmSelectorImpl::ConstructL();
       
    88     iMapNavInterface = CLmkMapNavigationInterface::NewL( iDb );
       
    89     iMapNavInterface->AttachAIWInterestL(R_LMK_PKGVIEWER_MENU, R_LMK_PACKAGE_AIW_INTEREST_SHOWONMAP);
       
    90      for (TUint i(0); i < iParser.NumOfParsedLandmarks(); i++)
       
    91 	    {
       
    92 	    User::LeaveIfError( iTotalLms.Append(i) );
       
    93 	    }
       
    94 	iSaveLmUtils = CLmkSaveLandmarkUtils::NewL(iDb,iParser);
       
    95 	//setting of observer is needed for the search operation.
       
    96 	iSaveLmUtils->SetObserver(this);
       
    97     }
       
    98 
       
    99 // -----------------------------------------------------------------------------
       
   100 // CLmkDlgPackageSelectorImpl::NewL
       
   101 // Two-phased constructor.
       
   102 // -----------------------------------------------------------------------------
       
   103 //
       
   104 EXPORT_C CLmkDlgPackageSelectorImpl* CLmkDlgPackageSelectorImpl::NewL(
       
   105     CPosLandmarkDatabase& aDb,
       
   106     CLmkParser& aParser,
       
   107     CLmkSender& aSender )
       
   108     {
       
   109     CLmkDlgPackageSelectorImpl* self =
       
   110         new( ELeave ) CLmkDlgPackageSelectorImpl( aDb, aParser, aSender );
       
   111 
       
   112     CleanupStack::PushL( self );
       
   113     self->ConstructL();
       
   114     CleanupStack::Pop();
       
   115 
       
   116     return self;
       
   117     }
       
   118 
       
   119 // ----------------------------------------------------
       
   120 // CLmkDlgPackageSelectorImpl::~CLmkDlgPackageSelectorImpl
       
   121 // ----------------------------------------------------
       
   122 //
       
   123 CLmkDlgPackageSelectorImpl::~CLmkDlgPackageSelectorImpl()
       
   124     {
       
   125     if(iMapNavInterface)
       
   126     	{
       
   127     	iMapNavInterface->Release();
       
   128     	}
       
   129     iTotalLms.Close();
       
   130     delete iSaveLmUtils;
       
   131     }
       
   132 
       
   133 // ----------------------------------------------------
       
   134 // CLmkDlgPackageSelectorImpl::HelpContext
       
   135 // ----------------------------------------------------
       
   136 //
       
   137 TCoeHelpContext CLmkDlgPackageSelectorImpl::HelpContext() const
       
   138     {
       
   139     return TCoeHelpContext( TUid::Uid( KLmkMsgViewerAppUID3 ),
       
   140                             KLM_HLP_RECEIVED_PACKAGE );
       
   141     }
       
   142 
       
   143 // ----------------------------------------------------
       
   144 // CLmkDlgPackageSelectorImpl::SetupListProviderL
       
   145 // ----------------------------------------------------
       
   146 //
       
   147 void CLmkDlgPackageSelectorImpl::SetupListProviderL()
       
   148     {
       
   149     if ( !iListProvider )
       
   150         {
       
   151         iListProvider =
       
   152             LmkListProviderFactory::CreateProviderL( iParser );
       
   153         iListProvider->AddObserverL( *this );
       
   154         iListProvider->InitializeL();
       
   155         }
       
   156     }
       
   157 
       
   158 // ----------------------------------------------------
       
   159 // CLmkDlgPackageSelectorImpl::GetDlgResources
       
   160 // ----------------------------------------------------
       
   161 //
       
   162 
       
   163 
       
   164 void CLmkDlgPackageSelectorImpl::GetDlgResources(
       
   165     TBool /*aIsSingleSelector*/,
       
   166     TInt& aTitlePaneResource,
       
   167     TInt& aMenuBarResource,
       
   168     TInt& aDialogResource ) const
       
   169     {
       
   170     aTitlePaneResource = KZeroResourceId;
       
   171     aMenuBarResource = R_LMK_PKGVIEWER_MENUBAR;
       
   172     aDialogResource = R_LMK_PKGVIEWER_OPTIONS_BACK_DLG;
       
   173     }
       
   174 
       
   175 
       
   176 
       
   177 // ----------------------------------------------------
       
   178 // CLmkDlgPackageSelectorImpl::HandleLaunchingEventL
       
   179 // ----------------------------------------------------
       
   180 //
       
   181 void CLmkDlgPackageSelectorImpl::HandleLaunchingEventL()
       
   182     {
       
   183     // Call base class implementation:
       
   184     CLmkDlgSelectorImplBase::HandleLaunchingEventL();
       
   185 
       
   186     // cast is safe, package selector is always multiselector
       
   187     static_cast<CLmkMultiSelectorDialog*>( iDialog )->SetupSendMenu(
       
   188                     iSender, R_LMK_PKGVIEWER_MENU, R_LMK_SENDUI_MENU_TEXT );
       
   189     }
       
   190 
       
   191 // -----------------------------------------------------------------------------
       
   192 // CLmkDlgPackageSelectorImpl::HandleOperationL
       
   193 // -----------------------------------------------------------------------------
       
   194 //
       
   195 void CLmkDlgPackageSelectorImpl::HandleOperationL(
       
   196                                        TOperationTypes aType,
       
   197                                        TReal32 /*aProgress*/,
       
   198                                        TInt aStatus )
       
   199     {
       
   200     if(aType == ENewPkgCategory && aStatus != KPosLmOperationNotComplete)
       
   201     	{
       
   202     	if (iSaveLmUtils->CategoryAddConfirmationQueryL(iNoOfNewCategories,iNewCategoryFound) )
       
   203 			{
       
   204 			iType  = EImport;
       
   205 			iParser.StartImportingL( iTotalLms, ETrue );// Save landmarks with new categories
       
   206 			}
       
   207 		else
       
   208 			{
       
   209 			iType  = EImport;
       
   210 			iParser.StartImportingL( iTotalLms , EFalse); //Save landmarks without new categories
       
   211 			}
       
   212     	}
       
   213     else if( (aType == EImport ) && (aStatus != KPosLmOperationNotComplete && iWaitNote ))
       
   214     	{
       
   215     	iWaitNote->ProcessFinishedL();
       
   216         iWaitNote = NULL;
       
   217     	}
       
   218     }
       
   219 
       
   220 // ----------------------------------------------------
       
   221 // CLmkDlgPackageSelectorImpl::GetLandmarksInPackageL
       
   222 // ----------------------------------------------------
       
   223 //
       
   224 void CLmkDlgPackageSelectorImpl::GetLandmarksInPackageL(RPointerArray<CPosLandmark> &aLmkArray)
       
   225 	{
       
   226 	const CArrayFix<TInt>* indexes = iDialog->ListBox()->SelectionIndexes();
       
   227 	CPosLandmark* lmk;
       
   228 	if(indexes->Count() == 0)
       
   229 		{
       
   230 		lmk = iParser.LandmarkLC(iDialog->ListBox()->CurrentItemIndex());
       
   231 		aLmkArray.Append(lmk);
       
   232 		CleanupStack::Pop();//iParser.LandmarkLC
       
   233 		}
       
   234 	else
       
   235 		{
       
   236 		TInt count = indexes->Count();
       
   237 		for(TInt i = 0;i < count; ++i)
       
   238 			{
       
   239 			TInt index = indexes->At(i);
       
   240 			lmk = iParser.LandmarkLC(index);
       
   241 			aLmkArray.Append(lmk);
       
   242 			CleanupStack::Pop();//iParser.LandmarkLC
       
   243 			}
       
   244 		}
       
   245 	}
       
   246 
       
   247 // ----------------------------------------------------
       
   248 // CLmkDlgPackageSelectorImpl::ProcessCommandL
       
   249 // ----------------------------------------------------
       
   250 //
       
   251 void CLmkDlgPackageSelectorImpl::ProcessCommandL( TInt aCommandId )
       
   252     {
       
   253     TInt aiwCmd = iMapNavInterface->GetServiceCmdByMenuCmd(aCommandId);
       
   254 
       
   255     if(KAiwCmdNone != aiwCmd)
       
   256     	{
       
   257     	RPointerArray<CPosLandmark> lmkArray;
       
   258     	switch(aiwCmd)
       
   259     		{
       
   260     		case KAiwCmdMnShowMap:
       
   261     			{
       
   262     			GetLandmarksInPackageL(lmkArray);
       
   263     			CleanupStack::PushL( TCleanupItem( CleanupArray, &lmkArray ) );
       
   264     			iMapNavInterface->ShowLandmarksOnMapL(lmkArray, aCommandId,
       
   265     												CLmkMapNavigationInterface::EByLmkView);
       
   266     			CleanupStack::PopAndDestroy(); // lmkArray
       
   267     			break;
       
   268     			}
       
   269     		default:
       
   270     			{
       
   271     			break;
       
   272     			}
       
   273     		}
       
   274     	return;
       
   275     	}
       
   276     switch ( aCommandId )
       
   277         {
       
   278         case EAknCmdHelp:
       
   279             {
       
   280             HlpLauncher::LaunchHelpApplicationL( iEnv->WsSession(),
       
   281                                 iEnv->EikAppUi()->AppHelpContextL() );
       
   282             break;
       
   283             }
       
   284         case ELmkCmdSendVia1: // These commands are used by SendUi
       
   285         case ELmkCmdSendVia2:
       
   286         case ELmkCmdSendVia3:
       
   287         case ELmkCmdSendVia4:
       
   288         case ELmkCmdSendVia5:
       
   289         case ELmkCmdSendVia6:
       
   290         case ELmkCmdSendVia7:
       
   291         case ELmkCmdSendVia8:
       
   292         case ELmkCmdSendVia9:
       
   293         case ELmkCmdSendVia10:
       
   294         case ELmkCmdSend:
       
   295             {
       
   296             SendSelectedLandmarksCmdL(aCommandId);
       
   297             break;
       
   298             }
       
   299         case ELmkCmdOpenLm:
       
   300             {
       
   301             OpenLandmarkCmdL();
       
   302             break;
       
   303             }
       
   304         case ELmkCmdSaveSelectedLms:
       
   305             {
       
   306             SaveLandmarksCmdL();
       
   307             break;
       
   308             }
       
   309         case ELmkCmdSaveAllLms:
       
   310             {
       
   311             SaveAllLandmarksCmdL();
       
   312             break;
       
   313             }
       
   314         case ELmkCmdSendSelectedLms:
       
   315             {
       
   316             SendSelectedLandmarksCmdL(aCommandId);
       
   317             break;
       
   318             }
       
   319         case ELmkCmdSendAllLms:
       
   320             {
       
   321             SendAllLandmarksCmdL(aCommandId);
       
   322             break;
       
   323             }
       
   324         default:
       
   325             {
       
   326             // Command not handled here, forward it to the app ui.
       
   327             static_cast<MEikCommandObserver*>(iEnv->EikAppUi())->ProcessCommandL( aCommandId );
       
   328             break;
       
   329             }
       
   330         }
       
   331     }
       
   332 
       
   333 // ----------------------------------------------------
       
   334 // CLmkDlgPackageSelectorImpl::DynInitDlgMenuPaneL
       
   335 // ----------------------------------------------------
       
   336 //
       
   337 void CLmkDlgPackageSelectorImpl::DynInitDlgMenuPaneL(TInt aResourceId,
       
   338         CEikMenuPane* aMenuPane)
       
   339     {
       
   340     iMapNavInterface->HandleMenuOperationL(aResourceId, aMenuPane,
       
   341             ELmkCmdMnNav);
       
   342 
       
   343     TInt markedCount = ListMarkedItemCountL();
       
   344 
       
   345     switch (aResourceId)
       
   346         {
       
   347         case R_LMK_PKGVIEWER_MENU:
       
   348             {
       
   349             if (FeatureManager::FeatureSupported(KFeatureIdLandmarksConverter))
       
   350                 {
       
   351                 aMenuPane->SetItemDimmed(ELmkCmdSendDummy, EFalse);
       
   352                 }
       
   353             else
       
   354                 {
       
   355                 aMenuPane->SetItemDimmed(ELmkCmdSendDummy, ETrue);
       
   356                 }
       
   357 
       
   358             if (FeatureManager::FeatureSupported(KFeatureIdHelp)
       
   359                     && !iIsHideHelp)
       
   360                 {
       
   361                 aMenuPane->SetItemDimmed(EAknCmdHelp, EFalse);
       
   362                 }
       
   363             else
       
   364                 {
       
   365                 aMenuPane->SetItemDimmed(EAknCmdHelp, ETrue);
       
   366                 }
       
   367 
       
   368             if (markedCount < 1)
       
   369                 {
       
   370                 aMenuPane->SetItemDimmed(ELmkCmdOpenLm, ETrue);
       
   371                 }
       
   372             else if (markedCount == 1)
       
   373                 {
       
   374                 aMenuPane->SetItemDimmed(ELmkCmdOpenLm, EFalse);
       
   375                 }
       
   376             else if (markedCount > 1)
       
   377                 {
       
   378                 aMenuPane->SetItemDimmed(ELmkCmdOpenLm, ETrue);
       
   379                 }
       
   380 
       
   381             TBool isLandmarkDataEmpty = EFalse;
       
   382 
       
   383             // check for show on map for single selected landmark
       
   384             if (markedCount == 1)
       
   385                 {
       
   386                 CLmkLandmark* lmklandmark = iParser.LmkLandmarkLC(
       
   387                         iDialog->CurrentItemIndex());
       
   388                 if (IsLandmarkDataEmptyL(lmklandmark->PosLandmark()))
       
   389                     {
       
   390                     isLandmarkDataEmpty = ETrue;
       
   391                     }
       
   392                 CleanupStack::PopAndDestroy(lmklandmark); //lmklandmark
       
   393                 }
       
   394             else if (markedCount < 1)
       
   395                 {
       
   396                 isLandmarkDataEmpty = ETrue;
       
   397                 }
       
   398 
       
   399             TInt cnt = aMenuPane->NumberOfItemsInPane();
       
   400             for (TInt i = 0; i < cnt; ++i)
       
   401                 {
       
   402                 CEikMenuPaneItem::SData& itemData =
       
   403                         aMenuPane->ItemDataByIndexL(i);
       
   404                 if (iMapNavInterface->GetServiceCmdByMenuCmd(
       
   405                         itemData.iCommandId) == KAiwCmdMnShowMap)
       
   406                     {
       
   407 		            if (isLandmarkDataEmpty)
       
   408 		                aMenuPane->SetItemDimmed(itemData.iCommandId, ETrue);
       
   409 		            else 
       
   410 		                aMenuPane->SetItemDimmed(itemData.iCommandId, EFalse);
       
   411 		            break;
       
   412                     }
       
   413                 }
       
   414             break;
       
   415             }
       
   416         case R_LMK_PKGVIEWER_SAVE_LANDMARK_SUBMENU:
       
   417             {
       
   418             if (markedCount < 1)
       
   419                 {
       
   420                 aMenuPane->SetItemDimmed(ELmkCmdSaveSelectedLms, ETrue);
       
   421                 }
       
   422             break;
       
   423             }
       
   424         case R_LMK_PKGVIEWER_SEND_LANDMARK_SUBMENU:
       
   425             {
       
   426             if (markedCount < 1)
       
   427                 {
       
   428                 aMenuPane->SetItemDimmed(ELmkCmdSendSelectedLms, ETrue);
       
   429                 }
       
   430             break;
       
   431             }
       
   432         default:
       
   433             break;
       
   434         }
       
   435     }
       
   436 
       
   437 // ----------------------------------------------------
       
   438 // CLmkDlgPackageSelectorImpl::OpenLandmarkCmdL
       
   439 // ----------------------------------------------------
       
   440 //
       
   441 void CLmkDlgPackageSelectorImpl::OpenLandmarkCmdL()
       
   442     {
       
   443     CLmkPackageEditorImpl* editorImpl =
       
   444         CLmkPackageEditorImpl::NewL( iDb, iParser, iSender,
       
   445                                      iDialog->CurrentItemIndex() );
       
   446     iParser.ChangeObserver(*editorImpl);
       
   447     editorImpl->ExecuteLD();
       
   448     // Restore the parser's observer back to LmkPkg Selector
       
   449     iParser.ChangeObserver(*this);
       
   450     }
       
   451 
       
   452 // ----------------------------------------------------
       
   453 // CLmkDlgPackageSelectorImpl::SaveLandmarksCmdL
       
   454 // ----------------------------------------------------
       
   455 //
       
   456 void CLmkDlgPackageSelectorImpl::SaveLandmarksCmdL()
       
   457     {
       
   458     const CArrayFix<TInt>* markedIndexes = iDialog->SelectionIndexes();
       
   459     RArray<TUint> importIndexes;
       
   460     CleanupClosePushL( importIndexes );
       
   461     TInt count( markedIndexes->Count() );
       
   462     TUint markedIndex (0);
       
   463     if ( count > 0 )
       
   464         {
       
   465         for ( TInt i( 0 ); i < count; ++i )
       
   466             {
       
   467             User::LeaveIfError(
       
   468                 importIndexes.Append( markedIndexes->At( i ) ) );
       
   469             }
       
   470         markedIndex = importIndexes[0];
       
   471         }
       
   472     else
       
   473         { // only highlighted item, no marked items
       
   474         User::LeaveIfError(
       
   475             importIndexes.Append( iDialog->CurrentItemIndex() ) );
       
   476         markedIndex = iDialog->CurrentItemIndex();
       
   477         }
       
   478 
       
   479 
       
   480  	CLmkSaveLandmarkUtils* saveLmUtils = CLmkSaveLandmarkUtils::NewL(iDb,iParser);
       
   481 	CleanupStack::PushL(saveLmUtils );
       
   482 
       
   483 	RArray<TCategoryName> newCategories;
       
   484 	CleanupClosePushL(newCategories);
       
   485 	TCategoryName newCategoryFound;
       
   486 
       
   487 	TInt noOfNewCategories = saveLmUtils->CheckForNewCategoriesL( importIndexes,newCategoryFound,newCategories);
       
   488 
       
   489 	if (saveLmUtils->CategoryAddConfirmationQueryL( noOfNewCategories,newCategoryFound) )
       
   490 		{
       
   491 		iParser.StartImportingL( importIndexes, ETrue );// Save landmarks with new categories
       
   492 		}
       
   493 	else
       
   494 		{
       
   495 		iParser.StartImportingL( importIndexes , EFalse); //Save landmarks without new categories
       
   496 		}
       
   497     // wait note
       
   498     iWaitNote = new (ELeave) CAknWaitDialog( NULL, ETrue );
       
   499     if ( !iWaitNote->ExecuteLD( R_LMK_IMPORTING_WAIT_NOTE ) )
       
   500         {
       
   501         //making iWaitNote null, since framework destroys waitnote
       
   502         //dialog on pressing cancel.
       
   503         iWaitNote = NULL;
       
   504         iParser.CancelImporting();
       
   505        	CleanupStack::PopAndDestroy(3); // newCategories, saveLmUtils,totalLms
       
   506 		return;
       
   507         }
       
   508 
       
   509     // Saved confirmation note
       
   510     saveLmUtils->LmsSavedConfirmationNoteL(importIndexes, markedIndex);
       
   511 
       
   512 	iDialog->ListBox()->ClearSelection();
       
   513 	iDialog->UpdateMskL();
       
   514     CleanupStack::PopAndDestroy(3); // newCategories, saveLmUtils,importIndexes
       
   515     }
       
   516 
       
   517 // ----------------------------------------------------
       
   518 // CLmkDlgPackageSelectorImpl::SaveAllLandmarksCmdL
       
   519 // ----------------------------------------------------
       
   520 //
       
   521 void CLmkDlgPackageSelectorImpl::SaveAllLandmarksCmdL()
       
   522 	{
       
   523 
       
   524 	RArray<TCategoryName> newCategories;
       
   525 	CleanupClosePushL(newCategories);
       
   526 	iSaveLmUtils->StartSearchNewCatL(iNoOfNewCategories,newCategories,iNewCategoryFound);
       
   527 	iType  = ENewPkgCategory;
       
   528 	// wait note
       
   529 	iWaitNote = new (ELeave) CAknWaitDialog( NULL, ETrue );
       
   530 	if ( !iWaitNote->ExecuteLD( R_LMK_IMPORTING_WAIT_NOTE ) )
       
   531 		{
       
   532 		//making iWaitNote null, since framework destroys waitnote
       
   533 	    //dialog on pressing cancel.
       
   534 	    iWaitNote = NULL;
       
   535 		(iType == ENewPkgCategory )?iSaveLmUtils->CancelSearchNewCat():iParser.CancelImporting();
       
   536 	    CleanupStack::PopAndDestroy();//newCategories
       
   537 		return;
       
   538 		}
       
   539 	// Saved confirmation note
       
   540     iSaveLmUtils->LmsSavedConfirmationNoteL( iTotalLms );
       
   541     CleanupStack::PopAndDestroy();//newCategories
       
   542     }
       
   543 
       
   544 // ----------------------------------------------------
       
   545 // CLmkDlgPackageSelectorImpl::SendSelectedLandmarksCmdL
       
   546 // ----------------------------------------------------
       
   547 //
       
   548 void CLmkDlgPackageSelectorImpl::SendSelectedLandmarksCmdL(TInt aCommandId)
       
   549     {
       
   550     RPointerArray<CLmkLandmark> lmkArray;
       
   551     const CArrayFix<TInt>* constMarkedIndexes = iDialog->SelectionIndexes();
       
   552     TUint index(0);
       
   553     TBool oneItemSelected = EFalse;
       
   554     if (constMarkedIndexes->Count() == 0)
       
   555         {
       
   556         oneItemSelected = ETrue;
       
   557         }
       
   558     TInt markedItemCount = constMarkedIndexes->Count();
       
   559     TInt i(0);
       
   560     while( markedItemCount >0 || oneItemSelected)
       
   561 	    {
       
   562 	    if(oneItemSelected)
       
   563 		    {
       
   564 		    index = iDialog->CurrentItemIndex();
       
   565 		    oneItemSelected = EFalse;
       
   566 		    }
       
   567 		else
       
   568 			{
       
   569 			index = constMarkedIndexes->At(i);
       
   570 			i++;
       
   571 			}
       
   572 		CLmkLandmark* lmklandmark = iParser.LmkLandmarkLC(index);
       
   573         User::LeaveIfError(lmkArray.Append(lmklandmark));
       
   574         CleanupStack::Pop();//lmklandmark
       
   575         --markedItemCount;
       
   576 	    }
       
   577 	iDialog->ListBox()->ClearSelection();
       
   578 	iDialog->UpdateMskL();
       
   579     iSender.SendLandmarksL(aCommandId,iParser.PackageName(),lmkArray);
       
   580     lmkArray.ResetAndDestroy();
       
   581     }
       
   582 
       
   583 // ----------------------------------------------------
       
   584 // CLmkDlgPackageSelectorImpl::SendAllLandmarksCmdL
       
   585 // ----------------------------------------------------
       
   586 //
       
   587 void CLmkDlgPackageSelectorImpl::SendAllLandmarksCmdL(TInt aCommandId)
       
   588     {
       
   589 
       
   590     RPointerArray<CLmkLandmark> lmkArray;
       
   591     for ( TInt i(0); i < iParser.NumOfParsedLandmarks(); i++ )
       
   592         {
       
   593         CLmkLandmark* lmklandmark = iParser.LmkLandmarkLC(i);
       
   594         User::LeaveIfError(lmkArray.Append(lmklandmark));
       
   595         CleanupStack::Pop();//lmklandmark
       
   596         }
       
   597 
       
   598 	iSender.SendLandmarksL(aCommandId,iParser.PackageName(),lmkArray);
       
   599     lmkArray.ResetAndDestroy();
       
   600     }
       
   601 
       
   602 // -----------------------------------------------------------------------------
       
   603 // CLmkDlgPackageSelectorImpl::IsLandmarkDataEmptyL
       
   604 // -----------------------------------------------------------------------------
       
   605 //
       
   606 TBool CLmkDlgPackageSelectorImpl::IsLandmarkDataEmptyL(
       
   607         CPosLandmark* aLandmark)
       
   608     {
       
   609     // verify that destination landmark has coordinates
       
   610     TLocality loc;
       
   611     TBool isValid = (KErrNone == aLandmark->GetPosition(loc));
       
   612     isValid &= !Math::IsNaN(loc.Latitude()) && !Math::IsNaN(loc.Longitude());
       
   613     return !isValid;
       
   614     
       
   615 /*    if (!isValid)
       
   616         {
       
   617         // verify that destination landmark has address info
       
   618         TPositionFieldId fieldId = aLandmark->FirstPositionFieldId();
       
   619         while (fieldId != EPositionFieldNone)
       
   620             {
       
   621             if (fieldId > EPositionFieldAddressCapabilitiesBegin && fieldId
       
   622                     < EPositionFieldBuildingTelephone)
       
   623                 {
       
   624                 TPtrC field;
       
   625                 aLandmark->GetPositionField(fieldId, field);
       
   626                 if (field.Length())
       
   627                     {
       
   628                     isValid = ETrue;
       
   629                     break;
       
   630                     }
       
   631                 }
       
   632             fieldId = aLandmark->NextPositionFieldId(fieldId);
       
   633             }
       
   634         }
       
   635     return !isValid;*/
       
   636     }
       
   637 
       
   638 //  End of File