S60 3rd Edition SDK for Symbian OS
Example Applications Guide

CLandmarksView Class Reference

#include <LandmarksView.h>

List of all members.

Public Member Functions

 ~CLandmarksView ()
TUid Id () const
void HandleCommandL (TInt aCommand)
void DoActivateL (const TVwsViewId &aPrevViewId, TUid aCustomMessageId, const TDesC8 &aCustomMessage)
void DoDeactivate ()
void DynInitMenuPaneL (TInt aResourceId, CEikMenuPane *aMenuPane)

Static Public Member Functions

static CLandmarksView * NewLC (CAknNavigationDecorator *aNaviDecorator, CLandmarksApplicationEngine &aEngine)

Private Member Functions

 CLandmarksView (CAknNavigationDecorator *aNaviDecorator, CLandmarksApplicationEngine &aEngine)
void ConstructL ()
void AddLandmarkL (TBool aUseCurrentLocation)

Private Attributes

CLandmarksContainer * iContainer
 The container containing the graphical components of the view.
CLandmarksApplicationEngine & iEngine
 The application engine used for modifying categories.
CAknNavigationDecorator * iNaviDecorator
 Decorates the navi pane (with navigation arrows etc).


Detailed Description

CLandmarksView is the view displaying list of landmarks

Definition at line 33 of file LandmarksView.h.


Constructor & Destructor Documentation

CLandmarksView::~CLandmarksView (   ) 
 

Destructor.

Definition at line 71 of file LandmarksView.cpp.

References iContainer.

00072     {
00073     delete iContainer;
00074     }

CLandmarksView::CLandmarksView (  CAknNavigationDecorator *  aNaviDecorator,
CLandmarksApplicationEngine &  aEngine
)  [private]
 

C++ constructor.

Parameters:
aNaviDecorator the navigation decorator displaying the tabs
aEngine the engine used for fetching categories data.

Definition at line 35 of file LandmarksView.cpp.

00038 :   iEngine(aEngine), 
00039     iNaviDecorator(aNaviDecorator)
00040     {
00041     // No implementation required
00042     }


Member Function Documentation

CLandmarksView * CLandmarksView::NewLC (  CAknNavigationDecorator *  aNaviDecorator,
CLandmarksApplicationEngine &  aEngine
)  [static]
 

Two-phased constructor.

Parameters:
aNaviDecorator the navigation decorator displaying the tabs
aEngine the engine used for fetching category data.

Definition at line 59 of file LandmarksView.cpp.

References CLandmarksView().

00062     {
00063     CLandmarksView* self = new (ELeave) CLandmarksView(
00064         aNaviDecorator, aEngine);
00065     CleanupStack::PushL(self);
00066     self->ConstructL();
00067     return self;
00068     }

TUid CLandmarksView::Id (   )  const
 

Id Identity of this view to the system.

Returns:
the ID of this view

Definition at line 82 of file LandmarksView.cpp.

00083     {
00084     return TUid::Uid(ELandmarksViewId);
00085     }

void CLandmarksView::HandleCommandL (  TInt  aCommand  ) 
 

HandleCommandL handles user menu selections.

Parameters:
aCommand the enumerated code for the option selected

Definition at line 93 of file LandmarksView.cpp.

References AddLandmarkL(), CLandmarksContainer::CurrentLandmark(), CLandmarksContainer::DeleteLandmarkL(), and iContainer.

00094     {
00095     switch (aCommand)
00096         {
00097         case ELandmarksAddCurrent:
00098             AddLandmarkL(ETrue); // use current location
00099             break;
00100 
00101         case ELandmarksAddBlank:
00102             AddLandmarkL(EFalse); // create blank
00103             break;
00104 
00105         case ELandmarksDelete:
00106             iContainer->DeleteLandmarkL();
00107             break;
00108 
00109         case ELandmarksOpen:
00110             {
00111             TPckgC<TPosLmItemId> lmId(iContainer->CurrentLandmark());
00112             
00113             AppUi()->ActivateLocalViewL(
00114                 TUid::Uid(ELandmarksInfoViewId),
00115                 TUid::Uid(ELandmarksViewInfoById),
00116                 lmId);
00117             break;
00118             }
00119 
00120         default:
00121             AppUi()->HandleCommandL(aCommand);
00122             break;
00123         }
00124     }

void CLandmarksView::DoActivateL (  const TVwsViewId &  aPrevViewId,
TUid  aCustomMessageId,
const TDesC8 &  aCustomMessage
) 
 

DoActivateL is responsible for activating this view.

Parameters:
aPrevViewId The id of the previous view
aCustomMessageId message identifier
aCustomMessage custom message provided when the view is changed

Definition at line 132 of file LandmarksView.cpp.

References CLandmarksContainer::ConstructL(), iContainer, Id(), iEngine, iNaviDecorator, and CLandmarksApplicationEngine::NotifyViewActivated().

00136     {
00137     if (!iContainer)
00138         {
00139         iContainer = new (ELeave) CLandmarksContainer(
00140             *this, iEngine, iNaviDecorator);
00141         iContainer->SetMopParent(this);
00142             iContainer->ConstructL(ClientRect());
00143         }
00144 
00145     // Enable receiving of keyboard events.
00146     AppUi()->AddToStackL(*this, iContainer);
00147 
00148     // Make view visible.
00149     iContainer->MakeVisible(ETrue);
00150 
00151     // Notify that this view is active
00152     iEngine.NotifyViewActivated(Id(), ETrue);
00153     }

void CLandmarksView::DoDeactivate (   ) 
 

DoDeactivate is responsible for deactivating this view.

Definition at line 161 of file LandmarksView.cpp.

References iContainer, Id(), iEngine, and CLandmarksApplicationEngine::NotifyViewActivated().

00162     {
00163     // Hide view.
00164     iContainer->MakeVisible(EFalse);
00165 
00166     // Notify that this view is inactive
00167     iEngine.NotifyViewActivated(Id(), EFalse);
00168 
00169     // Disable receiving keyboard events.
00170     AppUi()->RemoveFromStack(iContainer);
00171     }

void CLandmarksView::DynInitMenuPaneL (  TInt  aResourceId,
CEikMenuPane *  aMenuPane
) 
 

DynInitMenuPaneL initializes the menu pane before it is displayed.

Parameters:
aResourceId a resource ID indetifying the menu bar containing the menu pane to be initialized.
aMenuPane the menu pane to initialize.

Definition at line 179 of file LandmarksView.cpp.

References iContainer, and CLandmarksContainerBase::IsItemSelected().

00182     {
00183     CAknView::DynInitMenuPaneL(aResourceId, aMenuPane);
00184     if (aResourceId == R_LMREFAPP_MENU)
00185         {
00186         // If no landmark is selected we need to hide some command options.
00187         TBool isListEmpty  = !iContainer->IsItemSelected();
00188         aMenuPane->SetItemDimmed(ELandmarksDelete, isListEmpty);
00189         aMenuPane->SetItemDimmed(ELandmarksOpen, isListEmpty);
00190         }
00191     }

void CLandmarksView::ConstructL (   )  [private]
 

By default Symbian 2nd phase constructor is private.

Definition at line 49 of file LandmarksView.cpp.

00050     {
00051     BaseConstructL(R_LMREFAPP_VIEW);
00052     }

void CLandmarksView::AddLandmarkL (  TBool  aUseCurrentLocation  )  [private]
 

Launches a landmark edit dialog and adds a landmark to the database.

Parameters:
aUseCurrentLocation ETrue if the landmark will be based on current location. EFalse if no location should be predefined.

Definition at line 199 of file LandmarksView.cpp.

References CLandmarksApplicationEngine::AddLandmarkL(), iContainer, iEngine, CLandmarksContainer::MakeNaviPaneVisibleL(), and CLandmarksEditDialog::NewLC().

00200     {
00201     // Create new landmark
00202     CPosLandmark* newLandmark = CPosLandmark::NewLC();
00203 
00204     // Create edit dialog
00205     TBool isEdited(EFalse);
00206     CLandmarksEditDialog* editDialog = CLandmarksEditDialog::NewLC(
00207         *newLandmark, aUseCurrentLocation, isEdited, iEngine);
00208 
00209     // Remove tabs from this view
00210     iContainer->MakeNaviPaneVisibleL(EFalse);
00211 
00212     // Dialog must not leave without restoring tab group. Must be trapped.
00213     TRAPD(err, editDialog->ExecuteLD(R_LMREFAPP_EDIT_DIALOG));
00214 
00215     // Restore tabs to this view
00216     iContainer->MakeNaviPaneVisibleL(ETrue);
00217 
00218     User::LeaveIfError(err);
00219     CleanupStack::Pop(editDialog);
00220 
00221     if (isEdited)
00222         {
00223         iEngine.AddLandmarkL(*newLandmark);
00224         }
00225 
00226     CleanupStack::PopAndDestroy(newLandmark);
00227     }


© Nokia 2006

Back to top