|
1 /* |
|
2 * Copyright (c) 2007-2009 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: ESMR policy implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "emailtrace.h" |
|
19 #include "cesmrviewerdialog.h" |
|
20 |
|
21 #include <data_caging_path_literals.hrh> |
|
22 #include <esmrgui.rsg> |
|
23 #include <esmrpolicies.rsg> |
|
24 #include <eikenv.h> |
|
25 #include <eikappui.h> |
|
26 #include <avkon.hrh> |
|
27 #include <MAgnEntryUi.h> |
|
28 #include <eikmenup.h> |
|
29 #include <calentry.h> |
|
30 #include <apgtask.h> |
|
31 #include <apgcli.h> |
|
32 #include <AknDef.h> |
|
33 #include <AknUtils.h> |
|
34 #include <StringLoader.h> |
|
35 #include <akntitle.h> |
|
36 #include <eikspane.h> |
|
37 #include <e32keys.h> |
|
38 #include <AiwServiceHandler.h> |
|
39 #include <featmgr.h> |
|
40 #include <bldvariant.hrh> |
|
41 #include <akntoolbar.h> |
|
42 #include <aknappui.h> |
|
43 #include <aknViewAppUi.h> |
|
44 #include <aknview.h> |
|
45 #include <eikcolib.h> |
|
46 #include <aknbutton.h> |
|
47 #include <aknnavi.h> |
|
48 #include <aknnavide.h> |
|
49 #include <msvuids.h> |
|
50 //</cmail> |
|
51 #include <featmgr.h> |
|
52 //</cmail> |
|
53 #include <cmrmailboxutils.h> |
|
54 |
|
55 #include "cesmrpolicy.h" |
|
56 #include "esmrdef.h" |
|
57 #include "cesmrpolicymanager.h" |
|
58 #include "cesmrurlparserplugin.h" |
|
59 #include "esmricalvieweropcodes.hrh" |
|
60 #include "tesmrinputparams.h" |
|
61 #include "cesmrattachmentinfo.h" |
|
62 #include "cesmrview.h" |
|
63 #include "esmrgui.hrh" |
|
64 #include "cesmrfield.h" |
|
65 #include "cesmrviewerfieldstorage.h" |
|
66 #include "esmrentryhelper.h" |
|
67 #include "mesmrmeetingrequestentry.h" |
|
68 #include "esmrinternaluid.h" |
|
69 #include "cesmrlistquery.h" |
|
70 #include "cesmrconfirmationquery.h" |
|
71 #include "cesmrsendui.h" |
|
72 #include "cesmrcontactmenuhandler.h" |
|
73 #include "cesmrfieldbuilderinterface.h" |
|
74 #include "cesmrtrackingviewdialog.h" |
|
75 #include "mesmruibase.h" |
|
76 #include "cesmruifactory.h" |
|
77 #include "cesmrlocationpluginhandler.h" |
|
78 #include "cesmrfeaturesettings.h" |
|
79 #include "esmrconfig.hrh" |
|
80 #include "mesmrfieldevent.h" |
|
81 |
|
82 #include "CFSMailBox.h" |
|
83 |
|
84 /// Unnamed namespace for local definitions |
|
85 namespace { // codescanner::namespace |
|
86 |
|
87 #ifdef _DEBUG |
|
88 |
|
89 // Literal for viewer dialog |
|
90 _LIT( KESMRViewerDlgPanicTxt, "ESMRViewerDlg" ); |
|
91 |
|
92 enum TESMRViewerDlgPanic |
|
93 { |
|
94 EESMRViewerDlgInvalidCommand, |
|
95 EESMRViewerDlgnvalidSeriesResult, |
|
96 EESMRViewerDlgInvalidEntry |
|
97 }; |
|
98 |
|
99 void Panic( TESMRViewerDlgPanic aPanic ) |
|
100 { |
|
101 |
|
102 User::Panic( KESMRViewerDlgPanicTxt, aPanic ); |
|
103 } |
|
104 |
|
105 #endif |
|
106 |
|
107 // Definition for default buffer length |
|
108 const TInt KCalDefaultBufferLen = 40; |
|
109 |
|
110 // Calendar command parameter |
|
111 _LIT16( KCalCmdDATE, "GRAPHICDAY" ); |
|
112 |
|
113 // Definition for time format ("YYYY MM DD HH MM SS MMMMMM" - 26) |
|
114 _LIT( KCalCmdTimeFormat, "%F %Y %M %D %H %T %S %C" ); |
|
115 |
|
116 // Definition for calendar application UID |
|
117 const TUid KCalendarAppUID = { KUidCalendarApplication }; |
|
118 |
|
119 // Defs for prefix |
|
120 _LIT( KMailtoMatchPattern, "mailto:*" ); // these are never localized |
|
121 const TInt KMailtoLength = 7; // "mailto:" length |
|
122 |
|
123 |
|
124 // ======== LOCAL FUNCTIONS ======== |
|
125 |
|
126 // --------------------------------------------------------------------------- |
|
127 // Set empty buttons to toolbar. |
|
128 // --------------------------------------------------------------------------- |
|
129 // |
|
130 void SetEmptyButtonsL( CAknToolbar* aToolbar ) |
|
131 { |
|
132 aToolbar->AddItemL( CAknButton::NewL(), EAknCtButton, EESMRCmdUndefined, 0, 0 ); |
|
133 aToolbar->AddItemL( CAknButton::NewL(), EAknCtButton, EESMRCmdUndefined, 0, 1 ); |
|
134 aToolbar->AddItemL( CAknButton::NewL(), EAknCtButton, EESMRCmdUndefined, 0, 2 ); |
|
135 } |
|
136 |
|
137 // --------------------------------------------------------------------------- |
|
138 // Set buttons for responding to meeting request to toolbar. |
|
139 // --------------------------------------------------------------------------- |
|
140 // |
|
141 void SetResponseButtonsL( CAknToolbar* aToolbar ) |
|
142 { |
|
143 CAknButton* buttonAccept = CAknButton::NewLC(); |
|
144 buttonAccept->ConstructFromResourceL( R_ACCEPT_BUTTON ); |
|
145 aToolbar->AddItemL( buttonAccept, EAknCtButton, EESMRCmdAcceptMR, 0, 0 ); |
|
146 CleanupStack::Pop( buttonAccept ); |
|
147 |
|
148 CAknButton* buttonTentative = CAknButton::NewLC(); |
|
149 buttonTentative->ConstructFromResourceL( R_TENTATIVE_BUTTON ); |
|
150 aToolbar->AddItemL( buttonTentative, EAknCtButton, EESMRCmdTentativeMR, 0, 1 ); |
|
151 CleanupStack::Pop( buttonTentative ); |
|
152 |
|
153 CAknButton* buttonDecline = CAknButton::NewLC(); |
|
154 buttonDecline->ConstructFromResourceL( R_DECLINE_BUTTON ); |
|
155 aToolbar->AddItemL( buttonDecline, EAknCtButton, EESMRCmdDeclineMR, 0, 2 ); |
|
156 CleanupStack::Pop( buttonDecline ); |
|
157 } |
|
158 |
|
159 /** |
|
160 * Sets recurrence modification rule to entry. Rule is queried |
|
161 * from the user. Invalid result will cause panic. |
|
162 * @param aEntry Reference to meeting request. |
|
163 */ |
|
164 void SetRecurrenceModRuleL( |
|
165 MESMRCalEntry& aEntry, |
|
166 CESMRListQuery::TESMRListQueryType aQueryType ) |
|
167 { |
|
168 FUNC_LOG; |
|
169 if ( aEntry.IsRecurrentEventL() && |
|
170 aEntry.IsStoredL() ) |
|
171 { |
|
172 TInt result = |
|
173 CESMRListQuery::ExecuteL( aQueryType ); |
|
174 |
|
175 if( KErrCancel == result ) |
|
176 { |
|
177 // User has cancelled selecting opening the instance |
|
178 User::Leave( KErrCancel ); |
|
179 } |
|
180 |
|
181 TESMRThisOccurenceOrSeriesQuery recurrenceModRule = |
|
182 static_cast<TESMRThisOccurenceOrSeriesQuery>( result ); |
|
183 |
|
184 switch( recurrenceModRule ) |
|
185 { |
|
186 case EESMRThisOccurence: |
|
187 { |
|
188 aEntry.SetModifyingRuleL( |
|
189 MESMRMeetingRequestEntry::EESMRThisOnly ); |
|
190 break; |
|
191 } |
|
192 case EESMRSeries: |
|
193 { |
|
194 aEntry.SetModifyingRuleL( |
|
195 MESMRMeetingRequestEntry::EESMRAllInSeries ); |
|
196 break; |
|
197 } |
|
198 default: |
|
199 { |
|
200 __ASSERT_DEBUG( EFalse, |
|
201 Panic(EESMRViewerDlgnvalidSeriesResult) ); |
|
202 break; |
|
203 } |
|
204 } |
|
205 } |
|
206 else |
|
207 { |
|
208 aEntry.SetModifyingRuleL( |
|
209 MESMRMeetingRequestEntry::EESMRThisOnly ); |
|
210 } |
|
211 } |
|
212 } |
|
213 |
|
214 // ======== MEMBER FUNCTIONS ======== |
|
215 |
|
216 // --------------------------------------------------------------------------- |
|
217 // CESMRViewerDialog::CESMRViewerDialog |
|
218 // --------------------------------------------------------------------------- |
|
219 // |
|
220 CESMRViewerDialog::CESMRViewerDialog( |
|
221 MESMRCalEntry& aEntry, |
|
222 MAgnEntryUiCallback& aCallback ) : |
|
223 iEntry( aEntry ), |
|
224 iCallback( aCallback ), |
|
225 iClearToolbar( EFalse ) |
|
226 { |
|
227 FUNC_LOG; |
|
228 // Do nothing |
|
229 } |
|
230 |
|
231 // --------------------------------------------------------------------------- |
|
232 // CESMRViewerDialog::~CESMRViewerDialog |
|
233 // --------------------------------------------------------------------------- |
|
234 // |
|
235 CESMRViewerDialog::~CESMRViewerDialog() |
|
236 { |
|
237 FUNC_LOG; |
|
238 |
|
239 if ( iIdleNaviEventRunner ) |
|
240 { |
|
241 iIdleNaviEventRunner->Cancel(); |
|
242 delete iIdleNaviEventRunner; |
|
243 } |
|
244 |
|
245 iESMRStatic.Close(); |
|
246 |
|
247 if ( iFeatureManagerInitialized ) |
|
248 { |
|
249 FeatureManager::UnInitializeLib(); |
|
250 } |
|
251 |
|
252 if ( iServiceHandler ) |
|
253 { |
|
254 iServiceHandler->DetachMenu( R_MRVIEWER_MENUBAR, R_PS_AIW_INTEREST ); |
|
255 delete iServiceHandler; |
|
256 } |
|
257 |
|
258 delete iESMRSendUI; |
|
259 |
|
260 delete iLocationPluginHandler; |
|
261 |
|
262 delete iFeatures; |
|
263 |
|
264 TRAP_IGNORE( ClearToolbarL() ); |
|
265 |
|
266 // iView is deleted by framework because it uses the |
|
267 // custom control mechanism. |
|
268 } |
|
269 |
|
270 // --------------------------------------------------------------------------- |
|
271 // CESMRViewerDialog::NewL |
|
272 // --------------------------------------------------------------------------- |
|
273 // |
|
274 EXPORT_C CESMRViewerDialog* CESMRViewerDialog::NewL( |
|
275 CESMRPolicy* aPolicy, |
|
276 MESMRCalEntry& aEntry, |
|
277 MAgnEntryUiCallback& aCallback ) |
|
278 { |
|
279 FUNC_LOG; |
|
280 CESMRViewerDialog* self = |
|
281 new (ELeave) CESMRViewerDialog( aEntry, aCallback ); |
|
282 CleanupStack::PushL( self ); |
|
283 self->ConstructL( aPolicy ); |
|
284 CleanupStack::Pop( self ); |
|
285 return self; |
|
286 } |
|
287 |
|
288 // --------------------------------------------------------------------------- |
|
289 // CESMRViewerDialog::ConstructL |
|
290 // --------------------------------------------------------------------------- |
|
291 // |
|
292 void CESMRViewerDialog::ConstructL( |
|
293 CESMRPolicy* aPolicy ) |
|
294 { |
|
295 FUNC_LOG; |
|
296 |
|
297 iIdleNaviEventRunner = CIdle::NewL( CActive::EPriorityStandard ); |
|
298 |
|
299 iPolicy = aPolicy; |
|
300 iESMRStatic.ConnectL(); |
|
301 |
|
302 CAknDialog::ConstructL( R_MRVIEWER_MENUBAR ); |
|
303 |
|
304 TRect clientRect; |
|
305 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, clientRect ); |
|
306 |
|
307 TBool responseReady(EFalse); |
|
308 MESMRMeetingRequestEntry* mrEntry = NULL; |
|
309 if ( MESMRCalEntry::EESMRCalEntryMeetingRequest == iEntry.Type() ) |
|
310 { |
|
311 // This is meeting request |
|
312 mrEntry = static_cast<MESMRMeetingRequestEntry*>( &iEntry ); |
|
313 responseReady = mrEntry->IsSentL(); |
|
314 } |
|
315 |
|
316 iESMRSendUI = CESMRSendUI::NewL(EESMRCmdSendAs); |
|
317 |
|
318 FeatureManager::InitializeLibL(); |
|
319 iFeatureManagerInitialized = ETrue; |
|
320 |
|
321 CESMRViewerFieldStorage* storage = |
|
322 CESMRViewerFieldStorage::NewL( |
|
323 aPolicy, |
|
324 this, |
|
325 responseReady, |
|
326 *this ); |
|
327 |
|
328 // storage ownership is transferred to CESMRView |
|
329 iView = CESMRView::NewL(storage, iEntry, clientRect ); |
|
330 |
|
331 if ( iEntry.Entry().SummaryL().Length() == 0 ) |
|
332 { |
|
333 // if no title, set unnamed text: |
|
334 HBufC* title = StringLoader::LoadLC ( R_QTN_MEET_REQ_CONFLICT_UNNAMED, |
|
335 iCoeEnv ); |
|
336 iView->SetTitleL( *title ); |
|
337 CleanupStack::PopAndDestroy( title ); |
|
338 } |
|
339 else |
|
340 { |
|
341 iView->SetTitleL( iEntry.Entry().SummaryL() ); |
|
342 } |
|
343 |
|
344 TInt titleStringId = -1; |
|
345 switch ( iEntry.Type() ) |
|
346 { |
|
347 case MESMRCalEntry::EESMRCalEntryMeeting: |
|
348 { |
|
349 titleStringId = R_QTN_CALENDAR_TITLE_MEETING; |
|
350 break; |
|
351 } |
|
352 case MESMRCalEntry::EESMRCalEntryTodo: |
|
353 { |
|
354 titleStringId = R_QTN_CALENDAR_TITLE_TODO; |
|
355 break; |
|
356 } |
|
357 case MESMRCalEntry::EESMRCalEntryMemo: |
|
358 { |
|
359 titleStringId = R_QTN_CALENDAR_TITLE_MEMO; |
|
360 break; |
|
361 } |
|
362 case MESMRCalEntry::EESMRCalEntryAnniversary: |
|
363 { |
|
364 titleStringId = R_QTN_CALENDAR_TITLE_ANNIVERSARY; |
|
365 break; |
|
366 } |
|
367 case MESMRCalEntry::EESMRCalEntryReminder: // Fall through |
|
368 case MESMRCalEntry::EESMRCalEntryMeetingRequest: // Fall through |
|
369 default: |
|
370 { |
|
371 break; |
|
372 } |
|
373 } |
|
374 if ( titleStringId != -1 ) |
|
375 { |
|
376 CEikStatusPane* sp = iEikonEnv->AppUiFactory()->StatusPane(); |
|
377 CAknTitlePane* tp = |
|
378 static_cast<CAknTitlePane*>( |
|
379 sp->ControlL(TUid::Uid(EEikStatusPaneUidTitle)) ); |
|
380 HBufC* titleText = StringLoader::LoadLC( titleStringId, iCoeEnv ); |
|
381 tp->SetTextL( *titleText ); |
|
382 CleanupStack::PopAndDestroy( titleText ); |
|
383 } |
|
384 |
|
385 |
|
386 iFeatures = CESMRFeatureSettings::NewL(); |
|
387 if ( iFeatures->FeatureSupported( |
|
388 CESMRFeatureSettings::EESMRUIMnFwIntegration ) ) |
|
389 { |
|
390 iMenuBar->SetContextMenuTitleResourceId( R_MR_VIEWER_CONTEXT_MENU ); |
|
391 } |
|
392 |
|
393 // start to observe navigation decorator |
|
394 CEikStatusPane* sp = |
|
395 static_cast<CEikAppUiFactory*>( |
|
396 iEikonEnv->AppUiFactory() )->StatusPane(); |
|
397 |
|
398 CAknNavigationControlContainer* naviPane = |
|
399 static_cast<CAknNavigationControlContainer*>( |
|
400 sp->ControlL( TUid::Uid( EEikStatusPaneUidNavi ) ) ); |
|
401 |
|
402 if ( naviPane ) |
|
403 { |
|
404 iESMRNaviDecorator = naviPane->Top(); |
|
405 |
|
406 if ( iESMRNaviDecorator ) |
|
407 { |
|
408 iESMRNaviDecorator->SetNaviDecoratorObserver( this ); |
|
409 } |
|
410 } |
|
411 |
|
412 |
|
413 //start service handler and add the interests of this class |
|
414 iServiceHandler = CAiwServiceHandler::NewL(); |
|
415 iServiceHandler->AttachL( R_PS_AIW_INTEREST ); |
|
416 } |
|
417 |
|
418 // --------------------------------------------------------------------------- |
|
419 // CESMRViewerDialog::ActivateL |
|
420 // --------------------------------------------------------------------------- |
|
421 // |
|
422 void CESMRViewerDialog::ActivateL() |
|
423 { |
|
424 FUNC_LOG; |
|
425 iView->InternalizeL(); |
|
426 CAknDialog::ActivateL(); |
|
427 } |
|
428 |
|
429 // --------------------------------------------------------------------------- |
|
430 // CESMRViewerDialog::PreLayoutDynInitL |
|
431 // --------------------------------------------------------------------------- |
|
432 // |
|
433 void CESMRViewerDialog::PreLayoutDynInitL() |
|
434 { |
|
435 FUNC_LOG; |
|
436 SetDefaultMiddleSoftKeyL(); |
|
437 ButtonGroupContainer().MakeCommandVisibleByPosition( |
|
438 CEikButtonGroupContainer::EMiddleSoftkeyPosition, |
|
439 ETrue ); |
|
440 } |
|
441 |
|
442 // --------------------------------------------------------------------------- |
|
443 // CESMRViewerDialog::OfferKeyEventL |
|
444 // --------------------------------------------------------------------------- |
|
445 // |
|
446 TKeyResponse CESMRViewerDialog::OfferKeyEventL( |
|
447 const TKeyEvent& aEvent, |
|
448 TEventCode aType) |
|
449 { |
|
450 FUNC_LOG; |
|
451 TKeyResponse response( EKeyWasNotConsumed ); |
|
452 if ( aEvent.iCode != EKeyEscape && !MenuShowing() ) |
|
453 { |
|
454 response = iView->OfferKeyEventL( aEvent, aType ); |
|
455 } |
|
456 |
|
457 if ( response == EKeyWasNotConsumed ) |
|
458 { |
|
459 switch (aEvent.iScanCode) |
|
460 { |
|
461 case EStdKeyLeftArrow: |
|
462 if ( aType == EEventKey ) |
|
463 { |
|
464 response = EKeyWasConsumed; |
|
465 if ( iCallback.IsCommandAvailable( |
|
466 EESMRCmdMailPreviousMessage ) ) |
|
467 { |
|
468 ProcessCommandL( EESMRCmdMailPreviousMessage ); |
|
469 } |
|
470 } |
|
471 break; |
|
472 case EStdKeyRightArrow: |
|
473 if ( aType == EEventKey ) |
|
474 { |
|
475 response = EKeyWasConsumed; |
|
476 if ( iCallback.IsCommandAvailable( |
|
477 EESMRCmdMailNextMessage ) ) |
|
478 { |
|
479 ProcessCommandL( EESMRCmdMailNextMessage ); |
|
480 } |
|
481 } |
|
482 break; |
|
483 default: |
|
484 response = CAknDialog::OfferKeyEventL( aEvent, aType ); |
|
485 break; |
|
486 } |
|
487 } |
|
488 |
|
489 return response; |
|
490 } |
|
491 |
|
492 |
|
493 // --------------------------------------------------------------------------- |
|
494 // CESMRViewerDialog::ProcessCommandL |
|
495 // --------------------------------------------------------------------------- |
|
496 // |
|
497 void CESMRViewerDialog::ProcessCommandL( TInt aCommand ) |
|
498 { |
|
499 FUNC_LOG; |
|
500 TRAPD( err, DoProcessCommandL( aCommand ) ); |
|
501 if ( err != KErrNone && |
|
502 err != KErrCancel && |
|
503 err != KErrArgument ) |
|
504 { |
|
505 User::Leave(err); |
|
506 } |
|
507 } |
|
508 |
|
509 // --------------------------------------------------------------------------- |
|
510 // CESMRViewerDialog::DoProcessCommandL |
|
511 // --------------------------------------------------------------------------- |
|
512 // |
|
513 void CESMRViewerDialog::DoProcessCommandL( TInt aCommand ) |
|
514 { |
|
515 FUNC_LOG; |
|
516 CAknDialog::ProcessCommandL( aCommand ); |
|
517 |
|
518 switch ( aCommand ) |
|
519 { |
|
520 case EESMRCmdPrint: // Fall through |
|
521 case EESMRCmdPrint_Reserved1: // Fall through |
|
522 case EESMRCmdPrint_Reserved2: // Fall through |
|
523 case EESMRCmdPrint_Reserved3: // Fall through |
|
524 case EESMRCmdPrint_Reserved4: |
|
525 { |
|
526 this->MakeVisible(EFalse); |
|
527 HandlePrintCommandL(aCommand); |
|
528 this->MakeVisible(ETrue); |
|
529 break; |
|
530 } |
|
531 case EESMRCmdSendAs: |
|
532 { |
|
533 SendCalendarEntryL(aCommand); |
|
534 break; |
|
535 } |
|
536 |
|
537 // pass-through all calentryui related command to call back |
|
538 case EESMRCmdCalEntryUISend: // Fall through |
|
539 case EESMRCmdCalEntryUIAddParticipants: // Fall through |
|
540 case EESMRCmdCalEntryUISave: // Fall through |
|
541 { |
|
542 User::LeaveIfError( |
|
543 iCallback.ProcessCommandWithResultL( aCommand )); |
|
544 break; |
|
545 } |
|
546 case EESMRCmdCalEntryUIDelete: |
|
547 { |
|
548 if (!(iCallback.ProcessCommandWithResultL(aCommand) == KErrCancel)) |
|
549 { |
|
550 TryExitL( EAknSoftkeyClose ); |
|
551 } |
|
552 break; |
|
553 } |
|
554 // EEikBidCancel is called when Red End key is pressed or |
|
555 // application is killed via Swap Window |
|
556 case EEikBidCancel: // Fall through |
|
557 case EAknSoftkeyClose: // Fall through |
|
558 case EAknCmdExit: |
|
559 { |
|
560 TryExitL( aCommand ); |
|
561 break; |
|
562 } |
|
563 case EAknSoftkeySelect: // Fall through |
|
564 { |
|
565 iView->ProcessEditorCommandL( aCommand ); |
|
566 break; |
|
567 } |
|
568 case EESMRCmdEdit: // Fall through |
|
569 case EESMRCmdEditLocal: // Fall through |
|
570 case EESMRCmdDeleteMR: // Fall through |
|
571 case EESMRCmdCalEntryUIEdit: |
|
572 { |
|
573 TBool closeDialog = HandleCommandForRecurrentEventL( aCommand ); |
|
574 if ( closeDialog ) |
|
575 { |
|
576 TryExitL( EAknSoftkeyClose ); |
|
577 } |
|
578 break; |
|
579 } |
|
580 case EESMRCmdReply: // Fall through |
|
581 case EESMRCmdReplyAll: |
|
582 { |
|
583 User::LeaveIfError( |
|
584 iCallback.ProcessCommandWithResultL( aCommand )); |
|
585 break; |
|
586 } |
|
587 case EAknCmdHelp: |
|
588 { |
|
589 iView->LaunchViewerHelpL(); |
|
590 break; |
|
591 } |
|
592 case EESMRCmdViewTrack: |
|
593 { |
|
594 User::LeaveIfError( |
|
595 iCallback.ProcessCommandWithResultL( aCommand )); |
|
596 TryExitL( EAknSoftkeyClose ); |
|
597 break; |
|
598 } |
|
599 case EESMRCmdAcceptMR: // Fall through |
|
600 case EESMRCmdTentativeMR: // Fall through |
|
601 case EESMRCmdDeclineMR: // Fall through |
|
602 { |
|
603 iView->ExternalizeL(); // no forced validation |
|
604 TInt res = iCallback.ProcessCommandWithResultL( aCommand ); |
|
605 if ( res != KErrCancel ) |
|
606 { |
|
607 TryExitL( EAknSoftkeyClose ); |
|
608 } |
|
609 break; |
|
610 } |
|
611 case EESMRCmdRemoveFromCalendar: |
|
612 { |
|
613 iView->ExternalizeL(); // no forced validation |
|
614 TryExitL( EESMRCmdRemoveFromCalendar ); |
|
615 break; |
|
616 } |
|
617 case EESMRCmdViewCalendar: |
|
618 { |
|
619 OpenInDayModeL(); |
|
620 break; |
|
621 } |
|
622 // Email commands |
|
623 case EESMRCmdMailDelete: |
|
624 { |
|
625 TBool executeCmd( CESMRConfirmationQuery::ExecuteL( |
|
626 CESMRConfirmationQuery::EESMRDeleteMR ) ); |
|
627 |
|
628 if ( executeCmd ) |
|
629 { |
|
630 TInt res = iCallback.ProcessCommandWithResultL( aCommand ); |
|
631 if ( res != KErrCancel ) |
|
632 { |
|
633 TryExitL( EAknSoftkeyClose ); |
|
634 } |
|
635 } |
|
636 break; |
|
637 } |
|
638 case EESMRCmdClipboardCopy: |
|
639 { |
|
640 iView->ProcessEditorCommandL( aCommand ); |
|
641 break; |
|
642 } |
|
643 case EESMRCmdMailPreviousMessage: // Fall through |
|
644 case EESMRCmdMailNextMessage: // Fall through |
|
645 case EESMRCmdMailForwardAsMessage: // Fall through |
|
646 case EESMRCmdMailMoveMessage: // Fall through |
|
647 case EESMRCmdMailCopyMessage: // Fall through |
|
648 case EESMRCmdMailMoveMessageToDrafts: // Fall through |
|
649 case EESMRCmdMailComposeMessage: // Fall through |
|
650 case EESMRCmdMailMessageDetails: |
|
651 { |
|
652 TInt res = iCallback.ProcessCommandWithResultL( aCommand ); |
|
653 if ( res != KErrCancel ) |
|
654 { |
|
655 TryExitL( aCommand ); |
|
656 } |
|
657 break; |
|
658 } |
|
659 case EESMRCmdForward: |
|
660 { |
|
661 if ( iEntry.Type() == MESMRCalEntry::EESMRCalEntryMeetingRequest ) |
|
662 { |
|
663 // Because this is MR entry, it is safe to cast it. |
|
664 MESMRMeetingRequestEntry* mrEntry = |
|
665 static_cast<MESMRMeetingRequestEntry*>( &iEntry ); |
|
666 __ASSERT_DEBUG( mrEntry, Panic( EESMRViewerDlgInvalidEntry ) ); |
|
667 |
|
668 TInt command = SupportsForwardingAsMeetingL( mrEntry, ETrue ) |
|
669 ? EESMRCmdForwardAsMeeting : EESMRCmdForwardAsMail; |
|
670 |
|
671 CAknToolbar* currentToolbar = static_cast<CEikAppUiFactory*>( |
|
672 iEikonEnv->AppUiFactory() )->CurrentFixedToolbar(); |
|
673 if ( currentToolbar ) |
|
674 { |
|
675 currentToolbar->SetToolbarVisibility( EFalse ); |
|
676 } |
|
677 TInt res = iCallback.ProcessCommandWithResultL( command ); |
|
678 if ( currentToolbar ) |
|
679 { |
|
680 currentToolbar->SetToolbarVisibility( ETrue ); |
|
681 } |
|
682 if ( res != KErrCancel ) |
|
683 { |
|
684 TryExitL( aCommand ); |
|
685 } |
|
686 } |
|
687 break; |
|
688 } |
|
689 case EESMRCmdDownloadManager: |
|
690 { |
|
691 TInt res = iCallback.ProcessCommandWithResultL( aCommand ); |
|
692 if ( res != KErrCancel ) |
|
693 { |
|
694 TryExitL( EAknSoftkeyClose ); |
|
695 } |
|
696 break; |
|
697 } |
|
698 case EESMRCmdOpenAttachment: // Fall through |
|
699 case EESMRCmdOpenAttachmentView: // Fall through |
|
700 case EESMRCmdDownloadAttachment: // Fall through |
|
701 case EESMRCmdDownloadAllAttachments: // Fall through |
|
702 case EESMRCmdSaveAttachment: // Fall through |
|
703 case EESMRCmdSaveAllAttachments: // Fall through |
|
704 { |
|
705 TInt res = iCallback.ProcessCommandWithResultL( |
|
706 aCommand ); |
|
707 if ( res != KErrCancel ) |
|
708 { |
|
709 iExitTriggered = ETrue; |
|
710 } |
|
711 break; |
|
712 } |
|
713 case EESMRCmdMailFlagMessage: // Fall through |
|
714 case EESMRCmdMailMarkUnread: // Fall through |
|
715 case EESMRCmdMailMarkRead: |
|
716 { |
|
717 TInt res = iCallback.ProcessCommandWithResultL( aCommand ); |
|
718 break; |
|
719 } |
|
720 case EESMRCmdTodoMarkAsDone: // Fall through |
|
721 case EESMRCmdTodoMarkAsNotDone: |
|
722 { |
|
723 if ( iEntry.Type() == MESMRCalEntry::EESMRCalEntryTodo ) |
|
724 { |
|
725 User::LeaveIfError( |
|
726 iCallback.ProcessCommandWithResultL( aCommand )); |
|
727 } |
|
728 break; |
|
729 } |
|
730 case EESMRCmdSearchFromMap: |
|
731 case EESMRCmdShowOnMap: |
|
732 { |
|
733 if ( iFeatures->FeatureSupported( |
|
734 CESMRFeatureSettings::EESMRUIMnFwIntegration ) ) |
|
735 { |
|
736 LocationPluginHandlerL().HandleCommandL( aCommand, iEntry ); |
|
737 iView->SetControlFocusedL( EESMRFieldLocation ); |
|
738 } |
|
739 break; |
|
740 } |
|
741 default: |
|
742 { |
|
743 if ( aCommand >= EESMRCmdActionMenuFirst && |
|
744 aCommand < EESMRCmdActionMenuLast ) |
|
745 { |
|
746 iESMRStatic.ContactMenuHandlerL().ExecuteOptionsMenuL(aCommand); |
|
747 } |
|
748 else if ( aCommand == EESMRCmdActionMenuLast ) |
|
749 { |
|
750 TInt res = iCallback.ProcessCommandWithResultL( |
|
751 EESMRCmdOpenAttachmentView ); |
|
752 if ( res != KErrCancel ) |
|
753 { |
|
754 iExitTriggered = ETrue; |
|
755 } |
|
756 } |
|
757 else |
|
758 { |
|
759 __ASSERT_DEBUG( EFalse, Panic( EESMRViewerDlgInvalidCommand ) ); |
|
760 } |
|
761 break; |
|
762 } |
|
763 } |
|
764 } |
|
765 |
|
766 // --------------------------------------------------------------------------- |
|
767 // CESMRViewerDialog::OkToExitL |
|
768 // --------------------------------------------------------------------------- |
|
769 // |
|
770 TBool CESMRViewerDialog::OkToExitL(TInt aButtonId) |
|
771 { |
|
772 FUNC_LOG; |
|
773 TBool res( EFalse ); |
|
774 // show options |
|
775 switch ( aButtonId ) |
|
776 { |
|
777 case EAknSoftkeyOptions: |
|
778 { |
|
779 CAknDialog::DisplayMenuL(); |
|
780 break; |
|
781 } |
|
782 case EAknSoftkeyContextOptions: |
|
783 { |
|
784 if ( iFeatures->FeatureSupported( |
|
785 CESMRFeatureSettings::EESMRUIMnFwIntegration ) ) |
|
786 { |
|
787 iMenuBar->TryDisplayContextMenuBarL(); |
|
788 } |
|
789 break; |
|
790 } |
|
791 case EESMRCmdEdit: |
|
792 case EESMRCmdEditLocal: |
|
793 case EESMRCmdCalEntryUIEdit: |
|
794 { |
|
795 res = HandleCommandForRecurrentEventL( aButtonId ); |
|
796 break; |
|
797 } |
|
798 case EAknSoftkeySelect: |
|
799 { |
|
800 iView->ProcessEditorCommandL( aButtonId ); |
|
801 |
|
802 if ( iExitTriggered ) |
|
803 { |
|
804 res = ETrue; |
|
805 } |
|
806 break; |
|
807 } |
|
808 |
|
809 case EESMRCmdOpenAttachmentView: |
|
810 case EESMRCmdMskOpenEmailAttachment: |
|
811 case EESMRCmdOpenAttachment: |
|
812 case EESMRCmdDownloadAttachment: |
|
813 { |
|
814 ProcessCommandL( aButtonId ); |
|
815 break; |
|
816 } |
|
817 |
|
818 case EESMRCmdShowAllAttendees: |
|
819 case EESMRCmdShowOnMap: |
|
820 { |
|
821 iView->ProcessEditorCommandL( aButtonId ); |
|
822 break; |
|
823 } |
|
824 case EEikBidCancel: |
|
825 { |
|
826 res = ETrue; |
|
827 break; |
|
828 } |
|
829 case EAknSoftkeyClose: // Fall through |
|
830 case EAknCmdExit: // Fall through |
|
831 case EESMRCmdMailPreviousMessage: // Fall through |
|
832 case EESMRCmdMailNextMessage: // Fall through |
|
833 case EESMRCmdMailForwardAsMessage: // Fall through |
|
834 case EESMRCmdMailMoveMessage: // Fall through |
|
835 case EESMRCmdMailCopyMessage: // Fall through |
|
836 case EESMRCmdMailMoveMessageToDrafts: // Fall through |
|
837 case EESMRCmdMailComposeMessage: // Fall through |
|
838 case EESMRCmdMailMessageDetails: |
|
839 { |
|
840 iClearToolbar = ETrue; |
|
841 res = HandleMRExitL( aButtonId ); |
|
842 break; |
|
843 } |
|
844 case EESMRCmdRemoveFromCalendar: |
|
845 { |
|
846 res = iCallback.ProcessCommandWithResultL ( aButtonId ); |
|
847 break; |
|
848 } |
|
849 default: |
|
850 { |
|
851 if(iExitTriggered) |
|
852 { |
|
853 res = ETrue; |
|
854 } |
|
855 break; |
|
856 } |
|
857 } |
|
858 |
|
859 return res; |
|
860 } |
|
861 |
|
862 // --------------------------------------------------------------------------- |
|
863 // CESMRViewerDialog::CreateCustomControlL |
|
864 // --------------------------------------------------------------------------- |
|
865 // |
|
866 SEikControlInfo CESMRViewerDialog::CreateCustomControlL( TInt aType ) // codescanner::LFunctionCantLeave |
|
867 { |
|
868 FUNC_LOG; |
|
869 SEikControlInfo controlInfo; |
|
870 controlInfo.iControl = NULL; |
|
871 controlInfo.iFlags = 0; |
|
872 controlInfo.iTrailerTextId = 0; |
|
873 |
|
874 if ( aType == EEsMrViewerType ) |
|
875 { |
|
876 controlInfo.iControl = iView; |
|
877 } |
|
878 |
|
879 return controlInfo; |
|
880 } |
|
881 |
|
882 // --------------------------------------------------------------------------- |
|
883 // CESMRViewerDialog::ExecuteViewLD |
|
884 // --------------------------------------------------------------------------- |
|
885 // |
|
886 TInt CESMRViewerDialog::ExecuteViewLD() |
|
887 { |
|
888 FUNC_LOG; |
|
889 MakeMrGuiToolbarButtonsL(); |
|
890 return ExecuteLD( R_MRVIEWER_DIALOG ); |
|
891 } |
|
892 |
|
893 // --------------------------------------------------------------------------- |
|
894 // CESMRViewerDialog::Response |
|
895 // --------------------------------------------------------------------------- |
|
896 // |
|
897 TBool CESMRViewerDialog::Response( TInt aCommand ) |
|
898 { |
|
899 FUNC_LOG; |
|
900 iExitTriggered = EFalse; |
|
901 // Documentation says that this function might leave and also might |
|
902 // return system might error code. |
|
903 TInt res = KErrNone; |
|
904 TRAPD( error, res = iCallback.ProcessCommandWithResultL( aCommand ) ); |
|
905 if ( res != KErrCancel && error == KErrNone ) |
|
906 { |
|
907 iExitTriggered = ETrue; |
|
908 return ETrue; |
|
909 } |
|
910 return EFalse; |
|
911 } |
|
912 |
|
913 // --------------------------------------------------------------------------- |
|
914 // CESMRViewerDialog::ExitDialog |
|
915 // --------------------------------------------------------------------------- |
|
916 // |
|
917 void CESMRViewerDialog::ExitDialog() |
|
918 { |
|
919 FUNC_LOG; |
|
920 // If closing does not work what can we do |
|
921 TRAPD( error, ProcessCommandL(EAknSoftkeyClose) ); |
|
922 if ( error != KErrNone ) |
|
923 { |
|
924 CEikonEnv::Static()->HandleError( error );// codescanner::eikonenvstatic |
|
925 } |
|
926 } |
|
927 |
|
928 // --------------------------------------------------------------------------- |
|
929 // CESMRViewerDialog::ChangeReadyResponseL |
|
930 // --------------------------------------------------------------------------- |
|
931 // |
|
932 void CESMRViewerDialog::ChangeReadyResponseL() |
|
933 { |
|
934 FUNC_LOG; |
|
935 iView->ProcessEditorCommandL( EESMRCmdEdit ); |
|
936 } |
|
937 |
|
938 // --------------------------------------------------------------------------- |
|
939 // CESMRViewerDialog::DynInitMenuPaneL |
|
940 // --------------------------------------------------------------------------- |
|
941 // |
|
942 void CESMRViewerDialog::DynInitMenuPaneL( |
|
943 TInt aResourceId, |
|
944 CEikMenuPane* aMenuPane ) |
|
945 { |
|
946 FUNC_LOG; |
|
947 if ( iServiceHandler ) |
|
948 { |
|
949 if ( iServiceHandler->HandleSubmenuL( *aMenuPane ) ) |
|
950 { |
|
951 return; |
|
952 } |
|
953 } |
|
954 |
|
955 switch ( aResourceId ) |
|
956 { |
|
957 case R_ACTION_MENU: |
|
958 { |
|
959 iESMRStatic.ContactMenuHandlerL().InitOptionsMenuL( aMenuPane ); |
|
960 break; |
|
961 } |
|
962 case R_MR_VIEWER_MENU: |
|
963 { |
|
964 if (FeatureManager::FeatureSupported( KFeatureIdFfCmailIntegration )) |
|
965 { |
|
966 // remove help support in pf5250 |
|
967 aMenuPane->SetItemDimmed( EAknCmdHelp, ETrue); |
|
968 } |
|
969 |
|
970 HandlePolicyMenuL( |
|
971 aResourceId, |
|
972 aMenuPane ); |
|
973 |
|
974 // Insert send ui menu for all other entry types than meeting request |
|
975 if ( iEntry.Type() != MESMRCalEntry::EESMRCalEntryMeetingRequest ) |
|
976 { |
|
977 TryInsertSendMenuL(aMenuPane); |
|
978 } |
|
979 |
|
980 if ( iEntry.Entry().AttendeesL().Count() <= 1 ) |
|
981 { |
|
982 aMenuPane->SetItemDimmed( EESMRCmdReplyAll, ETrue ); |
|
983 } |
|
984 |
|
985 HandleDynamicMenuItemsL( aResourceId, aMenuPane ); |
|
986 |
|
987 if ( FeatureManager::FeatureSupported( |
|
988 KFeatureIdPrintingFrameworkCalendarPlugin ) ) |
|
989 { |
|
990 // Initiliaze menu |
|
991 iServiceHandler->InitializeMenuPaneL( |
|
992 *aMenuPane, |
|
993 aResourceId, |
|
994 EESMRCmdPrint, |
|
995 iServiceHandler->InParamListL() ); |
|
996 } |
|
997 else |
|
998 { |
|
999 aMenuPane->SetItemDimmed( EESMRCmdPrint, ETrue ); |
|
1000 } |
|
1001 |
|
1002 TBool canCopyToClipboard = iView->CanProcessEditorCommandL( EESMRCmdClipboardCopy ); |
|
1003 if ( !canCopyToClipboard ) |
|
1004 { |
|
1005 aMenuPane->SetItemDimmed( EESMRCmdClipboardCopy, ETrue ); |
|
1006 } |
|
1007 |
|
1008 break; |
|
1009 } |
|
1010 |
|
1011 case R_MR_VIEWER_LOCATION_MENU: |
|
1012 { |
|
1013 if ( iFeatures->FeatureSupported( |
|
1014 CESMRFeatureSettings::EESMRUIMnFwIntegration ) ) |
|
1015 { |
|
1016 TBool showOnMap = |
|
1017 LocationPluginHandlerL().IsCommandAvailableL( EESMRCmdShowOnMap, |
|
1018 iEntry ); |
|
1019 |
|
1020 aMenuPane->SetItemDimmed( EESMRCmdShowOnMap, !showOnMap ); |
|
1021 aMenuPane->SetItemDimmed( EESMRCmdSearchFromMap, showOnMap ); |
|
1022 |
|
1023 aMenuPane->SetItemDimmed( EESMRCmdEdit, |
|
1024 !iPolicy->IsDefaultCommand( EESMRCmdEdit ) ); |
|
1025 aMenuPane->SetItemDimmed( EESMRCmdEditLocal, |
|
1026 !iPolicy->IsDefaultCommand( EESMRCmdEditLocal ) ); |
|
1027 aMenuPane->SetItemDimmed( EESMRCmdCalEntryUIEdit, |
|
1028 !iPolicy->IsDefaultCommand( EESMRCmdCalEntryUIEdit ) ); |
|
1029 } |
|
1030 |
|
1031 break; |
|
1032 } |
|
1033 default: |
|
1034 { |
|
1035 break; |
|
1036 } |
|
1037 } |
|
1038 |
|
1039 // Handles email submenu |
|
1040 HandleEmailSubmenuL( aResourceId, aMenuPane ); |
|
1041 } |
|
1042 |
|
1043 // --------------------------------------------------------------------------- |
|
1044 // CESMRViewerDialog::HandleDynamicMenuItemsL |
|
1045 // --------------------------------------------------------------------------- |
|
1046 // |
|
1047 void CESMRViewerDialog::HandleDynamicMenuItemsL( |
|
1048 TInt aResourceId, CEikMenuPane* aMenuPane ) |
|
1049 { |
|
1050 FUNC_LOG; |
|
1051 if ( aResourceId == R_MR_VIEWER_MENU ) |
|
1052 { |
|
1053 if (FeatureManager::FeatureSupported( KFeatureIdFfCmailIntegration )) |
|
1054 { |
|
1055 // remove help support in pf5250 |
|
1056 aMenuPane->SetItemDimmed( EAknCmdHelp, ETrue); |
|
1057 } |
|
1058 if ( iFeatures->FeatureSupported( |
|
1059 CESMRFeatureSettings::EESMRUIMnFwIntegration ) ) |
|
1060 { |
|
1061 if ( !iView->IsComponentVisible( EESMRFieldLocation )) |
|
1062 { |
|
1063 aMenuPane->SetItemDimmed( EESMRCmdSearchFromMap, ETrue ); |
|
1064 aMenuPane->SetItemDimmed( EESMRCmdShowOnMap, ETrue ); |
|
1065 } |
|
1066 else |
|
1067 { |
|
1068 TBool showOnMap = LocationPluginHandlerL(). |
|
1069 IsCommandAvailableL( EESMRCmdShowOnMap, |
|
1070 iEntry ); |
|
1071 aMenuPane->SetItemDimmed( EESMRCmdSearchFromMap, showOnMap ); |
|
1072 aMenuPane->SetItemDimmed( EESMRCmdShowOnMap, !showOnMap ); |
|
1073 } |
|
1074 } |
|
1075 else |
|
1076 { |
|
1077 aMenuPane->SetItemDimmed( EESMRCmdSearchFromMap, ETrue ); |
|
1078 aMenuPane->SetItemDimmed( EESMRCmdShowOnMap, ETrue ); |
|
1079 } |
|
1080 |
|
1081 // Handle Action Menu item |
|
1082 TBool dim = !iESMRStatic.ContactMenuHandlerL().OptionsMenuAvailable(); |
|
1083 aMenuPane->SetItemDimmed( EESMRCmdActionMenu, dim ); |
|
1084 aMenuPane->SetItemDimmed( EESMRCmdClipboardCopy, dim ); |
|
1085 } |
|
1086 } |
|
1087 |
|
1088 // --------------------------------------------------------------------------- |
|
1089 // CESMRViewerDialog::TryInsertSendMenuL |
|
1090 // --------------------------------------------------------------------------- |
|
1091 // |
|
1092 void CESMRViewerDialog::TryInsertSendMenuL(CEikMenuPane* aMenuPane) |
|
1093 { |
|
1094 FUNC_LOG; |
|
1095 TInt index(KErrNotFound); |
|
1096 |
|
1097 // Insert send menu to the next position from "editing options" |
|
1098 aMenuPane->ItemAndPos(EESMRCmdClipboardCopy, index); |
|
1099 if (index == KErrNotFound) |
|
1100 { |
|
1101 aMenuPane->ItemAndPos(EESMRCmdCalEntryUIDelete, index); |
|
1102 if (index == KErrNotFound) |
|
1103 { |
|
1104 aMenuPane->ItemAndPos(EESMRCmdDeleteMR, index); |
|
1105 } |
|
1106 } |
|
1107 index++; |
|
1108 iESMRSendUI->DisplaySendMenuItemL(*aMenuPane, index); |
|
1109 } |
|
1110 |
|
1111 // --------------------------------------------------------------------------- |
|
1112 // CESMRViewerDialog::OpenInDayModeL |
|
1113 // --------------------------------------------------------------------------- |
|
1114 // |
|
1115 void CESMRViewerDialog::OpenInDayModeL() |
|
1116 { |
|
1117 FUNC_LOG; |
|
1118 |
|
1119 TApaTaskList taskList( iCoeEnv->WsSession() ); |
|
1120 TApaTask task = taskList.FindApp(KCalendarAppUID ); |
|
1121 |
|
1122 HBufC16* tail = NULL; |
|
1123 CommandTailL( tail ); |
|
1124 CleanupStack::PushL( tail ); |
|
1125 |
|
1126 // copy the 16-bit data into 8-bit buffer |
|
1127 HBufC8* paramBuf = HBufC8::NewLC( tail->Length() *2 ); |
|
1128 TPtr8 tailBuf = paramBuf->Des(); |
|
1129 |
|
1130 tailBuf.Copy( |
|
1131 reinterpret_cast<const TUint8*>( tail->Ptr() ), tail->Length() *2 ); |
|
1132 |
|
1133 if( task.Exists() ) // Calendar already open |
|
1134 { |
|
1135 const TUid dummyUID = { 0x0 }; |
|
1136 task.SendMessage( dummyUID, tailBuf ); |
|
1137 task.BringToForeground(); |
|
1138 } |
|
1139 else // Launch Calendar into day view |
|
1140 { |
|
1141 TApaAppInfo appInfo; |
|
1142 RApaLsSession lsSession; |
|
1143 User::LeaveIfError(lsSession.Connect()); |
|
1144 CleanupClosePushL( lsSession ); |
|
1145 |
|
1146 if( lsSession.GetAppInfo( appInfo, KCalendarAppUID ) == KErrNone ) |
|
1147 { |
|
1148 CApaCommandLine* cmdLine = CApaCommandLine::NewLC(); |
|
1149 cmdLine->SetExecutableNameL( appInfo.iFullName ); |
|
1150 cmdLine->SetCommandL( EApaCommandRun ); |
|
1151 cmdLine->SetTailEndL( tailBuf ); |
|
1152 |
|
1153 lsSession.StartApp( *cmdLine ); |
|
1154 CleanupStack::PopAndDestroy( cmdLine ); |
|
1155 } |
|
1156 |
|
1157 // Close lsSession |
|
1158 CleanupStack::PopAndDestroy(); // codescanner::cleanup |
|
1159 } |
|
1160 CleanupStack::PopAndDestroy( paramBuf ); |
|
1161 CleanupStack::PopAndDestroy( tail ); |
|
1162 } |
|
1163 |
|
1164 // --------------------------------------------------------------------------- |
|
1165 // CESMRViewerDialog::CommandTailL |
|
1166 // --------------------------------------------------------------------------- |
|
1167 // |
|
1168 void CESMRViewerDialog::CommandTailL(HBufC16*& aTailBuffer) |
|
1169 { |
|
1170 FUNC_LOG; |
|
1171 // "DATE YYYY MM DD HH MM SS MMMMMM" |
|
1172 aTailBuffer = HBufC::NewLC( KCalDefaultBufferLen ); |
|
1173 TPtr tailPtr = aTailBuffer->Des(); |
|
1174 |
|
1175 // get the start time of entry |
|
1176 CCalEntry& entry = iEntry.Entry(); |
|
1177 TTime startTime = entry.StartTimeL().TimeLocalL(); |
|
1178 |
|
1179 startTime.FormatL(tailPtr, KCalCmdTimeFormat() ); |
|
1180 tailPtr.Insert( 0, KCalCmdDATE ); |
|
1181 CleanupStack::Pop( aTailBuffer ); |
|
1182 } |
|
1183 |
|
1184 // --------------------------------------------------------------------------- |
|
1185 // CESMRViewerDialog::HandleCommandForRecurrentEventL |
|
1186 // --------------------------------------------------------------------------- |
|
1187 // |
|
1188 TBool CESMRViewerDialog::HandleCommandForRecurrentEventL( TInt aCommand ) |
|
1189 { |
|
1190 FUNC_LOG; |
|
1191 TBool closeDialog( EFalse ); |
|
1192 |
|
1193 switch ( aCommand ) |
|
1194 { |
|
1195 case EESMRCmdEdit: //Fall through |
|
1196 case EESMRCmdEditLocal: //Fall through |
|
1197 case EESMRCmdCalEntryUIEdit: |
|
1198 { |
|
1199 this->MakeVisible(EFalse); |
|
1200 if ( iEntry.IsRecurrentEventL() ) |
|
1201 { |
|
1202 // Check is the currently viewed entry a modifying entry. |
|
1203 // MESMRCalEntry should provide this method. |
|
1204 // if the entry is an exception to series, no query |
|
1205 // should be asked in which mode the editor should be launched |
|
1206 // in this occurance or series -mode. |
|
1207 if ( iEntry.Entry().RecurrenceIdL().TimeUtcL() != |
|
1208 Time::NullTTime() ) |
|
1209 { |
|
1210 iEntry.SetModifyingRuleL( MESMRCalEntry::EESMRThisOnly ); |
|
1211 } |
|
1212 else |
|
1213 { |
|
1214 SetRecurrenceModRuleL( |
|
1215 iEntry, |
|
1216 CESMRListQuery::EESMROpenThisOccurenceOrSeriesQuery ); |
|
1217 } |
|
1218 } |
|
1219 |
|
1220 MESMRMeetingRequestEntry* entry = NULL; |
|
1221 if ( MESMRCalEntry::EESMRCalEntryMeetingRequest == iEntry.Type() ) |
|
1222 { |
|
1223 entry = static_cast<MESMRMeetingRequestEntry*>(&iEntry); |
|
1224 |
|
1225 TESMRRole role = entry->RoleL(); |
|
1226 if ( role == EESMRRoleOrganizer ) |
|
1227 { |
|
1228 User::LeaveIfError( |
|
1229 iCallback.ProcessCommandWithResultL( EESMRCmdEdit )); |
|
1230 closeDialog = ETrue; |
|
1231 } |
|
1232 else |
|
1233 { |
|
1234 User::LeaveIfError( |
|
1235 iCallback.ProcessCommandWithResultL( EESMRCmdEditLocal )); |
|
1236 closeDialog = ETrue; |
|
1237 } |
|
1238 } |
|
1239 else |
|
1240 { |
|
1241 User::LeaveIfError( |
|
1242 iCallback.ProcessCommandWithResultL( EESMRCmdCalEntryUIEdit)); |
|
1243 closeDialog = ETrue; |
|
1244 } |
|
1245 this->MakeVisible(ETrue); |
|
1246 break; |
|
1247 } |
|
1248 case EESMRCmdDeleteMR: |
|
1249 { |
|
1250 if ( iEntry.Type () == MESMRCalEntry::EESMRCalEntryMeetingRequest ) |
|
1251 { |
|
1252 TBool okToDelete = ETrue; |
|
1253 |
|
1254 if ( iEntry.IsRecurrentEventL() ) |
|
1255 { |
|
1256 SetRecurrenceModRuleL( |
|
1257 iEntry, |
|
1258 CESMRListQuery::EESMRDeleteThisOccurenceOrSeriesQuery ); |
|
1259 } |
|
1260 else |
|
1261 { |
|
1262 okToDelete = CESMRConfirmationQuery::ExecuteL( |
|
1263 CESMRConfirmationQuery::EESMRDeleteMR ); |
|
1264 |
|
1265 } |
|
1266 |
|
1267 if ( okToDelete ) |
|
1268 { |
|
1269 // When deleting we do not need to externalize entry |
|
1270 TInt res = iCallback.ProcessCommandWithResultL( aCommand ); |
|
1271 if ( res != KErrCancel ) |
|
1272 { |
|
1273 closeDialog = ETrue; |
|
1274 } |
|
1275 } |
|
1276 } |
|
1277 break; |
|
1278 } |
|
1279 default: |
|
1280 { |
|
1281 break; |
|
1282 } |
|
1283 } |
|
1284 |
|
1285 return closeDialog; |
|
1286 } |
|
1287 |
|
1288 |
|
1289 // --------------------------------------------------------------------------- |
|
1290 // CESMRViewerDialog::SendCalendarEntryL |
|
1291 // --------------------------------------------------------------------------- |
|
1292 // |
|
1293 void CESMRViewerDialog::SendCalendarEntryL(TInt aCommandId) |
|
1294 { |
|
1295 FUNC_LOG; |
|
1296 // we don't need MenuPane in CCalSend but we need it for the API |
|
1297 CEikMenuPane* pane=NULL; |
|
1298 |
|
1299 // Show menu to user |
|
1300 // CCalenSend handles selection internally, so we don't |
|
1301 // get anything in return |
|
1302 iESMRSendUI->DisplaySendCascadeMenuL(*pane); |
|
1303 |
|
1304 // Try to send |
|
1305 if (iESMRSendUI->CanSendL(aCommandId)) |
|
1306 { |
|
1307 iESMRSendUI->SendAsVCalendarL(aCommandId, iEntry.Entry() ); |
|
1308 } |
|
1309 } |
|
1310 |
|
1311 // --------------------------------------------------------------------------- |
|
1312 // CESMRViewerDialog::HandlePrintCommandL |
|
1313 // --------------------------------------------------------------------------- |
|
1314 // |
|
1315 void CESMRViewerDialog::HandlePrintCommandL(TInt aCommand) |
|
1316 { |
|
1317 FUNC_LOG; |
|
1318 CAiwGenericParamList& inParams = iServiceHandler->InParamListL(); |
|
1319 |
|
1320 // Param date |
|
1321 |
|
1322 TCalTime startTime = iEntry.Entry().StartTimeL(); |
|
1323 |
|
1324 TAiwGenericParam dateParam( EGenericParamDateTime ); |
|
1325 TTime activeDay = startTime.TimeUtcL(); |
|
1326 |
|
1327 TAiwGenericParam calendarParam( EGenericParamCalendarItem ); |
|
1328 calendarParam.Value().Set( TUid::Uid(iEntry.Entry().LocalUidL()) ); |
|
1329 inParams.AppendL( calendarParam ); |
|
1330 |
|
1331 // Append date param |
|
1332 dateParam.Value().Set( activeDay ); |
|
1333 inParams.AppendL( dateParam ); |
|
1334 |
|
1335 const TUid uid( TUid::Uid( KUidCalendarApplication ) ); |
|
1336 TAiwGenericParam uidParam( EGenericParamApplication ); |
|
1337 uidParam.Value().Set( uid ); |
|
1338 inParams.AppendL( uidParam ); |
|
1339 |
|
1340 // Execute service command with given parameters |
|
1341 iServiceHandler->ExecuteMenuCmdL( aCommand, |
|
1342 inParams, |
|
1343 iServiceHandler->OutParamListL(), |
|
1344 0, |
|
1345 NULL ); |
|
1346 } |
|
1347 |
|
1348 // --------------------------------------------------------------------------- |
|
1349 // CESMRViewerDialog::HandleEmailSubmenuL |
|
1350 // --------------------------------------------------------------------------- |
|
1351 // |
|
1352 void CESMRViewerDialog::HandleEmailSubmenuL( |
|
1353 TInt aResourceId, |
|
1354 CEikMenuPane* aMenuPane ) |
|
1355 { |
|
1356 FUNC_LOG; |
|
1357 // Insert send ui menu for all other entry types than meeting request |
|
1358 if ( iEntry.Type() == MESMRCalEntry::EESMRCalEntryMeetingRequest ) |
|
1359 { |
|
1360 if ( R_MRVIEWER_EMAIL_MENU == aResourceId ) |
|
1361 { |
|
1362 TInt menuItemCount( aMenuPane->NumberOfItemsInPane() ); |
|
1363 for ( TInt i(0); i < menuItemCount; ++i ) |
|
1364 { |
|
1365 CEikMenuPaneItem::SData& item( |
|
1366 aMenuPane->ItemDataByIndexL( i ) ); |
|
1367 aMenuPane->SetItemDimmed( |
|
1368 item.iCommandId, |
|
1369 !iCallback.IsCommandAvailable(item.iCommandId) ); |
|
1370 } |
|
1371 } |
|
1372 else if ( R_MR_VIEWER_MENU == aResourceId ) |
|
1373 { |
|
1374 if (FeatureManager::FeatureSupported( KFeatureIdFfCmailIntegration )) |
|
1375 { |
|
1376 // remove help support in pf5250 |
|
1377 aMenuPane->SetItemDimmed( EAknCmdHelp, ETrue); |
|
1378 } |
|
1379 |
|
1380 TBool emailMenuDimmed( ETrue ); |
|
1381 // Try insert email specific menu |
|
1382 if ( EESMRAppESEmail == iPolicy->AllowedApp() ) |
|
1383 { |
|
1384 emailMenuDimmed = EFalse; |
|
1385 } |
|
1386 |
|
1387 aMenuPane->SetItemDimmed( |
|
1388 EESMRCmdMailDelete, |
|
1389 !iCallback.IsCommandAvailable( |
|
1390 EESMRCmdMailDelete) ); |
|
1391 aMenuPane->SetItemDimmed( |
|
1392 EESMRCmdMailMessageDetails, |
|
1393 !iCallback.IsCommandAvailable( |
|
1394 EESMRCmdMailMessageDetails ) ); |
|
1395 |
|
1396 aMenuPane->SetItemDimmed( |
|
1397 EESMRCmdMailPreviousMessage, |
|
1398 !iCallback.IsCommandAvailable( |
|
1399 EESMRCmdMailPreviousMessage ) ); |
|
1400 |
|
1401 aMenuPane->SetItemDimmed( |
|
1402 EESMRCmdMailNextMessage, |
|
1403 !iCallback.IsCommandAvailable( |
|
1404 EESMRCmdMailNextMessage ) ); |
|
1405 |
|
1406 aMenuPane->SetItemDimmed( |
|
1407 EESMRCmdMailEmailMoreMenu, |
|
1408 emailMenuDimmed ); |
|
1409 } |
|
1410 } |
|
1411 } |
|
1412 |
|
1413 // --------------------------------------------------------------------------- |
|
1414 // CESMRViewerDialog::HandlePolicyMenuL |
|
1415 // --------------------------------------------------------------------------- |
|
1416 // |
|
1417 void CESMRViewerDialog::HandlePolicyMenuL( |
|
1418 TInt aResourceId, |
|
1419 CEikMenuPane* aMenuPane ) |
|
1420 { |
|
1421 FUNC_LOG; |
|
1422 if ( aResourceId == R_MR_VIEWER_MENU ) |
|
1423 { |
|
1424 if (FeatureManager::FeatureSupported( KFeatureIdFfCmailIntegration )) |
|
1425 { |
|
1426 // remove help support in pf5250 |
|
1427 aMenuPane->SetItemDimmed( EAknCmdHelp, ETrue); |
|
1428 } |
|
1429 |
|
1430 if ( iEntry.Type() == MESMRCalEntry::EESMRCalEntryMeetingRequest ) |
|
1431 { |
|
1432 MESMRMeetingRequestEntry* mrEntry = |
|
1433 (MESMRMeetingRequestEntry*)( &iEntry ); |
|
1434 CCalEntry::TMethod method( |
|
1435 mrEntry->Entry().MethodL() ); |
|
1436 |
|
1437 TInt itemsInMenu( aMenuPane->NumberOfItemsInPane() ); |
|
1438 for ( TInt i(0); i < itemsInMenu; ++i ) |
|
1439 { |
|
1440 CEikMenuPaneItem::SData& item( |
|
1441 aMenuPane->ItemDataByIndexL( i ) ); |
|
1442 |
|
1443 if ( CCalEntry::EMethodCancel == method && |
|
1444 EESMRRoleOrganizer != mrEntry->RoleL()) |
|
1445 { |
|
1446 switch ( item.iCommandId ) |
|
1447 { |
|
1448 case EESMRCmdAcceptMR: // Fall through |
|
1449 case EESMRCmdTentativeMR: // Fall through |
|
1450 case EESMRCmdDeclineMR: // Fall through |
|
1451 case EESMRCmdDeleteMR: |
|
1452 { |
|
1453 aMenuPane->SetItemDimmed( |
|
1454 item.iCommandId, |
|
1455 ETrue ); |
|
1456 break; |
|
1457 } |
|
1458 case EESMRCmdRemoveFromCalendar: |
|
1459 { |
|
1460 TPtrC addr = DigMailboxAndRemovePrefixL(); |
|
1461 |
|
1462 if( iESMRStatic.MailBoxL( addr ).HasCapability( |
|
1463 EFSMBoxCapaRemoveFromCalendar ) && |
|
1464 iEntry.IsStoredL() ) |
|
1465 { |
|
1466 aMenuPane->SetItemDimmed( |
|
1467 item.iCommandId, |
|
1468 EFalse ); |
|
1469 } |
|
1470 else |
|
1471 { |
|
1472 aMenuPane->SetItemDimmed( |
|
1473 item.iCommandId, |
|
1474 ETrue ); |
|
1475 } |
|
1476 break; |
|
1477 } |
|
1478 default: |
|
1479 { |
|
1480 aMenuPane->SetItemDimmed( |
|
1481 item.iCommandId, |
|
1482 !iPolicy->IsDefaultCommand( |
|
1483 item.iCommandId) ); |
|
1484 break; |
|
1485 } |
|
1486 } |
|
1487 } |
|
1488 else |
|
1489 { |
|
1490 if ( EESMRCmdRemoveFromCalendar == item.iCommandId ) |
|
1491 { |
|
1492 aMenuPane->SetItemDimmed( |
|
1493 EESMRCmdRemoveFromCalendar, |
|
1494 ETrue ); |
|
1495 } |
|
1496 else |
|
1497 { |
|
1498 aMenuPane->SetItemDimmed( |
|
1499 item.iCommandId, |
|
1500 !iPolicy->IsDefaultCommand( item.iCommandId) ); |
|
1501 } |
|
1502 } |
|
1503 if ( EESMRRoleOrganizer == mrEntry->RoleL()) |
|
1504 { |
|
1505 //dim tracking view menuitem if no attendees |
|
1506 //or if current cfsmailbox doesn't support attendee status |
|
1507 if( EESMRCmdViewTrack == item.iCommandId ) |
|
1508 { |
|
1509 TInt count(0); |
|
1510 |
|
1511 if ( SupportsAttendeeStatusL() ) |
|
1512 { |
|
1513 count = mrEntry->AttendeeCountL(EESMRRoleRequiredAttendee)+ |
|
1514 mrEntry->AttendeeCountL(EESMRRoleOptionalAttendee); |
|
1515 } |
|
1516 |
|
1517 if (!count) |
|
1518 { |
|
1519 aMenuPane->SetItemDimmed( item.iCommandId, ETrue ); |
|
1520 } |
|
1521 } |
|
1522 } |
|
1523 } |
|
1524 } |
|
1525 else |
|
1526 { |
|
1527 TInt itemsInMenu( aMenuPane->NumberOfItemsInPane() ); |
|
1528 for ( TInt i(0); i < itemsInMenu; ++i ) |
|
1529 { |
|
1530 CEikMenuPaneItem::SData& item = aMenuPane->ItemDataByIndexL(i); |
|
1531 |
|
1532 aMenuPane->SetItemDimmed( |
|
1533 item.iCommandId, |
|
1534 !iPolicy->IsDefaultCommand( item.iCommandId) ); |
|
1535 } |
|
1536 |
|
1537 if ( iEntry.Type() == MESMRCalEntry::EESMRCalEntryTodo ) |
|
1538 { |
|
1539 if (iPolicy->IsDefaultCommand(EESMRCmdTodoMarkAsDone)) |
|
1540 { |
|
1541 TBool dim(EFalse); |
|
1542 if( iEntry.Entry().StatusL() == CCalEntry::ETodoCompleted ) |
|
1543 { |
|
1544 dim = ETrue; |
|
1545 } |
|
1546 aMenuPane->SetItemDimmed( EESMRCmdTodoMarkAsDone, dim ); |
|
1547 aMenuPane->SetItemDimmed( EESMRCmdTodoMarkAsNotDone, !dim ); |
|
1548 } |
|
1549 } |
|
1550 } |
|
1551 } |
|
1552 } |
|
1553 |
|
1554 // --------------------------------------------------------------------------- |
|
1555 // CESMRViewerDialog::SupportsAttendeeStatusL |
|
1556 // --------------------------------------------------------------------------- |
|
1557 // |
|
1558 TBool CESMRViewerDialog::SupportsAttendeeStatusL( ) |
|
1559 { |
|
1560 FUNC_LOG; |
|
1561 TBool supportsAttendeeStatus(EFalse); |
|
1562 CESMRFieldBuilderInterface* plugin = NULL; |
|
1563 TRAPD( error, |
|
1564 plugin = CESMRFieldBuilderInterface::CreatePluginL( |
|
1565 TUid::Uid(KESMRUIFieldBuilderPluginImplUId) ) ); |
|
1566 CleanupStack::PushL( plugin ); |
|
1567 |
|
1568 if (error == KErrNone && plugin) |
|
1569 { |
|
1570 TUid uid = {0}; |
|
1571 MESMRBuilderExtension* extension = |
|
1572 static_cast<MESMRBuilderExtension*>( plugin->ExtensionL(uid) ); |
|
1573 |
|
1574 if (extension) |
|
1575 { |
|
1576 supportsAttendeeStatus = |
|
1577 extension->CFSMailBoxCapabilityL( |
|
1578 MESMRBuilderExtension::EMRCFSAttendeeStatus); |
|
1579 } |
|
1580 } |
|
1581 |
|
1582 CleanupStack::PopAndDestroy( plugin ); |
|
1583 |
|
1584 return supportsAttendeeStatus; |
|
1585 } |
|
1586 |
|
1587 // --------------------------------------------------------------------------- |
|
1588 // CESMRViewerDialog::HandleMRExitL |
|
1589 // --------------------------------------------------------------------------- |
|
1590 // |
|
1591 TBool CESMRViewerDialog::HandleMRExitL( TInt aCommand ) |
|
1592 { |
|
1593 FUNC_LOG; |
|
1594 TBool deleteEntry( EFalse ); |
|
1595 |
|
1596 TBool queryAvailable( ETrue ); |
|
1597 |
|
1598 // disable EESMRRemoveAppointment query if exiting dialog |
|
1599 // through email-based option menu command, |
|
1600 switch ( aCommand ) |
|
1601 { |
|
1602 case EESMRCmdMailPreviousMessage: // Fall through |
|
1603 case EESMRCmdMailNextMessage: // Fall through |
|
1604 case EESMRCmdMailForwardAsMessage: // Fall through |
|
1605 case EESMRCmdMailMoveMessage: // Fall through |
|
1606 case EESMRCmdMailCopyMessage: // Fall through |
|
1607 case EESMRCmdMailMoveMessageToDrafts: // Fall through |
|
1608 case EESMRCmdMailComposeMessage: // Fall through |
|
1609 case EESMRCmdMailMessageDetails: // Fall through |
|
1610 case EESMRCmdForward: |
|
1611 { |
|
1612 queryAvailable = EFalse; |
|
1613 break; |
|
1614 } |
|
1615 default: |
|
1616 break; |
|
1617 } |
|
1618 |
|
1619 if ( MESMRCalEntry::EESMRCalEntryMeetingRequest == iEntry.Type() ) |
|
1620 { |
|
1621 MESMRMeetingRequestEntry* mrEntry = static_cast<MESMRMeetingRequestEntry*>( &iEntry ); |
|
1622 |
|
1623 if ( mrEntry->IsOpenedFromMail() && |
|
1624 queryAvailable && |
|
1625 EESMRRoleOrganizer != mrEntry->RoleL() && |
|
1626 mrEntry->IsMeetingCancelledL() && |
|
1627 EESMRAttendeeStatusDecline != mrEntry->AttendeeStatusL() && |
|
1628 CESMRConfirmationQuery::ExecuteL( CESMRConfirmationQuery::EESMRRemoveAppointment) ) |
|
1629 { |
|
1630 deleteEntry = ETrue; |
|
1631 } |
|
1632 } |
|
1633 |
|
1634 if ( deleteEntry ) |
|
1635 { |
|
1636 iView->ExternalizeL(); |
|
1637 TInt res = iCallback.ProcessCommandWithResultL( EESMRCmdRemoveFromCalendar ); |
|
1638 if ( res == KErrCancel ) |
|
1639 { |
|
1640 return EFalse; |
|
1641 } |
|
1642 } |
|
1643 |
|
1644 if ( EESMRCmdRemoveFromCalendar == aCommand ) |
|
1645 { |
|
1646 return deleteEntry; |
|
1647 } |
|
1648 |
|
1649 return ETrue; |
|
1650 } |
|
1651 |
|
1652 // --------------------------------------------------------------------------- |
|
1653 // CESMRViewerDialog::SupportsForwardingAsMeetingL |
|
1654 // --------------------------------------------------------------------------- |
|
1655 // |
|
1656 TBool CESMRViewerDialog::SupportsForwardingAsMeetingL( |
|
1657 MESMRMeetingRequestEntry* aEntry, |
|
1658 TBool aForceResetDefaultMRMailbox ) |
|
1659 { |
|
1660 FUNC_LOG; |
|
1661 TBool sendingAsMRSupported( EFalse ); |
|
1662 TESMRMailPlugin currentPlugin = aEntry->CurrentPluginL(); |
|
1663 |
|
1664 if ( EESMRIntelliSync != currentPlugin ) |
|
1665 { |
|
1666 if ( aEntry->IsOpenedFromMail() ) |
|
1667 { |
|
1668 // Set default MR mail box to the one used for this MR |
|
1669 // unless if it already is set |
|
1670 CMRMailboxUtils* mbUtils = CMRMailboxUtils::NewL(); |
|
1671 CleanupStack::PushL( mbUtils ); |
|
1672 TInt currentEntryId = AccountIdL( aEntry->CurrentMailBoxIdL() ); |
|
1673 CMRMailboxUtils::TMailboxInfo mrMailboxInfo; |
|
1674 mbUtils->GetDefaultMRMailBoxL( mrMailboxInfo ); |
|
1675 if ( mrMailboxInfo.iEntryId != currentEntryId ) |
|
1676 { |
|
1677 mbUtils->SetDefaultMRMailBoxL( currentEntryId ); |
|
1678 } |
|
1679 CleanupStack::PopAndDestroy( mbUtils ); |
|
1680 |
|
1681 // When opened from email, we need to make sure that |
|
1682 // meeting request sending is possible |
|
1683 CESMRFieldBuilderInterface* plugin = |
|
1684 CESMRFieldBuilderInterface::CreatePluginL( |
|
1685 TUid::Uid( KESMRUIFieldBuilderPluginImplUId ) ); |
|
1686 CleanupDeletePushL( plugin ); |
|
1687 |
|
1688 if ( plugin ) |
|
1689 { |
|
1690 TUid uid = {0}; |
|
1691 MESMRBuilderExtension* extension = |
|
1692 static_cast<MESMRBuilderExtension*>( |
|
1693 plugin->ExtensionL( uid ) ); |
|
1694 |
|
1695 if ( extension ) |
|
1696 { |
|
1697 sendingAsMRSupported = |
|
1698 extension->MRCanBeOriginateedL( |
|
1699 aForceResetDefaultMRMailbox ); |
|
1700 } |
|
1701 } |
|
1702 CleanupStack::PopAndDestroy( plugin ); |
|
1703 plugin = NULL; |
|
1704 } |
|
1705 else |
|
1706 { |
|
1707 sendingAsMRSupported = ETrue; |
|
1708 } |
|
1709 } |
|
1710 |
|
1711 return sendingAsMRSupported; |
|
1712 } |
|
1713 |
|
1714 |
|
1715 // --------------------------------------------------------------------------- |
|
1716 // CESMRViewerDialog::LocationPluginHandlerL |
|
1717 // --------------------------------------------------------------------------- |
|
1718 // |
|
1719 CESMRLocationPluginHandler& CESMRViewerDialog::LocationPluginHandlerL() |
|
1720 { |
|
1721 FUNC_LOG; |
|
1722 if ( !iLocationPluginHandler ) |
|
1723 { |
|
1724 iLocationPluginHandler = CESMRLocationPluginHandler::NewL( *this ); |
|
1725 } |
|
1726 |
|
1727 return *iLocationPluginHandler; |
|
1728 } |
|
1729 |
|
1730 // --------------------------------------------------------------------------- |
|
1731 // CESMRViewerDialog::LocationPluginHandlerL |
|
1732 // --------------------------------------------------------------------------- |
|
1733 // |
|
1734 void CESMRViewerDialog::HandleFieldEventL( const MESMRFieldEvent& aEvent ) |
|
1735 { |
|
1736 FUNC_LOG; |
|
1737 if ( aEvent.Type() == MESMRFieldEvent::EESMRFieldCommandEvent ) |
|
1738 { |
|
1739 TInt* command = static_cast< TInt* >( aEvent.Param( 0 ) ); |
|
1740 |
|
1741 switch ( *command ) |
|
1742 { |
|
1743 case EESMRCmdRestoreMiddleSoftKey: |
|
1744 { |
|
1745 SetDefaultMiddleSoftKeyL(); |
|
1746 ButtonGroupContainer().DrawDeferred(); |
|
1747 break; |
|
1748 } |
|
1749 case EESMRCmdOpenAttachment:// Fall through |
|
1750 case EESMRCmdOpenAttachmentView:// Fall through |
|
1751 case EESMRCmdDownloadAttachment: // Fall through |
|
1752 case EESMRCmdDownloadAllAttachments: // Fall through |
|
1753 case EESMRCmdSaveAttachment: // Fall through |
|
1754 case EESMRCmdSaveAllAttachments: // Fall through |
|
1755 case EESMRCmdMskOpenEmailAttachment: |
|
1756 { |
|
1757 ProcessCommandL( *command ); |
|
1758 |
|
1759 break; |
|
1760 } |
|
1761 default: |
|
1762 { |
|
1763 break; |
|
1764 } |
|
1765 } |
|
1766 } |
|
1767 } |
|
1768 |
|
1769 // --------------------------------------------------------------------------- |
|
1770 // CESMRViewerDialog::SetDefaultMiddleSoftKeyL |
|
1771 // --------------------------------------------------------------------------- |
|
1772 // |
|
1773 void CESMRViewerDialog::SetDefaultMiddleSoftKeyL() |
|
1774 { |
|
1775 FUNC_LOG; |
|
1776 TInt resourceId = KErrNotFound; |
|
1777 if ( MESMRCalEntry::EESMRCalEntryMeetingRequest == iEntry.Type() ) |
|
1778 { |
|
1779 // If 'Edit' command is not allowed then we change the MSK to 'Select' |
|
1780 if ( !iPolicy->IsDefaultCommand( EESMRCmdEdit ) ) |
|
1781 { |
|
1782 resourceId = R_MR_SELECT_SOFTKEY; |
|
1783 // Disable middle softkey by default |
|
1784 // Focused field enables it if MSK has select functionality |
|
1785 ButtonGroupContainer().MakeCommandVisibleByPosition( |
|
1786 CEikButtonGroupContainer::EMiddleSoftkeyPosition, |
|
1787 EFalse ); |
|
1788 } |
|
1789 else |
|
1790 { |
|
1791 resourceId = R_MR_EDIT_SOFTKEY; |
|
1792 } |
|
1793 |
|
1794 } |
|
1795 else if ( iPolicy->IsDefaultCommand( EESMRCmdCalEntryUIEdit ) ) |
|
1796 { |
|
1797 // Set correct edit command in MSK. Dialog resource has EESMRCmdEdit |
|
1798 resourceId = R_MR_CAL_EDIT_SOFTKEY; |
|
1799 } |
|
1800 |
|
1801 if ( resourceId != KErrNotFound ) |
|
1802 { |
|
1803 ButtonGroupContainer().SetCommandL( |
|
1804 CEikButtonGroupContainer::EMiddleSoftkeyPosition, |
|
1805 resourceId ); |
|
1806 } |
|
1807 } |
|
1808 |
|
1809 // --------------------------------------------------------------------------- |
|
1810 // CESMRViewerDialog::DigMailboxAndRemovePrefixL |
|
1811 // --------------------------------------------------------------------------- |
|
1812 // |
|
1813 TPtrC CESMRViewerDialog::DigMailboxAndRemovePrefixL() |
|
1814 { |
|
1815 CCalUser* calUser = iEntry.Entry().PhoneOwnerL(); |
|
1816 TPtrC addrWithoutPrefix = calUser->Address(); |
|
1817 TInt pos = KErrNotFound; |
|
1818 |
|
1819 do |
|
1820 { |
|
1821 pos = addrWithoutPrefix.MatchF( KMailtoMatchPattern ); |
|
1822 if ( pos != KErrNotFound ) |
|
1823 { |
|
1824 addrWithoutPrefix.Set( addrWithoutPrefix.Mid( KMailtoLength ) ); |
|
1825 } |
|
1826 } |
|
1827 while ( pos != KErrNotFound ); |
|
1828 |
|
1829 return addrWithoutPrefix; |
|
1830 } |
|
1831 |
|
1832 // --------------------------------------------------------------------------- |
|
1833 // CESMRViewerDialog::OfferToolbarEventL |
|
1834 // --------------------------------------------------------------------------- |
|
1835 // |
|
1836 void CESMRViewerDialog::OfferToolbarEventL( TInt aCommand ) |
|
1837 { |
|
1838 ProcessCommandL( aCommand ); |
|
1839 } |
|
1840 |
|
1841 // --------------------------------------------------------------------------- |
|
1842 // CESMRViewerDialog::HandleNaviDecoratorEventL |
|
1843 // --------------------------------------------------------------------------- |
|
1844 // |
|
1845 void CESMRViewerDialog::HandleNaviDecoratorEventL( TInt aEventID ) |
|
1846 { |
|
1847 FUNC_LOG; |
|
1848 if ( iESMRNaviDecorator ) |
|
1849 { |
|
1850 iESMRNaviDecorator->SetNaviDecoratorObserver( NULL ); |
|
1851 } |
|
1852 if ( iIdleNaviEventRunner && !iIdleNaviEventRunner->IsActive() ) |
|
1853 { |
|
1854 if( aEventID == |
|
1855 MAknNaviDecoratorObserver::EAknNaviDecoratorEventRightTabArrow ) |
|
1856 { |
|
1857 iIdleNaviEventRunner->Start( |
|
1858 TCallBack( RunCmdMailNextMessageIdle, this ) ); |
|
1859 } |
|
1860 else |
|
1861 { |
|
1862 iIdleNaviEventRunner->Start( |
|
1863 TCallBack( RunCmdMailPreviousMessageIdle, this ) ); |
|
1864 } |
|
1865 } |
|
1866 } |
|
1867 |
|
1868 |
|
1869 // --------------------------------------------------------------------------- |
|
1870 // CESMRViewerDialog::HandleSessionEventL |
|
1871 // --------------------------------------------------------------------------- |
|
1872 // |
|
1873 void CESMRViewerDialog::HandleSessionEventL( |
|
1874 TMsvSessionEvent /*aEvent*/, TAny* /*aArg1*/, |
|
1875 TAny* /*aArg2*/, TAny* /*aArg3*/ ) |
|
1876 { |
|
1877 FUNC_LOG; |
|
1878 } |
|
1879 |
|
1880 |
|
1881 // --------------------------------------------------------------------------- |
|
1882 // CESMRViewerDialog::RunCmdMailNextMessageIdle [static] |
|
1883 // --------------------------------------------------------------------------- |
|
1884 // |
|
1885 TInt CESMRViewerDialog::RunCmdMailNextMessageIdle( TAny* aObjPtr ) |
|
1886 { |
|
1887 CESMRViewerDialog* self = |
|
1888 reinterpret_cast<CESMRViewerDialog*>( aObjPtr ); |
|
1889 if ( self ) |
|
1890 { |
|
1891 TRAP_IGNORE( self->ProcessCommandL( EESMRCmdMailNextMessage ) ); |
|
1892 } |
|
1893 return KErrNone; |
|
1894 } |
|
1895 |
|
1896 // --------------------------------------------------------------------------- |
|
1897 // CESMRViewerDialog::RunCmdMailPreviousMessageIdle [static] |
|
1898 // --------------------------------------------------------------------------- |
|
1899 // |
|
1900 TInt CESMRViewerDialog::RunCmdMailPreviousMessageIdle( TAny* aObjPtr ) |
|
1901 { |
|
1902 CESMRViewerDialog* self = |
|
1903 reinterpret_cast<CESMRViewerDialog*>( aObjPtr ); |
|
1904 if ( self ) |
|
1905 { |
|
1906 TRAP_IGNORE( self->ProcessCommandL( EESMRCmdMailPreviousMessage ) ); |
|
1907 } |
|
1908 return KErrNone; |
|
1909 } |
|
1910 |
|
1911 // --------------------------------------------------------------------------- |
|
1912 // CESMRViewerDialog::MakeMrGuiToolbarButtonsL |
|
1913 // --------------------------------------------------------------------------- |
|
1914 // |
|
1915 void CESMRViewerDialog::MakeMrGuiToolbarButtonsL() |
|
1916 { |
|
1917 CAknToolbar* currentToolbar = static_cast<CEikAppUiFactory*>( |
|
1918 iEikonEnv->AppUiFactory() )->CurrentFixedToolbar(); |
|
1919 if ( currentToolbar ) |
|
1920 { |
|
1921 iOldObserver = currentToolbar->ToolbarObserver(); |
|
1922 currentToolbar->SetToolbarObserver( this ); |
|
1923 |
|
1924 TBool setResponseButtons = EFalse; |
|
1925 if ( iEntry.Type() == MESMRCalEntry::EESMRCalEntryMeetingRequest ) |
|
1926 { |
|
1927 CCalEntry::TMethod method = iEntry.Entry().MethodL(); |
|
1928 if ( method != CCalEntry::EMethodCancel ) |
|
1929 { |
|
1930 setResponseButtons = ETrue; |
|
1931 } |
|
1932 } |
|
1933 |
|
1934 if ( setResponseButtons ) |
|
1935 { |
|
1936 SetResponseButtonsL( currentToolbar ); |
|
1937 } |
|
1938 else |
|
1939 { |
|
1940 SetEmptyButtonsL( currentToolbar ); |
|
1941 } |
|
1942 } |
|
1943 } |
|
1944 |
|
1945 // --------------------------------------------------------------------------- |
|
1946 // CESMRViewerDialog::ClearToolbarL |
|
1947 // --------------------------------------------------------------------------- |
|
1948 // |
|
1949 void CESMRViewerDialog::ClearToolbarL() |
|
1950 { |
|
1951 if ( iClearToolbar ) |
|
1952 { |
|
1953 // creating empty toolbar buttons |
|
1954 CAknToolbar* currentToolbar = static_cast<CEikAppUiFactory*>( |
|
1955 iEikonEnv->AppUiFactory() )->CurrentFixedToolbar(); |
|
1956 if ( currentToolbar ) |
|
1957 { |
|
1958 SetEmptyButtonsL( currentToolbar ); |
|
1959 } |
|
1960 } |
|
1961 } |
|
1962 |
|
1963 // --------------------------------------------------------------------------- |
|
1964 // CESMRViewerDialog::AccountIdL |
|
1965 // --------------------------------------------------------------------------- |
|
1966 // |
|
1967 TInt CESMRViewerDialog::AccountIdL( const TFSMailMsgId& aMailboxId ) |
|
1968 { |
|
1969 FUNC_LOG; |
|
1970 |
|
1971 CMsvSession* msvSession = CMsvSession::OpenSyncL( *this ); |
|
1972 CleanupStack::PushL( msvSession ); |
|
1973 CMsvEntry* rootEntry = msvSession->GetEntryL( KMsvRootIndexEntryIdValue ); |
|
1974 CleanupStack::PushL( rootEntry ); |
|
1975 |
|
1976 rootEntry->SetSortTypeL( |
|
1977 TMsvSelectionOrdering( KMsvNoGrouping, EMsvSortByNone, ETrue ) ); |
|
1978 |
|
1979 TInt accountId = 0; |
|
1980 TBool found = EFalse; |
|
1981 const TInt count = rootEntry->Count(); |
|
1982 for ( TInt ii = 0; ii < count && !found; ++ii ) |
|
1983 { |
|
1984 const TMsvEntry& entry = (*rootEntry)[ii]; |
|
1985 if ( entry.iType == KUidMsvServiceEntry ) |
|
1986 { |
|
1987 if ( entry.iMtmData1 == aMailboxId.PluginId().iUid && |
|
1988 entry.iMtmData2 == aMailboxId.Id() ) |
|
1989 { |
|
1990 accountId = entry.Id(); |
|
1991 found = ETrue; |
|
1992 } |
|
1993 } |
|
1994 } |
|
1995 |
|
1996 if ( !found ) |
|
1997 { |
|
1998 User::Leave( KErrNotFound ); |
|
1999 } |
|
2000 |
|
2001 CleanupStack::PopAndDestroy( rootEntry ); |
|
2002 CleanupStack::PopAndDestroy( msvSession ); |
|
2003 return accountId; |
|
2004 } |