2 * Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
14 * Description: LandmarksUi Content File - This class provides functionality for viewing and editing
24 #ifndef CLMKEDITORDLG_H
25 #define CLMKEDITORDLG_H
28 #include "EPos_CPosLandmark.h"
29 #include <EPos_Landmarks.h> // Lm typedefs, constants etc.
30 #include <e32base.h> // CBase
32 // FORWARD DECLARATIONS
33 class CPosLandmarkDatabase;
36 class MObjectProvider;
37 class TCoeHelpContext;
41 typedef TUint32 TLmkEditorAttributes;
42 typedef TInt TLmkEditorMode;
46 * This is a dialog class, which is used to launch landmark viewer/editor.
47 * It provides functionality for viewing and editing landmark data.
48 * By default all the fields are shown, but user can customize the total number of
49 * displayable fields. It also supports mechanism to disable map and navigation
50 * related menu option.
52 class CLmkEditorDlg : public CBase
57 @enum _TLmkEditorAttributes
58 @discussion Defines the flag for displaying landmark fields on the viewer/editor dialog.
59 Any combination of these flags,will display those fields,when viewer/editor is launched.
60 By default the flag is set as ELmkAll.This flag is set in class TLmkEditorParams.
63 enum _TLmkEditorAttributes
65 /**This flag allows Name field of the landmark, to be shown.*/
66 ELmkOnlyName = 0x0000,
67 /**This flag allows the Category/Categories field of the landmark , to be shown*/
68 ELmkCategory = 0x0001,
69 /**This flag allows the Street name field of the landmark,to be shown.*/
71 /**This flag allows the City name field to be shown, where the landmark belongs.*/
73 /**This flag allows the State name field to be shown,where the landmark belongs.*/
74 ELmkStateProvince = 0x0008,
75 /**This flag allows the Country name field to be shown, where landmark belongs.*/
77 /**This flag allows the Postal Zip field of the landmark, to be shown.*/
78 ELmkPostalZIP = 0x0020,
79 /**This flag allows the Latitude field of the landmark, to be shown.*/
80 ELmkLatitude = 0x0040,
81 /**This flag allows the Longitude field of the landmark, to be shown.*/
82 ELmkLongitude = 0x0080,
83 /**This flag allows the Position accuracy field of the landmark, to be shown.It specifies the
84 horizontal accuracy of the landmark related to Longitude and Latitude values.
86 ELmkPositionAccuracy = 0x0100,
87 /**This flag allows the Altitude field of the landmark, to be shown. It specifies the vertical
88 position of the landmark.*/
89 ELmkAltitude = 0x0200,
90 /**This flag allows the Altitude accuracy field of the landmark, to be shown.It specifies the
91 vertical accuracy of the landmark related to Landmark's Altitude value.*/
92 ELmkAltitudeAccuracy = 0x0400,
93 /**This flag allows All fields of the landmark, to be shown.*/
95 /**This flag allows the Description field of the landmark, to be shown.*/
96 ELmkDescription = 0x0800,
97 /**This flag allows the Phone number field of the landmark, to be shown.*/
98 ELmkPhoneNumber = 0x1000,
99 /**This flag allows the Web address field of the landmark, to be shown.*/
100 ELmkWebAddress = 0x2000
104 @enum _TLmkEditorMode
105 @discussion Defines flag, that decides the mode in which the landmark
106 dialog is launched(viewer or editor).
107 By default, the flag is set as ELmkEditor.This flag is set in class
112 /**Landmark will be launched in editor mode. */
114 /**Landmark will be launched in viewer mode. */
115 ELmkViewer // only viewing allowed
119 * This class is a wrapper, around the flags @ref _TLmkEditorAttributes and @ref _TLmkEditorMode.
120 * It is used to set these flags to CLmkEditorDlg before launching the dialog.
121 * It encapsualtes _TLmkEditorAttributes & _TLmkEditorMode.
122 * It is used by class CLmkEditorDlg.
124 class TLmkEditorParams
126 public: // Constructors and destructor
129 * @return newly instantiated object
131 IMPORT_C TLmkEditorParams();
133 // Compiler-generated destructor is ok for this class;
135 private: // Unimplemented functions
136 // Unimplemented copy constructor
137 TLmkEditorParams( const TLmkEditorParams& );
139 // Unimplemented assignment operator
140 TLmkEditorParams& operator = ( const TLmkEditorParams& );
142 public: // Input parameters
145 * This member,specifies what all landmark attributes to be shown in editor/viewer dialog.
146 * It can have a combination of values from enum @ref _TLmkEditorAttributes.
147 * By default ELmkAll attribute is used if no value is specified.
149 TLmkEditorAttributes iAttributes;
152 * This member,specifies the mode (Viewer or Editor) in which the landmark dialog will be launched.
153 * It holds a value from enum @ref _TLmkEditorMode, by default ELmkEditor is used if no value is specified.
155 TLmkEditorMode iEditorMode;
158 public: // Constructors and destructor
160 * This is a static function, which creates and returns an instance of this class,
161 * based on landmark id, which exists in landmark database.
162 * @param[in] aDb Reference to landmark database that includes this landmark.
163 * @param[in] aLandmark Landmark id, which exists in Landmarks database.
164 * @param[in] aParams Attribute, holds values for launching the landmark dialog
165 * in viewer or editor mode, and number of landmark fields to be
167 * @panic Panics with system-wide panic codes.
168 * @leave Leaves with KErrNotFound,If the landmark does not exist in the database
169 * Leaves with KErrNotSupported if framework functionality is not available.
170 * @return new instance of this class
172 IMPORT_C static CLmkEditorDlg* NewL( CPosLandmarkDatabase& aDb,
173 TPosLmItemId aLandmarkId,
174 TLmkEditorParams& aParams );
177 * This is a static function, which creates and returns an instance of this class,
178 * based on landmark object, which does not exist in landmark database.
179 * @param[in] aDb reference to landmark database, where new landmark will be created,
180 * if launched in edit mode.
181 * @param [in\out] aLandmark pre-filled landmarks object. In case of edit mode,
182 * the passed aLandmark is updated with the information entered
183 * by the user along with the landmark id, which can be obtained
184 * by calling LandmarkId() method of CPosLandmark.
185 * @param[in] aParams aParams attributes whether to launch landmark in viewer mode
187 * @panic Panics with system-wide panic codes.
188 * @leave Leaves with KErrNotSupported if framework functionality is not available.
189 * @return new instance of this class
191 IMPORT_C static CLmkEditorDlg* NewL( CPosLandmarkDatabase& aDb,
192 CPosLandmark& aLandmark,
193 TLmkEditorParams& aParams );
198 IMPORT_C ~CLmkEditorDlg();
200 public: // New functions
202 * This method sets the context - that is, the enclosing parent control - for this control.
203 * @param[in] aParent The parent object which is the context for the control.
205 IMPORT_C void SetMopParent( MObjectProvider* aParent );
208 * This method sets help context. There are many applications using landmark editor
209 * and they may have an own help topic to be shown, when editor's help
210 * is launched. With this command it is possible to define the used
211 * help content. Landmark's own help context is used as default.
212 * @param[in] aContext help context to use
214 IMPORT_C void SetHelpContext( TCoeHelpContext aContext );
217 * This function launches the landmark dialog.It launches the dialog either in viewer
218 * or editor mode , depending upon the flag set.
221 * When the dialog is launched in edit mode, the user can edit the landmark fields (some or all)
222 * and can save the Landmark.
223 * On closing the dialog, the landmark is saved to the landmark database. If saving a
224 * landmark fails due to less memory, the user is notified with an information note. If any
225 * of the landmark fields are filled and landmark name is not provided, user is asked to
226 * provide the landmark name, else if nothing is entered the dialog will close without saving
228 * In case of new landmark creation, once the dialog is closed and the application returns
229 * from ExecuteLD() method, client applications can obtain the landmark id of the newly
230 * created landmark by calling LandmarkId() method from CPosLandmark class.
233 * The user can view the Landmark contents by accepting the dialog
234 * Canelling the dialog will close the dialog
235 * @panic Panics with system-wide, panic codes.
236 * @leave Leaves with KErrNotSupported if framework functionality is not available.
237 * @return Returns non-zero if accepted & saved in edit mode.
238 Returns zero if fails due to less memory or any other error
239 in edit mode.It always returns zero in view mode.
241 IMPORT_C TInt ExecuteLD();
243 * This function, when invoked, disables the Map and Navigation related Menu Options
244 * This needs to be invoked before ExecuteLD(). By default, the Map and Navigation
245 * menu options are enabled and are shown.
248 IMPORT_C void DisableMapAndNavigationMenuOptions();
252 * C++ default constructor.
253 * @return newly instantiated object
258 * By default Symbian 2nd phase constructor is private.
264 void ConstructL( CPosLandmarkDatabase& aDb,
265 TLmkEditorParams& aParams,
266 TPosLmItemId aLandmarkId,
267 CPosLandmark* aLandmark );
270 /// Own: Search implementor object
271 CLmkEditorImpl* iEditorImpl;
273 /// Own: A pointer to TBool
274 TBool* iDestroyedPtr;
276 /// Own: Landmark sender object
280 #endif // CLMKEDITORDLG_H