|
1 /* |
|
2 * Copyright (c) 2002 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: LandmarkUi Content File |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 // [INCLUDE FILES] - do not remove |
|
26 #include <e32svr.h> |
|
27 #include <StifParser.h> |
|
28 #include <Stiftestinterface.h> |
|
29 #include "BCAppLmkAddEdit.h" |
|
30 |
|
31 #include <CLmkEditorDlg.h> |
|
32 #include <Epos_CPosLandmarkDatabase.h> |
|
33 #include <Epos_Landmarks.h> |
|
34 #include <coecntrl.h> |
|
35 #include <lbsposition.h> |
|
36 #include "BCAppLmkEditorEngine.h" |
|
37 |
|
38 // EXTERNAL DATA STRUCTURES |
|
39 //extern ?external_data; |
|
40 |
|
41 // EXTERNAL FUNCTION PROTOTYPES |
|
42 //extern ?external_function( ?arg_type,?arg_type ); |
|
43 |
|
44 // CONSTANTS |
|
45 //const ?type ?constant_var = ?constant; |
|
46 |
|
47 // MACROS |
|
48 //#define ?macro ?macro_def |
|
49 |
|
50 // LOCAL CONSTANTS AND MACROS |
|
51 //const ?type ?constant_var = ?constant; |
|
52 //#define ?macro_name ?macro_def |
|
53 |
|
54 // MODULE DATA STRUCTURES |
|
55 //enum ?declaration |
|
56 //typedef ?declaration |
|
57 |
|
58 // LOCAL FUNCTION PROTOTYPES |
|
59 //?type ?function_name( ?arg_type, ?arg_type ); |
|
60 |
|
61 // FORWARD DECLARATIONS |
|
62 //class ?FORWARD_CLASSNAME; |
|
63 |
|
64 // ============================= LOCAL FUNCTIONS =============================== |
|
65 |
|
66 // ----------------------------------------------------------------------------- |
|
67 // ?function_name ?description. |
|
68 // ?description |
|
69 // Returns: ?value_1: ?description |
|
70 // ?value_n: ?description_line1 |
|
71 // ?description_line2 |
|
72 // ----------------------------------------------------------------------------- |
|
73 // |
|
74 /* |
|
75 ?type ?function_name( |
|
76 ?arg_type arg, // ?description |
|
77 ?arg_type arg) // ?description |
|
78 { |
|
79 |
|
80 ?code // ?comment |
|
81 |
|
82 // ?comment |
|
83 ?code |
|
84 } |
|
85 */ |
|
86 |
|
87 // ============================ MEMBER FUNCTIONS =============================== |
|
88 |
|
89 // ----------------------------------------------------------------------------- |
|
90 // CBCAppLmkAddEdit::Delete |
|
91 // Delete here all resources allocated and opened from test methods. |
|
92 // Called from destructor. |
|
93 // ----------------------------------------------------------------------------- |
|
94 // |
|
95 void CBCAppLmkAddEdit::Delete() |
|
96 { |
|
97 |
|
98 } |
|
99 |
|
100 // ----------------------------------------------------------------------------- |
|
101 // CBCAppLmkAddEdit::RunMethodL |
|
102 // Run specified method. Contains also table of test mothods and their names. |
|
103 // ----------------------------------------------------------------------------- |
|
104 // |
|
105 TInt CBCAppLmkAddEdit::RunMethodL( |
|
106 CStifItemParser& aItem ) |
|
107 { |
|
108 |
|
109 static TStifFunctionInfo const KFunctions[] = |
|
110 { |
|
111 // Copy this line for every implemented function. |
|
112 // First string is the function name used in TestScripter script file. |
|
113 // Second is the actual implementation member function. |
|
114 ENTRY( "Example", CBCAppLmkAddEdit::ExampleL ), |
|
115 ENTRY( "TestNewL", CBCAppLmkAddEdit::TestNewL ), |
|
116 ENTRY( "TestNew2L", CBCAppLmkAddEdit::TestNew2L ), |
|
117 ENTRY( "TestExecuteLD", CBCAppLmkAddEdit::TestExecuteLD ), |
|
118 ENTRY( "TestSetMopParent", CBCAppLmkAddEdit::TestSetMopParent ), |
|
119 ENTRY( "TestSetHelpContext", CBCAppLmkAddEdit::TestSetHelpContext ), |
|
120 ENTRY( "TestDisableMapAndNaviOptions", CBCAppLmkAddEdit::TestDisableMapAndNaviOptions ), |
|
121 //ADD NEW ENTRY HERE |
|
122 // [test cases entries] - Do not remove |
|
123 |
|
124 }; |
|
125 |
|
126 const TInt count = sizeof( KFunctions ) / |
|
127 sizeof( TStifFunctionInfo ); |
|
128 |
|
129 return RunInternalL( KFunctions, count, aItem ); |
|
130 |
|
131 } |
|
132 |
|
133 // ----------------------------------------------------------------------------- |
|
134 // CBCAppLmkAddEdit::ExampleL |
|
135 // Example test method function. |
|
136 // (other items were commented in a header). |
|
137 // ----------------------------------------------------------------------------- |
|
138 // |
|
139 TInt CBCAppLmkAddEdit::ExampleL( CStifItemParser& aItem ) |
|
140 { |
|
141 |
|
142 // Print to UI |
|
143 _LIT( KBCAppLmkAddEdit, "BCAppLmkAddEdit" ); |
|
144 _LIT( KExample, "In Example" ); |
|
145 TestModuleIf().Printf( 0, KBCAppLmkAddEdit, KExample ); |
|
146 // Print to log file |
|
147 iLog->Log( KExample ); |
|
148 |
|
149 TInt i = 0; |
|
150 TPtrC string; |
|
151 _LIT( KParam, "Param[%i]: %S" ); |
|
152 while ( aItem.GetNextString ( string ) == KErrNone ) |
|
153 { |
|
154 TestModuleIf().Printf( i, KBCAppLmkAddEdit, |
|
155 KParam, i, &string ); |
|
156 i++; |
|
157 } |
|
158 |
|
159 return KErrNone; |
|
160 |
|
161 } |
|
162 |
|
163 TInt CBCAppLmkAddEdit::TestNewL( CStifItemParser& /*aItem*/ ) |
|
164 { |
|
165 CPosLandmarkDatabase* ilDb = CPosLandmarkDatabase::OpenL(); |
|
166 CPosLmOperation* operation = NULL; |
|
167 |
|
168 if( ilDb->IsInitializingNeeded() ) |
|
169 { |
|
170 operation = ilDb->InitializeL(); |
|
171 operation->ExecuteL(); |
|
172 } |
|
173 |
|
174 CLmkEditorDlg::TLmkEditorParams editParams; |
|
175 editParams.iAttributes = CLmkEditorDlg::ELmkAll; |
|
176 editParams.iEditorMode = CLmkEditorDlg::ELmkEditor; |
|
177 |
|
178 CPosLandmark* LmkEditor = CPosLandmark::NewL(); |
|
179 CleanupStack::PushL( LmkEditor ); |
|
180 |
|
181 CLmkEditorDlg* editDlg = CLmkEditorDlg::NewL(*ilDb,*LmkEditor,editParams); |
|
182 CleanupStack::PushL( editDlg ); |
|
183 //ReleaseLandmarkResources(); |
|
184 CleanupStack::PopAndDestroy(2); |
|
185 delete ilDb; ilDb=NULL; |
|
186 delete operation; operation=NULL; |
|
187 return KErrNone; |
|
188 } |
|
189 |
|
190 TInt CBCAppLmkAddEdit::TestNew2L( CStifItemParser& /*aItem*/ ) |
|
191 { |
|
192 //Create an empty landmark object |
|
193 CPosLandmark* lmk = CPosLandmark::NewL(); |
|
194 CleanupStack::PushL(lmk); |
|
195 //Specify the various fields for landmark |
|
196 TLocality locality; |
|
197 locality.SetAccuracy(32.2,32.4); |
|
198 locality.SetCoordinate(56,25); |
|
199 locality.SetHorizontalAccuracy(33.1); |
|
200 locality.SetVerticalAccuracy(24.2); |
|
201 lmk->SetLandmarkNameL(_L("Forum Mall")); |
|
202 lmk->SetLandmarkDescriptionL(_L("Shopping Complex")); |
|
203 //Populate the landmark with the specified field information |
|
204 lmk->SetPositionL(locality); |
|
205 //lmk->SetLandmarkIdL( 1 ); |
|
206 |
|
207 CPosLandmarkDatabase* ilDb = CPosLandmarkDatabase::OpenL(); |
|
208 //CleanupStack::PushL(ilDb); |
|
209 ilDb->AddLandmarkL(*lmk); |
|
210 CPosLmOperation* operation = NULL; |
|
211 if ( ilDb->IsInitializingNeeded() ) |
|
212 { |
|
213 operation = ilDb->InitializeL(); |
|
214 operation->ExecuteL(); |
|
215 } |
|
216 |
|
217 CLmkEditorDlg::TLmkEditorParams editParams; |
|
218 editParams.iAttributes = CLmkEditorDlg::ELmkAll; |
|
219 editParams.iEditorMode = CLmkEditorDlg::ELmkEditor; |
|
220 TPosLmItemId lmItem = lmk->LandmarkId(); |
|
221 CLmkEditorDlg* editDlg = CLmkEditorDlg::NewL(*ilDb,lmItem,editParams); |
|
222 CleanupStack::PushL( editDlg ); |
|
223 |
|
224 //ReleaseLandmarkResources(); |
|
225 CleanupStack::PopAndDestroy(2); //ilDb, lmk |
|
226 //delete ilDb; ilDb=NULL; |
|
227 delete operation; operation=NULL; |
|
228 return KErrNone; |
|
229 } |
|
230 |
|
231 TInt CBCAppLmkAddEdit::TestExecuteLD( CStifItemParser& /*aItem*/ ) |
|
232 { |
|
233 TPosLmItemId lmItem = 0; |
|
234 |
|
235 CPosLandmarkDatabase* ilDb = CPosLandmarkDatabase::OpenL(); |
|
236 CPosLmOperation* operation = NULL; |
|
237 |
|
238 if ( ilDb->IsInitializingNeeded() ) |
|
239 { |
|
240 operation = ilDb->InitializeL(); |
|
241 operation->ExecuteL(); |
|
242 } |
|
243 |
|
244 CLmkEditorDlg::TLmkEditorParams editParams; |
|
245 editParams.iAttributes = CLmkEditorDlg::ELmkAll; |
|
246 editParams.iEditorMode = CLmkEditorDlg::ELmkEditor; |
|
247 |
|
248 CPosLandmark* landmark = CPosLandmark::NewL(); |
|
249 CleanupStack::PushL( landmark ); |
|
250 |
|
251 CLmkEditorDlg* editDlg = CLmkEditorDlg::NewL(*ilDb,*landmark,editParams); |
|
252 CleanupStack::PushL( editDlg ); |
|
253 TRAPD(result,editDlg->ExecuteLD()); |
|
254 |
|
255 //ReleaseLandmarkResources(); |
|
256 CleanupStack::Pop(2); |
|
257 delete ilDb; ilDb=NULL; |
|
258 delete operation; operation=NULL; |
|
259 return KErrNone; |
|
260 |
|
261 } |
|
262 |
|
263 TInt CBCAppLmkAddEdit::TestSetMopParent( CStifItemParser& /*aItem*/ ) |
|
264 { |
|
265 CPosLandmarkDatabase* ilDb = CPosLandmarkDatabase::OpenL(); |
|
266 CPosLmOperation* operation = NULL; |
|
267 if ( ilDb->IsInitializingNeeded() ) |
|
268 { |
|
269 operation = ilDb->InitializeL(); |
|
270 operation->ExecuteL(); |
|
271 } |
|
272 |
|
273 CPosLandmark* landmark = CPosLandmark::NewL(); |
|
274 CleanupStack::PushL( landmark ); |
|
275 |
|
276 CLmkEditorDlg::TLmkEditorParams editParams; |
|
277 editParams.iAttributes = CLmkEditorDlg::ELmkAll; |
|
278 editParams.iEditorMode = CLmkEditorDlg::ELmkEditor; |
|
279 |
|
280 engine = new (ELeave) CLmkAddEditEngine; |
|
281 |
|
282 CLmkEditorDlg* editDlg = CLmkEditorDlg::NewL(*ilDb,*landmark,editParams); |
|
283 CleanupStack::PushL( editDlg ); |
|
284 |
|
285 |
|
286 |
|
287 |
|
288 TRAPD(result,editDlg->SetMopParent(engine)); |
|
289 |
|
290 //ReleaseLandmarkResources(); |
|
291 CleanupStack::Pop(2); |
|
292 |
|
293 delete ilDb; ilDb=NULL; |
|
294 delete operation; operation=NULL; |
|
295 |
|
296 |
|
297 return KErrNone; |
|
298 } |
|
299 |
|
300 TInt CBCAppLmkAddEdit::TestSetHelpContext( CStifItemParser& /*aItem*/ ) |
|
301 { |
|
302 CPosLandmarkDatabase* ilDb = CPosLandmarkDatabase::OpenL(); |
|
303 CPosLmOperation* operation = NULL; |
|
304 if ( ilDb->IsInitializingNeeded() ) |
|
305 { |
|
306 operation = ilDb->InitializeL(); |
|
307 operation->ExecuteL(); |
|
308 } |
|
309 |
|
310 CPosLandmark* landmark = CPosLandmark::NewL(); |
|
311 CleanupStack::PushL( landmark ); |
|
312 |
|
313 CLmkEditorDlg::TLmkEditorParams editParams; |
|
314 editParams.iAttributes = CLmkEditorDlg::ELmkAll; |
|
315 editParams.iEditorMode = CLmkEditorDlg::ELmkEditor; |
|
316 |
|
317 TCoeHelpContext aContext; |
|
318 CLmkEditorDlg* editDlg = CLmkEditorDlg::NewL(*ilDb,*landmark,editParams); |
|
319 CleanupStack::PushL( editDlg ); |
|
320 |
|
321 editDlg->SetHelpContext(aContext); |
|
322 |
|
323 //ReleaseLandmarkResources(); |
|
324 CleanupStack::PopAndDestroy(2); |
|
325 |
|
326 delete ilDb; ilDb=NULL; |
|
327 delete operation; operation=NULL; |
|
328 return KErrNone; |
|
329 } |
|
330 |
|
331 |
|
332 TInt CBCAppLmkAddEdit::TestDisableMapAndNaviOptions( CStifItemParser& /*aItem*/ ) |
|
333 { |
|
334 #ifdef __SERIES60_31__ |
|
335 CPosLandmarkDatabase* ilDb = CPosLandmarkDatabase::OpenL(); |
|
336 CPosLmOperation* operation = NULL; |
|
337 if ( ilDb->IsInitializingNeeded() ) |
|
338 { |
|
339 operation = ilDb->InitializeL(); |
|
340 operation->ExecuteL(); |
|
341 } |
|
342 |
|
343 CPosLandmark* landmark = CPosLandmark::NewL(); |
|
344 CleanupStack::PushL( landmark ); |
|
345 |
|
346 CLmkEditorDlg::TLmkEditorParams editParams; |
|
347 editParams.iAttributes = CLmkEditorDlg::ELmkAll; |
|
348 editParams.iEditorMode = CLmkEditorDlg::ELmkEditor; |
|
349 |
|
350 CLmkEditorDlg* editDlg = CLmkEditorDlg::NewL(*ilDb,*landmark,editParams); |
|
351 editDlg->DisableMapAndNavigationMenuOptions(); |
|
352 TRAP_IGNORE(editDlg->ExecuteLD()); |
|
353 CleanupStack::PopAndDestroy(); |
|
354 //ReleaseLandmarkResources(); |
|
355 delete ilDb; |
|
356 delete operation; |
|
357 #endif |
|
358 return KErrNone; |
|
359 } |
|
360 |
|
361 |
|
362 // ----------------------------------------------------------------------------- |
|
363 // CBCAppLmkAddEdit::?member_function |
|
364 // ?implementation_description |
|
365 // (other items were commented in a header). |
|
366 // ----------------------------------------------------------------------------- |
|
367 // |
|
368 /* |
|
369 TInt CBCAppLmkAddEdit::?member_function( |
|
370 CItemParser& aItem ) |
|
371 { |
|
372 |
|
373 ?code |
|
374 |
|
375 } |
|
376 */ |
|
377 |
|
378 // ========================== OTHER EXPORTED FUNCTIONS ========================= |
|
379 // None |
|
380 |
|
381 // [End of File] - Do not remove |