18
|
1 |
/*
|
|
2 |
* Copyright (c) 2002-2010 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: This file contains the methods implementing the core
|
|
15 |
* functionality of landmarks editor
|
|
16 |
*
|
|
17 |
*/
|
|
18 |
|
|
19 |
// INCLUDE FILES
|
|
20 |
#include <AknSettingCache.h>
|
|
21 |
#include <AiwServiceHandler.h> // AIW
|
|
22 |
#include <AiwCommon.hrh> // AIW
|
|
23 |
#include <featmgr.h>
|
|
24 |
#include <aknlayoutscalable_avkon.cdl.h>
|
|
25 |
#include <layoutmetadata.cdl.h>
|
|
26 |
#include <aknmessagequerydialog.h>
|
|
27 |
#include <AknIconUtils.h>
|
|
28 |
#include <AknWaitDialog.h>
|
|
29 |
#include <aknlists.h>
|
|
30 |
#include <StringLoader.h>
|
|
31 |
#include <AknQueryDialog.h>
|
|
32 |
#include <eikcapc.h>
|
|
33 |
#include <eikmenup.h>
|
|
34 |
#include <hlplch.h>
|
|
35 |
#include <sendnorm.rsg> // R_SENDUI_MENU
|
|
36 |
#include <lmkui.rsg>
|
|
37 |
#include <CLmkEditorDlg.h>
|
|
38 |
#include <EPos_CPosLandmark.h>
|
|
39 |
#include <EPos_CPosLandmarkDatabase.h>
|
|
40 |
#include <epos_poslandmarkserialization.h>
|
|
41 |
#include <bldvariant.hrh>
|
|
42 |
#include <AknDef.h>
|
|
43 |
#include <sysutil.h>
|
|
44 |
|
|
45 |
#include <baclipb.h> // for CClipboard
|
|
46 |
#include <txtrich.h>
|
|
47 |
#include <txtetext.h>
|
|
48 |
#include <s32std.h>
|
|
49 |
|
|
50 |
#include "CLmkUiUtils.h"
|
|
51 |
#include "landmarks.hrh"
|
|
52 |
#include "LmkConsts.h"
|
|
53 |
#include "LmkUID.h"
|
|
54 |
#include "CLmkLocationService.h"
|
|
55 |
#include "CLmkDbUtils.h"
|
|
56 |
#include "CLmkEditorFieldArray.h"
|
|
57 |
#include "MLmkEditorField.h"
|
|
58 |
#include "LmkNotes.h"
|
|
59 |
#include "CLmkDlgCategorySelectorImpl.h"
|
|
60 |
#include <csxhelp/lm.hlp.hrh>
|
|
61 |
#include "CLmkSender.h"
|
|
62 |
#include "clmkgotourlcmd.h"
|
|
63 |
#include "clmkcallcmd.h"
|
|
64 |
#include "CLmkEditorImpl.h"
|
|
65 |
#include "CLmkEditorTextField.h"
|
|
66 |
#include "lmkicondialog.h"
|
|
67 |
#include "CLmkEditorListField.h"
|
|
68 |
#include "CLmkEditorCoordinateField.h"
|
|
69 |
#include <landmarks.rsg>
|
|
70 |
#include <uriutils.h>
|
|
71 |
#include "LmkListProviderFactory.h"
|
|
72 |
#include "CLmkListProviderBase.h"
|
|
73 |
#include <locnotprefplugindomaincrkeys.h>
|
|
74 |
#include "clmkcentralrepository.h"
|
|
75 |
#include "CLmkEditorNumberField.h"
|
|
76 |
#include "lmkwaitdlglauncher.h" // Wait dialog launcher
|
|
77 |
#include "LmkEditorFieldFactory.h"
|
|
78 |
#include <locationvariationdomaincrkeys.h>
|
|
79 |
#include <lmkerrors.h>
|
|
80 |
#include "Debug.h"
|
|
81 |
|
|
82 |
// CONSTANTS
|
|
83 |
/// Unnamed namespace for local definitions
|
|
84 |
namespace
|
|
85 |
{
|
|
86 |
const TInt KHOffsetCatInfoPopup(100);
|
|
87 |
const TInt KVOffsetCatInfoPopup(30);
|
|
88 |
#if defined(_DEBUG)
|
|
89 |
_LIT( KPanicMsg, "CLmkEditorImpl");
|
|
90 |
|
|
91 |
void Panic(TPanicCode aReason)
|
|
92 |
{
|
|
93 |
User::Panic(KPanicMsg, aReason);
|
|
94 |
}
|
|
95 |
#endif
|
|
96 |
} // namespace
|
|
97 |
|
|
98 |
// ================= LOCAL FUNCTIONS =======================
|
|
99 |
static void CleanupArray(TAny* aArray)
|
|
100 |
{
|
|
101 |
(static_cast<RPointerArray<CPosLandmark>*> (aArray))->ResetAndDestroy();
|
|
102 |
}
|
|
103 |
|
|
104 |
// ============================ MEMBER FUNCTIONS ===============================
|
|
105 |
|
|
106 |
// -----------------------------------------------------------------------------
|
|
107 |
// CLmkEditorImpl::CLmkEditorImpl
|
|
108 |
// C++ default constructor can NOT contain any code, that
|
|
109 |
// might leave.
|
|
110 |
// -----------------------------------------------------------------------------
|
|
111 |
//
|
|
112 |
CLmkEditorImpl::CLmkEditorImpl(CPosLandmarkDatabase& aDb,
|
|
113 |
CLmkSender& aSender, TLmkEditorMode aEditorMode) :
|
|
114 |
iDb(aDb), iSender(aSender), iEditorMode(aEditorMode), iIsEditing(EFalse),
|
|
115 |
iResetWebAddrSize(ETrue), iIsCategorySelctorOpen(EFalse)
|
|
116 |
{
|
|
117 |
}
|
|
118 |
|
|
119 |
// -----------------------------------------------------------------------------
|
|
120 |
// CLmkEditorImpl::ConstructL
|
|
121 |
// Symbian 2nd phase constructor can leave.
|
|
122 |
// -----------------------------------------------------------------------------
|
|
123 |
//
|
|
124 |
void CLmkEditorImpl::ConstructL(TPosLmItemId aLandmarkId,
|
|
125 |
TLmkEditorAttributes aAttributes)
|
|
126 |
{
|
|
127 |
DEBUG( CLmkEditorImpl::ConstructL Editing/Viewing Existing Landmark with LandmarkId )
|
|
128 |
CommonConstructL(aAttributes);
|
|
129 |
iLandmark = iDb.ReadLandmarkLC(aLandmarkId);
|
|
130 |
iLmkFields = CLmkFields::NewL(iLabelArray, iDb, aAttributes, aLandmarkId,
|
|
131 |
iLandmark, iJapaneseInputMode);
|
|
132 |
ChangeContextImageL();
|
|
133 |
iEditorFieldArray = CLmkEditorFieldArray::NewL(*iLmkFields, *this);
|
|
134 |
CleanupStack::Pop(iLandmark);
|
|
135 |
if (iLandmark)
|
|
136 |
{
|
|
137 |
iIsLmOwned = ETrue;
|
|
138 |
}
|
|
139 |
iListProvider = LmkListProviderFactory::CreateProviderL( iDb, ELandmarkSelector );
|
|
140 |
iListProvider->AddObserverL( *this );
|
|
141 |
iListProvider->InitializeL();
|
|
142 |
}
|
|
143 |
|
|
144 |
// -----------------------------------------------------------------------------
|
|
145 |
// CLmkEditorImpl::ConstructL
|
|
146 |
// Symbian 2nd phase constructor can leave.
|
|
147 |
// -----------------------------------------------------------------------------
|
|
148 |
//
|
|
149 |
void CLmkEditorImpl::ConstructL(CPosLandmark* aLandmark,
|
|
150 |
TLmkEditorAttributes aAttributes)
|
|
151 |
{
|
|
152 |
DEBUG( CLmkEditorImpl::ConstructL Editing/Viewing Existing Landmark with Landmark Object );
|
|
153 |
CommonConstructL(aAttributes);
|
|
154 |
iLmkFields = CLmkFields::NewL(iLabelArray, iDb, aAttributes,
|
|
155 |
aLandmark->LandmarkId(), aLandmark, iJapaneseInputMode);
|
|
156 |
iLandmark = aLandmark;
|
|
157 |
ChangeContextImageL();
|
|
158 |
iEditorFieldArray = CLmkEditorFieldArray::NewL(*iLmkFields, *this);
|
|
159 |
}
|
|
160 |
|
|
161 |
// -----------------------------------------------------------------------------
|
|
162 |
// CLmkEditorImpl::ConstructL
|
|
163 |
// Symbian 2nd phase constructor can leave.
|
|
164 |
// Empty Landmark Editor
|
|
165 |
// -----------------------------------------------------------------------------
|
|
166 |
//
|
|
167 |
void CLmkEditorImpl::ConstructL(TPosLmItemId* aLandmarkId,
|
|
168 |
CPosLandmark* aLandmark, TLmkEditorAttributes aAttributes)
|
|
169 |
{
|
|
170 |
DEBUG( CLmkEditorImpl::ConstructL Empty Landmarks Editor Construction );
|
|
171 |
CommonConstructL(aAttributes);
|
|
172 |
iLmkFields = CLmkFields::NewL(iLabelArray, iDb, aAttributes,
|
|
173 |
*aLandmarkId, aLandmark, iJapaneseInputMode);
|
|
174 |
iLandmarkItemId = aLandmarkId;
|
|
175 |
iLandmark = aLandmark;
|
|
176 |
ChangeContextImageL();
|
|
177 |
iEditorFieldArray = CLmkEditorFieldArray::NewL(*iLmkFields, *this);
|
|
178 |
}
|
|
179 |
|
|
180 |
// -----------------------------------------------------------------------------
|
|
181 |
// CLmkEditorImpl::CommonConstructL
|
|
182 |
// -----------------------------------------------------------------------------
|
|
183 |
//
|
|
184 |
void CLmkEditorImpl::CommonConstructL(TLmkEditorAttributes& aAttributes)
|
|
185 |
{
|
|
186 |
DEBUG( CLmkEditorImpl::CommonConstructL Start )
|
|
187 |
iLandmarkItemId = NULL; // Set to NULL by default. Use only where needed.
|
|
188 |
iLmkUiUtils = CLmkUiUtils::NewL();
|
|
189 |
iLmkUiUtils->ReadLmkUiResourceFileL();
|
|
190 |
CAknForm::ConstructL(R_LMK_EDITOR_MENUBAR);
|
|
191 |
|
|
192 |
iLmkUiUtils->StoreNaviPaneL(); // store old navi pane
|
|
193 |
iLmkUiUtils->CreateDefaultNaviPaneL();
|
|
194 |
// For setting Japanese input mode
|
|
195 |
CAknSettingCache& cache = CAknEnv::Static()->SettingCache();
|
|
196 |
TLanguage currentLanguage = cache.InputLanguage();
|
|
197 |
if (currentLanguage == ELangJapanese)
|
|
198 |
{
|
|
199 |
iJapaneseInputMode = ETrue;
|
|
200 |
}
|
|
201 |
else
|
|
202 |
{
|
|
203 |
iJapaneseInputMode = EFalse;
|
|
204 |
}
|
|
205 |
CreateLabelArrayL();
|
|
206 |
ConstructContextMenuL();
|
|
207 |
|
|
208 |
// launching browser
|
|
209 |
iLmkGoToURLCmd = CLmkGoToURLCmd::NewL();
|
|
210 |
// Launching Call UI
|
|
211 |
iLmkCallCmd = CLmkCallCmd::NewL();
|
|
212 |
iLmkCallCmd->AttachMenuPaneL(R_LMK_EDITOR_CALL_SUBMENU,
|
|
213 |
R_LMK_EDITOR_AIW_INTEREST);
|
|
214 |
// Create AIW interest
|
|
215 |
iLmkCallCmd->AttachInterestL(R_LMK_EDITOR_AIW_INTEREST);
|
|
216 |
// By default enable map and navigation feature
|
|
217 |
iMapNavFeature = ETrue;
|
|
218 |
|
|
219 |
iMapNavInterface = CLmkMapNavigationInterface::NewL(iDb);
|
|
220 |
iCatInfoPopupNote = NULL;
|
|
221 |
iRepository = CLmkCentralRepository::NewL(KLocSystemofMeasurements, this);
|
|
222 |
|
|
223 |
// Create the wait dialog launcher
|
|
224 |
iWaitDialogLauncher = CLmkWaitDialogLauncher::NewL();
|
|
225 |
iWaitDialogLauncher->SetObserver(this);
|
|
226 |
|
|
227 |
iIsLmOwned = EFalse;
|
|
228 |
|
|
229 |
// Check if the Coordinates has to be hidden
|
|
230 |
CheckHideCoordinateL();
|
|
231 |
|
|
232 |
if (iIsHideCoordinate)
|
|
233 |
{
|
|
234 |
aAttributes &= ~CLmkEditorDlg::ELmkLatitude;
|
|
235 |
aAttributes &= ~CLmkEditorDlg::ELmkLongitude;
|
|
236 |
aAttributes &= ~CLmkEditorDlg::ELmkPositionAccuracy;
|
|
237 |
aAttributes &= ~CLmkEditorDlg::ELmkAltitude;
|
|
238 |
aAttributes &= ~CLmkEditorDlg::ELmkAltitudeAccuracy;
|
|
239 |
}
|
|
240 |
DEBUG( CLmkEditorImpl::CommonConstructL End )
|
|
241 |
}
|
|
242 |
|
|
243 |
// -----------------------------------------------------------------------------
|
|
244 |
// CLmkEditorImpl::NewL
|
|
245 |
// Two-phased constructor.
|
|
246 |
// -----------------------------------------------------------------------------
|
|
247 |
//
|
|
248 |
EXPORT_C CLmkEditorImpl* CLmkEditorImpl::NewL(CPosLandmarkDatabase& aDb,
|
|
249 |
CLmkSender& aSender, TLmkEditorAttributes aAttributes,
|
|
250 |
TLmkEditorMode aEditorMode, TPosLmItemId aLandmarkId)
|
|
251 |
{
|
|
252 |
CLmkEditorImpl* self = new (ELeave) CLmkEditorImpl(aDb, aSender,
|
|
253 |
aEditorMode);
|
|
254 |
|
|
255 |
CleanupStack::PushL(self);
|
|
256 |
self->ConstructL(aLandmarkId, aAttributes);
|
|
257 |
CleanupStack::Pop(); //self
|
|
258 |
return self;
|
|
259 |
}
|
|
260 |
|
|
261 |
// -----------------------------------------------------------------------------
|
|
262 |
// CLmkEditorImpl::NewL
|
|
263 |
// Two-phased constructor.
|
|
264 |
// -----------------------------------------------------------------------------
|
|
265 |
//
|
|
266 |
EXPORT_C CLmkEditorImpl* CLmkEditorImpl::NewL(CPosLandmarkDatabase& aDb,
|
|
267 |
CLmkSender& aSender, TLmkEditorAttributes aAttributes,
|
|
268 |
TLmkEditorMode aEditorMode, CPosLandmark* aLandmark)
|
|
269 |
{
|
|
270 |
CLmkEditorImpl* self = new (ELeave) CLmkEditorImpl(aDb, aSender,
|
|
271 |
aEditorMode);
|
|
272 |
|
|
273 |
CleanupStack::PushL(self);
|
|
274 |
self->ConstructL(aLandmark, aAttributes);
|
|
275 |
CleanupStack::Pop(); //self
|
|
276 |
return self;
|
|
277 |
}
|
|
278 |
|
|
279 |
// -----------------------------------------------------------------------------
|
|
280 |
// CLmkEditorImpl::NewL
|
|
281 |
// Two-phased constructor.
|
|
282 |
// -----------------------------------------------------------------------------
|
|
283 |
//
|
|
284 |
EXPORT_C CLmkEditorImpl* CLmkEditorImpl::NewL(CPosLandmarkDatabase& aDb,
|
|
285 |
CLmkSender& aSender, TLmkEditorAttributes aAttributes,
|
|
286 |
TLmkEditorMode aEditorMode, TPosLmItemId* aLandmarkId,
|
|
287 |
CPosLandmark* aLandmark)
|
|
288 |
{
|
|
289 |
CLmkEditorImpl* self = new (ELeave) CLmkEditorImpl(aDb, aSender,
|
|
290 |
aEditorMode);
|
|
291 |
|
|
292 |
CleanupStack::PushL(self);
|
|
293 |
self->ConstructL(aLandmarkId, aLandmark, aAttributes);
|
|
294 |
CleanupStack::Pop(); //self
|
|
295 |
return self;
|
|
296 |
}
|
|
297 |
|
|
298 |
// -----------------------------------------------------------------------------
|
|
299 |
// CLmkEditorImpl::~CLmkEditorImpl()
|
|
300 |
// -----------------------------------------------------------------------------
|
|
301 |
//
|
|
302 |
CLmkEditorImpl::~CLmkEditorImpl()
|
|
303 |
{
|
|
304 |
delete iWaitDialogLauncher;
|
|
305 |
|
|
306 |
CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current();
|
|
307 |
cba->RemoveCommandObserver(KMskCommandPos);
|
|
308 |
|
|
309 |
if (iLmkUiUtils)
|
|
310 |
{
|
|
311 |
iLmkUiUtils->SetOldContextIcon();
|
|
312 |
iLmkUiUtils->RestoreOldTitlePane();
|
|
313 |
}
|
|
314 |
|
|
315 |
delete iLmkUiUtils;
|
|
316 |
delete iLmkFields;
|
|
317 |
iLabelArray.ResetAndDestroy();
|
|
318 |
iCategoryNames.Close();
|
|
319 |
iLabelArray.Close();
|
|
320 |
delete iEditorFieldArray;
|
|
321 |
delete iLocationService;
|
|
322 |
|
|
323 |
if (iContextMenuBar)
|
|
324 |
{
|
|
325 |
iEikonEnv->EikAppUi()->RemoveFromStack(iContextMenuBar);
|
|
326 |
delete iContextMenuBar;
|
|
327 |
}
|
|
328 |
delete iLmkGoToURLCmd;
|
|
329 |
delete iLmkCallCmd;
|
|
330 |
iMapNavInterface->Release();
|
|
331 |
delete iCatInfoPopupNote;
|
|
332 |
|
|
333 |
if(iListProvider)
|
|
334 |
{
|
|
335 |
iListProvider->RemoveObserver(*this);
|
|
336 |
delete iListProvider;
|
|
337 |
}
|
|
338 |
|
|
339 |
delete iRepository;
|
|
340 |
if (iIsLmOwned && iLandmark)
|
|
341 |
delete iLandmark;
|
|
342 |
}
|
|
343 |
|
|
344 |
// -----------------------------------------------------------------------------
|
|
345 |
// CLmkEditorImpl::SetMopParent
|
|
346 |
// -----------------------------------------------------------------------------
|
|
347 |
//
|
|
348 |
EXPORT_C void CLmkEditorImpl::SetMopParent(MObjectProvider* aParent)
|
|
349 |
{
|
|
350 |
CCoeControl::SetMopParent(aParent);
|
|
351 |
}
|
|
352 |
|
|
353 |
// -----------------------------------------------------------------------------
|
|
354 |
// CLmkEditorImpl::SetHelpContext
|
|
355 |
// -----------------------------------------------------------------------------
|
|
356 |
//
|
|
357 |
EXPORT_C void CLmkEditorImpl::SetHelpContext(TCoeHelpContext aContext)
|
|
358 |
{
|
|
359 |
iHelpContext = aContext;
|
|
360 |
}
|
|
361 |
|
|
362 |
// -----------------------------------------------------------------------------
|
|
363 |
// CLmkEditorImpl::ExecuteL
|
|
364 |
// -----------------------------------------------------------------------------
|
|
365 |
//
|
|
366 |
EXPORT_C TInt CLmkEditorImpl::ExecuteLD()
|
|
367 |
{
|
|
368 |
CleanupStack::PushL(this);
|
|
369 |
AttachAIWMenuInterestL();
|
|
370 |
CleanupStack::Pop();//this
|
|
371 |
if (iEditorMode == CLmkEditorDlg::ELmkEditor)
|
|
372 |
{
|
|
373 |
iIsEditing = ETrue;
|
|
374 |
return CAknForm::ExecuteLD(R_LMK_EDITOR_DIALOG);
|
|
375 |
}
|
|
376 |
else // viewer/receive state of editor
|
|
377 |
{
|
|
378 |
iIsEditing = EFalse;
|
|
379 |
return CAknForm::ExecuteLD(R_LMK_VIEWER_DIALOG);
|
|
380 |
}
|
|
381 |
}
|
|
382 |
|
|
383 |
// -----------------------------------------------------------------------------
|
|
384 |
// CLmkEditorImpl::DisableMapAndNavigationMenuOptions
|
|
385 |
// -----------------------------------------------------------------------------
|
|
386 |
//
|
|
387 |
EXPORT_C void CLmkEditorImpl::DisableMapAndNavigationMenuOptions()
|
|
388 |
{
|
|
389 |
iMapNavFeature = EFalse;
|
|
390 |
}
|
|
391 |
|
|
392 |
// -----------------------------------------------------------------------------
|
|
393 |
// CLmkEditorImpl::DynInitMenuPaneL
|
|
394 |
// -----------------------------------------------------------------------------
|
|
395 |
//
|
|
396 |
void CLmkEditorImpl::DynInitMenuPaneL(TInt aResourceId,
|
|
397 |
CEikMenuPane* aMenuPane)
|
|
398 |
{
|
|
399 |
switch (aResourceId)
|
|
400 |
{
|
|
401 |
case R_AVKON_FORM_MENUPANE:
|
|
402 |
{
|
|
403 |
CAknForm::DynInitMenuPaneL(aResourceId, aMenuPane);
|
|
404 |
TBool isLandmarkDataEmpty = EFalse;
|
|
405 |
TBool dimClearPos = ETrue;
|
|
406 |
|
|
407 |
// Disable Map and Navigation feature when opted not to show
|
|
408 |
if (!iMapNavFeature)
|
|
409 |
{
|
|
410 |
isLandmarkDataEmpty = ETrue;
|
|
411 |
}
|
|
412 |
else if (iLandmark && iIsHideCoordinate)
|
|
413 |
{
|
|
414 |
isLandmarkDataEmpty = IsLandmarkDataEmptyL(iLandmark);
|
|
415 |
}
|
|
416 |
else
|
|
417 |
{
|
|
418 |
isLandmarkDataEmpty = ArePositionFieldEmptyL();
|
|
419 |
}
|
|
420 |
|
|
421 |
if (isLandmarkDataEmpty)
|
|
422 |
{
|
|
423 |
// delete the show on map & Navigate To options
|
|
424 |
aMenuPane->DeleteMenuItem(ELmkShowOnMapPlaceHolder);
|
|
425 |
aMenuPane->DeleteMenuItem(ELmkNavigateToPlaceHolder);
|
|
426 |
}
|
|
427 |
else if (IsEditable())
|
|
428 |
{
|
|
429 |
// delete the Navigate To option for editor
|
|
430 |
aMenuPane->DeleteMenuItem(ELmkNavigateToPlaceHolder);
|
|
431 |
}
|
|
432 |
|
|
433 |
if (IsEditable())
|
|
434 |
{
|
|
435 |
dimClearPos = ArePositionFieldEmptyL();
|
|
436 |
}
|
|
437 |
|
|
438 |
if (dimClearPos || iIsHideCoordinate)
|
|
439 |
{
|
|
440 |
aMenuPane->SetItemDimmed(ELmkCmdClearPosInfo, ETrue);
|
|
441 |
}
|
|
442 |
|
|
443 |
if (iMapNavFeature)
|
|
444 |
{
|
|
445 |
iMapNavInterface->AttachMenuPaneL(aMenuPane,
|
|
446 |
R_LMK_EDITOR_MENU, ELmkCmdMnNav);
|
|
447 |
}
|
|
448 |
|
|
449 |
// Send menu is handled by the sender:
|
|
450 |
if (FeatureManager::FeatureSupported(KFeatureIdLandmarksConverter))
|
|
451 |
{
|
|
452 |
aMenuPane->SetItemDimmed(ELmkCmdSendDummy, EFalse);
|
|
453 |
iSender.DisplaySendMenuL(*aMenuPane, 1);
|
|
454 |
}
|
|
455 |
else
|
|
456 |
{
|
|
457 |
aMenuPane->SetItemDimmed(ELmkCmdSendDummy, ETrue);
|
|
458 |
}
|
|
459 |
|
|
460 |
if (FeatureManager::FeatureSupported(
|
|
461 |
KFeatureIdLocationFrameworkCore))
|
|
462 |
{
|
|
463 |
aMenuPane->SetItemDimmed(ELmkCmdCurrentLocation,
|
|
464 |
!IsEditable());
|
|
465 |
}
|
|
466 |
else
|
|
467 |
{
|
|
468 |
aMenuPane->SetItemDimmed(ELmkCmdCurrentLocation, ETrue);
|
|
469 |
}
|
|
470 |
|
|
471 |
if (FeatureManager::FeatureSupported(KFeatureIdHelp)
|
|
472 |
&& !iIsHideHelp)
|
|
473 |
{
|
|
474 |
aMenuPane->SetItemDimmed(EAknCmdHelp, EFalse);
|
|
475 |
}
|
|
476 |
else
|
|
477 |
{
|
|
478 |
aMenuPane->SetItemDimmed(EAknCmdHelp, ETrue);
|
|
479 |
}
|
|
480 |
|
|
481 |
//only in edit mode
|
|
482 |
aMenuPane->SetItemDimmed(ELmkCmdSelectCategories, !IsEditable());
|
|
483 |
aMenuPane->SetItemDimmed(ELmkCmdChangeIcon, !IsEditable());
|
|
484 |
|
|
485 |
//additional commands always dimmed in this class:
|
|
486 |
aMenuPane->SetItemDimmed(ELmkCmdSaveLm, ETrue);
|
|
487 |
// Only in view mode
|
|
488 |
aMenuPane->SetItemDimmed(ELmkCmdEditLm, IsEditable());
|
|
489 |
//allways dimmed
|
|
490 |
aMenuPane->SetItemDimmed(EAknFormCmdEdit, ETrue);
|
|
491 |
aMenuPane->SetItemDimmed(EAknFormCmdSave, ETrue);
|
|
492 |
aMenuPane->SetItemDimmed(EAknFormCmdLabel, ETrue);
|
|
493 |
aMenuPane->SetItemDimmed(EAknFormCmdAdd, ETrue);
|
|
494 |
aMenuPane->SetItemDimmed(EAknFormCmdDelete, ETrue);
|
|
495 |
aMenuPane->SetItemDimmed(ELmkCmdCategories, ETrue);
|
|
496 |
aMenuPane->SetItemDimmed(ELmkCmdEditTextLm, ETrue);
|
|
497 |
|
|
498 |
if (IsEditable())
|
|
499 |
{
|
|
500 |
aMenuPane->SetItemDimmed(ELmkCmdCall, ETrue);
|
|
501 |
aMenuPane->SetItemDimmed(ELmkCmdGoToUrl, ETrue);
|
|
502 |
}
|
|
503 |
else
|
|
504 |
{
|
|
505 |
MLmkFieldData* field = iLmkFields->GetField(EPhoneNumber);
|
|
506 |
if (field)
|
|
507 |
{
|
|
508 |
TInt id = field->UniqueFieldIdentity();
|
|
509 |
MLmkEditorField* control = iEditorFieldArray->Find(id);
|
|
510 |
if ((!control) || GetFieldTextLengthL(*control) <= 0)
|
|
511 |
{
|
|
512 |
aMenuPane->SetItemDimmed(ELmkCmdCall, ETrue);
|
|
513 |
}
|
|
514 |
|
|
515 |
MLmkFieldData* field2 = iLmkFields->GetField(EWebAddress);
|
|
516 |
if (field2)
|
|
517 |
{
|
|
518 |
TInt id2 = field2->UniqueFieldIdentity();
|
|
519 |
control = iEditorFieldArray->Find(id2);
|
|
520 |
if ((!control) || GetFieldTextLengthL(*control) <= 0)
|
|
521 |
{
|
|
522 |
aMenuPane->SetItemDimmed(ELmkCmdGoToUrl, ETrue);
|
|
523 |
}
|
|
524 |
}
|
|
525 |
}
|
|
526 |
}
|
|
527 |
break;
|
|
528 |
}
|
|
529 |
case R_SENDUI_MENU: // Dynamically created send ui menu
|
|
530 |
{
|
|
531 |
// Send menu is handled by the sender:
|
|
532 |
if (FeatureManager::FeatureSupported(KFeatureIdLandmarksConverter))
|
|
533 |
{
|
|
534 |
iSender.DisplaySendCascadeMenuL(*aMenuPane);
|
|
535 |
}
|
|
536 |
break;
|
|
537 |
}
|
|
538 |
case R_LMK_EDITOR_CONTEXT_MENU:
|
|
539 |
{
|
|
540 |
MLmkEditorField* field = iEditorFieldArray->Find(
|
|
541 |
IdOfFocusControl());
|
|
542 |
TUint type = field->LandmarkItemField().FieldType();
|
|
543 |
|
|
544 |
if (type != EPhoneNumber)
|
|
545 |
{
|
|
546 |
aMenuPane->SetItemDimmed(ELmkEditMenuAiwId, ETrue);
|
|
547 |
}
|
|
548 |
if (type != EWebAddress)
|
|
549 |
{
|
|
550 |
aMenuPane->SetItemDimmed(ELmkCmdGoToUrl, ETrue);
|
|
551 |
}
|
|
552 |
if (type == EPhoneNumber)
|
|
553 |
{
|
|
554 |
if (GetFieldTextLengthL(*field) <= 0)
|
|
555 |
{
|
|
556 |
aMenuPane->SetItemDimmed(ELmkEditMenuAiwId, ETrue);
|
|
557 |
}
|
|
558 |
}
|
|
559 |
if (type == EWebAddress)
|
|
560 |
{
|
|
561 |
if (GetFieldTextLengthL(*field) <= 0)
|
|
562 |
{
|
|
563 |
aMenuPane->SetItemDimmed(ELmkCmdGoToUrl, ETrue);
|
|
564 |
}
|
|
565 |
}
|
|
566 |
break;
|
|
567 |
}
|
|
568 |
case R_LMK_EDITOR_CALL_SUBMENU:
|
|
569 |
{
|
|
570 |
// Initialize the AIW menu service
|
|
571 |
// Must not overlap with other menu ids
|
|
572 |
iLmkCallCmd->InitializeMenuPaneL(*aMenuPane, aResourceId,
|
|
573 |
ELmkCmdLast);
|
|
574 |
break;
|
|
575 |
}
|
|
576 |
default:
|
|
577 |
{
|
|
578 |
break;
|
|
579 |
}
|
|
580 |
}
|
|
581 |
iMapNavInterface->HandleMenuOperationL(aResourceId, aMenuPane,
|
|
582 |
ELmkCmdMnNav);
|
|
583 |
}
|
|
584 |
|
|
585 |
// -----------------------------------------------------------------------------
|
|
586 |
// CLmkEditorImpl::IsLandmarkDataEmptyL
|
|
587 |
// -----------------------------------------------------------------------------
|
|
588 |
//
|
|
589 |
TBool CLmkEditorImpl::IsLandmarkDataEmptyL(CPosLandmark* aLandmark)
|
|
590 |
{
|
|
591 |
// verify that destination landmark has coordinates
|
|
592 |
TLocality loc;
|
|
593 |
TBool isValid = (KErrNone == aLandmark->GetPosition(loc));
|
|
594 |
isValid &= !Math::IsNaN(loc.Latitude()) && !Math::IsNaN(loc.Longitude());
|
|
595 |
return !isValid;
|
|
596 |
|
|
597 |
/* if (!isValid)
|
|
598 |
{
|
|
599 |
// verify that destination landmark has address info
|
|
600 |
TPositionFieldId fieldId = aLandmark->FirstPositionFieldId();
|
|
601 |
while (fieldId != EPositionFieldNone)
|
|
602 |
{
|
|
603 |
if (fieldId > EPositionFieldAddressCapabilitiesBegin && fieldId
|
|
604 |
< EPositionFieldBuildingTelephone)
|
|
605 |
{
|
|
606 |
TPtrC field;
|
|
607 |
aLandmark->GetPositionField(fieldId, field);
|
|
608 |
if (field.Length())
|
|
609 |
{
|
|
610 |
isValid = ETrue;
|
|
611 |
break;
|
|
612 |
}
|
|
613 |
}
|
|
614 |
fieldId = aLandmark->NextPositionFieldId(fieldId);
|
|
615 |
}
|
|
616 |
}
|
|
617 |
return !isValid;*/
|
|
618 |
}
|
|
619 |
|
|
620 |
// -----------------------------------------------------------------------------
|
|
621 |
// CLmkEditorImpl::ProcessCommandL
|
|
622 |
// -----------------------------------------------------------------------------
|
|
623 |
//
|
|
624 |
void CLmkEditorImpl::ProcessCommandL(TInt aCommandId)
|
|
625 |
{
|
|
626 |
DEBUG1( CLmkEditorImpl::ProcessCommandL aCommandId=%d, aCommandId );
|
|
627 |
// Hide the context sensitive menu here
|
|
628 |
HideMenu();
|
|
629 |
iContextMenuBar->StopDisplayingMenuBar();
|
|
630 |
|
|
631 |
CAknDialog::ProcessCommandL(aCommandId);
|
|
632 |
TInt aiwCmd = iMapNavInterface->GetServiceCmdByMenuCmd(aCommandId);
|
|
633 |
|
|
634 |
// Handles Map and Navigation commands
|
|
635 |
if (KAiwCmdNone != aiwCmd)
|
|
636 |
{
|
|
637 |
// Landmark array to pass to M&N interface
|
|
638 |
RPointerArray<CPosLandmark> lmkArray;
|
|
639 |
switch (aiwCmd)
|
|
640 |
{
|
|
641 |
case KAiwCmdMnShowMap:
|
|
642 |
{
|
|
643 |
CPosLandmark* landmark = GetCurrentEditedLandmarkL();
|
|
644 |
lmkArray.Append(landmark);
|
|
645 |
CleanupStack::PushL(TCleanupItem(CleanupArray, &lmkArray));
|
|
646 |
iMapNavInterface->ShowLandmarksOnMapL(lmkArray, aCommandId,
|
|
647 |
CLmkMapNavigationInterface::EByLmkView);
|
|
648 |
CleanupStack::PopAndDestroy(); //lmkArray
|
|
649 |
break;
|
|
650 |
}
|
|
651 |
case KAiwCmdMnNavigateTo:
|
|
652 |
{
|
|
653 |
CPosLandmark* landmark = GetCurrentEditedLandmarkL();
|
|
654 |
lmkArray.Append(landmark);
|
|
655 |
CleanupStack::PushL(TCleanupItem(CleanupArray, &lmkArray));
|
|
656 |
iMapNavInterface->NavigateToLandmarkL(lmkArray[0], aCommandId);
|
|
657 |
CleanupStack::PopAndDestroy(); //lmkArray
|
|
658 |
break;
|
|
659 |
}
|
|
660 |
}
|
|
661 |
lmkArray.Reset();
|
|
662 |
return;
|
|
663 |
}
|
|
664 |
switch (aCommandId)
|
|
665 |
{
|
|
666 |
case EAknCmdHelp:
|
|
667 |
{
|
|
668 |
HlpLauncher::LaunchHelpApplicationL(
|
|
669 |
iEikonEnv->WsSession(),
|
|
670 |
static_cast<CAknAppUi*> (iCoeEnv->AppUi())->AppHelpContextL());
|
|
671 |
break;
|
|
672 |
}
|
|
673 |
// these all are same: save & exit
|
|
674 |
case EAknSoftkeyBack:
|
|
675 |
case EAknSoftkeyExit:
|
|
676 |
case EEikCmdExit:
|
|
677 |
case EAknCmdExit:
|
|
678 |
{
|
|
679 |
CAknForm::OkToExitL(aCommandId);
|
|
680 |
iLmkUiUtils->RestoreOldNaviPaneL();
|
|
681 |
CEikAppUi* appUi = iEikonEnv->EikAppUi();
|
|
682 |
// Close this dialog first
|
|
683 |
delete this;
|
|
684 |
// Exit application
|
|
685 |
static_cast<MEikCommandObserver*> (appUi)->ProcessCommandL(
|
|
686 |
aCommandId);
|
|
687 |
break;
|
|
688 |
}
|
|
689 |
case ELmkCmdDeleteLm:
|
|
690 |
{
|
|
691 |
if (LmkNotes::LandmarkConfirmationQueryL(iEikonEnv))
|
|
692 |
{
|
|
693 |
iLmkFields->DeleteLandmarkL();
|
|
694 |
iLmkUiUtils->RestoreOldNaviPaneL();
|
|
695 |
iIsEditing = EFalse;
|
|
696 |
delete this;
|
|
697 |
}
|
|
698 |
break;
|
|
699 |
}
|
|
700 |
case ELmkCmdSelectCategories:
|
|
701 |
{
|
|
702 |
if (!iIsCategorySelctorOpen)
|
|
703 |
{
|
|
704 |
iIsCategorySelctorOpen = ETrue;
|
|
705 |
SelectCategoriesCmdL();
|
|
706 |
}
|
|
707 |
break;
|
|
708 |
}
|
|
709 |
case ELmkCmdChangeIcon:
|
|
710 |
{
|
|
711 |
ChangeIconCmdL();
|
|
712 |
break;
|
|
713 |
}
|
|
714 |
case ELmkCmdCurrentLocation:
|
|
715 |
{
|
|
716 |
CurrentLocationCmdL();
|
|
717 |
break;
|
|
718 |
}
|
|
719 |
case ELmkCmdSendVia1:
|
|
720 |
case ELmkCmdSendVia2:
|
|
721 |
case ELmkCmdSendVia3:
|
|
722 |
case ELmkCmdSendVia4:
|
|
723 |
case ELmkCmdSendVia5:
|
|
724 |
case ELmkCmdSendVia6:
|
|
725 |
case ELmkCmdSendVia7:
|
|
726 |
case ELmkCmdSendVia8:
|
|
727 |
case ELmkCmdSendVia9:
|
|
728 |
case ELmkCmdSendVia10:
|
|
729 |
case ELmkCmdSend:
|
|
730 |
{
|
|
731 |
if (!IsNameFieldEmptyL())
|
|
732 |
{
|
|
733 |
// Obtain the current landmark object
|
|
734 |
CPosLandmark* lmk = GetCurrentEditedLandmarkL();
|
|
735 |
CleanupStack::PushL(lmk);
|
|
736 |
iSender.SendSingleLandmarkL(*lmk);
|
|
737 |
CleanupStack::PopAndDestroy(lmk);
|
|
738 |
}
|
|
739 |
else
|
|
740 |
{
|
|
741 |
DoNotSaveFormDataL();
|
|
742 |
}
|
|
743 |
break;
|
|
744 |
}
|
|
745 |
case ELmkCmdGoToUrl:
|
|
746 |
{
|
|
747 |
// Get URL field
|
|
748 |
MLmkFieldData* field = iLmkFields->GetField(EWebAddress);
|
|
749 |
if (field)
|
|
750 |
{
|
|
751 |
TInt id = field->UniqueFieldIdentity();
|
|
752 |
MLmkEditorField* control = iEditorFieldArray->Find(id);
|
|
753 |
if (control)
|
|
754 |
{
|
|
755 |
HBufC* fieldText = control->ControlTextL();
|
|
756 |
CleanupStack::PushL(fieldText);
|
|
757 |
TPtr urlPtr = fieldText->Des();
|
|
758 |
if (urlPtr.Length() > 0)
|
|
759 |
{
|
|
760 |
iLmkGoToURLCmd->LaunchBrowserL(urlPtr);
|
|
761 |
}
|
|
762 |
CleanupStack::PopAndDestroy(fieldText);
|
|
763 |
}
|
|
764 |
}
|
|
765 |
break;
|
|
766 |
}
|
|
767 |
case ELmkCmdEditLm:
|
|
768 |
{
|
|
769 |
if (!iIsEditing)
|
|
770 |
{
|
|
771 |
LaunchLmkEditorL();
|
|
772 |
}
|
|
773 |
break;
|
|
774 |
}
|
|
775 |
case ELmkCmdCall:
|
|
776 |
case ELmkCmdLast:
|
|
777 |
{
|
|
778 |
MLmkFieldData* field = iLmkFields->GetField(EPhoneNumber);
|
|
779 |
if (field)
|
|
780 |
{
|
|
781 |
TInt id = field->UniqueFieldIdentity();
|
|
782 |
MLmkEditorField* control = iEditorFieldArray->Find(id);
|
|
783 |
if (control)
|
|
784 |
{
|
|
785 |
HBufC* fieldText = control->ControlTextL();
|
|
786 |
CleanupStack::PushL(fieldText);
|
|
787 |
if (fieldText && fieldText->Length() > 0)
|
|
788 |
{
|
|
789 |
//Check if any active character or not
|
|
790 |
TPtr ptr = fieldText->Des();
|
|
791 |
ptr.Trim();
|
|
792 |
if (ptr.Length() > 0)
|
|
793 |
{
|
|
794 |
//modified for 3.2, since command is not coming
|
|
795 |
//from menu item, hence need to pass diff command.
|
|
796 |
//this code needs some more modification to make it
|
|
797 |
//genericly work for all the commands.
|
|
798 |
iLmkCallCmd->ExecuteAIWCallCmdL(ELmkCmdCall, ptr);
|
|
799 |
}
|
|
800 |
}
|
|
801 |
CleanupStack::PopAndDestroy(fieldText);
|
|
802 |
}
|
|
803 |
}
|
|
804 |
break;
|
|
805 |
}
|
|
806 |
case ELmkCmdShow:
|
|
807 |
{
|
|
808 |
MLmkEditorField* field = iEditorFieldArray->Find(
|
|
809 |
IdOfFocusControl());
|
|
810 |
TUint type = field->LandmarkItemField().FieldType();
|
|
811 |
if (type == ECategories)
|
|
812 |
{
|
|
813 |
if (iCalegorySelectionFlag) // Receive mode
|
|
814 |
{
|
|
815 |
CategoriesCmdFromXmlL();
|
|
816 |
}
|
|
817 |
else
|
|
818 |
{
|
|
819 |
CategoriesCmdL(); // View mode
|
|
820 |
}
|
|
821 |
}
|
|
822 |
break;
|
|
823 |
}
|
|
824 |
case ELmkCmdClearPosInfo:
|
|
825 |
{
|
|
826 |
ClearPositionInfoL();
|
|
827 |
break;
|
|
828 |
}
|
|
829 |
default:
|
|
830 |
{
|
|
831 |
CAknForm::ProcessCommandL(aCommandId);
|
|
832 |
break;
|
|
833 |
}
|
|
834 |
}
|
|
835 |
}
|
|
836 |
|
|
837 |
// -----------------------------------------------------------------------------
|
|
838 |
// CLmkEditorImpl::HandleControlStateChangeL
|
|
839 |
// -----------------------------------------------------------------------------
|
|
840 |
//
|
|
841 |
void CLmkEditorImpl::HandleControlStateChangeL(TInt aControlId)
|
|
842 |
{
|
|
843 |
MLmkEditorField* changedField = iEditorFieldArray->Find(aControlId);
|
|
844 |
if (changedField)
|
|
845 |
{
|
|
846 |
if (changedField->LandmarkItemField().IsTitleField())
|
|
847 |
{
|
|
848 |
HBufC* title = changedField->ControlTextL();
|
|
849 |
CleanupStack::PushL(title);
|
|
850 |
if (!title)
|
|
851 |
{
|
|
852 |
title = HBufC::New(0);
|
|
853 |
}
|
|
854 |
iLmkUiUtils->ChangeTitlePaneL(title);
|
|
855 |
CleanupStack::Pop(); //title
|
|
856 |
}
|
|
857 |
}
|
|
858 |
}
|
|
859 |
|
|
860 |
// -----------------------------------------------------------------------------
|
|
861 |
// CLmkEditorImpl::DoNotSaveFormDataL
|
|
862 |
// -----------------------------------------------------------------------------
|
|
863 |
//
|
|
864 |
void CLmkEditorImpl::DoNotSaveFormDataL()
|
|
865 |
{
|
|
866 |
if (!iIsEndKey)
|
|
867 |
{
|
|
868 |
LmkNotes::InformationNoteL(iEikonEnv, R_LMK_EMPTY_LANDMARK_NAME_NOTE);
|
|
869 |
}
|
|
870 |
MLmkFieldData* field = iLmkFields->GetField(EName);
|
|
871 |
if (field)
|
|
872 |
{
|
|
873 |
TInt id = field->UniqueFieldIdentity();
|
|
874 |
TryChangeFocusL(id);
|
|
875 |
}
|
|
876 |
CAknForm::SetInitialCurrentLine();
|
|
877 |
}
|
|
878 |
|
|
879 |
// -----------------------------------------------------------------------------
|
|
880 |
// CLmkEditorImpl::GetHelpContext
|
|
881 |
// -----------------------------------------------------------------------------
|
|
882 |
//
|
|
883 |
void CLmkEditorImpl::GetHelpContext(TCoeHelpContext& aContext) const
|
|
884 |
{
|
|
885 |
if (iHelpContext.iContext.Length() > 0)
|
|
886 |
{
|
|
887 |
aContext.iContext = iHelpContext.iContext;
|
|
888 |
aContext.iMajor = iHelpContext.iMajor;
|
|
889 |
}
|
|
890 |
else if (iEditorMode == CLmkEditorDlg::ELmkViewer)
|
|
891 |
{
|
|
892 |
aContext.iContext = KLM_HLP_LM_VIEWER;
|
|
893 |
aContext.iMajor = TUid::Uid(KLmkAppUID3);
|
|
894 |
}
|
|
895 |
else
|
|
896 |
{
|
|
897 |
aContext.iContext = KLM_HLP_LM_EDITOR;
|
|
898 |
aContext.iMajor = TUid::Uid(KLmkAppUID3);
|
|
899 |
}
|
|
900 |
}
|
|
901 |
|
|
902 |
// -----------------------------------------------------------------------------
|
|
903 |
// CLmkEditorImpl::OfferKeyEventL
|
|
904 |
// -----------------------------------------------------------------------------
|
|
905 |
//
|
|
906 |
TKeyResponse CLmkEditorImpl::OfferKeyEventL(const TKeyEvent& aKeyEvent,
|
|
907 |
TEventCode aType)
|
|
908 |
{
|
|
909 |
/**
|
|
910 |
* By def, dialog opens in view mode
|
|
911 |
* selecting 'edit' option from (either from context menu/options menu)
|
|
912 |
* to edit landmark fields
|
|
913 |
*
|
|
914 |
*/
|
|
915 |
if (IsEditable())
|
|
916 |
{
|
|
917 |
//always dimmed for the editor
|
|
918 |
DimmMiddleSoftKey();
|
|
919 |
}
|
|
920 |
else if (aKeyEvent.iCode == EKeyBackspace)
|
|
921 |
{
|
|
922 |
if (!IsEditable() && iIsLmkReceiveMode == EFalse)
|
|
923 |
{
|
|
924 |
ProcessCommandL(ELmkCmdDeleteLm);
|
|
925 |
return EKeyWasConsumed;
|
|
926 |
}
|
|
927 |
}
|
|
928 |
else if (aKeyEvent.iCode == EKeyPhoneEnd)
|
|
929 |
{
|
|
930 |
iIsEndKey = ETrue;
|
|
931 |
OkToExitL(EAknSoftkeyDone);
|
|
932 |
}
|
|
933 |
else // for 'sendkey' handling
|
|
934 |
{
|
|
935 |
if (aKeyEvent.iCode == EKeyPhoneSend && (!IsEditable())
|
|
936 |
&& (!Layout_Meta_Data::IsPenEnabled()))
|
|
937 |
{
|
|
938 |
// Get Landmark's telephone number
|
|
939 |
TPosLmItemId lmId = iLmkFields->LandmarkId();
|
|
940 |
CPosLandmark* landmark = iDb.ReadLandmarkLC(lmId);
|
|
941 |
// Get phone num field
|
|
942 |
if (landmark->IsPositionFieldAvailable(
|
|
943 |
ELmkPositionFieldPhoneNumber))
|
|
944 |
{
|
|
945 |
TPtrC telnumPtr;
|
|
946 |
if ((landmark->GetPositionField(ELmkPositionFieldPhoneNumber,
|
|
947 |
telnumPtr) == KErrNone) && (telnumPtr.Length() > 0))
|
|
948 |
{
|
|
949 |
iLmkCallCmd->ExecuteAIWCallCmdL(ELmkCmdCall, telnumPtr);
|
|
950 |
}
|
|
951 |
else
|
|
952 |
{
|
|
953 |
// Get name
|
|
954 |
TPtrC lmkNamePtr;
|
|
955 |
if (landmark->GetLandmarkName(lmkNamePtr) == KErrNone)
|
|
956 |
{
|
|
957 |
LmkNotes::InformationNotewithTextL(iEikonEnv,
|
|
958 |
R_LMK_NOTE_NO_NUMBER_TO_NAME, lmkNamePtr);
|
|
959 |
}
|
|
960 |
}
|
|
961 |
}
|
|
962 |
CleanupStack::PopAndDestroy(landmark);
|
|
963 |
}
|
|
964 |
}
|
|
965 |
|
|
966 |
if (aType == EEventKey && (aKeyEvent.iCode == EKeyEnter
|
|
967 |
|| aKeyEvent.iScanCode == EStdKeyEnter))
|
|
968 |
{
|
|
969 |
TBool isCategoryField = EFalse;
|
|
970 |
MLmkEditorField* field = iEditorFieldArray->Find(IdOfFocusControl());
|
|
971 |
TUint type = field->LandmarkItemField().FieldType();
|
|
972 |
|
|
973 |
if (type == ECategory || type == ECategories)
|
|
974 |
isCategoryField = ETrue;
|
|
975 |
|
|
976 |
// check the editor mode and category field focus
|
|
977 |
if (IsEditable() == EFalse || isCategoryField)
|
|
978 |
{
|
|
979 |
TKeyEvent enterKeyEvent(aKeyEvent);
|
|
980 |
enterKeyEvent.iCode = EKeyOK;
|
|
981 |
CEikButtonGroupContainer* cba =
|
|
982 |
CEikButtonGroupContainer::Current();
|
|
983 |
return cba->OfferKeyEventL(enterKeyEvent, aType);
|
|
984 |
}
|
|
985 |
}
|
|
986 |
TKeyResponse response = CAknForm::OfferKeyEventL(aKeyEvent, aType);
|
|
987 |
return response;
|
|
988 |
}
|
|
989 |
|
|
990 |
// -----------------------------------------------------------------------------
|
|
991 |
// CLmkEditorImpl::NotifyL
|
|
992 |
// -----------------------------------------------------------------------------
|
|
993 |
//
|
|
994 |
void CLmkEditorImpl::NotifyL(const TInt aStatus)
|
|
995 |
{
|
|
996 |
// Stop the running wait dialog
|
|
997 |
TInt buttonId = iWaitDialogLauncher->StopWaitDialogL();
|
|
998 |
if (EEikBidCancel != buttonId)
|
|
999 |
{
|
|
1000 |
switch (aStatus)
|
|
1001 |
{
|
|
1002 |
case KErrNone:
|
|
1003 |
case KPositionPartialUpdate:
|
|
1004 |
{
|
|
1005 |
if (iLocationService)
|
|
1006 |
{
|
|
1007 |
TPosition position = iLocationService->CurrentPosition();
|
|
1008 |
SetCurrentLocationL(position);
|
|
1009 |
}
|
|
1010 |
break;
|
|
1011 |
}
|
|
1012 |
default:
|
|
1013 |
{
|
|
1014 |
break;
|
|
1015 |
}
|
|
1016 |
}
|
|
1017 |
}
|
|
1018 |
delete iLocationService;
|
|
1019 |
iLocationService = NULL;
|
|
1020 |
}
|
|
1021 |
|
|
1022 |
// -----------------------------------------------------------------------------
|
|
1023 |
// CLmkEditorImpl::NotifyErrorL
|
|
1024 |
// -----------------------------------------------------------------------------
|
|
1025 |
//
|
|
1026 |
void CLmkEditorImpl::NotifyErrorL(TInt aErrorCode)
|
|
1027 |
{
|
|
1028 |
// Stop the running wait dialog
|
|
1029 |
TInt buttonId = iWaitDialogLauncher->StopWaitDialogL();
|
|
1030 |
|
|
1031 |
delete iLocationService;
|
|
1032 |
iLocationService = NULL;
|
|
1033 |
|
|
1034 |
if (EEikBidCancel != buttonId)
|
|
1035 |
{
|
|
1036 |
switch (aErrorCode)
|
|
1037 |
{
|
|
1038 |
case KPositionQualityLoss:
|
|
1039 |
case KErrTimedOut:
|
|
1040 |
case KErrNotFound: // No PSY selected.
|
|
1041 |
case KErrUnknown:
|
|
1042 |
case KErrCancel:
|
|
1043 |
case KErrArgument:
|
|
1044 |
default:
|
|
1045 |
// The above errors are because of location request failures
|
|
1046 |
// Ask user to retry location request
|
|
1047 |
{
|
|
1048 |
if (LmkNotes::MessageQueryWithLinkL(iEikonEnv,
|
|
1049 |
R_LMK_MSG_QUERY_HEADING_PANE_TEXT,
|
|
1050 |
R_LMK_CONF_RETRY_LOCATION_REQUEST,
|
|
1051 |
R_LMK_REQUEST_FAIL_MORE_INFO, MessageQueryCallBack))
|
|
1052 |
{
|
|
1053 |
if (iLocationService)
|
|
1054 |
{
|
|
1055 |
delete iLocationService;
|
|
1056 |
iLocationService = NULL;
|
|
1057 |
}
|
|
1058 |
CurrentLocationCmdL();
|
|
1059 |
}
|
|
1060 |
}
|
|
1061 |
}
|
|
1062 |
}
|
|
1063 |
}
|
|
1064 |
|
|
1065 |
// -----------------------------------------------------------------------------
|
|
1066 |
// CLmkEditorImpl::CreateCustomControlL
|
|
1067 |
// -----------------------------------------------------------------------------
|
|
1068 |
//
|
|
1069 |
SEikControlInfo CLmkEditorImpl::CreateCustomControlL(TInt /*aControlType*/)
|
|
1070 |
{
|
|
1071 |
SEikControlInfo ctrl;
|
|
1072 |
ctrl.iControl = NULL;
|
|
1073 |
ctrl.iTrailerTextId = 0;
|
|
1074 |
ctrl.iFlags = 0;
|
|
1075 |
/*switch( aControlType )
|
|
1076 |
{
|
|
1077 |
case EDistanceEditorType:
|
|
1078 |
{
|
|
1079 |
ctrl.iControl = new(ELeave) CLmkDistanceEditor();
|
|
1080 |
break;
|
|
1081 |
}
|
|
1082 |
default:
|
|
1083 |
{
|
|
1084 |
break;
|
|
1085 |
}
|
|
1086 |
}*/
|
|
1087 |
return ctrl;
|
|
1088 |
}
|
|
1089 |
|
|
1090 |
// ----------------------------------------------------
|
|
1091 |
// CLmkEditorImpl::ConvertCustomControlTypeToBaseControlType
|
|
1092 |
// ----------------------------------------------------
|
|
1093 |
//
|
|
1094 |
MEikDialogPageObserver::TFormControlTypes CLmkEditorImpl::ConvertCustomControlTypeToBaseControlType(
|
|
1095 |
TInt aControlType) const
|
|
1096 |
{
|
|
1097 |
switch (aControlType)
|
|
1098 |
{
|
|
1099 |
case EDistanceEditorType:
|
|
1100 |
{
|
|
1101 |
return MEikDialogPageObserver::EMfneDerived;
|
|
1102 |
//break;
|
|
1103 |
}
|
|
1104 |
default:
|
|
1105 |
{
|
|
1106 |
return MEikDialogPageObserver::EUnknownType;
|
|
1107 |
//break;
|
|
1108 |
}
|
|
1109 |
}
|
|
1110 |
}
|
|
1111 |
|
|
1112 |
// -----------------------------------------------------------------------------
|
|
1113 |
// CLmkEditorImpl::PreLayoutDynInitL
|
|
1114 |
// -----------------------------------------------------------------------------
|
|
1115 |
//
|
|
1116 |
void CLmkEditorImpl::PreLayoutDynInitL()
|
|
1117 |
{
|
|
1118 |
CAknForm::PreLayoutDynInitL();
|
|
1119 |
// When adding fields the form must be editable:
|
|
1120 |
SetEditableL(ETrue);
|
|
1121 |
if (iCalegorySelectionFlag && iCategoryNames.Count() >= 1)
|
|
1122 |
iEditorFieldArray->SetCategoryName(iCategoryNames[0]);
|
|
1123 |
iEditorFieldArray->CreateFieldsFromLmkL();
|
|
1124 |
SetEditableL(EFalse);
|
|
1125 |
CAknForm::SetInitialCurrentLine();
|
|
1126 |
}
|
|
1127 |
|
|
1128 |
// -----------------------------------------------------------------------------
|
|
1129 |
// CLmkEditorImpl::PostLayoutDynInitL
|
|
1130 |
// -----------------------------------------------------------------------------
|
|
1131 |
//
|
|
1132 |
void CLmkEditorImpl::PostLayoutDynInitL()
|
|
1133 |
{
|
|
1134 |
CAknForm::PostLayoutDynInitL();
|
|
1135 |
MLmkFieldData* fields = iLmkFields->GetField(EName);
|
|
1136 |
if (fields)
|
|
1137 |
{
|
|
1138 |
TPtrC name = fields->TextData();
|
|
1139 |
//ChangeTitle
|
|
1140 |
HBufC* title = name.Alloc();
|
|
1141 |
CleanupStack::PushL(title);
|
|
1142 |
iLmkUiUtils->StoreTitlePaneL(); // save old title pane
|
|
1143 |
iLmkUiUtils->ChangeTitlePaneL(title); //take ownership
|
|
1144 |
CleanupStack::Pop(title); //title
|
|
1145 |
}
|
|
1146 |
|
|
1147 |
SetEditableL(iEditorMode == CLmkEditorDlg::ELmkEditor);
|
|
1148 |
CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current();
|
|
1149 |
cba->UpdateCommandObserverL(KMskCommandPos, *this);
|
|
1150 |
if (!IsEditable())
|
|
1151 |
{
|
|
1152 |
AddMskCommandL(R_LM_MSK_EDIT, ELmkCmdEditLm);
|
|
1153 |
}
|
|
1154 |
else
|
|
1155 |
{
|
|
1156 |
//only for editor
|
|
1157 |
DimmMiddleSoftKey();
|
|
1158 |
if (iFieldTypeToFocus == ECategory || iFieldTypeToFocus
|
|
1159 |
== ECategories)
|
|
1160 |
{
|
|
1161 |
AddMskCommandL(R_LM_MSK_EDIT, ELmkCmdSelectCategories);
|
|
1162 |
}
|
|
1163 |
}
|
|
1164 |
}
|
|
1165 |
|
|
1166 |
// -----------------------------------------------------------------------------
|
|
1167 |
// CLmkEditorImpl::OkToExitL
|
|
1168 |
// -----------------------------------------------------------------------------
|
|
1169 |
//
|
|
1170 |
TBool CLmkEditorImpl::OkToExitL(TInt aKeyCode)
|
|
1171 |
{
|
|
1172 |
DEBUG( CLmkEditorImpl::OkToExitL start );
|
|
1173 |
TBool ret = EFalse;
|
|
1174 |
switch (aKeyCode)
|
|
1175 |
{
|
|
1176 |
case EAknSoftkeyDone:
|
|
1177 |
{
|
|
1178 |
if (IsEditable())
|
|
1179 |
{
|
|
1180 |
if (iEditorFieldArray->AreAllFieldsEmptyL())
|
|
1181 |
{
|
|
1182 |
if (iLandmark && iIsHideCoordinate)
|
|
1183 |
{
|
|
1184 |
TLocality locality;
|
|
1185 |
iLandmark->GetPosition(locality);
|
|
1186 |
if (!Math::IsNaN(locality.Latitude()))
|
|
1187 |
{
|
|
1188 |
DoNotSaveFormDataL();
|
|
1189 |
iIsEndKey = EFalse;
|
|
1190 |
// Stay back in the editor mode
|
|
1191 |
break;
|
|
1192 |
}
|
|
1193 |
}
|
|
1194 |
TRAPD(err,CPosLandmark* landmark = iDb.ReadLandmarkLC(iLmkFields->LandmarkId());CleanupStack::PopAndDestroy( landmark ));
|
|
1195 |
if (err == KErrNotFound)
|
|
1196 |
{
|
|
1197 |
// The Landmark is not in the database.Dont save the
|
|
1198 |
// landmark. Just return
|
|
1199 |
// Don't save when all landmark fields are empty
|
|
1200 |
iLmkUiUtils->RestoreOldNaviPaneL();
|
|
1201 |
ret = ETrue;
|
|
1202 |
}
|
|
1203 |
else
|
|
1204 |
{
|
|
1205 |
// The landmark is in the database. Hence, confirm
|
|
1206 |
// from the user whether he wants to delete the
|
|
1207 |
// landmark
|
|
1208 |
if (LmkNotes::LandmarkConfirmationQueryL(iEikonEnv))
|
|
1209 |
{
|
|
1210 |
iLmkFields->DeleteLandmarkL();
|
|
1211 |
iLmkUiUtils->RestoreOldNaviPaneL();
|
|
1212 |
ret = ETrue;
|
|
1213 |
}
|
|
1214 |
else
|
|
1215 |
{
|
|
1216 |
// Stay back in the editor mode
|
|
1217 |
ret = EFalse;
|
|
1218 |
}
|
|
1219 |
}
|
|
1220 |
|
|
1221 |
}
|
|
1222 |
else
|
|
1223 |
{
|
|
1224 |
if (!ValidateContentL())
|
|
1225 |
{
|
|
1226 |
ret = EFalse;
|
|
1227 |
return ret;
|
|
1228 |
}
|
|
1229 |
else
|
|
1230 |
{
|
|
1231 |
/**
|
|
1232 |
* Do not save landmark if disc space is not
|
|
1233 |
* enough
|
|
1234 |
*/
|
|
1235 |
TRAPD( err, iEditorFieldArray->SaveFieldsL() );
|
|
1236 |
if (err == KErrDiskFull)
|
|
1237 |
{
|
|
1238 |
ret = EFalse;
|
|
1239 |
LmkNotes::OutOfMemoryNoteL(iEikonEnv);
|
|
1240 |
delete this;
|
|
1241 |
return ret;
|
|
1242 |
}
|
|
1243 |
|
|
1244 |
if (iLandmarkItemId)
|
|
1245 |
{
|
|
1246 |
*iLandmarkItemId = iLmkFields->LandmarkId();
|
|
1247 |
}
|
|
1248 |
iLmkUiUtils->RestoreOldNaviPaneL();
|
|
1249 |
ret = ETrue;
|
|
1250 |
}
|
|
1251 |
}
|
|
1252 |
}
|
|
1253 |
else
|
|
1254 |
{
|
|
1255 |
iLmkUiUtils->RestoreOldNaviPaneL();
|
|
1256 |
ret = ETrue;
|
|
1257 |
}
|
|
1258 |
break;
|
|
1259 |
}
|
|
1260 |
default:
|
|
1261 |
break;
|
|
1262 |
}
|
|
1263 |
if (!ret)
|
|
1264 |
{
|
|
1265 |
ret = CAknForm::OkToExitL(aKeyCode);
|
|
1266 |
}
|
|
1267 |
DEBUG1( CLmkEditorImpl::OkToExitL start ret=%d,ret );
|
|
1268 |
return ret;
|
|
1269 |
}
|
|
1270 |
|
|
1271 |
// -----------------------------------------------------------------------------
|
|
1272 |
// CLmkEditorImpl::CreateLineL
|
|
1273 |
// -----------------------------------------------------------------------------
|
|
1274 |
//
|
|
1275 |
CCoeControl* CLmkEditorImpl::CreateLineL(const TDesC& aCaption,
|
|
1276 |
TInt aControlId, TInt aControlType)
|
|
1277 |
{
|
|
1278 |
return CreateLineByTypeL(aCaption, aControlId, aControlType, NULL);
|
|
1279 |
}
|
|
1280 |
|
|
1281 |
// -----------------------------------------------------------------------------
|
|
1282 |
// CLmkEditorImpl::LineControl
|
|
1283 |
// -----------------------------------------------------------------------------
|
|
1284 |
//
|
|
1285 |
CEikCaptionedControl* CLmkEditorImpl::LineControl(TInt aControlId) const
|
|
1286 |
{
|
|
1287 |
return Line(aControlId);
|
|
1288 |
}
|
|
1289 |
|
|
1290 |
// -----------------------------------------------------------------------------
|
|
1291 |
// CLmkEditorImpl::DeleteControl
|
|
1292 |
// -----------------------------------------------------------------------------
|
|
1293 |
//
|
|
1294 |
void CLmkEditorImpl::DeleteControl(TInt aControlId)
|
|
1295 |
{
|
|
1296 |
DeleteLine(aControlId);
|
|
1297 |
}
|
|
1298 |
|
|
1299 |
// -----------------------------------------------------------------------------
|
|
1300 |
// CLmkEditorImpl::TryChangeFocusL
|
|
1301 |
// -----------------------------------------------------------------------------
|
|
1302 |
//
|
|
1303 |
void CLmkEditorImpl::TryChangeFocusL(TInt aControlId)
|
|
1304 |
{
|
|
1305 |
if (ControlOrNull(aControlId))
|
|
1306 |
{
|
|
1307 |
TryChangeFocusToL(aControlId);
|
|
1308 |
}
|
|
1309 |
}
|
|
1310 |
|
|
1311 |
// -----------------------------------------------------------------------------
|
|
1312 |
// CLmkEditorImpl::SetCurrentLineCaptionL
|
|
1313 |
// -----------------------------------------------------------------------------
|
|
1314 |
//
|
|
1315 |
void CLmkEditorImpl::SetCurrentLineCaptionL(TInt aControlId,
|
|
1316 |
const TDesC& aText)
|
|
1317 |
{
|
|
1318 |
CEikCaptionedControl* ctl = Line(aControlId);
|
|
1319 |
if (ctl)
|
|
1320 |
{
|
|
1321 |
ctl->SetCaptionL(aText);
|
|
1322 |
ctl->DrawDeferred();
|
|
1323 |
}
|
|
1324 |
}
|
|
1325 |
|
|
1326 |
// -----------------------------------------------------------------------------
|
|
1327 |
// CLmkEditorImpl::Control
|
|
1328 |
// -----------------------------------------------------------------------------
|
|
1329 |
//
|
|
1330 |
CCoeControl* CLmkEditorImpl::Control(TInt aControlId) const
|
|
1331 |
{
|
|
1332 |
return ControlOrNull(aControlId);
|
|
1333 |
}
|
|
1334 |
|
|
1335 |
// -----------------------------------------------------------------------------
|
|
1336 |
// CLmkEditorImpl::SetEditableL
|
|
1337 |
// -----------------------------------------------------------------------------
|
|
1338 |
//
|
|
1339 |
void CLmkEditorImpl::SetEditableL(TBool aState)
|
|
1340 |
{
|
|
1341 |
CAknForm::SetEditableL(aState);
|
|
1342 |
}
|
|
1343 |
|
|
1344 |
// -----------------------------------------------------------------------------
|
|
1345 |
// CLmkEditorImpl::Database
|
|
1346 |
// -----------------------------------------------------------------------------
|
|
1347 |
//
|
|
1348 |
CPosLandmarkDatabase& CLmkEditorImpl::Database()
|
|
1349 |
{
|
|
1350 |
return iDb;
|
|
1351 |
}
|
|
1352 |
|
|
1353 |
// -----------------------------------------------------------------------------
|
|
1354 |
// CLmkEditorImpl::GetCurrentEditedLandmarkL
|
|
1355 |
// -----------------------------------------------------------------------------
|
|
1356 |
//
|
|
1357 |
CPosLandmark* CLmkEditorImpl::GetCurrentEditedLandmarkL()
|
|
1358 |
{
|
|
1359 |
iEditorFieldArray->SaveFieldsToBufferL();
|
|
1360 |
CArrayPtrFlat<MLmkFieldData>& fieldArray = iLmkFields->Fields();
|
|
1361 |
TInt count(fieldArray.Count());
|
|
1362 |
CPosLandmark* lmk = NULL;
|
|
1363 |
if (iLandmark)
|
|
1364 |
{
|
|
1365 |
HBufC8* lmBuf = PosLandmarkSerialization::PackL(*iLandmark);
|
|
1366 |
CleanupStack::PushL(lmBuf);
|
|
1367 |
lmk = PosLandmarkSerialization::UnpackL(lmBuf->Des());
|
|
1368 |
CleanupStack::PopAndDestroy(lmBuf);
|
|
1369 |
}
|
|
1370 |
else
|
|
1371 |
{
|
|
1372 |
lmk = CPosLandmark::NewL();
|
|
1373 |
}
|
|
1374 |
|
|
1375 |
TBool isPosFieldPresent = EFalse;
|
|
1376 |
|
|
1377 |
TLocationData locationData; // to store editor position data
|
|
1378 |
|
|
1379 |
//Position data
|
|
1380 |
TLocality locality = TLocality(); // empty locality
|
|
1381 |
|
|
1382 |
locationData.iLatitude = locality.Latitude();
|
|
1383 |
locationData.iLongitude = locality.Longitude();
|
|
1384 |
locationData.iAltitude = locality.Altitude();
|
|
1385 |
locationData.iHorizontalAccuracy = locality.HorizontalAccuracy();
|
|
1386 |
locationData.iVerticalAccuracy = locality.VerticalAccuracy();
|
|
1387 |
|
|
1388 |
for (TInt i = 0; i < count; i++)
|
|
1389 |
{
|
|
1390 |
switch (fieldArray[i]->FieldType())
|
|
1391 |
{
|
|
1392 |
case EName:
|
|
1393 |
{
|
|
1394 |
lmk->SetLandmarkNameL(fieldArray[i]->TextData());
|
|
1395 |
HBufC* path = fieldArray[i]->IconPath();
|
|
1396 |
if (path && path->Length() > 0 && fieldArray[i]->IconId()
|
|
1397 |
!= KErrNotFound)
|
|
1398 |
{
|
|
1399 |
// Get the default Mask index
|
|
1400 |
lmk->SetIconL(*path, fieldArray[i]->IconId(),
|
|
1401 |
KLmkDefaultId + 1);
|
|
1402 |
}
|
|
1403 |
|
|
1404 |
break;
|
|
1405 |
}
|
|
1406 |
case ECategory:
|
|
1407 |
case ECategories:
|
|
1408 |
{
|
|
1409 |
//Add categories to landmark
|
|
1410 |
RArray<TPosLmItemId>& categories =
|
|
1411 |
fieldArray[i]->Categories();
|
|
1412 |
TInt Tcount(categories.Count());
|
|
1413 |
for (TInt j = 0; j < Tcount; j++)
|
|
1414 |
{
|
|
1415 |
lmk->AddCategoryL(categories[j]);
|
|
1416 |
}
|
|
1417 |
break;
|
|
1418 |
}
|
|
1419 |
case EDescription:
|
|
1420 |
{
|
|
1421 |
lmk->SetLandmarkDescriptionL(fieldArray[i]->TextData());
|
|
1422 |
break;
|
|
1423 |
}
|
|
1424 |
//these all are same
|
|
1425 |
case EStreet:
|
|
1426 |
case EPostCode:
|
|
1427 |
case ECity:
|
|
1428 |
case EStateProvince:
|
|
1429 |
case ECountry:
|
|
1430 |
case EPhoneNumber:
|
|
1431 |
case EWebAddress:
|
|
1432 |
{
|
|
1433 |
lmk->SetPositionFieldL(fieldArray[i]->PositionFieldId(),
|
|
1434 |
fieldArray[i]->TextData());
|
|
1435 |
break;
|
|
1436 |
}
|
|
1437 |
case ELatitude:
|
|
1438 |
{
|
|
1439 |
isPosFieldPresent = ETrue;
|
|
1440 |
locationData.iLatitude = fieldArray[i]->DoubleData();
|
|
1441 |
break;
|
|
1442 |
}
|
|
1443 |
case ELongitude:
|
|
1444 |
{
|
|
1445 |
isPosFieldPresent = ETrue;
|
|
1446 |
locationData.iLongitude = fieldArray[i]->DoubleData();
|
|
1447 |
break;
|
|
1448 |
}
|
|
1449 |
case EPositionAccuracy:
|
|
1450 |
{
|
|
1451 |
locationData.iHorizontalAccuracy = fieldArray[i]->FloatData();
|
|
1452 |
break;
|
|
1453 |
}
|
|
1454 |
case EAltitude:
|
|
1455 |
{
|
|
1456 |
locationData.iAltitude = fieldArray[i]->FloatData();
|
|
1457 |
break;
|
|
1458 |
}
|
|
1459 |
case EAltitudeAccuracy:
|
|
1460 |
{
|
|
1461 |
locationData.iVerticalAccuracy = fieldArray[i]->FloatData();
|
|
1462 |
break;
|
|
1463 |
}
|
|
1464 |
default:
|
|
1465 |
{
|
|
1466 |
break;
|
|
1467 |
}
|
|
1468 |
}
|
|
1469 |
}
|
|
1470 |
|
|
1471 |
if (isPosFieldPresent)
|
|
1472 |
{
|
|
1473 |
// remove the old values to set new values
|
|
1474 |
lmk->RemoveLandmarkAttributes(CPosLandmark::EPosition);
|
|
1475 |
|
|
1476 |
if (!Math::IsNaN(locationData.iLatitude) && !Math::IsNaN(
|
|
1477 |
locationData.iLongitude))
|
|
1478 |
{
|
|
1479 |
if (!Math::IsNaN(locationData.iAltitude))
|
|
1480 |
{
|
|
1481 |
locality.SetCoordinate(locationData.iLatitude,
|
|
1482 |
locationData.iLongitude, locationData.iAltitude);
|
|
1483 |
|
|
1484 |
if (!Math::IsNaN(locationData.iVerticalAccuracy))
|
|
1485 |
{
|
|
1486 |
if (locationData.iVerticalAccuracy > 0)
|
|
1487 |
locality.SetVerticalAccuracy(
|
|
1488 |
locationData.iVerticalAccuracy);
|
|
1489 |
}
|
|
1490 |
}
|
|
1491 |
else
|
|
1492 |
{
|
|
1493 |
locality.SetCoordinate(locationData.iLatitude,
|
|
1494 |
locationData.iLongitude);
|
|
1495 |
}
|
|
1496 |
|
|
1497 |
if (!Math::IsNaN(locationData.iHorizontalAccuracy))
|
|
1498 |
{
|
|
1499 |
if (locationData.iHorizontalAccuracy > 0)
|
|
1500 |
locality.SetHorizontalAccuracy(
|
|
1501 |
locationData.iHorizontalAccuracy);
|
|
1502 |
}
|
|
1503 |
// save position if at least lat/lon are entered
|
|
1504 |
lmk->SetPositionL(locality);
|
|
1505 |
}
|
|
1506 |
}
|
|
1507 |
return lmk;
|
|
1508 |
}
|
|
1509 |
|
|
1510 |
// -----------------------------------------------------------------------------
|
|
1511 |
// CLmkEditorImpl::CreateLabelArrayL
|
|
1512 |
// -----------------------------------------------------------------------------
|
|
1513 |
//
|
|
1514 |
void CLmkEditorImpl::CreateLabelArrayL()
|
|
1515 |
{
|
|
1516 |
|
|
1517 |
if (iJapaneseInputMode)
|
|
1518 |
{
|
|
1519 |
// Display in Japanese order
|
|
1520 |
CreateLabelArrayForJapaneseModeL();
|
|
1521 |
}
|
|
1522 |
else
|
|
1523 |
{ // Normal mode
|
|
1524 |
CreateLabelArrayForNormalModeL();
|
|
1525 |
}
|
|
1526 |
}
|
|
1527 |
|
|
1528 |
// -----------------------------------------------------------------------------
|
|
1529 |
// CLmkEditorImpl::CreateLabelArrayForNormalModeL()
|
|
1530 |
// -----------------------------------------------------------------------------
|
|
1531 |
//
|
|
1532 |
void CLmkEditorImpl::CreateLabelArrayForNormalModeL()
|
|
1533 |
{
|
|
1534 |
CreateLabelL(R_LMK_NAME_LABEL, EName);
|
|
1535 |
CreateLabelL(R_LMK_CATEGORY_LABEL, ECategory);
|
|
1536 |
CreateLabelL(R_LMK_CATEGORIES_LABEL, ECategories);
|
|
1537 |
CreateLabelL(R_LMK_DESCRIPTION_LABEL, EDescription);
|
|
1538 |
CreateLabelL(R_LMK_STREET_LABEL, EStreet);
|
|
1539 |
CreateLabelL(R_LMK_POST_CODE_LABEL, EPostCode);
|
|
1540 |
CreateLabelL(R_LMK_CITY_LABEL, ECity);
|
|
1541 |
CreateLabelL(R_LMK_STATE_PROVINCE_LABEL, EStateProvince);
|
|
1542 |
CreateLabelL(R_LMK_COUNTRY_LABEL, ECountry);
|
|
1543 |
CreateLabelL(R_LMK_PHONE_NUMBER_LABEL, EPhoneNumber);
|
|
1544 |
CreateLabelL(R_LMK_WEB_ADDRESS_LABEL, EWebAddress);
|
|
1545 |
CreateLabelL(R_LMK_LATITUDE_LABEL, ELatitude);
|
|
1546 |
CreateLabelL(R_LMK_LONGITUDE_LABEL, ELongitude);
|
|
1547 |
CreateLabelL(R_LMK_POSITION_ACCURACY_LABEL, EPositionAccuracy);
|
|
1548 |
CreateLabelL(R_LMK_ALTITUDE_LABEL, EAltitude);
|
|
1549 |
CreateLabelL(R_LMK_ALTITUDE_ACCURACY_LABEL, EAltitudeAccuracy);
|
|
1550 |
}
|
|
1551 |
|
|
1552 |
// -----------------------------------------------------------------------------
|
|
1553 |
// CLmkEditorImpl::CreateLabelArrayForJapaneseModeL()
|
|
1554 |
// -----------------------------------------------------------------------------
|
|
1555 |
//
|
|
1556 |
void CLmkEditorImpl::CreateLabelArrayForJapaneseModeL()
|
|
1557 |
{
|
|
1558 |
CreateLabelL(R_LMK_NAME_LABEL, ENameJapaneseMode);
|
|
1559 |
CreateLabelL(R_LMK_CATEGORY_LABEL, ECategoryJapaneseMode);
|
|
1560 |
CreateLabelL(R_LMK_CATEGORIES_LABEL, ECategoriesJapaneseMode);
|
|
1561 |
CreateLabelL(R_LMK_DESCRIPTION_LABEL, EDescriptionJapaneseMode);
|
|
1562 |
CreateLabelL(R_LMK_POST_CODE_LABEL, EPostCodeJapaneseMode);
|
|
1563 |
CreateLabelL(R_LMK_STATE_PROVINCE_LABEL, EStateProvinceJapaneseMode);
|
|
1564 |
CreateLabelL(R_LMK_CITY_LABEL, ECityJapaneseMode);
|
|
1565 |
CreateLabelL(R_LMK_STREET_LABEL, EStreetJapaneseMode);
|
|
1566 |
CreateLabelL(R_LMK_COUNTRY_LABEL, ECountryJapaneseMode);
|
|
1567 |
CreateLabelL(R_LMK_PHONE_NUMBER_LABEL, EPhoneNumberJapaneseMode);
|
|
1568 |
CreateLabelL(R_LMK_WEB_ADDRESS_LABEL, EWebAddressJapaneseMode);
|
|
1569 |
CreateLabelL(R_LMK_LATITUDE_LABEL, ELatitudeJapaneseMode);
|
|
1570 |
CreateLabelL(R_LMK_LONGITUDE_LABEL, ELongitudeJapaneseMode);
|
|
1571 |
CreateLabelL(R_LMK_POSITION_ACCURACY_LABEL, EPositionAccuracyJapaneseMode);
|
|
1572 |
CreateLabelL(R_LMK_ALTITUDE_LABEL, EAltitudeJapaneseMode);
|
|
1573 |
CreateLabelL(R_LMK_ALTITUDE_ACCURACY_LABEL, EAltitudeAccuracyJapaneseMode);
|
|
1574 |
}
|
|
1575 |
|
|
1576 |
// -----------------------------------------------------------------------------
|
|
1577 |
// CLmkEditorImpl::CreateLabelL
|
|
1578 |
// -----------------------------------------------------------------------------
|
|
1579 |
//
|
|
1580 |
void CLmkEditorImpl::CreateLabelL(TInt iResourceId, TInt iPos)
|
|
1581 |
{
|
|
1582 |
HBufC* label = iCoeEnv->AllocReadResourceL(iResourceId);
|
|
1583 |
CleanupStack::PushL(label);
|
|
1584 |
User::LeaveIfError(iLabelArray.Insert(label, iPos));
|
|
1585 |
CleanupStack::Pop(); //label
|
|
1586 |
}
|
|
1587 |
|
|
1588 |
// -----------------------------------------------------------------------------
|
|
1589 |
// CLmkEditorImpl::IsNameFieldEmptyL
|
|
1590 |
// -----------------------------------------------------------------------------
|
|
1591 |
//
|
|
1592 |
TBool CLmkEditorImpl::IsNameFieldEmptyL()
|
|
1593 |
{
|
|
1594 |
const MLmkEditorField* field = &iEditorFieldArray->FieldAt(0);
|
|
1595 |
HBufC* fieldText = field->ControlTextL();
|
|
1596 |
TBool ret(ETrue);
|
|
1597 |
if (fieldText && fieldText->Length() > 0)
|
|
1598 |
{
|
|
1599 |
//Check if any active character or not
|
|
1600 |
TPtr16 ptr = fieldText->Des();
|
|
1601 |
ptr.Trim();
|
|
1602 |
if (ptr.Length() == 0)
|
|
1603 |
{
|
|
1604 |
ret = ETrue;
|
|
1605 |
}
|
|
1606 |
else
|
|
1607 |
{
|
|
1608 |
ret = EFalse;
|
|
1609 |
}
|
|
1610 |
}
|
|
1611 |
delete fieldText;
|
|
1612 |
return ret;
|
|
1613 |
}
|
|
1614 |
|
|
1615 |
// -----------------------------------------------------------------------------
|
|
1616 |
// CLmkEditorImpl::ValidateContentL()
|
|
1617 |
// -----------------------------------------------------------------------------
|
|
1618 |
//
|
|
1619 |
TBool CLmkEditorImpl::ValidateContentL()
|
|
1620 |
{
|
|
1621 |
TBool result = ETrue;
|
|
1622 |
if (IsFieldEmptyL(ELatitude) && !IsFieldEmptyL(ELongitude))
|
|
1623 |
{
|
|
1624 |
LmkNotes::InformationNoteL(iEikonEnv, R_LMK_ERROR_CHECK_NOTE);
|
|
1625 |
DoNotSaveDataL(ELatitude);
|
|
1626 |
result = EFalse;
|
|
1627 |
}
|
|
1628 |
else if (!IsFieldEmptyL(ELatitude) && IsFieldEmptyL(ELongitude))
|
|
1629 |
{
|
|
1630 |
LmkNotes::InformationNoteL(iEikonEnv, R_LMK_ERROR_CHECK_NOTE);
|
|
1631 |
DoNotSaveDataL(ELongitude);
|
|
1632 |
result = EFalse;
|
|
1633 |
}
|
|
1634 |
else if (IsFieldEmptyL(ELatitude) && !IsFieldEmptyL(EPositionAccuracy))
|
|
1635 |
{
|
|
1636 |
LmkNotes::InformationNoteL(iEikonEnv, R_LMK_ERROR_POS_ACC_CHECK_NOTE);
|
|
1637 |
DoNotSaveDataL(ELatitude);
|
|
1638 |
result = EFalse;
|
|
1639 |
}
|
|
1640 |
else if (IsFieldEmptyL(ELongitude) && !IsFieldEmptyL(EPositionAccuracy))
|
|
1641 |
{
|
|
1642 |
LmkNotes::InformationNoteL(iEikonEnv, R_LMK_ERROR_POS_ACC_CHECK_NOTE);
|
|
1643 |
DoNotSaveDataL(ELongitude);
|
|
1644 |
result = EFalse;
|
|
1645 |
}
|
|
1646 |
else if (IsFieldEmptyL(EAltitude) && !IsFieldEmptyL(EAltitudeAccuracy))
|
|
1647 |
{
|
|
1648 |
LmkNotes::InformationNoteL(iEikonEnv, R_LMK_ERROR_ALT_ACC_CHECK_NOTE);
|
|
1649 |
DoNotSaveDataL(EAltitude);
|
|
1650 |
result = EFalse;
|
|
1651 |
}
|
|
1652 |
else if ((IsFieldEmptyL(ELatitude) || IsFieldEmptyL(ELongitude))
|
|
1653 |
&& !IsFieldEmptyL(EAltitude))
|
|
1654 |
{
|
|
1655 |
LmkNotes::InformationNoteL(iEikonEnv, R_LMK_ERROR_ALTITUDE_CHECK_NOTE);
|
|
1656 |
DoNotSaveDataL(ELatitude);
|
|
1657 |
result = EFalse;
|
|
1658 |
}
|
|
1659 |
else if (IsInvalidUriL())
|
|
1660 |
{
|
|
1661 |
LmkNotes::InformationNoteL(iEikonEnv, R_LMK_ERROR_URL_ILLEGAL_NOTE);
|
|
1662 |
DoNotSaveDataL(EWebAddress);
|
|
1663 |
result = EFalse;
|
|
1664 |
}
|
|
1665 |
else if (IsNameFieldEmptyL())
|
|
1666 |
{
|
|
1667 |
DoNotSaveFormDataL();
|
|
1668 |
iIsEndKey = EFalse;
|
|
1669 |
result = EFalse;
|
|
1670 |
}
|
|
1671 |
return result;
|
|
1672 |
|
|
1673 |
}
|
|
1674 |
|
|
1675 |
// -----------------------------------------------------------------------------
|
|
1676 |
// CLmkEditorImpl::IsFieldEmptyL()
|
|
1677 |
// -----------------------------------------------------------------------------
|
|
1678 |
//
|
|
1679 |
TBool CLmkEditorImpl::IsFieldEmptyL(const TUint16 aFieldType)
|
|
1680 |
{
|
|
1681 |
TInt fldId;
|
|
1682 |
MLmkFieldData* field = iLmkFields->GetField(aFieldType);
|
|
1683 |
if (field)
|
|
1684 |
{
|
|
1685 |
fldId = field->UniqueFieldIdentity();
|
|
1686 |
}
|
|
1687 |
else
|
|
1688 |
{
|
|
1689 |
return EFalse;
|
|
1690 |
}
|
|
1691 |
|
|
1692 |
MLmkEditorField* fld = iEditorFieldArray->Find(fldId);
|
|
1693 |
if (!fld)
|
|
1694 |
{
|
|
1695 |
return ETrue;
|
|
1696 |
}
|
|
1697 |
|
|
1698 |
TReal val;
|
|
1699 |
switch (aFieldType)
|
|
1700 |
{
|
|
1701 |
case ELatitude:
|
|
1702 |
case ELongitude:
|
|
1703 |
{
|
|
1704 |
val = fld->FieldValue();
|
|
1705 |
}
|
|
1706 |
break;
|
|
1707 |
case EPositionAccuracy:
|
|
1708 |
case EAltitudeAccuracy:
|
|
1709 |
case EAltitude:
|
|
1710 |
{
|
|
1711 |
val = fld->FieldValue();
|
|
1712 |
}
|
|
1713 |
break;
|
|
1714 |
}
|
|
1715 |
return Math::IsNaN(val);
|
|
1716 |
}
|
|
1717 |
|
|
1718 |
// -----------------------------------------------------------------------------
|
|
1719 |
// CLmkEditorImpl::DoNotSaveDataL()
|
|
1720 |
// -----------------------------------------------------------------------------
|
|
1721 |
//
|
|
1722 |
void CLmkEditorImpl::DoNotSaveDataL(const TUint16 aFieldType)
|
|
1723 |
{
|
|
1724 |
if (iIsEditing)
|
|
1725 |
{
|
|
1726 |
MLmkFieldData* fields = iLmkFields->GetField(aFieldType);
|
|
1727 |
if (fields)
|
|
1728 |
{
|
|
1729 |
TInt id = fields->UniqueFieldIdentity();
|
|
1730 |
TryChangeFocusL(id);
|
|
1731 |
}
|
|
1732 |
}
|
|
1733 |
}
|
|
1734 |
|
|
1735 |
// -----------------------------------------------------------------------------
|
|
1736 |
// CLmkEditorImpl::OkToExitL
|
|
1737 |
// -----------------------------------------------------------------------------
|
|
1738 |
//
|
|
1739 |
TBool CLmkEditorImpl::OkToExitL()
|
|
1740 |
{
|
|
1741 |
TBool result = ETrue;
|
|
1742 |
if (iEditorFieldArray->AreAllFieldsEmptyL())
|
|
1743 |
{
|
|
1744 |
iLmkFields->DeleteLandmarkL();
|
|
1745 |
}
|
|
1746 |
else
|
|
1747 |
{
|
|
1748 |
if (IsNameFieldEmptyL())
|
|
1749 |
{
|
|
1750 |
DoNotSaveFormDataL();
|
|
1751 |
result = EFalse;
|
|
1752 |
}
|
|
1753 |
else
|
|
1754 |
{
|
|
1755 |
TRAPD( err, iEditorFieldArray->SaveFieldsL() );
|
|
1756 |
if (err == KErrDiskFull)
|
|
1757 |
{
|
|
1758 |
result = EFalse;
|
|
1759 |
LmkNotes::OutOfMemoryNoteL(iEikonEnv);
|
|
1760 |
delete this;
|
|
1761 |
return result;
|
|
1762 |
}
|
|
1763 |
if (iLandmarkItemId)
|
|
1764 |
{
|
|
1765 |
*iLandmarkItemId = iLmkFields->LandmarkId();
|
|
1766 |
}
|
|
1767 |
}
|
|
1768 |
}
|
|
1769 |
return result;
|
|
1770 |
}
|
|
1771 |
|
|
1772 |
// -----------------------------------------------------------------------------
|
|
1773 |
// CLmkEditorImpl::SelectCategoriesCmdL
|
|
1774 |
// -----------------------------------------------------------------------------
|
|
1775 |
//
|
|
1776 |
void CLmkEditorImpl::SelectCategoriesCmdL()
|
|
1777 |
{
|
|
1778 |
if (iCatInfoPopupNote)
|
|
1779 |
{
|
|
1780 |
iCatInfoPopupNote->HideInfoPopupNote();
|
|
1781 |
}
|
|
1782 |
MLmkFieldData* fields = iLmkFields->GetField(ECategory);
|
|
1783 |
if (!fields)
|
|
1784 |
{
|
|
1785 |
fields = iLmkFields->GetField(ECategories);
|
|
1786 |
}
|
|
1787 |
if (fields)
|
|
1788 |
{
|
|
1789 |
CLmkDlgCategorySelectorImpl* dlg = CLmkDlgCategorySelectorImpl::NewL(
|
|
1790 |
iDb, ETrue);
|
|
1791 |
CleanupStack::PushL(dlg);
|
|
1792 |
dlg->SetEmptyDlgLabel(R_LMK_EMPTY_NO_CATEGORIES,
|
|
1793 |
R_LMK_GUIDE_CREATE_LANDMARK);
|
|
1794 |
RArray<TPosLmItemId>& categories = fields->Categories();
|
|
1795 |
if (dlg->ExecuteL(categories))
|
|
1796 |
{
|
|
1797 |
iEditorFieldArray->UpdateFieldsL(ECategory);
|
|
1798 |
iEditorFieldArray->UpdateFieldsL(ECategories);
|
|
1799 |
}
|
|
1800 |
CleanupStack::PopAndDestroy(dlg);
|
|
1801 |
iIsCategorySelctorOpen = EFalse;
|
|
1802 |
DrawNow();
|
|
1803 |
}
|
|
1804 |
}
|
|
1805 |
|
|
1806 |
// -----------------------------------------------------------------------------
|
|
1807 |
// CLmkEditorImpl::CurrentLocationCmdL
|
|
1808 |
// -----------------------------------------------------------------------------
|
|
1809 |
//
|
|
1810 |
void CLmkEditorImpl::CurrentLocationCmdL()
|
|
1811 |
{
|
|
1812 |
if (ShowQueryIfLocationFieldsAlreadyFilledL())
|
|
1813 |
{
|
|
1814 |
return;
|
|
1815 |
}
|
|
1816 |
HBufC* srvName = StringLoader::LoadLC(R_LMK_SERVICE_RULE_NAME,
|
|
1817 |
const_cast<CCoeEnv *> (iCoeEnv));
|
|
1818 |
iLocationService = CLmkLocationService::NewL(*srvName);
|
|
1819 |
CleanupStack::PopAndDestroy(srvName); //srvName
|
|
1820 |
iLocationService->SetObserver(*this);
|
|
1821 |
iLocationService->LocationRequestL();
|
|
1822 |
TRAPD( error, iWaitDialogLauncher->StartWaitDialogL());
|
|
1823 |
if (error)
|
|
1824 |
{
|
|
1825 |
delete iLocationService;
|
|
1826 |
iLocationService = NULL;
|
|
1827 |
|
|
1828 |
User::Leave(error);
|
|
1829 |
}
|
|
1830 |
}
|
|
1831 |
|
|
1832 |
// -----------------------------------------------------------------------------
|
|
1833 |
// CLmkEditorImpl::ChangeIconCmdL
|
|
1834 |
// -----------------------------------------------------------------------------
|
|
1835 |
//
|
|
1836 |
void CLmkEditorImpl::ChangeIconCmdL()
|
|
1837 |
{
|
|
1838 |
TInt lSelectedIconIndex(0);
|
|
1839 |
CLmkIconMapDialog* dialog = new (ELeave) CLmkIconMapDialog(
|
|
1840 |
lSelectedIconIndex);
|
|
1841 |
MLmkFieldData* nameField;
|
|
1842 |
if (dialog->ExecuteLD(R_LMK_ICON_TABLE_DIALOG))
|
|
1843 |
{
|
|
1844 |
// icon file also contains masks, therefore 2*
|
|
1845 |
TInt iconIndex = 2 * lSelectedIconIndex;
|
|
1846 |
RFs fs;
|
|
1847 |
User::LeaveIfError(fs.Connect());
|
|
1848 |
CleanupClosePushL(fs);
|
|
1849 |
|
|
1850 |
if (SysUtil::DiskSpaceBelowCriticalLevelL(&fs, sizeof(CPosLandmark),
|
|
1851 |
EDriveC))
|
|
1852 |
{
|
|
1853 |
CleanupStack::PopAndDestroy(); // fs
|
|
1854 |
User::LeaveNoMemory();
|
|
1855 |
}
|
|
1856 |
else
|
|
1857 |
{
|
|
1858 |
nameField = iLmkFields->GetField(EName);
|
|
1859 |
TFileName* iconFile = CLmkUiUtils::LmkUiIconFileLC();
|
|
1860 |
if (nameField && iconFile)
|
|
1861 |
{
|
|
1862 |
nameField->SetIconId(iconIndex
|
|
1863 |
+ EMbmLmkuiQgn_prop_lm_transport);
|
|
1864 |
nameField->SetIconPathL(*iconFile);
|
|
1865 |
|
|
1866 |
//Update context icon
|
|
1867 |
CEikImage* image = new (ELeave) CEikImage();
|
|
1868 |
CleanupStack::PushL(image);
|
|
1869 |
image->CreatePictureFromFileL(*iconFile, nameField->IconId(),
|
|
1870 |
iconIndex + EMbmLmkuiQgn_prop_lm_transport_mask);
|
|
1871 |
|
|
1872 |
iLmkUiUtils->UpdateContextIconL(image);
|
|
1873 |
|
|
1874 |
// Added for appending Icon to Name label
|
|
1875 |
CLmkUiUtils::ChangeLmNameLabelIconL(*this, *nameField);
|
|
1876 |
CleanupStack::Pop(); //image
|
|
1877 |
CleanupStack::PopAndDestroy();//iconFile
|
|
1878 |
DrawNow();
|
|
1879 |
}
|
|
1880 |
}
|
|
1881 |
CleanupStack::PopAndDestroy(); // fs
|
|
1882 |
}
|
|
1883 |
}
|
|
1884 |
|
|
1885 |
// -----------------------------------------------------------------------------
|
|
1886 |
// CLmkEditorImpl::CategoriesCmdL
|
|
1887 |
// -----------------------------------------------------------------------------
|
|
1888 |
//
|
|
1889 |
void CLmkEditorImpl::CategoriesCmdL()
|
|
1890 |
{
|
|
1891 |
MLmkFieldData* categoryField = iLmkFields->GetField(ECategories);
|
|
1892 |
if (!categoryField)
|
|
1893 |
{
|
|
1894 |
return;
|
|
1895 |
}
|
|
1896 |
RArray<TPosLmItemId> categories = categoryField->Categories();
|
|
1897 |
TInt count(categories.Count());
|
|
1898 |
|
|
1899 |
HBufC* catName;
|
|
1900 |
// show the category list in a message query
|
|
1901 |
HBufC* message = HBufC::NewLC((KPosLmMaxCategoryNameLength * count) + 1);
|
|
1902 |
TPtr msgPtr = message->Des();
|
|
1903 |
CDesC16ArrayFlat* desArr = new (ELeave) CDesC16ArrayFlat(count);
|
|
1904 |
CleanupStack::PushL(desArr);
|
|
1905 |
// fill up the array with category´s names from the engine.
|
|
1906 |
for (TInt i = 0; i < count; i++)
|
|
1907 |
{
|
|
1908 |
catName = CLmkDbUtils::CategoryNameL(iDb, categories[i]);
|
|
1909 |
CleanupStack::PushL(catName);
|
|
1910 |
desArr->AppendL(catName->Des());
|
|
1911 |
CleanupStack::PopAndDestroy(catName); //name
|
|
1912 |
}
|
|
1913 |
desArr->Sort();
|
|
1914 |
for (TInt i = 0; i < count; i++)
|
|
1915 |
{
|
|
1916 |
msgPtr.Append((*desArr)[i]);
|
|
1917 |
if (i != (count - 1))
|
|
1918 |
{
|
|
1919 |
msgPtr.Append(_L("\n"));
|
|
1920 |
}
|
|
1921 |
}
|
|
1922 |
LmkNotes::MessageQueryL(iEikonEnv, msgPtr, count);
|
|
1923 |
CleanupStack::Pop();//desArr
|
|
1924 |
delete desArr;
|
|
1925 |
CleanupStack::PopAndDestroy(message); //message
|
|
1926 |
}
|
|
1927 |
|
|
1928 |
// -----------------------------------------------------------------------------
|
|
1929 |
// CLmkEditorImpl::SetCurrentLocationL
|
|
1930 |
// -----------------------------------------------------------------------------
|
|
1931 |
//
|
|
1932 |
void CLmkEditorImpl::SetCurrentLocationL(const TPosition& aPosition)
|
|
1933 |
{
|
|
1934 |
MLmkFieldData* latitude = iLmkFields->GetField(ELatitude);
|
|
1935 |
if (latitude)
|
|
1936 |
{
|
|
1937 |
latitude->SetTReal(aPosition.Latitude());
|
|
1938 |
|
|
1939 |
MLmkFieldData* longitude = iLmkFields->GetField(ELongitude);
|
|
1940 |
if (longitude)
|
|
1941 |
longitude->SetTReal(aPosition.Longitude());
|
|
1942 |
}
|
|
1943 |
|
|
1944 |
MLmkFieldData* altitude = iLmkFields->GetField(EAltitude);
|
|
1945 |
if (altitude)
|
|
1946 |
{
|
|
1947 |
altitude->SetTReal(aPosition.Altitude());
|
|
1948 |
}
|
|
1949 |
|
|
1950 |
MLmkFieldData* horizontalAccuracy = iLmkFields->GetField(
|
|
1951 |
EPositionAccuracy);
|
|
1952 |
if (horizontalAccuracy)
|
|
1953 |
{
|
|
1954 |
horizontalAccuracy->SetTReal(aPosition.HorizontalAccuracy());
|
|
1955 |
}
|
|
1956 |
|
|
1957 |
MLmkFieldData* verticalAccuracy = iLmkFields->GetField(EAltitudeAccuracy);
|
|
1958 |
if (verticalAccuracy)
|
|
1959 |
{
|
|
1960 |
verticalAccuracy->SetTReal(aPosition.VerticalAccuracy());
|
|
1961 |
}
|
|
1962 |
|
|
1963 |
TRAP_IGNORE(iLandmark->SetPositionL(aPosition));
|
|
1964 |
|
|
1965 |
iEditorFieldArray->UpdateFieldsL(EAllEditorItems);
|
|
1966 |
|
|
1967 |
DrawNow();
|
|
1968 |
}
|
|
1969 |
|
|
1970 |
// -----------------------------------------------------------------------------
|
|
1971 |
// CLmkEditorImpl::ChangeContextImageL
|
|
1972 |
// -----------------------------------------------------------------------------
|
|
1973 |
//
|
|
1974 |
void CLmkEditorImpl::ChangeContextImageL()
|
|
1975 |
{
|
|
1976 |
MLmkFieldData* nameField = iLmkFields->GetField(EName);
|
|
1977 |
if (nameField)
|
|
1978 |
{
|
|
1979 |
CEikImage* image = new (ELeave) CEikImage();
|
|
1980 |
CleanupStack::PushL(image);
|
|
1981 |
TFileName* defaultIconFile = CLmkUiUtils::LmkUiIconFileLC();
|
|
1982 |
// No need to add iconFile to cleanupstack since it is a member variable from CLmkFieldData class
|
|
1983 |
HBufC *iconFile = nameField->IconPath();
|
|
1984 |
TInt err = KErrNotFound;
|
|
1985 |
CFbsBitmap* bitmap;
|
|
1986 |
CFbsBitmap* mask;
|
|
1987 |
if (nameField->IconId() != KErrNotFound)
|
|
1988 |
{
|
|
1989 |
TRAP(err,AknIconUtils::CreateIconL( bitmap, mask,
|
|
1990 |
*iconFile, nameField->IconId(),
|
|
1991 |
nameField->IconId()+1 ););
|
|
1992 |
}
|
|
1993 |
// If the Icon File doesn't exist the CreateIconL in the if statement above will
|
|
1994 |
// Leave with KErrNotFound in which case the default Icon should be loaded.
|
|
1995 |
// Also when the Landmarks itself doesn't have a valid Icon, the default Icon is
|
|
1996 |
// loaded.
|
|
1997 |
if (err != KErrNone)
|
|
1998 |
{
|
|
1999 |
AknIconUtils::CreateIconL(bitmap, mask, *defaultIconFile,
|
|
2000 |
KLmkDefaultId, KLmkDefaultId + 1);
|
|
2001 |
}
|
|
2002 |
image->SetBitmap(bitmap);
|
|
2003 |
image->SetMask(mask);
|
|
2004 |
iLmkUiUtils->SwapNewContextIconL(image);
|
|
2005 |
CleanupStack::PopAndDestroy(); //defaultIconFile
|
|
2006 |
CleanupStack::Pop(); //image
|
|
2007 |
}
|
|
2008 |
}
|
|
2009 |
|
|
2010 |
// ----------------------------------------------------------------------------
|
|
2011 |
// CLmkEditorImpl::AttachAIWMenuInterestL
|
|
2012 |
// ----------------------------------------------------------------------------
|
|
2013 |
//
|
|
2014 |
void CLmkEditorImpl::AttachAIWMenuInterestL()
|
|
2015 |
{
|
|
2016 |
if (iMapNavFeature)
|
|
2017 |
{
|
|
2018 |
iMapNavInterface->AttachAIWInterestL(R_LMK_EDITOR_MENU,
|
|
2019 |
R_LMK_EDITOR_AIW_INTEREST_SHOWONMAP);
|
|
2020 |
if (iEditorMode != CLmkEditorDlg::ELmkEditor)
|
|
2021 |
{
|
|
2022 |
iMapNavInterface->AttachAIWInterestL(R_LMK_EDITOR_MENU,
|
|
2023 |
R_LMK_EDITOR_AIW_INTEREST_NAVIGATETO);
|
|
2024 |
}
|
|
2025 |
}
|
|
2026 |
}
|
|
2027 |
|
|
2028 |
// -----------------------------------------------------------------------------
|
|
2029 |
// CLmkEditorImpl::HandleResourceChange()
|
|
2030 |
// -----------------------------------------------------------------------------
|
|
2031 |
//
|
|
2032 |
void CLmkEditorImpl::HandleResourceChange(TInt aType)
|
|
2033 |
{
|
|
2034 |
CAknForm::HandleResourceChange(aType);
|
|
2035 |
}
|
|
2036 |
|
|
2037 |
// -----------------------------------------------------------------------------
|
|
2038 |
// CLmkEditorImpl::CategoriesCmdFromXmlL
|
|
2039 |
// -----------------------------------------------------------------------------
|
|
2040 |
//
|
|
2041 |
void CLmkEditorImpl::CategoriesCmdFromXmlL()
|
|
2042 |
{
|
|
2043 |
TInt count = iCategoryNames.Count();
|
|
2044 |
if (count <= 1)
|
|
2045 |
{
|
|
2046 |
return;
|
|
2047 |
}
|
|
2048 |
CDesC16ArrayFlat* desArr = new (ELeave) CDesC16ArrayFlat(count);
|
|
2049 |
CleanupStack::PushL(desArr);
|
|
2050 |
// fill up the array with category´s names from the engine.
|
|
2051 |
for (TInt i = 0; i < count; i++)
|
|
2052 |
{
|
|
2053 |
desArr->AppendL(iCategoryNames[i]);
|
|
2054 |
}
|
|
2055 |
|
|
2056 |
desArr->Sort();
|
|
2057 |
// show the category list in a message query
|
|
2058 |
HBufC* message = HBufC::NewLC((KPosLmMaxCategoryNameLength
|
|
2059 |
* iCategoryNames.Count()) + 1);
|
|
2060 |
TPtr msgPtr = message->Des();
|
|
2061 |
for (TInt i = 0; i < count; i++)
|
|
2062 |
{
|
|
2063 |
msgPtr.Append((*desArr)[i]);
|
|
2064 |
if (i != (count - 1))
|
|
2065 |
{
|
|
2066 |
msgPtr.Append(_L("\n"));
|
|
2067 |
}
|
|
2068 |
}
|
|
2069 |
LmkNotes::MessageQueryL(iEikonEnv, msgPtr, count);
|
|
2070 |
CleanupStack::PopAndDestroy(2); //message ,desArr
|
|
2071 |
}
|
|
2072 |
|
|
2073 |
// -----------------------------------------------------------------------------
|
|
2074 |
// CLmkEditorImpl::ConstructContextMenuL()
|
|
2075 |
// -----------------------------------------------------------------------------
|
|
2076 |
//
|
|
2077 |
void CLmkEditorImpl::ConstructContextMenuL()
|
|
2078 |
{
|
|
2079 |
CEikMenuBar* newMenuBar = new (ELeave) CEikMenuBar();
|
|
2080 |
CleanupStack::PushL(newMenuBar);
|
|
2081 |
newMenuBar->ConstructL(this, NULL, R_LMK_EDITOR_CONTEXT_MENUBAR);
|
|
2082 |
iEikonEnv->EikAppUi()->AddToStackL(newMenuBar, ECoeStackPriorityMenu,
|
|
2083 |
ECoeStackFlagRefusesFocus);
|
|
2084 |
iContextMenuBar = newMenuBar;
|
|
2085 |
CleanupStack::Pop(newMenuBar);
|
|
2086 |
}
|
|
2087 |
|
|
2088 |
// -----------------------------------------------------------------------------
|
|
2089 |
// CLmkEditorImpl::GetFieldTextLengthL
|
|
2090 |
// -----------------------------------------------------------------------------
|
|
2091 |
//
|
|
2092 |
TInt CLmkEditorImpl::GetFieldTextLengthL(MLmkEditorField& afield)
|
|
2093 |
{
|
|
2094 |
HBufC* fieldText = afield.ControlTextL();
|
|
2095 |
TInt fieldLen(0);
|
|
2096 |
if (fieldText)
|
|
2097 |
{
|
|
2098 |
if (fieldText->Length() > 0)
|
|
2099 |
{// Remove any blank spaces if any
|
|
2100 |
TPtr16 ptr = fieldText->Des();
|
|
2101 |
ptr.Trim();
|
|
2102 |
fieldLen = ptr.Length();
|
|
2103 |
}
|
|
2104 |
}
|
|
2105 |
delete fieldText;
|
|
2106 |
return fieldLen;
|
|
2107 |
}
|
|
2108 |
// -----------------------------------------------------------------------------
|
|
2109 |
// CLmkEditorImpl::UpdateViewDlgL
|
|
2110 |
// -----------------------------------------------------------------------------
|
|
2111 |
//
|
|
2112 |
void CLmkEditorImpl::UpdateViewDlgL()
|
|
2113 |
{
|
|
2114 |
DEBUG( CLmkEditorImpl::UpdateViewDlgL start )
|
|
2115 |
CPosLandmark* landmark;
|
|
2116 |
TInt id = iLmkFields->LandmarkId();
|
|
2117 |
landmark = iDb.ReadLandmarkLC(id);
|
|
2118 |
TLocality locality;
|
|
2119 |
landmark->GetPosition(locality);
|
|
2120 |
TRAP_IGNORE(iLandmark->SetPositionL(locality));
|
|
2121 |
CArrayPtrFlat<MLmkFieldData>& fieldArray = iLmkFields->Fields();
|
|
2122 |
CArrayPtrFlat<MLmkEditorField>& editorFieldArray =
|
|
2123 |
iEditorFieldArray->GetFieldArray();
|
|
2124 |
TInt count = fieldArray.Count();
|
|
2125 |
TInt postn = KErrNotFound;
|
|
2126 |
TInt ctrlid = KErrNotFound;
|
|
2127 |
for (TInt i(0); i < count; i++)
|
|
2128 |
{
|
|
2129 |
TUint fieldType = fieldArray[i]->FieldType();
|
|
2130 |
MLmkEditorField* fld = iEditorFieldArray->Find(
|
|
2131 |
fieldArray[i]->UniqueFieldIdentity(), &postn, &ctrlid);
|
|
2132 |
|
|
2133 |
switch (fieldType)
|
|
2134 |
{
|
|
2135 |
case EName:
|
|
2136 |
{
|
|
2137 |
UpdateNameEditorControlL(fld, landmark, fieldArray[i]);
|
|
2138 |
break;
|
|
2139 |
}
|
|
2140 |
case ECategory:
|
|
2141 |
case ECategories:
|
|
2142 |
{
|
|
2143 |
UpdateCategoryEditorControlL(fld, fieldArray[i], ctrlid,
|
|
2144 |
postn, *landmark);
|
|
2145 |
break;
|
|
2146 |
}
|
|
2147 |
case EDescription:
|
|
2148 |
{
|
|
2149 |
UpdateDesEditorControlL(fld, landmark, fieldArray[i], ctrlid,
|
|
2150 |
postn);
|
|
2151 |
break;
|
|
2152 |
}
|
|
2153 |
//these all are same
|
|
2154 |
case EStreet:
|
|
2155 |
case EPostCode:
|
|
2156 |
case ECity:
|
|
2157 |
case EStateProvince:
|
|
2158 |
case ECountry:
|
|
2159 |
case EPhoneNumber:
|
|
2160 |
case EWebAddress:
|
|
2161 |
{
|
|
2162 |
UpdateTextEditorControlL(fld, landmark, fieldArray[i],
|
|
2163 |
fieldType, ctrlid, postn);
|
|
2164 |
break;
|
|
2165 |
}
|
|
2166 |
case ELatitude:
|
|
2167 |
{
|
|
2168 |
UpdateCoordinateEditorControlL(fld, fieldArray[i],
|
|
2169 |
locality.Latitude(), ctrlid, postn);
|
|
2170 |
break;
|
|
2171 |
}
|
|
2172 |
case ELongitude:
|
|
2173 |
{
|
|
2174 |
UpdateCoordinateEditorControlL(fld, fieldArray[i],
|
|
2175 |
locality.Longitude(), ctrlid, postn);
|
|
2176 |
break;
|
|
2177 |
}
|
|
2178 |
case EPositionAccuracy:
|
|
2179 |
{
|
|
2180 |
UpdateNumberEditorControlL(fld, fieldArray[i],
|
|
2181 |
locality.HorizontalAccuracy(), ctrlid, postn);
|
|
2182 |
break;
|
|
2183 |
}
|
|
2184 |
case EAltitude:
|
|
2185 |
{
|
|
2186 |
UpdateNumberEditorControlL(fld, fieldArray[i],
|
|
2187 |
locality.Altitude(), ctrlid, postn);
|
|
2188 |
break;
|
|
2189 |
}
|
|
2190 |
case EAltitudeAccuracy:
|
|
2191 |
{
|
|
2192 |
UpdateNumberEditorControlL(fld, fieldArray[i],
|
|
2193 |
locality.VerticalAccuracy(), ctrlid, postn);
|
|
2194 |
break;
|
|
2195 |
}
|
|
2196 |
default:
|
|
2197 |
{
|
|
2198 |
break;
|
|
2199 |
}
|
|
2200 |
}
|
|
2201 |
}
|
|
2202 |
iEditorFieldArray->UpdateFieldsL();
|
|
2203 |
CleanupStack::PopAndDestroy(landmark);
|
|
2204 |
DrawNow();
|
|
2205 |
if (!IsEditable())
|
|
2206 |
{
|
|
2207 |
//only for landmarks viewer
|
|
2208 |
UpdateMskOnArrowMoveForViewerL();
|
|
2209 |
}
|
|
2210 |
DEBUG( CLmkEditorImpl::UpdateViewDlgL End )
|
|
2211 |
}
|
|
2212 |
|
|
2213 |
// -----------------------------------------------------------------------------
|
|
2214 |
// CLmkEditorImpl::ActivateL
|
|
2215 |
// -----------------------------------------------------------------------------
|
|
2216 |
//
|
|
2217 |
void CLmkEditorImpl::ActivateL()
|
|
2218 |
{
|
|
2219 |
if (iEditorMode == CLmkEditorDlg::ELmkEditor && iIsEditing)
|
|
2220 |
{
|
|
2221 |
MLmkFieldData* fields = iLmkFields->GetField(iFieldTypeToFocus);
|
|
2222 |
if (fields)
|
|
2223 |
{
|
|
2224 |
TInt id = fields->UniqueFieldIdentity();
|
|
2225 |
TryChangeFocusL(id);
|
|
2226 |
}
|
|
2227 |
}
|
|
2228 |
CCoeControl::ActivateL();
|
|
2229 |
}
|
|
2230 |
|
|
2231 |
// -----------------------------------------------------------------------------
|
|
2232 |
// CLmkEditorImpl::UpdateTextEditorControlL
|
|
2233 |
// -----------------------------------------------------------------------------
|
|
2234 |
//
|
|
2235 |
void CLmkEditorImpl::UpdateTextEditorControlL(MLmkEditorField* aEditorField,
|
|
2236 |
CPosLandmark* aLandmark, MLmkFieldData* fieldData, TUint aFiledType,
|
|
2237 |
TInt aPrevControlId, TInt aPos)
|
|
2238 |
{
|
|
2239 |
TPositionFieldId fieldId = EPositionFieldNone;
|
|
2240 |
switch (aFiledType)
|
|
2241 |
{
|
|
2242 |
case EStreet:
|
|
2243 |
fieldId = EPositionFieldStreet;
|
|
2244 |
break;
|
|
2245 |
case EPostCode:
|
|
2246 |
fieldId = EPositionFieldPostalCode;
|
|
2247 |
break;
|
|
2248 |
case ECity:
|
|
2249 |
fieldId = EPositionFieldCity;
|
|
2250 |
break;
|
|
2251 |
case EStateProvince:
|
|
2252 |
fieldId = EPositionFieldState;
|
|
2253 |
break;
|
|
2254 |
case ECountry:
|
|
2255 |
fieldId = EPositionFieldCountry;
|
|
2256 |
break;
|
|
2257 |
case EPhoneNumber:
|
|
2258 |
fieldId = ELmkPositionFieldPhoneNumber;
|
|
2259 |
break;
|
|
2260 |
case EWebAddress:
|
|
2261 |
fieldId = ELmkPositionFieldWebAddress;
|
|
2262 |
break;
|
|
2263 |
}
|
|
2264 |
TPtrC text;
|
|
2265 |
if (aLandmark->GetPositionField(fieldId, text) == KErrNone)
|
|
2266 |
{
|
|
2267 |
if (IsEditable() && text.Length() == 0 && aFiledType == EWebAddress)
|
|
2268 |
{
|
|
2269 |
//return if web address field and field is empty and its an editor
|
|
2270 |
return;
|
|
2271 |
}
|
|
2272 |
fieldData->SetTextL(text);
|
|
2273 |
if (!IsEditable())
|
|
2274 |
{
|
|
2275 |
aEditorField = AddOrDeleteLineL(aEditorField, fieldData,
|
|
2276 |
aPrevControlId, fieldData->UniqueFieldIdentity(), aPos);
|
|
2277 |
}
|
|
2278 |
if (aEditorField)
|
|
2279 |
{
|
|
2280 |
//now modify the text for display
|
|
2281 |
CLmkEditorTextField* field =
|
|
2282 |
static_cast<CLmkEditorTextField*> (aEditorField);
|
|
2283 |
HBufC* buff = HBufC::NewLC(text.Length());
|
|
2284 |
TPtr dispTxt = buff->Des();
|
|
2285 |
if (!IsEditable())
|
|
2286 |
{
|
|
2287 |
TPtr des1 = CLmkFields::RemoveEnterCharacter(text);
|
|
2288 |
dispTxt.Copy(des1);
|
|
2289 |
}
|
|
2290 |
else
|
|
2291 |
{
|
|
2292 |
dispTxt.Copy(text);
|
|
2293 |
}
|
|
2294 |
if (aFiledType == EWebAddress)
|
|
2295 |
{
|
|
2296 |
TInt position;
|
|
2297 |
if ((position = field->IsWebUrlProtocolPreFixedL(dispTxt))
|
|
2298 |
!= KErrNotFound)
|
|
2299 |
{
|
|
2300 |
field->TrimPrefixesFromWebUrlL(dispTxt, position + 1);
|
|
2301 |
}
|
|
2302 |
}
|
|
2303 |
TPtrC ptr;
|
|
2304 |
ptr.Set(dispTxt);
|
|
2305 |
field->SetControlTextL(ptr);
|
|
2306 |
CleanupStack::PopAndDestroy(buff);
|
|
2307 |
}
|
|
2308 |
}
|
|
2309 |
}
|
|
2310 |
|
|
2311 |
// -----------------------------------------------------------------------------
|
|
2312 |
// CLmkEditorImpl::UpdateDesEditorControlL
|
|
2313 |
// -----------------------------------------------------------------------------
|
|
2314 |
//
|
|
2315 |
void CLmkEditorImpl::UpdateDesEditorControlL(MLmkEditorField* aEditorField,
|
|
2316 |
CPosLandmark* aLandmark, MLmkFieldData* fieldData,
|
|
2317 |
TInt aPrevControlId, TInt aPos)
|
|
2318 |
{
|
|
2319 |
TPtrC text;
|
|
2320 |
aLandmark->GetLandmarkDescription(text);
|
|
2321 |
fieldData->SetTextL(text);
|
|
2322 |
TPtrC dispTxt;
|
|
2323 |
if (!IsEditable())
|
|
2324 |
{
|
|
2325 |
TPtr des1 = CLmkFields::RemoveEnterCharacter(text);
|
|
2326 |
dispTxt.Set(des1);
|
|
2327 |
aEditorField = AddOrDeleteLineL(aEditorField, fieldData,
|
|
2328 |
aPrevControlId, fieldData->UniqueFieldIdentity(), aPos);
|
|
2329 |
}
|
|
2330 |
else
|
|
2331 |
{
|
|
2332 |
dispTxt.Set(text);
|
|
2333 |
}
|
|
2334 |
CLmkEditorTextField* field =
|
|
2335 |
static_cast<CLmkEditorTextField*> (aEditorField);
|
|
2336 |
if (aEditorField)
|
|
2337 |
{
|
|
2338 |
field->Control()->SetTextL(&dispTxt);
|
|
2339 |
field->Control()->DrawDeferred();
|
|
2340 |
}
|
|
2341 |
}
|
|
2342 |
|
|
2343 |
// -----------------------------------------------------------------------------
|
|
2344 |
// CLmkEditorImpl::UpdateCategoryEditorControlL
|
|
2345 |
// -----------------------------------------------------------------------------
|
|
2346 |
//
|
|
2347 |
void CLmkEditorImpl::UpdateCategoryEditorControlL(
|
|
2348 |
MLmkEditorField* aEditorField, MLmkFieldData* fieldData,
|
|
2349 |
TInt aPrevControlId, TInt aPos, CPosLandmark& aLandmark)
|
|
2350 |
{
|
|
2351 |
RArray<TPosLmItemId>& categories = fieldData->Categories();
|
|
2352 |
aLandmark.GetCategoriesL(categories);
|
|
2353 |
TInt count(categories.Count());
|
|
2354 |
|
|
2355 |
if (count <= 1)
|
|
2356 |
{
|
|
2357 |
fieldData->SetFieldType(ECategory);
|
|
2358 |
}
|
|
2359 |
else
|
|
2360 |
{
|
|
2361 |
fieldData->SetFieldType(ECategories);
|
|
2362 |
}
|
|
2363 |
if (!IsEditable())
|
|
2364 |
{
|
|
2365 |
aEditorField = AddOrDeleteLineL(aEditorField, fieldData,
|
|
2366 |
aPrevControlId, fieldData->UniqueFieldIdentity(), aPos);
|
|
2367 |
}
|
|
2368 |
}
|
|
2369 |
|
|
2370 |
// -----------------------------------------------------------------------------
|
|
2371 |
// CLmkEditorImpl::UpdateCoordinateEditorControlL
|
|
2372 |
// -----------------------------------------------------------------------------
|
|
2373 |
//
|
|
2374 |
void CLmkEditorImpl::UpdateCoordinateEditorControlL(
|
|
2375 |
MLmkEditorField* aEditorField, MLmkFieldData* fieldData,
|
|
2376 |
TReal aValue, TInt aPrevControlId, TInt aPos)
|
|
2377 |
{
|
|
2378 |
fieldData->SetTReal(aValue);
|
|
2379 |
if (!IsEditable())
|
|
2380 |
{
|
|
2381 |
aEditorField = AddOrDeleteLineL(aEditorField, fieldData,
|
|
2382 |
aPrevControlId, fieldData->UniqueFieldIdentity(), aPos);
|
|
2383 |
}
|
|
2384 |
}
|
|
2385 |
|
|
2386 |
// -----------------------------------------------------------------------------
|
|
2387 |
// CLmkEditorImpl::UpdateNumberEditorControlL
|
|
2388 |
// -----------------------------------------------------------------------------
|
|
2389 |
//
|
|
2390 |
void CLmkEditorImpl::UpdateNumberEditorControlL(
|
|
2391 |
MLmkEditorField* aEditorField, MLmkFieldData* fieldData,
|
|
2392 |
TReal32 aValue, TInt aPrevControlId, TInt aPos)
|
|
2393 |
{
|
|
2394 |
fieldData->SetTReal(aValue);
|
|
2395 |
|
|
2396 |
if (!IsEditable())
|
|
2397 |
{
|
|
2398 |
aEditorField = AddOrDeleteLineL(aEditorField, fieldData,
|
|
2399 |
aPrevControlId, fieldData->UniqueFieldIdentity(), aPos);
|
|
2400 |
}
|
|
2401 |
}
|
|
2402 |
|
|
2403 |
// -----------------------------------------------------------------------------
|
|
2404 |
// CLmkEditorImpl::UpdateNameEditorControl
|
|
2405 |
// -----------------------------------------------------------------------------
|
|
2406 |
//
|
|
2407 |
void CLmkEditorImpl::UpdateNameEditorControlL(MLmkEditorField* aEditorField,
|
|
2408 |
CPosLandmark* aLandmark, MLmkFieldData* fieldData)
|
|
2409 |
{
|
|
2410 |
if (aEditorField && aLandmark && fieldData)
|
|
2411 |
{
|
|
2412 |
//name field icon updation
|
|
2413 |
TInt iconIden = -1;
|
|
2414 |
TInt iconMaskIndex = -1;
|
|
2415 |
TPtrC iconFile;
|
|
2416 |
CLmkEditorTextField* field =
|
|
2417 |
static_cast<CLmkEditorTextField*> (aEditorField);
|
|
2418 |
if (aLandmark->GetIcon(iconFile, iconIden, iconMaskIndex) && field)
|
|
2419 |
{
|
|
2420 |
if (iconIden > 0)
|
|
2421 |
{
|
|
2422 |
fieldData->SetIconId(iconIden);
|
|
2423 |
fieldData->SetIconPathL(iconFile);
|
|
2424 |
CEikImage* image = new (ELeave) CEikImage();
|
|
2425 |
CleanupStack::PushL(image);
|
|
2426 |
image->CreatePictureFromFileL(iconFile, iconIden,
|
|
2427 |
iconMaskIndex);
|
|
2428 |
iLmkUiUtils->UpdateContextIconL(image);
|
|
2429 |
CLmkUiUtils::ChangeLmNameLabelIconL(*this, *fieldData);
|
|
2430 |
CleanupStack::Pop(); //image
|
|
2431 |
field->CaptionedControl()->DrawDeferred();
|
|
2432 |
}
|
|
2433 |
//text control updation
|
|
2434 |
TPtrC text;
|
|
2435 |
aLandmark->GetLandmarkName(text);
|
|
2436 |
TPtrC dispTxt;
|
|
2437 |
if (!IsEditable())
|
|
2438 |
{
|
|
2439 |
TPtr des1 = CLmkFields::RemoveEnterCharacter(text);
|
|
2440 |
dispTxt.Set(des1);
|
|
2441 |
}
|
|
2442 |
else
|
|
2443 |
{
|
|
2444 |
dispTxt.Set(text);
|
|
2445 |
}
|
|
2446 |
field->Control()->SetTextL(&dispTxt);
|
|
2447 |
fieldData->SetTextL(text);
|
|
2448 |
HBufC* buff = dispTxt.AllocL();
|
|
2449 |
iLmkUiUtils->ChangeTitlePaneL(buff);
|
|
2450 |
field->Control()->DrawDeferred();
|
|
2451 |
}
|
|
2452 |
}
|
|
2453 |
}
|
|
2454 |
|
|
2455 |
// -----------------------------------------------------------------------------
|
|
2456 |
// CLmkEditorImpl::SetFieldTypeToFocusInEditMode
|
|
2457 |
// -----------------------------------------------------------------------------
|
|
2458 |
//
|
|
2459 |
void CLmkEditorImpl::SetFieldTypeToFocusInEditMode(TUint aFieldType)
|
|
2460 |
{
|
|
2461 |
iFieldTypeToFocus = aFieldType;
|
|
2462 |
}
|
|
2463 |
|
|
2464 |
// -----------------------------------------------------------------------------
|
|
2465 |
// CLmkEditorImpl::IsDlgEditing
|
|
2466 |
// -----------------------------------------------------------------------------
|
|
2467 |
//
|
|
2468 |
TBool CLmkEditorImpl::IsDlgEditing()
|
|
2469 |
{
|
|
2470 |
return iIsEditing;
|
|
2471 |
}
|
|
2472 |
|
|
2473 |
// -----------------------------------------------------------------------------
|
|
2474 |
// CLmkEditorImpl::SetDlgEditing
|
|
2475 |
// -----------------------------------------------------------------------------
|
|
2476 |
//
|
|
2477 |
void CLmkEditorImpl::SetDlgEditing(TBool aEditing)
|
|
2478 |
{
|
|
2479 |
iIsEditing = aEditing;
|
|
2480 |
}
|
|
2481 |
|
|
2482 |
// -----------------------------------------------------------------------------
|
|
2483 |
// CLmkEditorImpl::SetDlgEditing
|
|
2484 |
// -----------------------------------------------------------------------------
|
|
2485 |
//
|
|
2486 |
TInt CLmkEditorImpl::EditMode()
|
|
2487 |
{
|
|
2488 |
return iEditorMode;
|
|
2489 |
}
|
|
2490 |
|
|
2491 |
// -----------------------------------------------------------------------------
|
|
2492 |
// CLmkEditorImpl::UpdateMskOnArrowMoveForViewerL
|
|
2493 |
// -----------------------------------------------------------------------------
|
|
2494 |
//
|
|
2495 |
void CLmkEditorImpl::UpdateMskOnArrowMoveForViewerL()
|
|
2496 |
{
|
|
2497 |
TBool cmdAdded = EFalse;
|
|
2498 |
MLmkEditorField* field = iEditorFieldArray->Find(IdOfFocusControl());
|
|
2499 |
TUint type = field->LandmarkItemField().FieldType();
|
|
2500 |
switch (type)
|
|
2501 |
{
|
|
2502 |
case ECategories:
|
|
2503 |
{
|
|
2504 |
AddMskCommandL(R_LM_MSK_SHOW, ELmkCmdShow);
|
|
2505 |
cmdAdded = ETrue;
|
|
2506 |
break;
|
|
2507 |
}
|
|
2508 |
case EPhoneNumber:
|
|
2509 |
{
|
|
2510 |
HBufC* fieldText = field->ControlTextL();
|
|
2511 |
CleanupStack::PushL(fieldText);
|
|
2512 |
if (fieldText && fieldText->Length() > 0)
|
|
2513 |
{
|
|
2514 |
AddMskCommandL(R_LM_MSK_CALL, ELmkCmdLast);
|
|
2515 |
cmdAdded = ETrue;
|
|
2516 |
}
|
|
2517 |
CleanupStack::PopAndDestroy(fieldText);
|
|
2518 |
break;
|
|
2519 |
}
|
|
2520 |
case EWebAddress:
|
|
2521 |
{
|
|
2522 |
HBufC* fieldText = field->ControlTextL();
|
|
2523 |
CleanupStack::PushL(fieldText);
|
|
2524 |
if (fieldText && fieldText->Length() > 0)
|
|
2525 |
{
|
|
2526 |
AddMskCommandL(R_LM_MSK_BROWSE, ELmkCmdGoToUrl);
|
|
2527 |
cmdAdded = ETrue;
|
|
2528 |
}
|
|
2529 |
CleanupStack::PopAndDestroy(fieldText);
|
|
2530 |
break;
|
|
2531 |
}
|
|
2532 |
default:
|
|
2533 |
{
|
|
2534 |
//nothing
|
|
2535 |
break;
|
|
2536 |
}
|
|
2537 |
}
|
|
2538 |
if (!cmdAdded)
|
|
2539 |
{
|
|
2540 |
AddMskCommandL(R_LM_MSK_EDIT, ELmkCmdEditLm);
|
|
2541 |
}
|
|
2542 |
}
|
|
2543 |
|
|
2544 |
// -----------------------------------------------------------------------------
|
|
2545 |
// CLmkEditorImpl::AddMskCommandL
|
|
2546 |
// -----------------------------------------------------------------------------
|
|
2547 |
//
|
|
2548 |
void CLmkEditorImpl::AddMskCommandL(TInt aResourceId, TLmkAppCmdId aCommandId)
|
|
2549 |
{
|
|
2550 |
HBufC* mskTxt = NULL;
|
|
2551 |
mskTxt = StringLoader::LoadLC(aResourceId, iEikonEnv);
|
|
2552 |
CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current();
|
|
2553 |
cba->RemoveCommandFromStack(KMskCommandPos, iMskCmdId);
|
|
2554 |
iMskCmdId = aCommandId;
|
|
2555 |
iCurrentResourceId = aResourceId;
|
|
2556 |
cba->AddCommandToStackL(KMskCommandPos, iMskCmdId, mskTxt->Des());
|
|
2557 |
cba->MakeCommandVisible(iMskCmdId, ETrue);
|
|
2558 |
CleanupStack::PopAndDestroy(mskTxt);
|
|
2559 |
}
|
|
2560 |
|
|
2561 |
// -----------------------------------------------------------------------------
|
|
2562 |
// CLmkEditorImpl::AddMskCommandL
|
|
2563 |
// -----------------------------------------------------------------------------
|
|
2564 |
//
|
|
2565 |
void CLmkEditorImpl::DimmMiddleSoftKey()
|
|
2566 |
{
|
|
2567 |
/*This is required, since there was an error,
|
|
2568 |
where the menu item appears if there are not items
|
|
2569 |
in the lis, after pressing the middle key.Hence, if
|
|
2570 |
dummy msk is added to the resource, it fixes the error,
|
|
2571 |
now this dummy button needs to be disabled.Check the
|
|
2572 |
dialog resource in editor.rss*/
|
|
2573 |
CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current();
|
|
2574 |
cba->MakeCommandVisible(EAknSoftkeyContextOptions, EFalse);
|
|
2575 |
}
|
|
2576 |
|
|
2577 |
// -----------------------------------------------------------------------------
|
|
2578 |
// CLmkEditorImpl::ShowQueryIfLocationFieldsAlreadyFilledL
|
|
2579 |
// -----------------------------------------------------------------------------
|
|
2580 |
//
|
|
2581 |
TBool CLmkEditorImpl::ShowQueryIfLocationFieldsAlreadyFilledL()
|
|
2582 |
{
|
|
2583 |
TBool result = EFalse;
|
|
2584 |
TRealX lati;
|
|
2585 |
lati.SetNaN();
|
|
2586 |
TRealX longi;
|
|
2587 |
longi.SetNaN();
|
|
2588 |
|
|
2589 |
MLmkFieldData* lat = iLmkFields->GetField(ELatitude);
|
|
2590 |
if (lat)
|
|
2591 |
{
|
|
2592 |
//get latitude control id
|
|
2593 |
TInt id = lat->UniqueFieldIdentity();
|
|
2594 |
MLmkEditorField* latcontrol = iEditorFieldArray->Find(id);
|
|
2595 |
//get latitude control current text
|
|
2596 |
lati = static_cast<CLmkEditorCoordinateField*>(latcontrol)->FieldValue();
|
|
2597 |
|
|
2598 |
MLmkFieldData* lon = iLmkFields->GetField(ELongitude);
|
|
2599 |
if (lon)
|
|
2600 |
{
|
|
2601 |
//get longitude control id
|
|
2602 |
id = lon->UniqueFieldIdentity();
|
|
2603 |
MLmkEditorField* longcontrol = iEditorFieldArray->Find(id);
|
|
2604 |
//get longitude control current text
|
|
2605 |
longi = static_cast<CLmkEditorCoordinateField*>(longcontrol)->FieldValue();
|
|
2606 |
}
|
|
2607 |
|
|
2608 |
if ( (!lati.IsNaN()) && (!longi.IsNaN()))
|
|
2609 |
{
|
|
2610 |
if (!LmkNotes::ShowOwerriteLocationQueryL(iEikonEnv))
|
|
2611 |
{
|
|
2612 |
result = ETrue;
|
|
2613 |
}
|
|
2614 |
}
|
|
2615 |
}
|
|
2616 |
return result;
|
|
2617 |
}
|
|
2618 |
|
|
2619 |
// -----------------------------------------------------------------------------
|
|
2620 |
// CLmkEditorImpl::IsInvalidUriL
|
|
2621 |
// -----------------------------------------------------------------------------
|
|
2622 |
//
|
|
2623 |
TBool CLmkEditorImpl::IsInvalidUriL()
|
|
2624 |
{
|
|
2625 |
TBool ret = EFalse;
|
|
2626 |
MLmkFieldData* fields = iLmkFields->GetField(EWebAddress);
|
|
2627 |
if (fields)
|
|
2628 |
{
|
|
2629 |
MLmkEditorField* fld = iEditorFieldArray->Find(
|
|
2630 |
fields->UniqueFieldIdentity());
|
|
2631 |
if (fld)
|
|
2632 |
{
|
|
2633 |
HBufC* webaddr = HBufC::NewLC(KMaxBufferLen);
|
|
2634 |
CLmkEditorTextField* field =
|
|
2635 |
static_cast<CLmkEditorTextField*> (fld);
|
|
2636 |
TPtr ptr = webaddr->Des();
|
|
2637 |
field->Control()->GetText(ptr);
|
|
2638 |
ret = UriUtils::HasInvalidChars(ptr);
|
|
2639 |
CleanupStack::PopAndDestroy();//webaddr
|
|
2640 |
}
|
|
2641 |
}
|
|
2642 |
return ret;
|
|
2643 |
}
|
|
2644 |
|
|
2645 |
// -----------------------------------------------------------------------------
|
|
2646 |
// CLmkEditorImpl::HandleListProviderEvent
|
|
2647 |
// -----------------------------------------------------------------------------
|
|
2648 |
//
|
|
2649 |
void CLmkEditorImpl::HandleListProviderEvent(TLmkListProviderEventType /*aEvent*/)
|
|
2650 |
{
|
|
2651 |
TRAPD(err,CPosLandmark* landmark = iDb.ReadLandmarkLC(iLmkFields->LandmarkId());CleanupStack::PopAndDestroy( landmark ));
|
|
2652 |
if (err == KErrNotFound)
|
|
2653 |
{
|
|
2654 |
TRAP_IGNORE(DeleteSelfL());
|
|
2655 |
}
|
|
2656 |
else
|
|
2657 |
{
|
|
2658 |
//update the landmark viewer/editor
|
|
2659 |
TRAP_IGNORE(UpdateViewDlgL());
|
|
2660 |
}
|
|
2661 |
}
|
|
2662 |
|
|
2663 |
// -----------------------------------------------------------------------------
|
|
2664 |
// CLmkEditorImpl::HandleListProviderError
|
|
2665 |
// -----------------------------------------------------------------------------
|
|
2666 |
//
|
|
2667 |
void CLmkEditorImpl::HandleListProviderError(TInt /*aError*/)
|
|
2668 |
{
|
|
2669 |
//if error do nothing
|
|
2670 |
}
|
|
2671 |
|
|
2672 |
// -----------------------------------------------------------------------------
|
|
2673 |
// CLmkEditorImpl::LaunchLmkEditorL
|
|
2674 |
// -----------------------------------------------------------------------------
|
|
2675 |
//
|
|
2676 |
void CLmkEditorImpl::LaunchLmkEditorL()
|
|
2677 |
{
|
|
2678 |
CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current();
|
|
2679 |
cba->RemoveCommandFromStack(KMskCommandPos, iMskCmdId);
|
|
2680 |
// Launch editor
|
|
2681 |
TLmkEditorAttributes attributeFlags(CLmkEditorDlg::ELmkAll);
|
|
2682 |
// Check if the Landmark is alreayd present in the database. Incase,
|
|
2683 |
// a landmark is associated with the editor and if it is not
|
|
2684 |
// added to the Database, then the viewer would be launched with
|
|
2685 |
// the lanmark content
|
|
2686 |
if (KPosLmNullItemId == iLmkFields->LandmarkId() && iLandmark)
|
|
2687 |
{
|
|
2688 |
iEditor = CLmkEditorImpl::NewL(iDb, iSender, attributeFlags,
|
|
2689 |
CLmkEditorDlg::ELmkEditor, iLandmark);
|
|
2690 |
}
|
|
2691 |
else
|
|
2692 |
{
|
|
2693 |
iEditor = CLmkEditorImpl::NewL(iDb, iSender, attributeFlags,
|
|
2694 |
CLmkEditorDlg::ELmkEditor, iLmkFields->LandmarkId());
|
|
2695 |
}
|
|
2696 |
|
|
2697 |
MLmkEditorField* field = iEditorFieldArray->Find(IdOfFocusControl());
|
|
2698 |
iFieldTypeToFocus = field->LandmarkItemField().FieldType();
|
|
2699 |
iEditor->SetFieldTypeToFocusInEditMode(iFieldTypeToFocus);
|
|
2700 |
iEditor->SetDlgEditing(ETrue);
|
|
2701 |
iIsEditing = ETrue;
|
|
2702 |
if (!iMapNavFeature)
|
|
2703 |
{
|
|
2704 |
iEditor->DisableMapAndNavigationMenuOptions();
|
|
2705 |
}
|
|
2706 |
iEditor->ExecuteLD();
|
|
2707 |
iEditor->SetDlgEditing(EFalse);
|
|
2708 |
iIsEditing = EFalse;
|
|
2709 |
TInt err = KErrNone;
|
|
2710 |
TRAP( err, CPosLandmark* landmark = iDb.ReadLandmarkLC( iLmkFields->LandmarkId() ); CleanupStack::PopAndDestroy( landmark ) );
|
|
2711 |
if (err == KErrNotFound)
|
|
2712 |
{
|
|
2713 |
iLmkUiUtils->RestoreOldNaviPaneL();
|
|
2714 |
delete this;
|
|
2715 |
return;
|
|
2716 |
}
|
|
2717 |
AddMskCommandL(iCurrentResourceId, iMskCmdId);
|
|
2718 |
}
|
|
2719 |
|
|
2720 |
// -----------------------------------------------------------------------------
|
|
2721 |
// CLmkEditorImpl::DeleteSelfL
|
|
2722 |
// -----------------------------------------------------------------------------
|
|
2723 |
//
|
|
2724 |
void CLmkEditorImpl::DeleteSelfL()
|
|
2725 |
{
|
|
2726 |
iLmkUiUtils->RestoreOldNaviPaneL();
|
|
2727 |
if (iEditor)
|
|
2728 |
{
|
|
2729 |
//delete only editor,if editor instance is present,
|
|
2730 |
//viewer will be deleted in ProcessCommandL, where
|
|
2731 |
//editor was created.
|
|
2732 |
delete iEditor;
|
|
2733 |
iEditor = NULL;
|
|
2734 |
}
|
|
2735 |
else
|
|
2736 |
{
|
|
2737 |
delete this;
|
|
2738 |
}
|
|
2739 |
}
|
|
2740 |
|
|
2741 |
// -----------------------------------------------------------------------------
|
|
2742 |
// CLmkEditorImpl::HandleCentralRepositoryChangeL()
|
|
2743 |
// -----------------------------------------------------------------------------
|
|
2744 |
//
|
|
2745 |
void CLmkEditorImpl::HandleCentralRepositoryChangeL()
|
|
2746 |
{
|
|
2747 |
//change unit for position accuracy
|
|
2748 |
MLmkFieldData* fldData = iLmkFields->GetField(EPositionAccuracy);
|
|
2749 |
if (fldData)
|
|
2750 |
{
|
|
2751 |
TInt id1 = fldData->UniqueFieldIdentity();
|
|
2752 |
CLmkEditorNumberField* field =
|
|
2753 |
static_cast<CLmkEditorNumberField*> (iEditorFieldArray->Find(
|
|
2754 |
id1));
|
|
2755 |
if (field)
|
|
2756 |
field->HandleUnitChangeL();
|
|
2757 |
}
|
|
2758 |
|
|
2759 |
//change altitude unit
|
|
2760 |
MLmkFieldData* fldData1 = iLmkFields->GetField(EAltitude);
|
|
2761 |
if (fldData1)
|
|
2762 |
{
|
|
2763 |
TInt id2 = fldData1->UniqueFieldIdentity();
|
|
2764 |
CLmkEditorNumberField* field1 =
|
|
2765 |
static_cast<CLmkEditorNumberField*> (iEditorFieldArray->Find(
|
|
2766 |
id2));
|
|
2767 |
if (field1)
|
|
2768 |
field1->HandleUnitChangeL();
|
|
2769 |
}
|
|
2770 |
|
|
2771 |
//change altitude accuracy unit
|
|
2772 |
MLmkFieldData* fldData2 = iLmkFields->GetField(EAltitudeAccuracy);
|
|
2773 |
if (fldData2)
|
|
2774 |
{
|
|
2775 |
TInt id3 = fldData2->UniqueFieldIdentity();
|
|
2776 |
CLmkEditorNumberField* field2 =
|
|
2777 |
static_cast<CLmkEditorNumberField*> (iEditorFieldArray->Find(
|
|
2778 |
id3));
|
|
2779 |
if (field2)
|
|
2780 |
field2->HandleUnitChangeL();
|
|
2781 |
}
|
|
2782 |
}
|
|
2783 |
|
|
2784 |
// -----------------------------------------------------------------------------
|
|
2785 |
// CLmkEditorImpl::UpdateCatInfoNotePosition()
|
|
2786 |
// -----------------------------------------------------------------------------
|
|
2787 |
//
|
|
2788 |
void CLmkEditorImpl::UpdateCatInfoNotePosition()
|
|
2789 |
{
|
|
2790 |
//this is only to set the position of the
|
|
2791 |
//cat info note.
|
|
2792 |
if (iCatInfoPopupNote && IsCategoryField())
|
|
2793 |
{
|
|
2794 |
CEikCaptionedControl* tmpline = CurrentLine();
|
|
2795 |
TPoint pt1 = tmpline->PositionRelativeToScreen();
|
|
2796 |
pt1.iX += KHOffsetCatInfoPopup;
|
|
2797 |
pt1.iY += KVOffsetCatInfoPopup;
|
|
2798 |
iCatInfoPopupNote->SetPositionAndAlignment(pt1, EHLeftVTop);
|
|
2799 |
}
|
|
2800 |
}
|
|
2801 |
|
|
2802 |
// -----------------------------------------------------------------------------
|
|
2803 |
// CLmkEditorImpl::IsCategoryField()
|
|
2804 |
// -----------------------------------------------------------------------------
|
|
2805 |
//
|
|
2806 |
TBool CLmkEditorImpl::IsCategoryField()
|
|
2807 |
{
|
|
2808 |
//to check whether the current focussed field is a
|
|
2809 |
//category field.
|
|
2810 |
TBool result = ETrue;
|
|
2811 |
MLmkEditorField* field = iEditorFieldArray->Find(IdOfFocusControl());
|
|
2812 |
TUint type = field->LandmarkItemField().FieldType();
|
|
2813 |
if (type != ECategories && type != ECategory)
|
|
2814 |
{
|
|
2815 |
result = EFalse;
|
|
2816 |
}
|
|
2817 |
return result;
|
|
2818 |
}
|
|
2819 |
|
|
2820 |
#ifdef RD_SCALABLE_UI_V2
|
|
2821 |
// -----------------------------------------------------------------------------
|
|
2822 |
// CLmkEditorImpl::HandleDialogPageEventL
|
|
2823 |
// -----------------------------------------------------------------------------
|
|
2824 |
//
|
|
2825 |
void CLmkEditorImpl::HandleDialogPageEventL(TInt aEventID)
|
|
2826 |
{
|
|
2827 |
CAknForm::HandleDialogPageEventL(aEventID);
|
|
2828 |
if (aEventID == MEikDialogPageObserver::EDialogPageTapped)
|
|
2829 |
{
|
|
2830 |
MLmkEditorField* field = iEditorFieldArray->Find(IdOfFocusControl());
|
|
2831 |
TUint type = field->LandmarkItemField().FieldType();
|
|
2832 |
|
|
2833 |
// check the editor mode
|
|
2834 |
if (IsEditable()) // edit mode
|
|
2835 |
{
|
|
2836 |
if (type == ECategory || type == ECategories)
|
|
2837 |
{
|
|
2838 |
if (!iIsCategorySelctorOpen)
|
|
2839 |
{
|
|
2840 |
iIsCategorySelctorOpen = ETrue;
|
|
2841 |
SelectCategoriesCmdL();
|
|
2842 |
}
|
|
2843 |
}
|
|
2844 |
}
|
|
2845 |
else
|
|
2846 |
{// view or receive mode
|
|
2847 |
if (type == ECategories)
|
|
2848 |
{
|
|
2849 |
if (iCalegorySelectionFlag) // Receive mode
|
|
2850 |
{
|
|
2851 |
CategoriesCmdFromXmlL();
|
|
2852 |
}
|
|
2853 |
else
|
|
2854 |
{
|
|
2855 |
CategoriesCmdL(); // View mode
|
|
2856 |
}
|
|
2857 |
}
|
|
2858 |
else // focus is on any other landmark field
|
|
2859 |
{
|
|
2860 |
if (!iCalegorySelectionFlag)// No context menu for receive mode
|
|
2861 |
{
|
|
2862 |
if (!iIsEditing)
|
|
2863 |
{
|
|
2864 |
LaunchLmkEditorL();
|
|
2865 |
}
|
|
2866 |
}
|
|
2867 |
}
|
|
2868 |
}
|
|
2869 |
}
|
|
2870 |
}
|
|
2871 |
|
|
2872 |
#endif //RD_SCALABLE_UI_V2
|
|
2873 |
// -----------------------------------------------------------------------------
|
|
2874 |
// CLmkEditorImpl::LineChangedL
|
|
2875 |
// -----------------------------------------------------------------------------
|
|
2876 |
//
|
|
2877 |
|
|
2878 |
void CLmkEditorImpl::LineChangedL(TInt /*aControlId*/)
|
|
2879 |
{
|
|
2880 |
//hide the category info pop-up if active
|
|
2881 |
if (iCatInfoPopupNote)
|
|
2882 |
{
|
|
2883 |
iCatInfoPopupNote->HideInfoPopupNote();
|
|
2884 |
}
|
|
2885 |
MLmkEditorField* field = iEditorFieldArray->Find(IdOfFocusControl());
|
|
2886 |
__ASSERT_DEBUG( field, Panic( KLmkPanicNullMember ) );
|
|
2887 |
TUint type = field->LandmarkItemField().FieldType();
|
|
2888 |
if (IsEditable())
|
|
2889 |
{
|
|
2890 |
//editor
|
|
2891 |
if (type == ECategory || type == ECategories)
|
|
2892 |
{
|
|
2893 |
AddMskCommandL(R_LM_MSK_EDIT, ELmkCmdSelectCategories);
|
|
2894 |
}
|
|
2895 |
else
|
|
2896 |
{
|
|
2897 |
CEikButtonGroupContainer* cba =
|
|
2898 |
CEikButtonGroupContainer::Current();
|
|
2899 |
cba->MakeCommandVisible(iMskCmdId, EFalse);
|
|
2900 |
}
|
|
2901 |
}
|
|
2902 |
else
|
|
2903 |
{
|
|
2904 |
//viewer
|
|
2905 |
UpdateMskOnArrowMoveForViewerL();
|
|
2906 |
}
|
|
2907 |
}
|
|
2908 |
|
|
2909 |
// -----------------------------------------------------------------------------
|
|
2910 |
// CLmkEditorImpl::ClearPositionInfoL()
|
|
2911 |
// -----------------------------------------------------------------------------
|
|
2912 |
//
|
|
2913 |
void CLmkEditorImpl::ClearPositionInfoL()
|
|
2914 |
{
|
|
2915 |
//clear latitude
|
|
2916 |
MLmkFieldData* lat = iLmkFields->GetField(ELatitude);
|
|
2917 |
if (lat)
|
|
2918 |
{
|
|
2919 |
TInt id = lat->UniqueFieldIdentity();
|
|
2920 |
MLmkEditorField* latcontrol = iEditorFieldArray->Find(id);
|
|
2921 |
if (latcontrol)
|
|
2922 |
{
|
|
2923 |
latcontrol->ResetL();
|
|
2924 |
}
|
|
2925 |
}
|
|
2926 |
//clear longitude
|
|
2927 |
MLmkFieldData* lon = iLmkFields->GetField(ELongitude);
|
|
2928 |
if (lon)
|
|
2929 |
{
|
|
2930 |
TInt id = lon->UniqueFieldIdentity();
|
|
2931 |
MLmkEditorField* longcontrol = iEditorFieldArray->Find(id);
|
|
2932 |
if (longcontrol)
|
|
2933 |
{
|
|
2934 |
longcontrol->ResetL();
|
|
2935 |
}
|
|
2936 |
}
|
|
2937 |
//clear position accuracy
|
|
2938 |
MLmkFieldData* fldData = iLmkFields->GetField(EPositionAccuracy);
|
|
2939 |
if (fldData)
|
|
2940 |
{
|
|
2941 |
TInt id1 = fldData->UniqueFieldIdentity();
|
|
2942 |
CLmkEditorNumberField* field =
|
|
2943 |
static_cast<CLmkEditorNumberField*> (iEditorFieldArray->Find(
|
|
2944 |
id1));
|
|
2945 |
if (field)
|
|
2946 |
{
|
|
2947 |
field->ResetL();
|
|
2948 |
}
|
|
2949 |
}
|
|
2950 |
//clear altitude
|
|
2951 |
MLmkFieldData* fldData1 = iLmkFields->GetField(EAltitude);
|
|
2952 |
if (fldData1)
|
|
2953 |
{
|
|
2954 |
TInt id2 = fldData1->UniqueFieldIdentity();
|
|
2955 |
CLmkEditorNumberField* field1 =
|
|
2956 |
static_cast<CLmkEditorNumberField*> (iEditorFieldArray->Find(
|
|
2957 |
id2));
|
|
2958 |
if (field1)
|
|
2959 |
{
|
|
2960 |
field1->ResetL();
|
|
2961 |
}
|
|
2962 |
}
|
|
2963 |
//clear altitude accuracy
|
|
2964 |
MLmkFieldData* fldData2 = iLmkFields->GetField(EAltitudeAccuracy);
|
|
2965 |
if (fldData2)
|
|
2966 |
{
|
|
2967 |
TInt id3 = fldData2->UniqueFieldIdentity();
|
|
2968 |
CLmkEditorNumberField* field2 =
|
|
2969 |
static_cast<CLmkEditorNumberField*> (iEditorFieldArray->Find(
|
|
2970 |
id3));
|
|
2971 |
if (field2)
|
|
2972 |
{
|
|
2973 |
field2->ResetL();
|
|
2974 |
}
|
|
2975 |
}
|
|
2976 |
DrawNow();
|
|
2977 |
}
|
|
2978 |
|
|
2979 |
// -----------------------------------------------------------------------------
|
|
2980 |
// CLmkEditorImpl::ArePositionFieldEmptyL()
|
|
2981 |
// -----------------------------------------------------------------------------
|
|
2982 |
//
|
|
2983 |
TBool CLmkEditorImpl::ArePositionFieldEmptyL()
|
|
2984 |
{
|
|
2985 |
return (IsFieldEmptyL(ELatitude) && IsFieldEmptyL(ELongitude)
|
|
2986 |
&& IsFieldEmptyL(EAltitude) && IsFieldEmptyL(EAltitudeAccuracy)
|
|
2987 |
&& IsFieldEmptyL(EPositionAccuracy)) ? ETrue : EFalse;
|
|
2988 |
}
|
|
2989 |
|
|
2990 |
#ifdef RD_SCALABLE_UI_V2
|
|
2991 |
// -----------------------------------------------------------------------------
|
|
2992 |
// CLmkEditorImpl::HandleEditorCommandL()
|
|
2993 |
// -----------------------------------------------------------------------------
|
|
2994 |
//
|
|
2995 |
void CLmkEditorImpl::HandleEditorCommandL()
|
|
2996 |
{
|
|
2997 |
MLmkEditorField* field = iEditorFieldArray->Find(IdOfFocusControl());
|
|
2998 |
__ASSERT_DEBUG( field, Panic( KLmkPanicNullMember ) );
|
|
2999 |
|
|
3000 |
TUint type = field->LandmarkItemField().FieldType();
|
|
3001 |
switch (type)
|
|
3002 |
{
|
|
3003 |
case ECategories:
|
|
3004 |
case ECategory:
|
|
3005 |
{
|
|
3006 |
ProcessCommandL(ELmkCmdSelectCategories);
|
|
3007 |
break;
|
|
3008 |
}
|
|
3009 |
}
|
|
3010 |
}
|
|
3011 |
#endif //RD_SCALABLE_UI_V2
|
|
3012 |
// -----------------------------------------------------------------------------
|
|
3013 |
// CLmkAppLmItemSelectorImpl::HandleDialogDismissed
|
|
3014 |
// -----------------------------------------------------------------------------
|
|
3015 |
//
|
|
3016 |
void CLmkEditorImpl::HandleDialogDismissed(TInt aButtonId)
|
|
3017 |
{
|
|
3018 |
if (EEikBidCancel == aButtonId)
|
|
3019 |
{
|
|
3020 |
delete iLocationService;
|
|
3021 |
iLocationService = NULL;
|
|
3022 |
}
|
|
3023 |
}
|
|
3024 |
|
|
3025 |
// -----------------------------------------------------------------------------
|
|
3026 |
// CLmkEditorImpl::InsertLineL()
|
|
3027 |
// -----------------------------------------------------------------------------
|
|
3028 |
//
|
|
3029 |
MLmkEditorField* CLmkEditorImpl::InsertLineL(MLmkFieldData* aFieldData,
|
|
3030 |
TInt aPrevControlId)
|
|
3031 |
{
|
|
3032 |
MLmkEditorField* editorField = NULL;
|
|
3033 |
//data present, but control not present
|
|
3034 |
TryChangeFocusL(aPrevControlId);
|
|
3035 |
editorField = LmkEditorFieldFactory::CreateFieldL(*aFieldData, *this);
|
|
3036 |
CleanupStack::PushL(editorField);
|
|
3037 |
if (editorField)
|
|
3038 |
{
|
|
3039 |
editorField->SetEditableL(EFalse);
|
|
3040 |
iEditorFieldArray->GetFieldArray().AppendL(editorField);
|
|
3041 |
editorField->ActivateL();
|
|
3042 |
}
|
|
3043 |
CleanupStack::Pop(); //editorField
|
|
3044 |
return editorField;
|
|
3045 |
}
|
|
3046 |
|
|
3047 |
// -----------------------------------------------------------------------------
|
|
3048 |
// CLmkEditorImpl::DeleteLineL()
|
|
3049 |
// -----------------------------------------------------------------------------
|
|
3050 |
//
|
|
3051 |
void CLmkEditorImpl::DeleteLineL(MLmkEditorField* aEditorField, TInt aCtrlId,
|
|
3052 |
TInt aPos)
|
|
3053 |
{
|
|
3054 |
//data not present but control present
|
|
3055 |
//iEditorFieldArray->GetFieldArray().Delete( aPos-1 );
|
|
3056 |
iEditorFieldArray->GetFieldArray().Delete(aPos);
|
|
3057 |
delete aEditorField;
|
|
3058 |
aEditorField = NULL;
|
|
3059 |
DeleteLine(aCtrlId);
|
|
3060 |
}
|
|
3061 |
|
|
3062 |
// -----------------------------------------------------------------------------
|
|
3063 |
// CLmkEditorImpl::AddOrDeleteLineL()
|
|
3064 |
// -----------------------------------------------------------------------------
|
|
3065 |
//
|
|
3066 |
MLmkEditorField* CLmkEditorImpl::AddOrDeleteLineL(
|
|
3067 |
MLmkEditorField* aEditorField, MLmkFieldData* aFieldData,
|
|
3068 |
TInt aPrevControlId, TInt aCtrlId, TInt aPos)
|
|
3069 |
{
|
|
3070 |
TBool valPresent = iEditorFieldArray->CheckIfFieldIsEmpty(*aFieldData);
|
|
3071 |
if (valPresent && !aEditorField)
|
|
3072 |
{
|
|
3073 |
aEditorField = InsertLineL(aFieldData, aPrevControlId);
|
|
3074 |
}
|
|
3075 |
else if (!valPresent && aEditorField)
|
|
3076 |
{
|
|
3077 |
DeleteLineL(aEditorField, aCtrlId, aPos);
|
|
3078 |
aEditorField = NULL;
|
|
3079 |
}
|
|
3080 |
return aEditorField;
|
|
3081 |
}
|
|
3082 |
|
|
3083 |
// -----------------------------------------------------------------------------
|
|
3084 |
// CLmkEditorImpl::MessageQueryCallBack()
|
|
3085 |
// -----------------------------------------------------------------------------
|
|
3086 |
//
|
|
3087 |
TInt CLmkEditorImpl::MessageQueryCallBack(TAny* /*aPtr*/)
|
|
3088 |
{
|
|
3089 |
TInt result = KErrNone;
|
|
3090 |
CEikonEnv* env = CEikonEnv::Static();
|
|
3091 |
TRAP_IGNORE(result = LmkNotes::GenericMessageQueryL(env,R_LMK_REQUEST_FAIL_INFO_TEXT,
|
|
3092 |
R_LMK_MSG_QUERY_HEADING_PANE_TEXT));
|
|
3093 |
return result;
|
|
3094 |
}
|
|
3095 |
|
|
3096 |
// ---------------------------------------------------------
|
|
3097 |
// CLmkEditorImpl::CheckHideCoordinateL()
|
|
3098 |
// ---------------------------------------------------------
|
|
3099 |
//
|
|
3100 |
void CLmkEditorImpl::CheckHideCoordinateL()
|
|
3101 |
{
|
|
3102 |
TInt coordinateSettingValue = ELocCoordinatesNotHidden;
|
|
3103 |
TInt helpSettingValue = ELocHelpNotHidden;
|
|
3104 |
CRepository* repository = CRepository::NewL(TUid::Uid(
|
|
3105 |
KCRUidLocLocalVariation));
|
|
3106 |
CleanupStack::PushL(repository);
|
|
3107 |
User::LeaveIfError(repository->Get(KLocHideCoordinates,
|
|
3108 |
coordinateSettingValue));
|
|
3109 |
User::LeaveIfError(repository->Get(KLocHideHelp, helpSettingValue));
|
|
3110 |
CleanupStack::PopAndDestroy(repository);
|
|
3111 |
|
|
3112 |
if (ELocCoordinatesHidden == coordinateSettingValue)
|
|
3113 |
iIsHideCoordinate = ETrue;
|
|
3114 |
else
|
|
3115 |
iIsHideCoordinate = EFalse;
|
|
3116 |
|
|
3117 |
if (ELocHelpHidden == helpSettingValue)
|
|
3118 |
iIsHideHelp = ETrue;
|
|
3119 |
else
|
|
3120 |
iIsHideHelp = EFalse;
|
|
3121 |
}
|
|
3122 |
|
|
3123 |
// End of File
|
|
3124 |
|