37
|
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: LandmarksUi Package viewer implementation
|
|
15 |
* For Received Landmark
|
|
16 |
*
|
|
17 |
*/
|
|
18 |
|
|
19 |
// INCLUDE FILES
|
|
20 |
#include <featmgr.h>
|
|
21 |
#include <aknnotewrappers.h>
|
|
22 |
#include <AknWaitDialog.h>
|
|
23 |
#include <aknlists.h>
|
|
24 |
#include <StringLoader.h>
|
|
25 |
#include <AknQueryDialog.h>
|
|
26 |
#include <lmkui.rsg>
|
|
27 |
#include <eikmenup.h>
|
|
28 |
#include <hlplch.h>
|
|
29 |
#include <sendnorm.rsg> // R_SENDUI_MENU
|
|
30 |
#include <CLmkEditorDlg.h> // from system include!
|
|
31 |
#include "CLmkParser.h"
|
|
32 |
#include "landmarks.hrh"
|
|
33 |
#include "LmkUID.h"
|
|
34 |
#include <csxhelp/lmmes.hlp.hrh>
|
|
35 |
#include "CLmkUiUtils.h"
|
|
36 |
#include "CLmkEditorFieldArray.h"
|
|
37 |
#include "MLmkEditorField.h"
|
|
38 |
#include "LmkNotes.h"
|
|
39 |
#include "LmkConsts.h"
|
|
40 |
#include "CLmkDbUtils.h"
|
|
41 |
#include "CLmkLocationService.h"
|
|
42 |
#include "CLmkDlgCategorySelectorImpl.h"
|
|
43 |
#include "CLmkSender.h"
|
|
44 |
#include "CLmkLandMarkCategoriesName.h"
|
|
45 |
#include "CLmkPackageEditorImpl.h"
|
|
46 |
#include "CLmkSaveLandmarkUtils.h"
|
|
47 |
|
|
48 |
// ============================ MEMBER FUNCTIONS ===============================
|
|
49 |
|
|
50 |
// -----------------------------------------------------------------------------
|
|
51 |
// CLmkPackageEditorImpl::CLmkPackageEditorImpl
|
|
52 |
// C++ default constructor can NOT contain any code, that
|
|
53 |
// might leave.
|
|
54 |
// -----------------------------------------------------------------------------
|
|
55 |
//
|
|
56 |
CLmkPackageEditorImpl::CLmkPackageEditorImpl(CPosLandmarkDatabase& aDb,
|
|
57 |
CLmkParser& aParser, CLmkSender& aSender, TInt aItemIndex) :
|
|
58 |
CLmkEditorImpl(aDb, aSender, CLmkEditorDlg::ELmkViewer), // viewing only mode!
|
|
59 |
iParser(aParser), iItemIndex(aItemIndex)
|
|
60 |
{
|
|
61 |
TCoeHelpContext
|
|
62 |
help(TUid::Uid(KLmkMsgViewerAppUID3), KLM_HLP_RECEIVED_LM);
|
|
63 |
SetHelpContext(help);
|
|
64 |
}
|
|
65 |
|
|
66 |
// -----------------------------------------------------------------------------
|
|
67 |
// CLmkPackageEditorImpl::ConstructL
|
|
68 |
// Symbian 2nd phase constructor can leave.
|
|
69 |
// -----------------------------------------------------------------------------
|
|
70 |
//
|
|
71 |
void CLmkPackageEditorImpl::ConstructL()
|
|
72 |
{
|
|
73 |
iLandmark = iParser.LandmarkLC(iItemIndex);
|
|
74 |
iCategoryNameArray = iParser.CategoryNameLC(iItemIndex);
|
|
75 |
iCategoryNameArray->GetCategoryNames(iCategoryNames);
|
|
76 |
iCalegorySelectionFlag = ETrue;
|
|
77 |
CleanupStack::Pop(2); //iLandmark ,iCategoryNames
|
|
78 |
TLmkEditorAttributes arguments(CLmkEditorDlg::ELmkAll);
|
|
79 |
iIsLmkReceiveMode = ETrue;
|
|
80 |
CLmkEditorImpl::ConstructL(iLandmark, arguments);
|
|
81 |
}
|
|
82 |
|
|
83 |
// -----------------------------------------------------------------------------
|
|
84 |
// CLmkPackageEditorImpl::NewL
|
|
85 |
// Two-phased constructor.
|
|
86 |
// -----------------------------------------------------------------------------
|
|
87 |
//
|
|
88 |
EXPORT_C CLmkPackageEditorImpl* CLmkPackageEditorImpl::NewL(
|
|
89 |
CPosLandmarkDatabase& aDb, CLmkParser& aParser, CLmkSender& aSender,
|
|
90 |
TInt aItemIndex)
|
|
91 |
{
|
|
92 |
CLmkPackageEditorImpl* self = new (ELeave) CLmkPackageEditorImpl(aDb,
|
|
93 |
aParser, aSender, aItemIndex);
|
|
94 |
|
|
95 |
CleanupStack::PushL(self);
|
|
96 |
self->ConstructL();
|
|
97 |
CleanupStack::Pop(); //self
|
|
98 |
return self;
|
|
99 |
}
|
|
100 |
|
|
101 |
// -----------------------------------------------------------------------------
|
|
102 |
// CLmkPackageEditorImpl::~CLmkPackageEditorImpl()
|
|
103 |
// -----------------------------------------------------------------------------
|
|
104 |
//
|
|
105 |
CLmkPackageEditorImpl::~CLmkPackageEditorImpl()
|
|
106 |
{
|
|
107 |
if (iWaitNote)
|
|
108 |
{
|
|
109 |
TRAPD(err, iWaitNote->ProcessFinishedL());
|
|
110 |
if (err != KErrNone)
|
|
111 |
{
|
|
112 |
delete iWaitNote;
|
|
113 |
iWaitNote = NULL;
|
|
114 |
}
|
|
115 |
}
|
|
116 |
delete iLandmark;
|
|
117 |
delete iCategoryNameArray;
|
|
118 |
}
|
|
119 |
|
|
120 |
// -----------------------------------------------------------------------------
|
|
121 |
// CLmkPackageEditorImpl::HandleOperationL
|
|
122 |
// -----------------------------------------------------------------------------
|
|
123 |
//
|
|
124 |
void CLmkPackageEditorImpl::HandleOperationL(TOperationTypes aType,
|
|
125 |
TReal32 /*aProgress*/, TInt aStatus)
|
|
126 |
{
|
|
127 |
if (aType == EImport)
|
|
128 |
{
|
|
129 |
if (aStatus != KPosLmOperationNotComplete && iWaitNote)
|
|
130 |
{
|
|
131 |
iWaitNote->ProcessFinishedL();
|
|
132 |
iWaitNote = NULL;
|
|
133 |
}
|
|
134 |
}
|
|
135 |
}
|
|
136 |
|
|
137 |
// -----------------------------------------------------------------------------
|
|
138 |
// CLmkPackageEditorImpl::DynInitMenuPaneL
|
|
139 |
// -----------------------------------------------------------------------------
|
|
140 |
//
|
|
141 |
void CLmkPackageEditorImpl::DynInitMenuPaneL(TInt aResourceId,
|
|
142 |
CEikMenuPane* aMenuPane)
|
|
143 |
{
|
|
144 |
switch (aResourceId)
|
|
145 |
{
|
|
146 |
case R_AVKON_FORM_MENUPANE:
|
|
147 |
{
|
|
148 |
CAknForm::DynInitMenuPaneL(aResourceId, aMenuPane);
|
|
149 |
TBool hideMN = EFalse;
|
|
150 |
if (iIsHideCoordinate)
|
|
151 |
{
|
|
152 |
if (IsLandmarkDataEmptyL(iLandmark))
|
|
153 |
{
|
|
154 |
hideMN = ETrue;
|
|
155 |
}
|
|
156 |
}
|
|
157 |
else if (ArePositionFieldEmptyL())
|
|
158 |
{
|
|
159 |
hideMN = ETrue;
|
|
160 |
}
|
|
161 |
|
|
162 |
if (hideMN)
|
|
163 |
{
|
|
164 |
// delete the show on map & Navigate To options
|
|
165 |
aMenuPane->DeleteMenuItem(ELmkShowOnMapPlaceHolder);
|
|
166 |
aMenuPane->DeleteMenuItem(ELmkNavigateToPlaceHolder);
|
|
167 |
}
|
|
168 |
iMapNavInterface->AttachMenuPaneL(aMenuPane, R_LMK_EDITOR_MENU,
|
|
169 |
ELmkCmdMnNav);
|
|
170 |
|
|
171 |
// Send menu is handled by the sender:
|
|
172 |
if ( FeatureManager::FeatureSupported( KFeatureIdLandmarksConverter ) )
|
|
173 |
{
|
|
174 |
aMenuPane->SetItemDimmed(ELmkCmdSendDummy, EFalse);
|
|
175 |
|
|
176 |
// Use default "Send" item text from SendUI
|
|
177 |
iSender.DisplaySendMenuL(*aMenuPane, 1);
|
|
178 |
}
|
|
179 |
else
|
|
180 |
{
|
|
181 |
aMenuPane->SetItemDimmed(ELmkCmdSendDummy, ETrue);
|
|
182 |
}
|
|
183 |
|
|
184 |
if (FeatureManager::FeatureSupported(KFeatureIdHelp)
|
|
185 |
&& !iIsHideHelp)
|
|
186 |
{
|
|
187 |
aMenuPane->SetItemDimmed(EAknCmdHelp, EFalse);
|
|
188 |
}
|
|
189 |
else
|
|
190 |
{
|
|
191 |
aMenuPane->SetItemDimmed(EAknCmdHelp, ETrue);
|
|
192 |
}
|
|
193 |
|
|
194 |
//shown in package editor mode:
|
|
195 |
aMenuPane->SetItemDimmed(ELmkCmdSaveLm, EFalse);
|
|
196 |
DimmMenuItemsL(aMenuPane);
|
|
197 |
//always dimmed
|
|
198 |
aMenuPane->SetItemDimmed(EAknFormCmdEdit, ETrue);
|
|
199 |
aMenuPane->SetItemDimmed(EAknFormCmdSave, ETrue);
|
|
200 |
aMenuPane->SetItemDimmed(EAknFormCmdLabel, ETrue);
|
|
201 |
aMenuPane->SetItemDimmed(EAknFormCmdAdd, ETrue);
|
|
202 |
aMenuPane->SetItemDimmed(EAknFormCmdDelete, ETrue);
|
|
203 |
break;
|
|
204 |
}
|
|
205 |
case R_SENDUI_MENU: // Dynamically created send ui menu
|
|
206 |
{
|
|
207 |
if (FeatureManager::FeatureSupported(KFeatureIdLandmarksConverter))
|
|
208 |
{
|
|
209 |
iSender.DisplaySendCascadeMenuL(*aMenuPane);
|
|
210 |
}
|
|
211 |
break;
|
|
212 |
}
|
|
213 |
case R_LMK_EDITOR_MENU:
|
|
214 |
{
|
|
215 |
TBool hideMN = EFalse;
|
|
216 |
if (iIsHideCoordinate)
|
|
217 |
{
|
|
218 |
if (IsLandmarkDataEmptyL(iLandmark))
|
|
219 |
{
|
|
220 |
hideMN = ETrue;
|
|
221 |
}
|
|
222 |
}
|
|
223 |
else if (ArePositionFieldEmptyL())
|
|
224 |
{
|
|
225 |
hideMN = ETrue;
|
|
226 |
}
|
|
227 |
|
|
228 |
if (hideMN)
|
|
229 |
{
|
|
230 |
// delete the show on map & Navigate To options
|
|
231 |
aMenuPane->DeleteMenuItem(ELmkShowOnMapPlaceHolder);
|
|
232 |
aMenuPane->DeleteMenuItem(ELmkNavigateToPlaceHolder);
|
|
233 |
}
|
|
234 |
iMapNavInterface->AttachMenuPaneL(aMenuPane, R_LMK_EDITOR_MENU,
|
|
235 |
ELmkCmdMnNav);
|
|
236 |
|
|
237 |
// Send menu is handled by the sender:
|
|
238 |
if (FeatureManager::FeatureSupported(KFeatureIdLandmarksConverter))
|
|
239 |
{
|
|
240 |
aMenuPane->SetItemDimmed(ELmkCmdSendDummy, EFalse);
|
|
241 |
|
|
242 |
// Use default "Send" item text from SendUI
|
|
243 |
iSender.DisplaySendMenuL(*aMenuPane, 1);
|
|
244 |
}
|
|
245 |
DimmMenuItemsL(aMenuPane);
|
|
246 |
break;
|
|
247 |
}
|
|
248 |
default:
|
|
249 |
{
|
|
250 |
break;
|
|
251 |
}
|
|
252 |
}
|
|
253 |
iMapNavInterface->HandleMenuOperationL(aResourceId, aMenuPane,
|
|
254 |
ELmkCmdMnNav);
|
|
255 |
}
|
|
256 |
|
|
257 |
// -----------------------------------------------------------------------------
|
|
258 |
// CLmkPackageEditorImpl::ProcessCommandL
|
|
259 |
// -----------------------------------------------------------------------------
|
|
260 |
//
|
|
261 |
void CLmkPackageEditorImpl::ProcessCommandL(TInt aCommandId)
|
|
262 |
{
|
|
263 |
CAknDialog::ProcessCommandL(aCommandId);
|
|
264 |
iContextMenuBar->StopDisplayingMenuBar();
|
|
265 |
// Override just a couple of CLmkEditorImpl implementations:
|
|
266 |
switch (aCommandId)
|
|
267 |
{
|
|
268 |
case ELmkCmdSaveLm:
|
|
269 |
{
|
|
270 |
SaveLandmarkCmdL();
|
|
271 |
break;
|
|
272 |
}
|
|
273 |
// fall through all send cmds:
|
|
274 |
case ELmkCmdSendVia1:
|
|
275 |
case ELmkCmdSendVia2:
|
|
276 |
case ELmkCmdSendVia3:
|
|
277 |
case ELmkCmdSendVia4:
|
|
278 |
case ELmkCmdSendVia5:
|
|
279 |
case ELmkCmdSendVia6:
|
|
280 |
case ELmkCmdSendVia7:
|
|
281 |
case ELmkCmdSendVia8:
|
|
282 |
case ELmkCmdSendVia9:
|
|
283 |
case ELmkCmdSendVia10:
|
|
284 |
case ELmkCmdSend:
|
|
285 |
{
|
|
286 |
SendLandmarkCmdL(aCommandId);
|
|
287 |
break;
|
|
288 |
}
|
|
289 |
case EAknSoftkeyContextOptions:
|
|
290 |
{
|
|
291 |
iContextMenuBar->SetContextMenuTitleResourceId(
|
|
292 |
R_LMK_MSGVIEWER_CONTEXT_MENUBAR);
|
|
293 |
iContextMenuBar->TryDisplayContextMenuBarL();
|
|
294 |
break;
|
|
295 |
}
|
|
296 |
default:
|
|
297 |
{
|
|
298 |
CLmkEditorImpl::ProcessCommandL(aCommandId);
|
|
299 |
break;
|
|
300 |
}
|
|
301 |
}
|
|
302 |
}
|
|
303 |
|
|
304 |
// ----------------------------------------------------
|
|
305 |
// CLmkPackageEditorImpl::SaveLandmarkCmdL
|
|
306 |
// ----------------------------------------------------
|
|
307 |
//
|
|
308 |
void CLmkPackageEditorImpl::SaveLandmarkCmdL()
|
|
309 |
{
|
|
310 |
// Only one item is stored but API requires an array:
|
|
311 |
RArray<TUint> importIndexes(1);
|
|
312 |
CleanupClosePushL(importIndexes);
|
|
313 |
User::LeaveIfError(importIndexes.Append(iItemIndex));
|
|
314 |
CLmkSaveLandmarkUtils* saveLmUtils = CLmkSaveLandmarkUtils::NewL(iDb,
|
|
315 |
iParser);
|
|
316 |
CleanupStack::PushL(saveLmUtils);
|
|
317 |
RArray<TCategoryName> newCategories;
|
|
318 |
CleanupClosePushL(newCategories);
|
|
319 |
TCategoryName newCategoryFound;
|
|
320 |
TInt noOfNewCategories = saveLmUtils->CheckForNewCategoriesL(
|
|
321 |
importIndexes, newCategoryFound, newCategories);
|
|
322 |
|
|
323 |
if (saveLmUtils->CategoryAddConfirmationQueryL(noOfNewCategories,
|
|
324 |
newCategoryFound))
|
|
325 |
{
|
|
326 |
iParser.StartImportingL(importIndexes, ETrue);// Save landmarks with new categories
|
|
327 |
}
|
|
328 |
else
|
|
329 |
{
|
|
330 |
iParser.StartImportingL(importIndexes, EFalse); //Save landmarks without new categories
|
|
331 |
}
|
|
332 |
CleanupStack::PopAndDestroy(); // newCategories
|
|
333 |
// wait note
|
|
334 |
iWaitNote = new (ELeave) CAknWaitDialog(NULL, ETrue);
|
|
335 |
if (!iWaitNote->ExecuteLD(R_LMK_IMPORTING_WAIT_NOTE))
|
|
336 |
{
|
|
337 |
//making iWaitNote null, since framework destroys waitnote
|
|
338 |
//dialog on pressing cancel.
|
|
339 |
iWaitNote = NULL;
|
|
340 |
iParser.CancelImporting();
|
|
341 |
CleanupStack::PopAndDestroy(2);// saveLmUtils, importIndexes
|
|
342 |
return;
|
|
343 |
}
|
|
344 |
// Saved confirmation note
|
|
345 |
saveLmUtils->LmsSavedConfirmationNoteL(importIndexes, iItemIndex);
|
|
346 |
CleanupStack::PopAndDestroy(2);// saveLmUtils, importIndexes
|
|
347 |
}
|
|
348 |
|
|
349 |
// ----------------------------------------------------
|
|
350 |
// CLmkPackageEditorImpl::SendLandmarkCmdL
|
|
351 |
// ----------------------------------------------------
|
|
352 |
//
|
|
353 |
void CLmkPackageEditorImpl::SendLandmarkCmdL(TInt aCommandId)
|
|
354 |
{
|
|
355 |
CLmkLandmark* lmk = iParser.LmkLandmarkLC(iItemIndex);
|
|
356 |
iSender.SendSingleLandmarkL(aCommandId, *lmk);
|
|
357 |
CleanupStack::PopAndDestroy();//lmk
|
|
358 |
}
|
|
359 |
|
|
360 |
// ----------------------------------------------------
|
|
361 |
// CLmkPackageEditorImpl::UpdateMskOnArrowMoveForViewerL
|
|
362 |
// ----------------------------------------------------
|
|
363 |
//
|
|
364 |
void CLmkPackageEditorImpl::UpdateMskOnArrowMoveForViewerL()
|
|
365 |
{
|
|
366 |
MLmkEditorField* field = iEditorFieldArray->Find(IdOfFocusControl());
|
|
367 |
TUint type = field->LandmarkItemField().FieldType();
|
|
368 |
switch (type)
|
|
369 |
{
|
|
370 |
case ECategories:
|
|
371 |
{
|
|
372 |
CEikButtonGroupContainer* cba =
|
|
373 |
CEikButtonGroupContainer::Current();
|
|
374 |
cba->RemoveCommandFromStack(KMskCommandPos,
|
|
375 |
EAknSoftkeyContextOptions);
|
|
376 |
AddMskCommandL(R_LM_MSK_SHOW, ELmkCmdShow);
|
|
377 |
break;
|
|
378 |
}
|
|
379 |
default:
|
|
380 |
{
|
|
381 |
EnableMskMenuL();
|
|
382 |
break;
|
|
383 |
}
|
|
384 |
}
|
|
385 |
}
|
|
386 |
|
|
387 |
// ----------------------------------------------------
|
|
388 |
// CLmkPackageEditorImpl::EnableMskMenuL
|
|
389 |
// ----------------------------------------------------
|
|
390 |
//
|
|
391 |
void CLmkPackageEditorImpl::EnableMskMenuL()
|
|
392 |
{
|
|
393 |
CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current();
|
|
394 |
cba->RemoveCommandFromStack(KMskCommandPos, ELmkCmdShow);
|
|
395 |
cba->SetCommandSetL(
|
|
396 |
R_LMK_RECEIVED_VIEWER_SOFTKEYS_OPTIONS_BACK_CONTEXTOPTIONS);
|
|
397 |
cba->MakeCommandVisible(EAknSoftkeyContextOptions, ETrue);
|
|
398 |
iContextMenuBar->SetContextMenuTitleResourceId(
|
|
399 |
R_LMK_MSGVIEWER_CONTEXT_MENUBAR);
|
|
400 |
}
|
|
401 |
|
|
402 |
// ----------------------------------------------------
|
|
403 |
// CLmkPackageEditorImpl::PostLayoutDynInitL
|
|
404 |
// ----------------------------------------------------
|
|
405 |
//
|
|
406 |
void CLmkPackageEditorImpl::PostLayoutDynInitL()
|
|
407 |
{
|
|
408 |
CLmkEditorImpl::PostLayoutDynInitL();
|
|
409 |
CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current();
|
|
410 |
EnableMskMenuL();
|
|
411 |
}
|
|
412 |
|
|
413 |
// ----------------------------------------------------
|
|
414 |
// CLmkPackageEditorImpl::DimmMenuItems
|
|
415 |
// ----------------------------------------------------
|
|
416 |
//
|
|
417 |
void CLmkPackageEditorImpl::DimmMenuItemsL(CEikMenuPane* aMenuPane)
|
|
418 |
{
|
|
419 |
//not shown in package editor mode:
|
|
420 |
aMenuPane->SetItemDimmed(ELmkCmdCategories, ETrue);
|
|
421 |
aMenuPane->SetItemDimmed(ELmkCmdDeleteLm, ETrue);
|
|
422 |
aMenuPane->SetItemDimmed(ELmkCmdSelectCategories, ETrue);
|
|
423 |
aMenuPane->SetItemDimmed(ELmkCmdCurrentLocation, ETrue);
|
|
424 |
aMenuPane->SetItemDimmed(ELmkCmdChangeIcon, ETrue);
|
|
425 |
aMenuPane->SetItemDimmed(ELmkCmdEditTextLm, ETrue);
|
|
426 |
//additional commands always dimmed in this class:
|
|
427 |
aMenuPane->SetItemDimmed(ELmkCmdEditLm, ETrue);
|
|
428 |
aMenuPane->SetItemDimmed(ELmkCmdCall, ETrue);
|
|
429 |
aMenuPane->SetItemDimmed(ELmkCmdGoToUrl, ETrue);
|
|
430 |
aMenuPane->SetItemDimmed(ELmkCmdClearPosInfo, ETrue);
|
|
431 |
}
|
|
432 |
|
|
433 |
#ifdef RD_SCALABLE_UI_V2
|
|
434 |
// -----------------------------------------------------------------------------
|
|
435 |
// CLmkPackageEditorImpl::HandleDialogPageEventL
|
|
436 |
// -----------------------------------------------------------------------------
|
|
437 |
//
|
|
438 |
void CLmkPackageEditorImpl::HandleDialogPageEventL(TInt aEventID)
|
|
439 |
{
|
|
440 |
CAknForm::HandleDialogPageEventL(aEventID);
|
|
441 |
if (aEventID == MEikDialogPageObserver::EDialogPageTapped)
|
|
442 |
{
|
|
443 |
iContextMenuBar->SetContextMenuTitleResourceId(
|
|
444 |
R_LMK_MSGVIEWER_CONTEXT_MENUBAR);
|
|
445 |
iContextMenuBar->TryDisplayContextMenuBarL();
|
|
446 |
}
|
|
447 |
}
|
|
448 |
#endif//RD_SCALABLE_UI_V2
|
|
449 |
|
|
450 |
// End of File
|