williamr@2: /* williamr@2: * Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). williamr@2: * All rights reserved. williamr@2: * This component and the accompanying materials are made available williamr@4: * under the terms of "Eclipse Public License v1.0" williamr@2: * which accompanies this distribution, and is available williamr@4: * at the URL "http://www.eclipse.org/legal/epl-v10.html". williamr@2: * williamr@2: * Initial Contributors: williamr@2: * Nokia Corporation - initial contribution. williamr@2: * williamr@2: * Contributors: williamr@2: * williamr@2: * Description: LandmarksUi Content File - This class provides functionality for viewing and editing williamr@2: * landmark data. williamr@2: * williamr@2: */ williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: #ifndef CLMKEDITORDLG_H williamr@2: #define CLMKEDITORDLG_H williamr@2: williamr@2: // INCLUDES williamr@2: #include "EPos_CPosLandmark.h" williamr@2: #include // Lm typedefs, constants etc. williamr@2: #include // CBase williamr@2: williamr@2: // FORWARD DECLARATIONS williamr@2: class CPosLandmarkDatabase; williamr@2: class CPosLandmark; williamr@2: class CLmkEditorImpl; williamr@2: class MObjectProvider; williamr@2: class TCoeHelpContext; williamr@2: class CLmkSender; williamr@2: williamr@2: // TYPE DEFINITIONS williamr@2: typedef TUint32 TLmkEditorAttributes; williamr@2: typedef TInt TLmkEditorMode; williamr@2: williamr@2: // CLASS DECLARATION williamr@2: /** williamr@2: * This is a dialog class, which is used to launch landmark viewer/editor. williamr@2: * It provides functionality for viewing and editing landmark data. williamr@2: * By default all the fields are shown, but user can customize the total number of williamr@2: * displayable fields. It also supports mechanism to disable map and navigation williamr@2: * related menu option. williamr@2: */ williamr@2: class CLmkEditorDlg : public CBase williamr@2: { williamr@2: public: // Types williamr@2: williamr@2: /*! williamr@2: @enum _TLmkEditorAttributes williamr@2: @discussion Defines the flag for displaying landmark fields on the viewer/editor dialog. williamr@2: Any combination of these flags,will display those fields,when viewer/editor is launched. williamr@2: By default the flag is set as ELmkAll.This flag is set in class TLmkEditorParams. williamr@2: */ williamr@2: williamr@2: enum _TLmkEditorAttributes williamr@2: { williamr@2: /**This flag allows Name field of the landmark, to be shown.*/ williamr@2: ELmkOnlyName = 0x0000, williamr@2: /**This flag allows the Category/Categories field of the landmark , to be shown*/ williamr@2: ELmkCategory = 0x0001, williamr@2: /**This flag allows the Street name field of the landmark,to be shown.*/ williamr@2: ELmkStreet = 0x0002, williamr@2: /**This flag allows the City name field to be shown, where the landmark belongs.*/ williamr@2: ELmkCity = 0x0004, williamr@2: /**This flag allows the State name field to be shown,where the landmark belongs.*/ williamr@2: ELmkStateProvince = 0x0008, williamr@2: /**This flag allows the Country name field to be shown, where landmark belongs.*/ williamr@2: ELmkCountry = 0x0010, williamr@2: /**This flag allows the Postal Zip field of the landmark, to be shown.*/ williamr@2: ELmkPostalZIP = 0x0020, williamr@2: /**This flag allows the Latitude field of the landmark, to be shown.*/ williamr@2: ELmkLatitude = 0x0040, williamr@2: /**This flag allows the Longitude field of the landmark, to be shown.*/ williamr@2: ELmkLongitude = 0x0080, williamr@2: /**This flag allows the Position accuracy field of the landmark, to be shown.It specifies the williamr@2: horizontal accuracy of the landmark related to Longitude and Latitude values. williamr@2: */ williamr@2: ELmkPositionAccuracy = 0x0100, williamr@2: /**This flag allows the Altitude field of the landmark, to be shown. It specifies the vertical williamr@2: position of the landmark.*/ williamr@2: ELmkAltitude = 0x0200, williamr@2: /**This flag allows the Altitude accuracy field of the landmark, to be shown.It specifies the williamr@2: vertical accuracy of the landmark related to Landmark's Altitude value.*/ williamr@2: ELmkAltitudeAccuracy = 0x0400, williamr@2: /**This flag allows All fields of the landmark, to be shown.*/ williamr@2: ELmkAll = 0xFFFF, williamr@2: /**This flag allows the Description field of the landmark, to be shown.*/ williamr@2: ELmkDescription = 0x0800, williamr@2: /**This flag allows the Phone number field of the landmark, to be shown.*/ williamr@2: ELmkPhoneNumber = 0x1000, williamr@2: /**This flag allows the Web address field of the landmark, to be shown.*/ williamr@2: ELmkWebAddress = 0x2000 williamr@2: }; williamr@2: williamr@2: /*! williamr@2: @enum _TLmkEditorMode williamr@2: @discussion Defines flag, that decides the mode in which the landmark williamr@2: dialog is launched(viewer or editor). williamr@2: By default, the flag is set as ELmkEditor.This flag is set in class williamr@2: TLmkEditorParams. williamr@2: */ williamr@2: enum _TLmkEditorMode williamr@2: { williamr@2: /**Landmark will be launched in editor mode. */ williamr@2: ELmkEditor, williamr@2: /**Landmark will be launched in viewer mode. */ williamr@2: ELmkViewer // only viewing allowed williamr@2: }; williamr@2: williamr@2: /** williamr@2: * This class is a wrapper, around the flags @ref _TLmkEditorAttributes and @ref _TLmkEditorMode. williamr@2: * It is used to set these flags to CLmkEditorDlg before launching the dialog. williamr@2: * It encapsualtes _TLmkEditorAttributes & _TLmkEditorMode. williamr@2: * It is used by class CLmkEditorDlg. williamr@2: */ williamr@2: class TLmkEditorParams williamr@2: { williamr@2: public: // Constructors and destructor williamr@2: /** williamr@2: * C++ Constructor. williamr@2: * @return newly instantiated object williamr@2: */ williamr@2: IMPORT_C TLmkEditorParams(); williamr@2: williamr@2: // Compiler-generated destructor is ok for this class; williamr@2: williamr@2: private: // Unimplemented functions williamr@2: // Unimplemented copy constructor williamr@2: TLmkEditorParams( const TLmkEditorParams& ); williamr@2: williamr@2: // Unimplemented assignment operator williamr@2: TLmkEditorParams& operator = ( const TLmkEditorParams& ); williamr@2: williamr@2: public: // Input parameters williamr@2: williamr@2: /** williamr@2: * This member,specifies what all landmark attributes to be shown in editor/viewer dialog. williamr@2: * It can have a combination of values from enum @ref _TLmkEditorAttributes. williamr@2: * By default ELmkAll attribute is used if no value is specified. williamr@2: */ williamr@2: TLmkEditorAttributes iAttributes; williamr@2: williamr@2: /** williamr@2: * This member,specifies the mode (Viewer or Editor) in which the landmark dialog will be launched. williamr@2: * It holds a value from enum @ref _TLmkEditorMode, by default ELmkEditor is used if no value is specified. williamr@2: */ williamr@2: TLmkEditorMode iEditorMode; williamr@2: }; williamr@2: williamr@2: public: // Constructors and destructor williamr@2: /** williamr@2: * This is a static function, which creates and returns an instance of this class, williamr@2: * based on landmark id, which exists in landmark database. williamr@2: * @param[in] aDb Reference to landmark database that includes this landmark. williamr@2: * @param[in] aLandmark Landmark id, which exists in Landmarks database. williamr@2: * @param[in] aParams Attribute, holds values for launching the landmark dialog williamr@2: * in viewer or editor mode, and number of landmark fields to be williamr@2: * displayed. williamr@2: * @panic Panics with system-wide panic codes. williamr@2: * @leave Leaves with KErrNotFound,If the landmark does not exist in the database williamr@2: * Leaves with KErrNotSupported if framework functionality is not available. williamr@2: * @return new instance of this class williamr@2: */ williamr@2: IMPORT_C static CLmkEditorDlg* NewL( CPosLandmarkDatabase& aDb, williamr@2: TPosLmItemId aLandmarkId, williamr@2: TLmkEditorParams& aParams ); williamr@2: williamr@2: /** williamr@2: * This is a static function, which creates and returns an instance of this class, williamr@2: * based on landmark object, which does not exist in landmark database. williamr@2: * @param[in] aDb reference to landmark database, where new landmark will be created, williamr@2: * if launched in edit mode. williamr@2: * @param [in\out] aLandmark pre-filled landmarks object. In case of edit mode, williamr@2: * the passed aLandmark is updated with the information entered williamr@2: * by the user along with the landmark id, which can be obtained williamr@2: * by calling LandmarkId() method of CPosLandmark. williamr@2: * @param[in] aParams aParams attributes whether to launch landmark in viewer mode williamr@2: * or editor mode. williamr@2: * @panic Panics with system-wide panic codes. williamr@2: * @leave Leaves with KErrNotSupported if framework functionality is not available. williamr@2: * @return new instance of this class williamr@2: */ williamr@2: IMPORT_C static CLmkEditorDlg* NewL( CPosLandmarkDatabase& aDb, williamr@2: CPosLandmark& aLandmark, williamr@2: TLmkEditorParams& aParams ); williamr@2: williamr@2: /** williamr@2: * Destructor. williamr@2: */ williamr@2: IMPORT_C ~CLmkEditorDlg(); williamr@2: williamr@2: public: // New functions williamr@2: /** williamr@2: * This method sets the context - that is, the enclosing parent control - for this control. williamr@2: * @param[in] aParent The parent object which is the context for the control. williamr@2: */ williamr@2: IMPORT_C void SetMopParent( MObjectProvider* aParent ); williamr@2: williamr@2: /** williamr@2: * This method sets help context. There are many applications using landmark editor williamr@2: * and they may have an own help topic to be shown, when editor's help williamr@2: * is launched. With this command it is possible to define the used williamr@2: * help content. Landmark's own help context is used as default. williamr@2: * @param[in] aContext help context to use williamr@2: */ williamr@2: IMPORT_C void SetHelpContext( TCoeHelpContext aContext ); williamr@2: williamr@2: /** williamr@2: * This function launches the landmark dialog.It launches the dialog either in viewer williamr@2: * or editor mode , depending upon the flag set. williamr@2: * williamr@2: * Editor mode: williamr@2: * When the dialog is launched in edit mode, the user can edit the landmark fields (some or all) williamr@2: * and can save the Landmark. williamr@2: * On closing the dialog, the landmark is saved to the landmark database. If saving a williamr@2: * landmark fails due to less memory, the user is notified with an information note. If any williamr@2: * of the landmark fields are filled and landmark name is not provided, user is asked to williamr@2: * provide the landmark name, else if nothing is entered the dialog will close without saving williamr@2: * the landmark. williamr@2: * In case of new landmark creation, once the dialog is closed and the application returns williamr@2: * from ExecuteLD() method, client applications can obtain the landmark id of the newly williamr@2: * created landmark by calling LandmarkId() method from CPosLandmark class. williamr@2: * williamr@2: * Viewer mode: williamr@2: * The user can view the Landmark contents by accepting the dialog williamr@2: * Canelling the dialog will close the dialog williamr@2: * @panic Panics with system-wide, panic codes. williamr@2: * @leave Leaves with KErrNotSupported if framework functionality is not available. williamr@2: * @return Returns non-zero if accepted & saved in edit mode. williamr@2: Returns zero if fails due to less memory or any other error williamr@2: in edit mode.It always returns zero in view mode. williamr@2: */ williamr@2: IMPORT_C TInt ExecuteLD(); williamr@2: /** williamr@2: * This function, when invoked, disables the Map and Navigation related Menu Options williamr@2: * This needs to be invoked before ExecuteLD(). By default, the Map and Navigation williamr@2: * menu options are enabled and are shown. williamr@2: * williamr@2: */ williamr@2: IMPORT_C void DisableMapAndNavigationMenuOptions(); williamr@2: williamr@2: private: williamr@2: /** williamr@2: * C++ default constructor. williamr@2: * @return newly instantiated object williamr@2: */ williamr@2: CLmkEditorDlg(); williamr@2: williamr@2: /** williamr@2: * By default Symbian 2nd phase constructor is private. williamr@2: * @param aDb williamr@2: * @param aParams williamr@2: * @param aLandmarkId williamr@2: * @param aLandmark williamr@2: */ williamr@2: void ConstructL( CPosLandmarkDatabase& aDb, williamr@2: TLmkEditorParams& aParams, williamr@2: TPosLmItemId aLandmarkId, williamr@2: CPosLandmark* aLandmark ); williamr@2: williamr@2: private: // Data williamr@2: /// Own: Search implementor object williamr@2: CLmkEditorImpl* iEditorImpl; williamr@2: williamr@2: /// Own: A pointer to TBool williamr@2: TBool* iDestroyedPtr; williamr@2: williamr@2: /// Own: Landmark sender object williamr@2: CLmkSender* iSender; williamr@2: }; williamr@2: williamr@2: #endif // CLMKEDITORDLG_H williamr@2: williamr@2: // End of File