|
1 /* |
|
2 * Copyright (c) 2008 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: It is handler class to handle editor commands |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <evtmgmteditorui.rsg> |
|
19 #include <AknQueryDialog.h> |
|
20 #include <StringLoader.h> |
|
21 #include <lbsposition.h> |
|
22 #include <aknlistquerydialog.h> |
|
23 #include <StringLoader.h> |
|
24 #include <AknIconArray.h> // Icon Array |
|
25 #include <evteditor.mbg> |
|
26 #include <AknsUtils.h> |
|
27 #include <AknsSkinInstance.h> |
|
28 #include <data_caging_path_literals.hrh> |
|
29 #include <gulicon.h> // Gul Icon |
|
30 #include <eikapp.h> |
|
31 #include <aknlistquerydialog.h> |
|
32 #include <eikserverapp.h> |
|
33 #include <aknappui.h> |
|
34 #include <eikenv.h> |
|
35 |
|
36 #include "evteditor.h" |
|
37 #include "evtevent.h" |
|
38 #include "evttoneaction.h" |
|
39 #include "evtaction.h" |
|
40 #include "evtmgmteditorui.hrh" |
|
41 #include "evtmgmtuieditorcmdhandler.h" |
|
42 #include "evtmgmtuiplacecomponent.h" |
|
43 #include "evtmgmtuidesccomponent.h" |
|
44 #include "evtmgmtuiringtonecomponent.h" |
|
45 #include "evtmgmtuimapnavigationadapter.h" |
|
46 #include "evtdebug.h" |
|
47 #include "evteditorconsts.h" |
|
48 #include "evtmgmtuiwaitdlglauncher.h" |
|
49 #include "evtmgmtuiengine.h" |
|
50 #include "evtmgmtuilbtadapter.h" |
|
51 |
|
52 // --------------------------------------------------------------------------- |
|
53 // CEvtEditor ::NewL() |
|
54 // @param[in] aExitCmdHandler - handler to handle all commands which |
|
55 // may result into closing editor |
|
56 // @param[in/out] aEvent - event object which contains current event information. |
|
57 // event details may be changed while executing commands |
|
58 // @param[in] aEditorObserver - observer to handle editor specific operations |
|
59 // after command is executed |
|
60 // --------------------------------------------------------------------------- |
|
61 // |
|
62 CEvtMgmtUiEditorCmdHandler* CEvtMgmtUiEditorCmdHandler::NewL( |
|
63 CEvtEvent& aEvent, |
|
64 MEvtMgmtUiEditorObserver& aEditorObserver, |
|
65 CEvtMgmtUiEngine& aEventEngine ) |
|
66 { |
|
67 CEvtMgmtUiEditorCmdHandler * self = |
|
68 new ( ELeave ) CEvtMgmtUiEditorCmdHandler( aEvent, |
|
69 aEditorObserver, |
|
70 aEventEngine ); |
|
71 CleanupStack::PushL( self ); |
|
72 self->ConstructL(); |
|
73 CleanupStack::Pop( self ); |
|
74 return self; |
|
75 } |
|
76 |
|
77 // --------------------------------------------------------------------------- |
|
78 // CEvtMgmtUiEditorCmdHandler ::~CEvtMgmtUiEditorCmdHandler() |
|
79 // --------------------------------------------------------------------------- |
|
80 // |
|
81 CEvtMgmtUiEditorCmdHandler::~CEvtMgmtUiEditorCmdHandler() |
|
82 { |
|
83 EVTUIDEBUG("+ CEvtMgmtUiEditorCmdHandler::~CEvtMgmtUiEditorCmdHandler()"); |
|
84 // Unregister the command handler as an observer |
|
85 iEventEngine.RemoveObserver( this ); |
|
86 |
|
87 //cancel any asychronous operation |
|
88 Cancel(); |
|
89 |
|
90 // Reset the Array |
|
91 iEvtIdArray.Reset(); |
|
92 iEvtIdArray.Close(); |
|
93 |
|
94 //Delete iMapAdapter |
|
95 if( iMapAdapter ) |
|
96 { |
|
97 delete iMapAdapter; |
|
98 iMapAdapter = NULL; |
|
99 } |
|
100 |
|
101 //Delete iRingtoneComponent |
|
102 if( iRingtoneComponent ) |
|
103 { |
|
104 delete iRingtoneComponent; |
|
105 iRingtoneComponent = NULL; |
|
106 } |
|
107 |
|
108 //Delete iDescComponent |
|
109 if( iDescComponent ) |
|
110 { |
|
111 delete iDescComponent; |
|
112 iDescComponent = NULL; |
|
113 } |
|
114 |
|
115 //Delete iPlaceComponent |
|
116 if( iPlaceComponent ) |
|
117 { |
|
118 delete iPlaceComponent; |
|
119 iPlaceComponent = NULL; |
|
120 } |
|
121 |
|
122 //Delete iClientLibrary |
|
123 if( iClientLibrary ) |
|
124 { |
|
125 delete iClientLibrary; |
|
126 iClientLibrary = NULL; |
|
127 } |
|
128 |
|
129 //Delete wait launcher |
|
130 if( iWaitDialogLauncher ) |
|
131 { |
|
132 delete iWaitDialogLauncher; |
|
133 iWaitDialogLauncher = NULL; |
|
134 } |
|
135 |
|
136 EVTUIDEBUG("- CEvtMgmtUiEditorCmdHandler::~CEvtMgmtUiEditorCmdHandler()"); |
|
137 } |
|
138 |
|
139 // --------------------------------------------------------------------------- |
|
140 // CEvtMgmtUiEditorCmdHandler ::ConstructL() |
|
141 // --------------------------------------------------------------------------- |
|
142 // |
|
143 void CEvtMgmtUiEditorCmdHandler::ConstructL() |
|
144 { |
|
145 EVTUIDEBUG("+ CEvtMgmtUiEditorCmdHandler::ConstructL()"); |
|
146 CActiveScheduler::Add( this ); |
|
147 |
|
148 iEvtIdArray.Append(iEvent.EventId()); |
|
149 |
|
150 // Set the Command Handler as the observer |
|
151 iEventEngine.SetObserver( this ); |
|
152 EVTUIDEBUG("- CEvtMgmtUiEditorCmdHandler::ConstructL()"); |
|
153 } |
|
154 |
|
155 // --------------------------------------------------------------------------- |
|
156 // CEvtMgmtUiEditorCmdHandler ::CEvtMgmtUiEditorCmdHandler() |
|
157 // --------------------------------------------------------------------------- |
|
158 // |
|
159 CEvtMgmtUiEditorCmdHandler::CEvtMgmtUiEditorCmdHandler( |
|
160 CEvtEvent& aEvent, |
|
161 MEvtMgmtUiEditorObserver& aEditorObserver, |
|
162 CEvtMgmtUiEngine& aEventEngine ) |
|
163 :CActive( EPriorityStandard ), |
|
164 iEvent( aEvent ), |
|
165 iEditorObserver( aEditorObserver ), |
|
166 iEventEngine( aEventEngine ) |
|
167 { |
|
168 iWaitDialogLauncher = NULL; |
|
169 } |
|
170 |
|
171 // --------------------------------------------------------------------------- |
|
172 // CEvtMgmtUiEditorCmdHandler ::HandleEditorCmdL() |
|
173 // It will handle all editor commands |
|
174 // @param[in] aCommand - command id of the command to be handled. |
|
175 // --------------------------------------------------------------------------- |
|
176 // |
|
177 void CEvtMgmtUiEditorCmdHandler::HandleEditorCmdL( TInt aCommand ) |
|
178 { |
|
179 EVTUIDEBUG("+ CEvtMgmtUiEditorCmdHandler::HandleEditorCmdL()" ); |
|
180 |
|
181 // return if already Active |
|
182 if ( IsActive() || (iWaitDialogLauncher && iWaitDialogLauncher->IsActive()) ) |
|
183 { |
|
184 return; |
|
185 } |
|
186 |
|
187 //set state of the state-machine. |
|
188 iState = aCommand; |
|
189 switch( aCommand ) |
|
190 { |
|
191 case EEvtEditorCmdNavigateToPlace: |
|
192 case EEvtEditorCmdShowOnMap: |
|
193 case EEvtEditorCmdAddDescNew: |
|
194 case EEvtEditorCmdEditDesc: |
|
195 case EEvtEditorCmdAddDescFromExisting: |
|
196 case EEvtEditorCmdAssignTone: |
|
197 case EEvtEditorCmdActivate: |
|
198 case EEvtEditorCmdSaveDraft: |
|
199 case EEvtEditorCmdDelete: |
|
200 { |
|
201 // Schedule a request onto yourself for completion |
|
202 TRequestStatus* status = &iStatus; |
|
203 User::RequestComplete( status, KErrNone ); |
|
204 SetActive(); |
|
205 break; |
|
206 } |
|
207 case EEvtMgmtUiEventUiPosSettings: |
|
208 { |
|
209 if( !iClientLibrary ) |
|
210 iClientLibrary = CLocSettingsUiClient::NewL(); |
|
211 iClientLibrary->LaunchPosSettingsAsEmbeddedAppL( iStatus ); |
|
212 SetActive(); |
|
213 break; |
|
214 } |
|
215 case EEvtEditorCmdSetPlace: // set place |
|
216 { |
|
217 SetActive(); |
|
218 iStatus = KRequestPending; |
|
219 |
|
220 if(!iPlaceComponent) |
|
221 iPlaceComponent = CEvtMgmtUiPlaceComponent::NewL( iEvent.Place(), iEvent.Location() ); |
|
222 iPlaceComponent->DisplayPlacePopupDlg( iStatus ); |
|
223 break; |
|
224 } |
|
225 default: |
|
226 { |
|
227 EVTUIDEBUG("Error CEvtMgmtUiEditorCmdHandler::HandleEditorCmdL()" ); |
|
228 } |
|
229 } |
|
230 EVTUIDEBUG("- CEvtMgmtUiEditorCmdHandler::HandleEditorCmdL()" ); |
|
231 } |
|
232 |
|
233 // --------------------------------------------------------------------------- |
|
234 // CEvtMgmtUiEditorCmdHandler ::StopWaitDialogL() |
|
235 // Stop the Wait Loop |
|
236 // --------------------------------------------------------------------------- |
|
237 // |
|
238 void CEvtMgmtUiEditorCmdHandler::StopWaitDialogL() |
|
239 { |
|
240 // Handle the notification completion event. Stop the Wait Dialog |
|
241 if( iWaitDialogLauncher ) |
|
242 { |
|
243 iWaitDialogLauncher->StopWaitDialogL(); |
|
244 } |
|
245 } |
|
246 |
|
247 // --------------------------------------------------------------------------- |
|
248 // CEvtMgmtUiEditorCmdHandler ::StartWaitDialogL() |
|
249 // Launch the Wait Loop |
|
250 // --------------------------------------------------------------------------- |
|
251 // |
|
252 void CEvtMgmtUiEditorCmdHandler::StartWaitDialogL(TInt aResourceId) |
|
253 { |
|
254 // Create the wait loop if it doesn't exit |
|
255 if( !iWaitDialogLauncher ) |
|
256 { |
|
257 // Create the Wait loop |
|
258 iWaitDialogLauncher = CEvtMgmtUiWaitDialogLauncher::NewL(); |
|
259 iWaitDialogLauncher->SetObserver( this ); |
|
260 |
|
261 // No Cancel operation |
|
262 iWaitDialogLauncher->AllowUserToCancel( ETrue ); |
|
263 } |
|
264 |
|
265 if( iWaitDialogLauncher ) |
|
266 { |
|
267 // Set the CBA accordingly |
|
268 iWaitDialogLauncher->SetTextL( aResourceId ); |
|
269 |
|
270 // Finally start the Wait Dialog in Synchronous format |
|
271 iWaitDialogLauncher->StartWaitDialogL(); |
|
272 } |
|
273 } |
|
274 |
|
275 // --------------------------------------------------------------------------- |
|
276 // CEvtMgmtUiEditorCmdHandler ::HandleDialogDismissed() |
|
277 // Derived from CActive |
|
278 // --------------------------------------------------------------------------- |
|
279 // |
|
280 void CEvtMgmtUiEditorCmdHandler::HandleDialogDismissed( TInt aButtonId ) |
|
281 { |
|
282 EVTUIDEBUG("+ CEvtMgmtUiEditorCmdHandler::HandleDialogDismissed()"); |
|
283 if( EEikBidCancel == aButtonId ) |
|
284 { |
|
285 EVTUIDEBUG("wait dialog is dismissed manually" ); |
|
286 |
|
287 //Cancel Outstanding Request |
|
288 iEventEngine.CancelRequest(); |
|
289 } |
|
290 EVTUIDEBUG("- CEvtMgmtUiEditorCmdHandler::HandleDialogDismissed()"); |
|
291 } |
|
292 |
|
293 // --------------------------------------------------------------------------- |
|
294 // CEvtMgmtUiEditorCmdHandler ::RunError() |
|
295 // Derived from CActive |
|
296 // --------------------------------------------------------------------------- |
|
297 // |
|
298 TInt CEvtMgmtUiEditorCmdHandler::RunError( TInt aError ) |
|
299 { |
|
300 EVTUIDEBUG("+ CEvtMgmtUiEditorCmdHandler::RunError()" ); |
|
301 if( aError != KErrNone ) |
|
302 { |
|
303 if( iWaitDialogLauncher ) |
|
304 { |
|
305 TRAP_IGNORE(iWaitDialogLauncher->StopWaitDialogL()); |
|
306 } |
|
307 EVTUIDEBUG1("Error = %d", aError ); |
|
308 } |
|
309 EVTUIDEBUG("- CEvtMgmtUiEditorCmdHandler::RunError()" ); |
|
310 return aError; |
|
311 } |
|
312 |
|
313 // --------------------------------------------------------------------------- |
|
314 // CEvtMgmtUiEditorCmdHandler ::RunL() |
|
315 // Derived from CActive |
|
316 // --------------------------------------------------------------------------- |
|
317 // |
|
318 void CEvtMgmtUiEditorCmdHandler::RunL() |
|
319 { |
|
320 TInt error = iStatus.Int(); |
|
321 EVTUIDEBUG1("+ CEvtMgmtUiEditorCmdHandler::RunL() Error = %d", error ); |
|
322 //if no error, handle the command |
|
323 switch( iState ) |
|
324 { |
|
325 case EEvtEditorCmdActivate: |
|
326 case EEvtEditorCmdSaveDraft: |
|
327 { |
|
328 StartWaitDialogL( R_LOCEV_NOTE_SAVING_EVENT ); |
|
329 |
|
330 if( iEvent.EventId() ) //if present, modify event |
|
331 { |
|
332 iEventEngine.ModifyEventL(iEvent, iEventAttributeMask ); |
|
333 } |
|
334 else |
|
335 { |
|
336 iEventEngine.AddEventL( iEvent ); |
|
337 } |
|
338 return; |
|
339 } |
|
340 case EEvtEditorCmdDelete: |
|
341 { |
|
342 StartWaitDialogL( R_LOCEV_NOTE_SINGLEEVT_DELETE ); |
|
343 |
|
344 iEventEngine.DeleteEventsL( &iEvtIdArray ); |
|
345 return; |
|
346 } |
|
347 case EEvtEditorCmdSetPlace: |
|
348 { |
|
349 if( error == KErrCancel ) |
|
350 { |
|
351 iEditorObserver.NotifyEditorL( iState,KErrCancel ); |
|
352 if( iPlaceComponent ) |
|
353 { |
|
354 delete iPlaceComponent; |
|
355 iPlaceComponent = NULL; |
|
356 } |
|
357 return; |
|
358 } |
|
359 //handle 'set place' command |
|
360 HandleSetPlaceCommandL(); |
|
361 break; |
|
362 } |
|
363 case EEvtMgmtUiEventUiPosSettings: |
|
364 { |
|
365 if(iClientLibrary) |
|
366 { |
|
367 delete iClientLibrary; |
|
368 iClientLibrary = NULL; |
|
369 } |
|
370 break; |
|
371 } |
|
372 case EEvtEditorCmdNavigateToPlace: |
|
373 { |
|
374 HandleNavigateToPlaceCommandL(); |
|
375 break; |
|
376 } |
|
377 case EEvtEditorCmdShowOnMap: |
|
378 { |
|
379 HandleShowOnMapCommandL(); |
|
380 break; |
|
381 } |
|
382 case EEvtEditorCmdAddDescNew: |
|
383 case EEvtEditorCmdEditDesc: |
|
384 case EEvtEditorCmdAddDescFromExisting: |
|
385 { |
|
386 error = HandleDescCommandsL( iState ); |
|
387 break; |
|
388 } |
|
389 case EEvtEditorCmdAssignTone: |
|
390 { |
|
391 error = HandleAssignToneCommandL(); |
|
392 break; |
|
393 } |
|
394 default: |
|
395 { |
|
396 EVTUIDEBUG("Error in CEvtMgmtUiEditorCmdHandler::HandleEditorCmdL()" ); |
|
397 } |
|
398 } |
|
399 |
|
400 //Notify editor status of the operation in order to do any UI specific updates |
|
401 iEditorObserver.NotifyEditorL(iState,error); |
|
402 |
|
403 EVTUIDEBUG("- CEvtMgmtUiEditorCmdHandler::RunL()" ); |
|
404 } |
|
405 |
|
406 // --------------------------------------------------------------------------- |
|
407 // CEvtMgmtUiEditorCmdHandler ::DoCancel() |
|
408 // --------------------------------------------------------------------------- |
|
409 // |
|
410 void CEvtMgmtUiEditorCmdHandler::DoCancel() |
|
411 { |
|
412 switch( iState ) |
|
413 { |
|
414 case EEvtEditorCmdActivate: |
|
415 case EEvtEditorCmdSaveDraft: |
|
416 case EEvtEditorCmdDelete: |
|
417 { |
|
418 iEventEngine.CancelRequest(); |
|
419 return; |
|
420 } |
|
421 case EEvtEditorCmdSetPlace: |
|
422 { |
|
423 if( iPlaceComponent ) |
|
424 { |
|
425 delete iPlaceComponent; |
|
426 iPlaceComponent = NULL; |
|
427 } |
|
428 break; |
|
429 } |
|
430 case EEvtMgmtUiEventUiPosSettings: |
|
431 { |
|
432 if( iClientLibrary ) |
|
433 { |
|
434 iClientLibrary->ClosePosSettings(); |
|
435 delete iClientLibrary; |
|
436 iClientLibrary = NULL; |
|
437 } |
|
438 break; |
|
439 } |
|
440 case EEvtEditorCmdNavigateToPlace: |
|
441 case EEvtEditorCmdShowOnMap: |
|
442 { |
|
443 if( iMapAdapter ) |
|
444 { |
|
445 delete iMapAdapter; |
|
446 iMapAdapter = NULL; |
|
447 } |
|
448 break; |
|
449 } |
|
450 case EEvtEditorCmdAddDescNew: |
|
451 case EEvtEditorCmdEditDesc: |
|
452 case EEvtEditorCmdAddDescFromExisting: |
|
453 { |
|
454 if( iDescComponent ) |
|
455 { |
|
456 delete iDescComponent; |
|
457 iDescComponent = NULL; |
|
458 } |
|
459 break; |
|
460 } |
|
461 case EEvtEditorCmdAssignTone: |
|
462 { |
|
463 if( iRingtoneComponent ) |
|
464 { |
|
465 delete iRingtoneComponent; |
|
466 iRingtoneComponent = NULL; |
|
467 } |
|
468 break; |
|
469 } |
|
470 default: |
|
471 { |
|
472 break; |
|
473 } |
|
474 } |
|
475 } |
|
476 |
|
477 // ----------------------------------------------------------------------------- |
|
478 // CEvtMgmtUiEditorCmdHandler::DisplayConfirmationQueryDlg() |
|
479 // It shows confirmation query dialog |
|
480 // ----------------------------------------------------------------------------- |
|
481 // |
|
482 TBool CEvtMgmtUiEditorCmdHandler::DisplayConfirmationQueryDlgL( TInt aResourceId ) |
|
483 { |
|
484 EVTUIDEBUG("+ CEvtMgmtUiEditorCmdHandler::DisplayConfirmationQueryDlgL()" ); |
|
485 HBufC* msg = StringLoader::LoadLC( aResourceId ); |
|
486 TBool response= EFalse; |
|
487 CAknQueryDialog* confirmationQuery = CAknQueryDialog::NewL(); |
|
488 response = confirmationQuery->ExecuteLD( R_EVTUI_CONFIRMATION_QUERY, *msg ); |
|
489 CleanupStack::PopAndDestroy(msg); |
|
490 EVTUIDEBUG("- CEvtMgmtUiEditorCmdHandler::DisplayConfirmationQueryDlgL()" ); |
|
491 return response; |
|
492 } |
|
493 |
|
494 // ----------------------------------------------------------------------------- |
|
495 // CEvtMgmtUiEditorCmdHandler::HandleSetPlaceCommandL |
|
496 // It will handle'set place' operation. |
|
497 // ----------------------------------------------------------------------------- |
|
498 // |
|
499 void CEvtMgmtUiEditorCmdHandler::HandleSetPlaceCommandL() |
|
500 { |
|
501 EVTUIDEBUG("= Details recieved from Set Place component" ); |
|
502 EVTUIDEBUG1("TriggerId = %d", iEvent.EventId() ); |
|
503 TPtrC placePtr = iPlaceComponent->Place(); |
|
504 EVTUIDEBUG1("Place = %S", &placePtr ); |
|
505 EVTUIDEBUG1("Lat = %f", iPlaceComponent->TriggerLocation().Latitude() ); |
|
506 EVTUIDEBUG1("Long = %f", iPlaceComponent->TriggerLocation().Longitude() ); |
|
507 EVTUIDEBUG("= Finish Details recieved from Set Place component" ); |
|
508 |
|
509 //if place is already set |
|
510 if( iEvent.Place().Compare(KNullDesC ) != 0 ) |
|
511 { |
|
512 //display confirmation message to replace old details |
|
513 if( DisplayConfirmationQueryDlgL( R_EVTUI_EDITOR_CONFIRM_PLACESAVE ) ) |
|
514 { |
|
515 //if yes, then replace |
|
516 iEvent.SetPlaceL( iPlaceComponent->Place() ); |
|
517 iEventAttributeMask = iEventAttributeMask | CEvtMgmtUiEngine::EEvtEventAttributePlace; |
|
518 } |
|
519 } |
|
520 else //if place is not already set, then set it |
|
521 { |
|
522 iEvent.SetPlaceL( iPlaceComponent->Place() ); |
|
523 iEventAttributeMask = iEventAttributeMask | CEvtMgmtUiEngine::EEvtEventAttributePlace; |
|
524 } |
|
525 } |
|
526 |
|
527 // ----------------------------------------------------------------------------- |
|
528 // CEvtMgmtUiEditorCmdHandler::HandleDescCommandsL |
|
529 // It will handle add/edit/remove description operation. |
|
530 // @param[in] aCommand - Command id of the operation to be performed. |
|
531 // ----------------------------------------------------------------------------- |
|
532 // |
|
533 TInt CEvtMgmtUiEditorCmdHandler::HandleDescCommandsL( TInt aCommand ) |
|
534 { |
|
535 EVTUIDEBUG("+ CEvtMgmtUiEditorCmdHandler::HandleDescCommandsL()"); |
|
536 TInt result = KErrNone; |
|
537 switch( aCommand ) |
|
538 { |
|
539 case EEvtEditorCmdAddDescNew: |
|
540 case EEvtEditorCmdEditDesc: |
|
541 { |
|
542 iDescComponent = CEvtMgmtUiDescComponent::NewL(iEvent.Description()); |
|
543 result = iDescComponent->DisplayNotepadEditorL(); |
|
544 if( iDescComponent ) |
|
545 { |
|
546 if(result == KErrNone || result == KErrCancel ) |
|
547 iEvent.SetDescriptionL( iDescComponent->Desc() ); |
|
548 delete iDescComponent; |
|
549 iDescComponent = NULL; |
|
550 } |
|
551 EVTUIDEBUG("= add/edit description operation is completed" ); |
|
552 break; |
|
553 } |
|
554 case EEvtEditorCmdAddDescFromExisting: |
|
555 { |
|
556 iDescComponent = CEvtMgmtUiDescComponent::NewL(iEvent.Description()); |
|
557 result = iDescComponent->DescFromExistingNotesL(); |
|
558 if( iDescComponent ) |
|
559 { |
|
560 if(result == KErrNone ) |
|
561 iEvent.SetDescriptionL( iDescComponent->Desc() ); |
|
562 delete iDescComponent; |
|
563 iDescComponent = NULL; |
|
564 } |
|
565 EVTUIDEBUG("= add desc from existing operation is completed" ); |
|
566 break; |
|
567 } |
|
568 default: |
|
569 break; |
|
570 } |
|
571 EVTUIDEBUG("+ CEvtMgmtUiEditorCmdHandler::HandleDescCommandsL()"); |
|
572 return result; |
|
573 } |
|
574 |
|
575 // ----------------------------------------------------------------------------- |
|
576 // CEvtMgmtUiEditorCmdHandler::HandleAssignToneCommandL |
|
577 // It will handle 'assign tone' command. |
|
578 // @ret returns KErrNone if successfully handled else error |
|
579 // ----------------------------------------------------------------------------- |
|
580 // |
|
581 TInt CEvtMgmtUiEditorCmdHandler::HandleAssignToneCommandL() |
|
582 { |
|
583 EVTUIDEBUG("+ CEvtMgmtUiEditorCmdHandler::HandleAssignToneCommandL()" ); |
|
584 TInt retval = KErrNone; |
|
585 CEvtToneAction* tone = CEvtToneAction::NewLC(); |
|
586 if( iEvent.HasAction()) |
|
587 { |
|
588 tone->InternalizeL( iEvent.Action() ); |
|
589 iRingtoneComponent = CEvtMgmtUiRingtoneComponent::NewL( tone->FileName() ); |
|
590 } |
|
591 else |
|
592 iRingtoneComponent = CEvtMgmtUiRingtoneComponent::NewL( KNullDesC() ); |
|
593 |
|
594 if( iRingtoneComponent->DisplayAudioTonePopupDlgL() == KErrCancel ) |
|
595 { |
|
596 if( iRingtoneComponent ) |
|
597 { |
|
598 delete iRingtoneComponent; |
|
599 iRingtoneComponent = NULL; |
|
600 } |
|
601 CleanupStack::PopAndDestroy(); //tone |
|
602 return KErrCancel; |
|
603 } |
|
604 if( iRingtoneComponent) |
|
605 { |
|
606 if( iRingtoneComponent->Ringtone().Compare( KNullDesC ) == 0 ) |
|
607 { |
|
608 retval = KErrNotFound; |
|
609 iEvent.SetActionL( NULL ); |
|
610 } |
|
611 else |
|
612 { |
|
613 tone->SetFileNameL( iRingtoneComponent->Ringtone() ); |
|
614 |
|
615 CEvtAction* action = CEvtAction::NewLC(); |
|
616 tone->ExternalizeL( *action ); |
|
617 iEvent.SetActionL( action ); //ownership is transferred. |
|
618 |
|
619 CleanupStack::Pop( action ); |
|
620 } |
|
621 delete iRingtoneComponent; |
|
622 iRingtoneComponent = NULL; |
|
623 } |
|
624 CleanupStack::PopAndDestroy( ); //tone |
|
625 EVTUIDEBUG("- CEvtMgmtUiEditorCmdHandler::HandleAssignToneCommandL()" ); |
|
626 return retval; |
|
627 } |
|
628 |
|
629 // ----------------------------------------------------------------------------- |
|
630 // CEvtMgmtUiEditorCmdHandler::HandleShowOnMapCommandL |
|
631 // It will handle 'show on map' command. |
|
632 // ----------------------------------------------------------------------------- |
|
633 // |
|
634 void CEvtMgmtUiEditorCmdHandler::HandleShowOnMapCommandL() |
|
635 { |
|
636 EVTUIDEBUG("+ CEvtMgmtUiEditorCmdHandler::HandleShowOnMapCommandL()" ); |
|
637 iMapAdapter = CEvtMgmtUiMapNavigationAdapter::NewL(); |
|
638 iMapAdapter->SetLocation(iEvent.Location()); |
|
639 iMapAdapter->ShowOnMapL(); |
|
640 if(iMapAdapter) |
|
641 { |
|
642 delete iMapAdapter; |
|
643 iMapAdapter = NULL; |
|
644 } |
|
645 EVTUIDEBUG("- CEvtMgmtUiEditorCmdHandler::HandleShowOnMapCommandL()" ); |
|
646 } |
|
647 |
|
648 // ----------------------------------------------------------------------------- |
|
649 // CEvtMgmtUiEditorCmdHandler::HandleNavigateToPlaceCommandL |
|
650 // It will handle 'navigate to place' command. |
|
651 // ----------------------------------------------------------------------------- |
|
652 // |
|
653 void CEvtMgmtUiEditorCmdHandler::HandleNavigateToPlaceCommandL() |
|
654 { |
|
655 EVTUIDEBUG("+ CEvtMgmtUiEditorCmdHandler::HandleNavigateToPlaceCommandL()" ); |
|
656 iMapAdapter = CEvtMgmtUiMapNavigationAdapter::NewL(); |
|
657 iMapAdapter->SetLocation(iEvent.Location()); |
|
658 iMapAdapter->NavigateToPlaceL(); |
|
659 if(iMapAdapter) |
|
660 { |
|
661 delete iMapAdapter; |
|
662 iMapAdapter = NULL; |
|
663 } |
|
664 EVTUIDEBUG("- CEvtMgmtUiEditorCmdHandler::HandleNavigateToPlaceCommandL()" ); |
|
665 } |
|
666 |
|
667 // ----------------------------------------------------------------------------- |
|
668 // CEvtMgmtUiEditorCmdHandler::SetEventAttributeMask |
|
669 // It will set attribute mask which will be used to update event. |
|
670 // ----------------------------------------------------------------------------- |
|
671 void CEvtMgmtUiEditorCmdHandler::SetEventAttributeMask( TEvtEventAttributeMask aEventAttributeMask ) |
|
672 { |
|
673 iEventAttributeMask = iEventAttributeMask | aEventAttributeMask; |
|
674 } |
|
675 |
|
676 // ----------------------------------------------------------------------------- |
|
677 // void CEvtMgmtUiEditorCmdHandler::NotifyEventChangeL |
|
678 // ----------------------------------------------------------------------------- |
|
679 // |
|
680 void CEvtMgmtUiEditorCmdHandler::NotifyEventChangeL( TInt aErrorCode, TInt /*aState*/ ) |
|
681 { |
|
682 EVTUIDEBUG("+ CEvtMgmtUiEditorCmdHandler::NotifyEventChangeL()" ); |
|
683 |
|
684 // Stop the Wait Dialog |
|
685 StopWaitDialogL(); |
|
686 |
|
687 //Notify editor status of the operation in order to do any UI specific updates |
|
688 iEditorObserver.NotifyEditorL(iState,iStatus.Int()); |
|
689 |
|
690 if( aErrorCode == KErrServerTerminated || |
|
691 aErrorCode == KErrServerBusy || |
|
692 aErrorCode == KErrNotReady ) |
|
693 { |
|
694 EVTUIDEBUG("Exiting application as server is not ready." ); |
|
695 // The User has exited the application using the Exit option from |
|
696 //.Options menu. But, thats possible only if we exit the application |
|
697 // with EAknCmdExit. |
|
698 // A bit of convoluted logic but needed because we are using the |
|
699 // same components for the Settings UI Server as well as LC. |
|
700 |
|
701 CEikonEnv* env = CEikonEnv::Static(); |
|
702 CEikAppServer* server = env->AppServer(); |
|
703 if ( server ) |
|
704 { |
|
705 server->NotifyServerExit( EAknCmdExit ); |
|
706 } |
|
707 CAknAppUi* appUi = static_cast< CAknAppUi* >( env->AppUi()); |
|
708 appUi->RunAppShutter(); |
|
709 return; |
|
710 } |
|
711 EVTUIDEBUG("- CEvtMgmtUiEditorCmdHandler::NotifyEventChangeL()" ); |
|
712 } |
|
713 |
|
714 // ----------------------------------------------------------------------------- |
|
715 // void CEvtMgmtUiEditorCmdHandler::NotifyEventChangeL |
|
716 // ----------------------------------------------------------------------------- |
|
717 // |
|
718 void CEvtMgmtUiEditorCmdHandler::NotifyModelChangeL() |
|
719 { |
|
720 // Do Nothing here |
|
721 } |
|
722 |
|
723 //end of file |