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