basiclocationinfodisplay/blid/ui/src/CBlidBaseView.cpp
branchRCL_3
changeset 6 91123d004e8f
parent 0 522cd55cc3d7
child 16 8173571d354e
equal deleted inserted replaced
5:41042d2af523 6:91123d004e8f
   177                 }                
   177                 }                
   178             break;
   178             break;
   179             }
   179             }
   180         case R_BLID_MAIN_MENU:
   180         case R_BLID_MAIN_MENU:
   181             {
   181             {
   182             CBlidBaseView::HandleHelpFeature( aMenuPane );
   182             CBlidBaseView::HandleHelpFeatureL( aMenuPane );
   183             break;
   183             break;
   184             }
   184             }
   185             
   185             
   186         case R_BLID_SET_DESTINATION_MENU:
   186         case R_BLID_SET_DESTINATION_MENU:
   187 			{
   187 			{
   272 		iPopupDialog->ChangeDlgSoftKey();	    	
   272 		iPopupDialog->ChangeDlgSoftKey();	    	
   273 	    }
   273 	    }
   274     }
   274     }
   275 
   275 
   276 // ---------------------------------------------------------
   276 // ---------------------------------------------------------
   277 // CBlidBaseView::HandleHelpFeature
   277 // CBlidBaseView::HandleHelpFeatureL
   278 // Handles the Help option command
   278 // Handles the Help option command
   279 // ---------------------------------------------------------
   279 // ---------------------------------------------------------
   280 //
   280 //
   281 void CBlidBaseView::HandleHelpFeature( CEikMenuPane* aMenuPane ) const
   281 void CBlidBaseView::HandleHelpFeatureL( CEikMenuPane* aMenuPane ) const
   282     {
   282     {
   283     //implementation for req 406-917. Hide position view based on feature variation flag
   283     //implementation for req 406-917. Hide position view based on feature variation flag
   284     TInt helpSettingValue = ELocHelpNotHidden;
   284     TInt helpSettingValue = ELocHelpNotHidden;
   285     CRepository* repository = CRepository::NewL( TUid::Uid( KCRUidLocLocalVariation) );
   285     CRepository* repository = CRepository::NewL( TUid::Uid( KCRUidLocLocalVariation) );
   286     CleanupStack::PushL( repository );
   286     CleanupStack::PushL( repository );
   304 // Insers a waypoint
   304 // Insers a waypoint
   305 // ----------------------------------------------------------------------------
   305 // ----------------------------------------------------------------------------
   306 //
   306 //
   307 TBool CBlidBaseView::InsertWaypointL()
   307 TBool CBlidBaseView::InsertWaypointL()
   308     {
   308     {
   309     TInt index(KErrCancel);
       
   310     TBuf<KBlidWaypointNameMaxLen> textData;
   309     TBuf<KBlidWaypointNameMaxLen> textData;
   311     StringLoader::Load( textData, R_BLID_WAYPOINT_NAME, iCoeEnv );
   310     StringLoader::Load( textData, R_BLID_WAYPOINT_NAME, iCoeEnv );
   312     TInt errorCode(KErrNone);	
   311     TInt errorCode(KErrNone);	
   313     TBool returnValue(ETrue);
   312     TBool returnValue(ETrue);
   314     TInt removedIndex;
   313     TInt removedIndex;
   328             return EFalse;           
   327             return EFalse;           
   329             }
   328             }
   330             
   329             
   331         }while( CheckIfExistL( textData, errorCode, removedIndex ) );
   330         }while( CheckIfExistL( textData, errorCode, removedIndex ) );
   332         
   331         
   333         if(errorCode != KErrNone)
   332 		if(errorCode != KErrNone)
   334         	{
   333 				{
   335         	return EFalse;
   334 				return EFalse;
   336         	}
   335 				}
   337 
   336 
   338         /// if KMaxNumberOfWaypoints or more than that is already present
   337 		/// if KMaxNumberOfWaypoints or more than that is already present
   339         /// display note.
   338 		/// display note.
   340         if ( iRouter->Count() >= KMaxNumberOfWaypoints )
   339 		if ( iRouter->Count() >= KMaxNumberOfWaypoints )
   341             {
   340 		    {
   342             static_cast<CBlidAppUi*>(AppUi()
   341 		    static_cast<CBlidAppUi*>(AppUi()
   343                 )->ShowDialogL( BlidNotes::EBlidOverWriteWaypointNote );            
   342 		        )->ShowDialogL( BlidNotes::EBlidOverWriteWaypointNote );            
   344             return EFalse;            
   343 		    return EFalse;            
   345             }    
   344 		    }    
   346 
   345 
   347         TInt retVal(KErrNone);
   346 		TNamedCoordinate* waypoint = new(ELeave)TNamedCoordinate();
   348         if ( index >=0 )
   347 		CleanupStack::PushL( waypoint );
   349             {
   348 		waypoint->SetName( textData );
   350             if ( iRouter->IndexOfWaypoint() >=0 && 
   349 		TPosition position = iLocation->GetCurrentPosition();
   351                  index >= iRouter->IndexOfWaypoint() )
   350 		waypoint->SetCoordinate( position.Latitude(),
   352                 {                
   351 		                         position.Longitude(),
   353                 index++;
   352 		                         position.Altitude() );
   354                 }
   353 		position.SetHorizontalAccuracy(position.HorizontalAccuracy());
   355             retVal = iRouter->RemoveL( index );
   354 		waypoint->SetAccuracy(position.HorizontalAccuracy());
   356             if(retVal == KErrDiskFull)
   355 		//iRouter takes waypoint's ownership
   357 	        	{
   356 		TInt retVal = iRouter->AppendL( waypoint, ETrue);
   358 	        	BlidNotes::OutOfMemoryNoteL();
   357 		if(retVal == KErrDiskFull)
   359 	        	}
   358 				{
   360             }
   359 				delete waypoint;
   361         
   360 				BlidNotes::OutOfMemoryNoteL();
   362         if(retVal == KErrNone)
   361 				returnValue = EFalse;
   363         	{
   362 				}
   364         	TNamedCoordinate* waypoint = new(ELeave)TNamedCoordinate();
   363 		CleanupStack::Pop(); //waypoint
   365 	        CleanupStack::PushL( waypoint );
   364 
   366 	        waypoint->SetName( textData );
   365 		return returnValue;
   367 	        TPosition position = iLocation->GetCurrentPosition();
   366 		}
   368 	        waypoint->SetCoordinate( position.Latitude(),
       
   369 	                                 position.Longitude(),
       
   370 	                                 position.Altitude() );
       
   371 	        position.SetHorizontalAccuracy(position.HorizontalAccuracy());
       
   372 	        waypoint->SetAccuracy(position.HorizontalAccuracy());
       
   373 	        //iRouter takes waypoint's ownership
       
   374 	        TInt retVal = iRouter->AppendL( waypoint, ETrue);
       
   375 	        if(retVal == KErrDiskFull)
       
   376 	        	{
       
   377 	        	delete waypoint;
       
   378 	        	BlidNotes::OutOfMemoryNoteL();
       
   379 	        	returnValue = EFalse;
       
   380 	        	}
       
   381 	        CleanupStack::Pop(); //waypoint
       
   382         	}                
       
   383         return returnValue;
       
   384         }
       
   385 
   367 
   386 // ----------------------------------------------------------------------------
   368 // ----------------------------------------------------------------------------
   387 // CBlidBaseView::SelectWaypoint
   369 // CBlidBaseView::SelectWaypoint
   388 // Select a waypoint
   370 // Select a waypoint
   389 // ----------------------------------------------------------------------------
   371 // ----------------------------------------------------------------------------