|
1 /* |
|
2 * Copyright (c) 2004 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 Content File - This class provides functionality for viewing and editing |
|
15 * landmark data. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 #ifndef CLMKEDITORDLG_H |
|
25 #define CLMKEDITORDLG_H |
|
26 |
|
27 // INCLUDES |
|
28 #include "EPos_CPosLandmark.h" |
|
29 #include <EPos_Landmarks.h> // Lm typedefs, constants etc. |
|
30 #include <e32base.h> // CBase |
|
31 |
|
32 // FORWARD DECLARATIONS |
|
33 class CPosLandmarkDatabase; |
|
34 class CPosLandmark; |
|
35 class CLmkEditorImpl; |
|
36 class MObjectProvider; |
|
37 class TCoeHelpContext; |
|
38 class CLmkSender; |
|
39 |
|
40 // TYPE DEFINITIONS |
|
41 typedef TUint32 TLmkEditorAttributes; |
|
42 typedef TInt TLmkEditorMode; |
|
43 |
|
44 // CLASS DECLARATION |
|
45 /** |
|
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. |
|
51 */ |
|
52 class CLmkEditorDlg : public CBase |
|
53 { |
|
54 public: // Types |
|
55 |
|
56 /*! |
|
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. |
|
61 */ |
|
62 |
|
63 enum _TLmkEditorAttributes |
|
64 { |
|
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.*/ |
|
70 ELmkStreet = 0x0002, |
|
71 /**This flag allows the City name field to be shown, where the landmark belongs.*/ |
|
72 ELmkCity = 0x0004, |
|
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.*/ |
|
76 ELmkCountry = 0x0010, |
|
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. |
|
85 */ |
|
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.*/ |
|
94 ELmkAll = 0xFFFF, |
|
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 |
|
101 }; |
|
102 |
|
103 /*! |
|
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 |
|
108 TLmkEditorParams. |
|
109 */ |
|
110 enum _TLmkEditorMode |
|
111 { |
|
112 /**Landmark will be launched in editor mode. */ |
|
113 ELmkEditor, |
|
114 /**Landmark will be launched in viewer mode. */ |
|
115 ELmkViewer // only viewing allowed |
|
116 }; |
|
117 |
|
118 /** |
|
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. |
|
123 */ |
|
124 class TLmkEditorParams |
|
125 { |
|
126 public: // Constructors and destructor |
|
127 /** |
|
128 * C++ Constructor. |
|
129 * @return newly instantiated object |
|
130 */ |
|
131 IMPORT_C TLmkEditorParams(); |
|
132 |
|
133 // Compiler-generated destructor is ok for this class; |
|
134 |
|
135 private: // Unimplemented functions |
|
136 // Unimplemented copy constructor |
|
137 TLmkEditorParams( const TLmkEditorParams& ); |
|
138 |
|
139 // Unimplemented assignment operator |
|
140 TLmkEditorParams& operator = ( const TLmkEditorParams& ); |
|
141 |
|
142 public: // Input parameters |
|
143 |
|
144 /** |
|
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. |
|
148 */ |
|
149 TLmkEditorAttributes iAttributes; |
|
150 |
|
151 /** |
|
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. |
|
154 */ |
|
155 TLmkEditorMode iEditorMode; |
|
156 }; |
|
157 |
|
158 public: // Constructors and destructor |
|
159 /** |
|
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 |
|
166 * displayed. |
|
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 |
|
171 */ |
|
172 IMPORT_C static CLmkEditorDlg* NewL( CPosLandmarkDatabase& aDb, |
|
173 TPosLmItemId aLandmarkId, |
|
174 TLmkEditorParams& aParams ); |
|
175 |
|
176 /** |
|
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 |
|
186 * or editor 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 |
|
190 */ |
|
191 IMPORT_C static CLmkEditorDlg* NewL( CPosLandmarkDatabase& aDb, |
|
192 CPosLandmark& aLandmark, |
|
193 TLmkEditorParams& aParams ); |
|
194 |
|
195 /** |
|
196 * Destructor. |
|
197 */ |
|
198 IMPORT_C ~CLmkEditorDlg(); |
|
199 |
|
200 public: // New functions |
|
201 /** |
|
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. |
|
204 */ |
|
205 IMPORT_C void SetMopParent( MObjectProvider* aParent ); |
|
206 |
|
207 /** |
|
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 |
|
213 */ |
|
214 IMPORT_C void SetHelpContext( TCoeHelpContext aContext ); |
|
215 |
|
216 /** |
|
217 * This function launches the landmark dialog.It launches the dialog either in viewer |
|
218 * or editor mode , depending upon the flag set. |
|
219 * |
|
220 * Editor mode: |
|
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 |
|
227 * the landmark. |
|
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. |
|
231 * |
|
232 * Viewer mode: |
|
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. |
|
240 */ |
|
241 IMPORT_C TInt ExecuteLD(); |
|
242 /** |
|
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. |
|
246 * |
|
247 */ |
|
248 IMPORT_C void DisableMapAndNavigationMenuOptions(); |
|
249 |
|
250 private: |
|
251 /** |
|
252 * C++ default constructor. |
|
253 * @return newly instantiated object |
|
254 */ |
|
255 CLmkEditorDlg(); |
|
256 |
|
257 /** |
|
258 * By default Symbian 2nd phase constructor is private. |
|
259 * @param aDb |
|
260 * @param aParams |
|
261 * @param aLandmarkId |
|
262 * @param aLandmark |
|
263 */ |
|
264 void ConstructL( CPosLandmarkDatabase& aDb, |
|
265 TLmkEditorParams& aParams, |
|
266 TPosLmItemId aLandmarkId, |
|
267 CPosLandmark* aLandmark ); |
|
268 |
|
269 private: // Data |
|
270 /// Own: Search implementor object |
|
271 CLmkEditorImpl* iEditorImpl; |
|
272 |
|
273 /// Own: A pointer to TBool |
|
274 TBool* iDestroyedPtr; |
|
275 |
|
276 /// Own: Landmark sender object |
|
277 CLmkSender* iSender; |
|
278 }; |
|
279 |
|
280 #endif // CLMKEDITORDLG_H |
|
281 |
|
282 // End of File |