76 #include "cesmruifactory.h" |
39 #include "cesmruifactory.h" |
77 #include "cesmrlocationpluginhandler.h" |
40 #include "cesmrlocationpluginhandler.h" |
78 #include "cesmrfeaturesettings.h" |
41 #include "cesmrfeaturesettings.h" |
79 #include "esmrconfig.hrh" |
42 #include "esmrconfig.hrh" |
80 #include "mesmrfieldevent.h" |
43 #include "mesmrfieldevent.h" |
81 |
44 #include "cmrtoolbar.h" |
82 #include "cfsmailbox.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" |
83 |
74 |
84 /// Unnamed namespace for local definitions |
75 /// Unnamed namespace for local definitions |
85 namespace { // codescanner::namespace |
76 namespace { // codescanner::namespace |
86 |
77 |
87 #ifdef _DEBUG |
78 #ifdef _DEBUG |
88 |
|
89 // Literal for viewer dialog |
|
90 _LIT( KESMRViewerDlgPanicTxt, "ESMRViewerDlg" ); |
|
91 |
79 |
92 enum TESMRViewerDlgPanic |
80 enum TESMRViewerDlgPanic |
93 { |
81 { |
94 EESMRViewerDlgInvalidCommand, |
82 EESMRViewerDlgInvalidCommand, |
95 EESMRViewerDlgnvalidSeriesResult, |
83 EESMRViewerDlgnvalidSeriesResult, |
96 EESMRViewerDlgInvalidEntry |
84 EESMRViewerDlgInvalidEntry |
97 }; |
85 }; |
98 |
86 |
99 void Panic( TESMRViewerDlgPanic aPanic ) |
87 void Panic( TESMRViewerDlgPanic aPanic ) |
100 { |
88 { |
101 |
89 // Literal for viewer dialog |
|
90 _LIT( KESMRViewerDlgPanicTxt, "ESMRViewerDlg" ); |
102 User::Panic( KESMRViewerDlgPanicTxt, aPanic ); |
91 User::Panic( KESMRViewerDlgPanicTxt, aPanic ); |
103 } |
92 } |
104 |
93 |
105 #endif |
94 #endif |
106 |
95 |
107 // Definition for default buffer length |
96 // Definition for default buffer length |
108 const TInt KCalDefaultBufferLen = 40; |
97 const TInt KCalDefaultBufferLen = 40; |
109 |
98 |
|
99 // VGA resolution screen size in pixels |
|
100 const TInt KVGAOneSide( 640 ); |
|
101 const TInt KVGAOtherSide( 480 ); |
|
102 |
110 // Calendar command parameter |
103 // Calendar command parameter |
111 _LIT16( KCalCmdDATE, "GRAPHICDAY" ); |
104 _LIT16( KCalCmdDATE, "GRAPHICDAY" ); |
112 |
105 |
113 // Definition for time format ("YYYY MM DD HH MM SS MMMMMM" - 26) |
106 // Definition for time format ("YYYY MM DD HH MM SS MMMMMM" - 26) |
114 _LIT( KCalCmdTimeFormat, "%F %Y %M %D %H %T %S %C" ); |
107 _LIT( KCalCmdTimeFormat, "%F %Y %M %D %H %T %S %C" ); |
115 |
108 |
116 // Definition for calendar application UID |
109 // Definition for calendar application UID |
117 const TUid KCalendarAppUID = { KUidCalendarApplication }; |
110 const TUid KCalendarAppUID = { KUidCalendarApplication }; |
118 |
111 |
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 |
112 |
159 /** |
113 /** |
160 * Sets recurrence modification rule to entry. Rule is queried |
114 * Sets recurrence modification rule to entry. Rule is queried |
161 * from the user. Invalid result will cause panic. |
115 * from the user. Invalid result will cause panic. |
162 * @param aEntry Reference to meeting request. |
116 * @param aEntry Reference to meeting request. |
233 // --------------------------------------------------------------------------- |
186 // --------------------------------------------------------------------------- |
234 // |
187 // |
235 CESMRViewerDialog::~CESMRViewerDialog() |
188 CESMRViewerDialog::~CESMRViewerDialog() |
236 { |
189 { |
237 FUNC_LOG; |
190 FUNC_LOG; |
238 |
191 iESMRStatic.Close(); |
239 if ( iIdleNaviEventRunner ) |
192 |
240 { |
193 if ( iTitlePane ) |
241 iIdleNaviEventRunner->Cancel(); |
194 { |
242 delete iIdleNaviEventRunner; |
195 // Returns the previous title back to titlepane |
|
196 iTitlePane->Rollback(); |
|
197 delete iTitlePane; |
243 } |
198 } |
244 |
199 |
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; |
200 delete iESMRSendUI; |
259 |
|
260 delete iLocationPluginHandler; |
201 delete iLocationPluginHandler; |
261 |
|
262 delete iFeatures; |
202 delete iFeatures; |
263 |
|
264 TRAP_IGNORE( ClearToolbarL() ); |
|
265 |
203 |
266 // iView is deleted by framework because it uses the |
204 // iView is deleted by framework because it uses the |
267 // custom control mechanism. |
205 // custom control mechanism. |
|
206 delete iToolbar; |
|
207 delete iFocusStrategy; |
268 } |
208 } |
269 |
209 |
270 // --------------------------------------------------------------------------- |
210 // --------------------------------------------------------------------------- |
271 // CESMRViewerDialog::NewL |
211 // CESMRViewerDialog::NewL |
272 // --------------------------------------------------------------------------- |
212 // --------------------------------------------------------------------------- |
273 // |
213 // |
274 EXPORT_C CESMRViewerDialog* CESMRViewerDialog::NewL( |
214 EXPORT_C CESMRViewerDialog* CESMRViewerDialog::NewL( |
275 CESMRPolicy* aPolicy, |
215 MMRInfoProvider& aInfoProvider, |
276 MESMRCalEntry& aEntry, |
|
277 MAgnEntryUiCallback& aCallback ) |
216 MAgnEntryUiCallback& aCallback ) |
278 { |
217 { |
279 FUNC_LOG; |
218 FUNC_LOG; |
280 CESMRViewerDialog* self = |
219 CESMRViewerDialog* self = |
281 new (ELeave) CESMRViewerDialog( aEntry, aCallback ); |
220 new (ELeave) CESMRViewerDialog( aInfoProvider, aCallback ); |
282 CleanupStack::PushL( self ); |
221 CleanupStack::PushL( self ); |
283 self->ConstructL( aPolicy ); |
222 self->ConstructL(); |
284 CleanupStack::Pop( self ); |
223 CleanupStack::Pop( self ); |
285 return self; |
224 return self; |
286 } |
225 } |
287 |
226 |
288 // --------------------------------------------------------------------------- |
227 // --------------------------------------------------------------------------- |
289 // CESMRViewerDialog::ConstructL |
228 // CESMRViewerDialog::ConstructL |
290 // --------------------------------------------------------------------------- |
229 // --------------------------------------------------------------------------- |
291 // |
230 // |
292 void CESMRViewerDialog::ConstructL( |
231 void CESMRViewerDialog::ConstructL() |
293 CESMRPolicy* aPolicy ) |
232 { |
294 { |
233 FUNC_LOG; |
295 FUNC_LOG; |
|
296 |
|
297 iIdleNaviEventRunner = CIdle::NewL( CActive::EPriorityStandard ); |
|
298 |
|
299 iPolicy = aPolicy; |
|
300 iESMRStatic.ConnectL(); |
234 iESMRStatic.ConnectL(); |
301 |
235 |
302 CAknDialog::ConstructL( R_MRVIEWER_MENUBAR ); |
236 CAknDialog::ConstructL( R_MRVIEWER_MENUBAR ); |
303 |
237 |
|
238 // Class disables avkon toolbar by default, which |
|
239 // we want in case of non-MR |
|
240 iToolbar = CMRToolbar::NewL(); |
|
241 |
304 TRect clientRect; |
242 TRect clientRect; |
305 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, clientRect ); |
243 AknLayoutUtils::LayoutMetricsRect( |
|
244 AknLayoutUtils::EMainPane, |
|
245 clientRect ); |
306 |
246 |
307 TBool responseReady(EFalse); |
247 TBool responseReady(EFalse); |
|
248 MESMRCalEntry* calEntry = iInfoProvider.EntryL(); |
308 MESMRMeetingRequestEntry* mrEntry = NULL; |
249 MESMRMeetingRequestEntry* mrEntry = NULL; |
309 if ( MESMRCalEntry::EESMRCalEntryMeetingRequest == iEntry.Type() ) |
250 if ( MESMRCalEntry::EESMRCalEntryMeetingRequest == calEntry->Type() ) |
310 { |
251 { |
311 // This is meeting request |
252 // This is meeting request |
312 mrEntry = static_cast<MESMRMeetingRequestEntry*>( &iEntry ); |
253 mrEntry = static_cast<MESMRMeetingRequestEntry*>( calEntry ); |
313 responseReady = mrEntry->IsSentL(); |
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); |
314 } |
259 } |
315 |
260 |
316 iESMRSendUI = CESMRSendUI::NewL(EESMRCmdSendAs); |
261 iESMRSendUI = CESMRSendUI::NewL(EESMRCmdSendAs); |
317 |
|
318 FeatureManager::InitializeLibL(); |
|
319 iFeatureManagerInitialized = ETrue; |
|
320 |
262 |
321 CESMRViewerFieldStorage* storage = |
263 CESMRViewerFieldStorage* storage = |
322 CESMRViewerFieldStorage::NewL( |
264 CESMRViewerFieldStorage::NewL( |
323 aPolicy, |
265 iInfoProvider.PolicyProvider().CurrentPolicy(), |
324 this, |
266 this, |
325 responseReady, |
267 responseReady, |
326 *this ); |
268 *this ); |
327 |
269 |
|
270 // Create focus strategy |
|
271 iFocusStrategy = CMRFocusStrategyViewer::NewL( *storage ); |
|
272 // Give the strategy to the iView |
|
273 |
328 // storage ownership is transferred to CESMRView |
274 // storage ownership is transferred to CESMRView |
329 iView = CESMRView::NewL(storage, iEntry, clientRect ); |
275 iView = CESMRView::NewL( |
330 |
276 storage, |
331 if ( iEntry.Entry().SummaryL().Length() == 0 ) |
277 *calEntry, |
|
278 clientRect, |
|
279 *iFocusStrategy, |
|
280 *iToolbar, |
|
281 this ); |
|
282 |
|
283 iView->SetViewMode( EESMRViewMR ); |
|
284 |
|
285 if ( calEntry->Entry().SummaryL().Length() == 0 ) |
332 { |
286 { |
333 // if no title, set unnamed text: |
287 // if no title, set unnamed text: |
334 HBufC* title = StringLoader::LoadLC ( R_QTN_MEET_REQ_CONFLICT_UNNAMED, |
288 HBufC* title = StringLoader::LoadLC ( R_QTN_MEET_REQ_CONFLICT_UNNAMED, |
335 iCoeEnv ); |
289 iCoeEnv ); |
336 iView->SetTitleL( *title ); |
290 iView->SetTitleL( *title ); |
337 CleanupStack::PopAndDestroy( title ); |
291 CleanupStack::PopAndDestroy( title ); |
338 } |
292 } |
339 else |
293 else |
340 { |
294 { |
341 iView->SetTitleL( iEntry.Entry().SummaryL() ); |
295 iView->SetTitleL( calEntry->Entry().SummaryL() ); |
342 } |
296 } |
343 |
297 |
344 TInt titleStringId = -1; |
298 TInt titleStringId = -1; |
345 switch ( iEntry.Type() ) |
299 switch ( calEntry->Type() ) |
346 { |
300 { |
|
301 case MESMRCalEntry::EESMRCalEntryMeetingRequest: |
|
302 { |
|
303 titleStringId = R_QTN_MEET_REQ_TITLE_MEETING; |
|
304 break; |
|
305 } |
347 case MESMRCalEntry::EESMRCalEntryMeeting: |
306 case MESMRCalEntry::EESMRCalEntryMeeting: |
348 { |
307 { |
349 titleStringId = R_QTN_CALENDAR_TITLE_MEETING; |
308 titleStringId = R_QTN_CALENDAR_TITLE_MEETING; |
350 break; |
309 break; |
351 } |
310 } |
356 } |
315 } |
357 case MESMRCalEntry::EESMRCalEntryMemo: |
316 case MESMRCalEntry::EESMRCalEntryMemo: |
358 { |
317 { |
359 titleStringId = R_QTN_CALENDAR_TITLE_MEMO; |
318 titleStringId = R_QTN_CALENDAR_TITLE_MEMO; |
360 break; |
319 break; |
361 } |
320 } |
362 case MESMRCalEntry::EESMRCalEntryAnniversary: |
321 case MESMRCalEntry::EESMRCalEntryAnniversary: |
363 { |
322 { |
364 titleStringId = R_QTN_CALENDAR_TITLE_ANNIVERSARY; |
323 titleStringId = R_QTN_CALENDAR_TITLE_ANNIVERSARY; |
365 break; |
324 break; |
366 } |
325 } |
367 case MESMRCalEntry::EESMRCalEntryReminder: // Fall through |
326 case MESMRCalEntry::EESMRCalEntryReminder: // Fall through |
368 case MESMRCalEntry::EESMRCalEntryMeetingRequest: // Fall through |
|
369 default: |
327 default: |
370 { |
328 { |
371 break; |
329 break; |
372 } |
330 } |
373 } |
331 } |
374 if ( titleStringId != -1 ) |
332 if ( titleStringId != -1 ) |
375 { |
333 { |
376 CEikStatusPane* sp = iEikonEnv->AppUiFactory()->StatusPane(); |
334 if( !iTitlePane ) |
377 CAknTitlePane* tp = |
335 { |
378 static_cast<CAknTitlePane*>( |
336 iTitlePane = CESMRTitlePaneHandler::NewL( *iEikonEnv ); |
379 sp->ControlL(TUid::Uid(EEikStatusPaneUidTitle)) ); |
337 } |
|
338 |
380 HBufC* titleText = StringLoader::LoadLC( titleStringId, iCoeEnv ); |
339 HBufC* titleText = StringLoader::LoadLC( titleStringId, iCoeEnv ); |
381 tp->SetTextL( *titleText ); |
340 iTitlePane->SetNewTitle( titleText ); |
382 CleanupStack::PopAndDestroy( titleText ); |
341 CleanupStack::PopAndDestroy( titleText ); |
383 } |
342 } |
384 |
343 |
385 |
|
386 iFeatures = CESMRFeatureSettings::NewL(); |
344 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 } |
345 } |
417 |
346 |
418 // --------------------------------------------------------------------------- |
347 // --------------------------------------------------------------------------- |
419 // CESMRViewerDialog::ActivateL |
348 // CESMRViewerDialog::ActivateL |
420 // --------------------------------------------------------------------------- |
349 // --------------------------------------------------------------------------- |
448 TEventCode aType) |
410 TEventCode aType) |
449 { |
411 { |
450 FUNC_LOG; |
412 FUNC_LOG; |
451 TKeyResponse response( EKeyWasNotConsumed ); |
413 TKeyResponse response( EKeyWasNotConsumed ); |
452 if ( aEvent.iCode != EKeyEscape && !MenuShowing() ) |
414 if ( aEvent.iCode != EKeyEscape && !MenuShowing() ) |
453 { |
415 { |
454 response = iView->OfferKeyEventL( aEvent, aType ); |
416 response = iView->OfferKeyEventL( aEvent, aType ); |
455 } |
417 } |
456 |
418 |
457 if ( response == EKeyWasNotConsumed ) |
419 if ( response == EKeyWasNotConsumed ) |
458 { |
420 { |
459 switch (aEvent.iScanCode) |
421 switch (aEvent.iScanCode) |
460 { |
422 { |
461 case EStdKeyLeftArrow: |
423 case '4': |
462 if ( aType == EEventKey ) |
424 { |
463 { |
425 response = EKeyWasConsumed; |
464 response = EKeyWasConsumed; |
426 ProcessCommandL(EESMRCmdMailPreviousMessage); |
465 if ( iCallback.IsCommandAvailable( |
|
466 EESMRCmdMailPreviousMessage ) ) |
|
467 { |
|
468 ProcessCommandL( EESMRCmdMailPreviousMessage ); |
|
469 } |
|
470 } |
|
471 break; |
427 break; |
472 case EStdKeyRightArrow: |
428 } |
473 if ( aType == EEventKey ) |
429 case '6': |
474 { |
430 { |
475 response = EKeyWasConsumed; |
431 response = EKeyWasConsumed; |
476 if ( iCallback.IsCommandAvailable( |
432 ProcessCommandL(EESMRCmdMailNextMessage); |
477 EESMRCmdMailNextMessage ) ) |
|
478 { |
|
479 ProcessCommandL( EESMRCmdMailNextMessage ); |
|
480 } |
|
481 } |
|
482 break; |
433 break; |
|
434 } |
483 default: |
435 default: |
|
436 { |
484 response = CAknDialog::OfferKeyEventL( aEvent, aType ); |
437 response = CAknDialog::OfferKeyEventL( aEvent, aType ); |
485 break; |
438 break; |
|
439 } |
486 } |
440 } |
487 } |
441 } |
488 |
442 |
489 return response; |
443 return response; |
490 } |
444 } |
491 |
445 |
492 |
|
493 // --------------------------------------------------------------------------- |
446 // --------------------------------------------------------------------------- |
494 // CESMRViewerDialog::ProcessCommandL |
447 // CESMRViewerDialog::ProcessCommandL |
495 // --------------------------------------------------------------------------- |
448 // --------------------------------------------------------------------------- |
496 // |
449 // |
497 void CESMRViewerDialog::ProcessCommandL( TInt aCommand ) |
450 void CESMRViewerDialog::ProcessCommandL( TInt aCommand ) |
498 { |
451 { |
499 FUNC_LOG; |
452 FUNC_LOG; |
|
453 |
500 TRAPD( err, DoProcessCommandL( aCommand ) ); |
454 TRAPD( err, DoProcessCommandL( aCommand ) ); |
501 if ( err != KErrNone && |
455 if ( err != KErrNone && |
502 err != KErrCancel && |
456 err != KErrCancel && |
503 err != KErrArgument ) |
457 err != KErrArgument ) |
504 { |
458 { |
598 } |
548 } |
599 case EESMRCmdAcceptMR: // Fall through |
549 case EESMRCmdAcceptMR: // Fall through |
600 case EESMRCmdTentativeMR: // Fall through |
550 case EESMRCmdTentativeMR: // Fall through |
601 case EESMRCmdDeclineMR: // Fall through |
551 case EESMRCmdDeclineMR: // Fall through |
602 { |
552 { |
603 iView->ExternalizeL(); // no forced validation |
553 if ( !UserWantToHandleAttachmentsL() ) |
604 TInt res = iCallback.ProcessCommandWithResultL( aCommand ); |
554 { |
605 if ( res != KErrCancel ) |
555 iView->ExternalizeL(); // no forced validation |
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 ); |
556 TInt res = iCallback.ProcessCommandWithResultL( aCommand ); |
631 if ( res != KErrCancel ) |
557 if ( res != KErrCancel ) |
632 { |
558 { |
633 TryExitL( EAknSoftkeyClose ); |
559 TryExitL( EAknSoftkeyClose ); |
634 } |
560 } |
635 } |
561 } |
636 break; |
562 break; |
637 } |
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 } |
638 case EESMRCmdClipboardCopy: |
592 case EESMRCmdClipboardCopy: |
639 { |
593 { |
640 iView->ProcessEditorCommandL( aCommand ); |
594 iView->ProcessEditorCommandL( aCommand ); |
641 break; |
595 break; |
642 } |
596 } |
643 case EESMRCmdMailPreviousMessage: // Fall through |
597 case EESMRCmdMailPreviousMessage: // Fall through |
644 case EESMRCmdMailNextMessage: // Fall through |
598 case EESMRCmdMailNextMessage: // Fall through |
645 case EESMRCmdMailForwardAsMessage: // Fall through |
599 case EESMRCmdMailForwardAsMessage: // Fall through |
646 case EESMRCmdMailMoveMessage: // Fall through |
600 case EESMRCmdMailMoveMessage: // Fall through |
647 case EESMRCmdMailCopyMessage: // Fall through |
601 case EESMRCmdMailCopyMessage: // Fall through |
648 case EESMRCmdMailMoveMessageToDrafts: // Fall through |
602 case EESMRCmdMailMoveMessageToDrafts: // Fall through |
649 case EESMRCmdMailComposeMessage: // Fall through |
603 case EESMRCmdMailComposeMessage: // Fall through |
650 case EESMRCmdMailMessageDetails: |
604 case EESMRCmdMailMessageDetails: |
651 { |
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 entry is recurring, we want to ask from user, if |
|
627 // single instance or whole series will be forwarded |
|
628 if( aCommand == EESMRCmdForwardAsMail && |
|
629 iInfoProvider.EntryL()->IsRecurrentEventL() ) |
|
630 { |
|
631 SetRecurrenceModRuleL( |
|
632 *( iInfoProvider.EntryL() ), |
|
633 CESMRListQuery::EESMRForwardThisOccurenceOrSeriesQuery ); |
|
634 } |
|
635 |
652 TInt res = iCallback.ProcessCommandWithResultL( aCommand ); |
636 TInt res = iCallback.ProcessCommandWithResultL( aCommand ); |
653 if ( res != KErrCancel ) |
637 if ( res != KErrCancel ) |
654 { |
638 { |
655 TryExitL( aCommand ); |
639 TryExitL( aCommand ); |
656 } |
640 } |
657 break; |
641 break; |
658 } |
642 } |
659 case EESMRCmdForward: |
643 |
660 { |
644 // <cmail> |
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: |
645 case EESMRCmdDownloadManager: |
690 { |
646 { |
691 TInt res = iCallback.ProcessCommandWithResultL( aCommand ); |
647 TInt res = iCallback.ProcessCommandWithResultL( aCommand ); |
692 if ( res != KErrCancel ) |
648 if ( res != KErrCancel ) |
693 { |
649 { |
694 TryExitL( EAknSoftkeyClose ); |
650 TryExitL( EAknSoftkeyClose ); |
695 } |
651 } |
696 break; |
652 // </cmail> |
697 } |
653 break; |
|
654 } |
|
655 |
|
656 // <cmail> |
698 case EESMRCmdOpenAttachment: // Fall through |
657 case EESMRCmdOpenAttachment: // Fall through |
699 case EESMRCmdOpenAttachmentView: // Fall through |
658 case EESMRCmdOpenAttachmentView: // Fall through |
700 case EESMRCmdDownloadAttachment: // Fall through |
659 case EESMRCmdDownloadAttachment: // Fall through |
701 case EESMRCmdDownloadAllAttachments: // Fall through |
660 case EESMRCmdDownloadAllAttachments: // Fall through |
702 case EESMRCmdSaveAttachment: // Fall through |
661 case EESMRCmdSaveAttachment: // Fall through |
703 case EESMRCmdSaveAllAttachments: // Fall through |
662 case EESMRCmdSaveAllAttachments: // Fall through |
|
663 // </cmail> |
704 { |
664 { |
705 TInt res = iCallback.ProcessCommandWithResultL( |
665 TInt res = iCallback.ProcessCommandWithResultL( |
706 aCommand ); |
666 aCommand ); |
707 if ( res != KErrCancel ) |
667 if ( res != KErrCancel ) |
708 { |
668 { |
709 iExitTriggered = ETrue; |
669 iExitTriggered = ETrue; |
710 } |
670 } |
711 break; |
671 break; |
712 } |
672 } |
|
673 |
|
674 /* |
|
675 * Attachment field viewer context menu commands |
|
676 */ |
|
677 case EESMRViewerOpenAttachment: |
|
678 case EESMRViewerSaveAttachment: |
|
679 case EESMRViewerSaveAllAttachments: |
|
680 case EESMRViewerCancelAttachmentDownload: |
|
681 { |
|
682 iView->ProcessEditorCommandL( aCommand ); |
|
683 break; |
|
684 } |
|
685 |
713 case EESMRCmdMailFlagMessage: // Fall through |
686 case EESMRCmdMailFlagMessage: // Fall through |
714 case EESMRCmdMailMarkUnread: // Fall through |
687 case EESMRCmdMailMarkUnread: // Fall through |
715 case EESMRCmdMailMarkRead: |
688 case EESMRCmdMailMarkRead: |
716 { |
689 { |
717 TInt res = iCallback.ProcessCommandWithResultL( aCommand ); |
690 TInt res = iCallback.ProcessCommandWithResultL( aCommand ); |
718 break; |
691 break; |
719 } |
692 } |
720 case EESMRCmdTodoMarkAsDone: // Fall through |
693 case EESMRCmdTodoMarkAsDone: // Fall through |
721 case EESMRCmdTodoMarkAsNotDone: |
694 case EESMRCmdTodoMarkAsNotDone: |
722 { |
695 { |
723 if ( iEntry.Type() == MESMRCalEntry::EESMRCalEntryTodo ) |
696 if ( iInfoProvider.EntryL()->Type() == MESMRCalEntry::EESMRCalEntryTodo ) |
724 { |
697 { |
725 User::LeaveIfError( |
698 User::LeaveIfError( |
726 iCallback.ProcessCommandWithResultL( aCommand )); |
699 iCallback.ProcessCommandWithResultL( aCommand )); |
727 } |
700 } |
728 break; |
701 break; |
729 } |
702 } |
730 case EESMRCmdSearchFromMap: |
703 case EESMRCmdSearchFromMap: |
731 case EESMRCmdShowOnMap: |
704 case EESMRCmdShowOnMap: |
732 { |
705 { |
733 if ( iFeatures->FeatureSupported( |
706 if ( iFeatures->FeatureSupported( |
734 CESMRFeatureSettings::EESMRUIMnFwIntegration ) ) |
707 CESMRFeatureSettings::EESMRUIMnFwIntegration ) ) |
735 { |
708 { |
736 LocationPluginHandlerL().HandleCommandL( aCommand, iEntry ); |
709 MESMRCalEntry* entry = iInfoProvider.EntryL(); |
|
710 LocationPluginHandlerL().HandleCommandL( aCommand, *entry ); |
737 iView->SetControlFocusedL( EESMRFieldLocation ); |
711 iView->SetControlFocusedL( EESMRFieldLocation ); |
738 } |
712 } |
739 break; |
713 break; |
740 } |
714 } |
|
715 case EMRCmdHideAttachmentIndicator: |
|
716 { |
|
717 iView->ProcessEditorCommandL( EMRCmdHideAttachmentIndicator ); |
|
718 } |
|
719 break; |
741 default: |
720 default: |
742 { |
721 { |
743 if ( aCommand >= EESMRCmdActionMenuFirst && |
722 if ( aCommand >= EESMRCmdActionMenuFirst && |
744 aCommand < EESMRCmdActionMenuLast ) |
723 aCommand < EESMRCmdActionMenuLast ) |
745 { |
724 { |
746 iESMRStatic.ContactMenuHandlerL().ExecuteOptionsMenuL(aCommand); |
725 iESMRStatic.ContactMenuHandlerL().ExecuteOptionsMenuL(aCommand); |
747 } |
726 } |
748 else if ( aCommand == EESMRCmdActionMenuLast ) |
727 else if ( aCommand == EESMRCmdActionMenuLast ) |
749 { |
728 { |
750 TInt res = iCallback.ProcessCommandWithResultL( |
729 TInt res = iCallback.ProcessCommandWithResultL( |
751 EESMRCmdOpenAttachmentView ); |
730 EESMRCmdOpenAttachmentView ); |
752 if ( res != KErrCancel ) |
731 if ( res != KErrCancel ) |
753 { |
732 { |
754 iExitTriggered = ETrue; |
733 iExitTriggered = ETrue; |
755 } |
734 } |
932 void CESMRViewerDialog::ChangeReadyResponseL() |
920 void CESMRViewerDialog::ChangeReadyResponseL() |
933 { |
921 { |
934 FUNC_LOG; |
922 FUNC_LOG; |
935 iView->ProcessEditorCommandL( EESMRCmdEdit ); |
923 iView->ProcessEditorCommandL( EESMRCmdEdit ); |
936 } |
924 } |
|
925 |
|
926 // --------------------------------------------------------------------------- |
|
927 // CESMRViewerDialog::DynInitToolbarL |
|
928 // --------------------------------------------------------------------------- |
|
929 // |
|
930 void CESMRViewerDialog::DynInitToolbarL ( |
|
931 TInt /*aResourceId*/, |
|
932 CAknToolbar* /*aToolbar*/ ) |
|
933 { |
|
934 // TODO: Not implemented yet |
|
935 } |
|
936 |
|
937 // --------------------------------------------------------------------------- |
|
938 // CESMRViewerDialog::OfferToolbarEventL |
|
939 // --------------------------------------------------------------------------- |
|
940 // |
|
941 void CESMRViewerDialog::OfferToolbarEventL( TInt aCommand ) |
|
942 { |
|
943 ProcessCommandL( aCommand ); |
|
944 } |
937 |
945 |
938 // --------------------------------------------------------------------------- |
946 // --------------------------------------------------------------------------- |
939 // CESMRViewerDialog::DynInitMenuPaneL |
947 // CESMRViewerDialog::DynInitMenuPaneL |
940 // --------------------------------------------------------------------------- |
948 // --------------------------------------------------------------------------- |
941 // |
949 // |
942 void CESMRViewerDialog::DynInitMenuPaneL( |
950 void CESMRViewerDialog::DynInitMenuPaneL( |
943 TInt aResourceId, |
951 TInt aResourceId, |
944 CEikMenuPane* aMenuPane ) |
952 CEikMenuPane* aMenuPane ) |
945 { |
953 { |
946 FUNC_LOG; |
954 FUNC_LOG; |
947 if ( iServiceHandler ) |
955 MESMRCalEntry* entry = iInfoProvider.EntryL(); |
948 { |
956 |
949 if ( iServiceHandler->HandleSubmenuL( *aMenuPane ) ) |
957 TMRMenuStyle menuStyle( EMROptionsMenu ); |
950 { |
|
951 return; |
|
952 } |
|
953 } |
|
954 |
958 |
955 switch ( aResourceId ) |
959 switch ( aResourceId ) |
956 { |
960 { |
957 case R_ACTION_MENU: |
961 case R_ACTION_MENU: |
958 { |
962 { |
959 iESMRStatic.ContactMenuHandlerL().InitOptionsMenuL( aMenuPane ); |
963 CESMRContactMenuHandler& handler = iESMRStatic.ContactMenuHandlerL(); |
|
964 if ( handler.OptionsMenuAvailable() ) |
|
965 { |
|
966 handler.InitOptionsMenuL( aMenuPane ); |
|
967 } |
960 break; |
968 break; |
961 } |
969 } |
962 case R_MR_VIEWER_MENU: |
970 case R_MR_VIEWER_MENU: |
963 { |
971 { |
964 if (FeatureManager::FeatureSupported( KFeatureIdFfCmailIntegration )) |
|
965 { |
|
966 // remove help support in pf5250 |
|
967 aMenuPane->SetItemDimmed( EAknCmdHelp, ETrue); |
|
968 } |
|
969 |
|
970 HandlePolicyMenuL( |
972 HandlePolicyMenuL( |
971 aResourceId, |
973 aResourceId, |
972 aMenuPane ); |
974 aMenuPane ); |
973 |
975 |
974 // Insert send ui menu for all other entry types than meeting request |
976 // Insert send ui menu for all other entry types than meeting request |
975 if ( iEntry.Type() != MESMRCalEntry::EESMRCalEntryMeetingRequest ) |
977 if ( entry->Type() != MESMRCalEntry::EESMRCalEntryMeetingRequest ) |
976 { |
978 { |
977 TryInsertSendMenuL(aMenuPane); |
979 TryInsertSendMenuL(aMenuPane); |
978 } |
980 } |
979 |
981 |
980 if ( iEntry.Entry().AttendeesL().Count() <= 1 ) |
982 if ( entry->Entry().AttendeesL().Count() <= 1 ) |
981 { |
983 { |
982 aMenuPane->SetItemDimmed( EESMRCmdReplyAll, ETrue ); |
984 aMenuPane->SetItemDimmed( EESMRCmdReplyAll, ETrue ); |
983 } |
985 } |
984 |
986 |
985 HandleDynamicMenuItemsL( aResourceId, aMenuPane ); |
987 HandleDynamicMenuItemsL( aResourceId, aMenuPane ); |
986 |
988 |
987 if ( FeatureManager::FeatureSupported( |
989 break; |
988 KFeatureIdPrintingFrameworkCalendarPlugin ) ) |
990 } |
989 { |
991 case R_FORWARD_OPTIONS: |
990 // Initiliaze menu |
992 { |
991 iServiceHandler->InitializeMenuPaneL( |
993 HandleForwardMenuL( aResourceId, aMenuPane ); |
992 *aMenuPane, |
994 break; |
993 aResourceId, |
995 } |
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: |
996 case R_MR_VIEWER_LOCATION_MENU: |
1012 { |
997 { |
1013 if ( iFeatures->FeatureSupported( |
998 menuStyle = EMRContextMenu; |
1014 CESMRFeatureSettings::EESMRUIMnFwIntegration ) ) |
999 InitLocationMenuL( aMenuPane ); |
1015 { |
1000 break; |
1016 TBool showOnMap = |
1001 } |
1017 LocationPluginHandlerL().IsCommandAvailableL( EESMRCmdShowOnMap, |
1002 case R_MR_VIEWER_ATTACHMENT_MENU: |
1018 iEntry ); |
1003 { |
1019 |
1004 menuStyle = EMRContextMenu; |
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; |
1005 break; |
1032 } |
1006 } |
1033 default: |
1007 default: |
1034 { |
1008 { |
1035 break; |
1009 break; |
1036 } |
1010 } |
1037 } |
1011 } |
1038 |
1012 |
1039 // Handles email submenu |
1013 // Handles email submenu |
1040 HandleEmailSubmenuL( aResourceId, aMenuPane ); |
1014 HandleEmailSubmenuL( aResourceId, aMenuPane ); |
|
1015 |
|
1016 // Handles field specific context menu |
|
1017 iView->DynInitMenuPaneL( menuStyle, aResourceId, aMenuPane ); |
1041 } |
1018 } |
1042 |
1019 |
1043 // --------------------------------------------------------------------------- |
1020 // --------------------------------------------------------------------------- |
1044 // CESMRViewerDialog::HandleDynamicMenuItemsL |
1021 // CESMRViewerDialog::HandleDynamicMenuItemsL |
1045 // --------------------------------------------------------------------------- |
1022 // --------------------------------------------------------------------------- |
1048 TInt aResourceId, CEikMenuPane* aMenuPane ) |
1025 TInt aResourceId, CEikMenuPane* aMenuPane ) |
1049 { |
1026 { |
1050 FUNC_LOG; |
1027 FUNC_LOG; |
1051 if ( aResourceId == R_MR_VIEWER_MENU ) |
1028 if ( aResourceId == R_MR_VIEWER_MENU ) |
1052 { |
1029 { |
1053 if (FeatureManager::FeatureSupported( KFeatureIdFfCmailIntegration )) |
1030 // Map and Navigation Fw support |
1054 { |
|
1055 // remove help support in pf5250 |
|
1056 aMenuPane->SetItemDimmed( EAknCmdHelp, ETrue); |
|
1057 } |
|
1058 if ( iFeatures->FeatureSupported( |
1031 if ( iFeatures->FeatureSupported( |
1059 CESMRFeatureSettings::EESMRUIMnFwIntegration ) ) |
1032 CESMRFeatureSettings::EESMRUIMnFwIntegration ) && |
1060 { |
1033 iView->IsControlVisible( EESMRFieldLocation )) |
1061 if ( !iView->IsComponentVisible( EESMRFieldLocation )) |
1034 { |
1062 { |
1035 MESMRCalEntry* entry = iInfoProvider.EntryL(); |
1063 aMenuPane->SetItemDimmed( EESMRCmdSearchFromMap, ETrue ); |
1036 TBool showOnMap = LocationPluginHandlerL(). |
1064 aMenuPane->SetItemDimmed( EESMRCmdShowOnMap, ETrue ); |
1037 IsCommandAvailableL( EESMRCmdShowOnMap, *entry ); |
1065 } |
1038 aMenuPane->SetItemDimmed( EESMRCmdSearchFromMap, showOnMap ); |
1066 else |
1039 aMenuPane->SetItemDimmed( EESMRCmdShowOnMap, !showOnMap ); |
1067 { |
|
1068 TBool showOnMap = LocationPluginHandlerL(). |
|
1069 IsCommandAvailableL( EESMRCmdShowOnMap, |
|
1070 iEntry ); |
|
1071 aMenuPane->SetItemDimmed( EESMRCmdSearchFromMap, showOnMap ); |
|
1072 aMenuPane->SetItemDimmed( EESMRCmdShowOnMap, !showOnMap ); |
|
1073 } |
|
1074 } |
1040 } |
1075 else |
1041 else |
1076 { |
1042 { |
1077 aMenuPane->SetItemDimmed( EESMRCmdSearchFromMap, ETrue ); |
1043 aMenuPane->SetItemDimmed( EESMRCmdSearchFromMap, ETrue ); |
1078 aMenuPane->SetItemDimmed( EESMRCmdShowOnMap, ETrue ); |
1044 aMenuPane->SetItemDimmed( EESMRCmdShowOnMap, ETrue ); |
1079 } |
1045 } |
1080 |
1046 |
1081 // Handle Action Menu item |
1047 // Handle Action Menu item |
1082 TBool dim = !iESMRStatic.ContactMenuHandlerL().OptionsMenuAvailable(); |
1048 TBool dim = !iESMRStatic.ContactMenuHandlerL().OptionsMenuAvailable(); |
1083 aMenuPane->SetItemDimmed( EESMRCmdActionMenu, dim ); |
1049 aMenuPane->SetItemDimmed( EESMRCmdActionMenu, dim ); |
1084 aMenuPane->SetItemDimmed( EESMRCmdClipboardCopy, dim ); |
1050 aMenuPane->SetItemDimmed( EESMRCmdClipboardCopy, dim ); |
1085 } |
1051 } |
1167 // |
1157 // |
1168 void CESMRViewerDialog::CommandTailL(HBufC16*& aTailBuffer) |
1158 void CESMRViewerDialog::CommandTailL(HBufC16*& aTailBuffer) |
1169 { |
1159 { |
1170 FUNC_LOG; |
1160 FUNC_LOG; |
1171 // "DATE YYYY MM DD HH MM SS MMMMMM" |
1161 // "DATE YYYY MM DD HH MM SS MMMMMM" |
1172 aTailBuffer = HBufC::NewLC( KCalDefaultBufferLen ); |
1162 aTailBuffer = HBufC::NewLC( KCalDefaultBufferLen ); |
1173 TPtr tailPtr = aTailBuffer->Des(); |
1163 TPtr tailPtr = aTailBuffer->Des(); |
1174 |
1164 |
1175 // get the start time of entry |
1165 // get the start time of entry |
1176 CCalEntry& entry = iEntry.Entry(); |
1166 CCalEntry& entry = iInfoProvider.EntryL()->Entry(); |
1177 TTime startTime = entry.StartTimeL().TimeLocalL(); |
1167 TTime startTime = entry.StartTimeL().TimeLocalL(); |
1178 |
1168 |
1179 startTime.FormatL(tailPtr, KCalCmdTimeFormat() ); |
1169 startTime.FormatL(tailPtr, KCalCmdTimeFormat() ); |
1180 tailPtr.Insert( 0, KCalCmdDATE ); |
1170 tailPtr.Insert( 0, KCalCmdDATE ); |
1181 CleanupStack::Pop( aTailBuffer ); |
1171 CleanupStack::Pop( aTailBuffer ); |
1182 } |
1172 } |
1183 |
1173 |
1184 // --------------------------------------------------------------------------- |
1174 // --------------------------------------------------------------------------- |
1185 // CESMRViewerDialog::HandleCommandForRecurrentEventL |
1175 // CESMRViewerDialog::HandleCommandForEventL |
1186 // --------------------------------------------------------------------------- |
1176 // --------------------------------------------------------------------------- |
1187 // |
1177 // |
1188 TBool CESMRViewerDialog::HandleCommandForRecurrentEventL( TInt aCommand ) |
1178 TBool CESMRViewerDialog::HandleCommandForEventL( TInt aCommand ) |
1189 { |
1179 { |
1190 FUNC_LOG; |
1180 FUNC_LOG; |
1191 TBool closeDialog( EFalse ); |
1181 TBool closeDialog( EFalse ); |
1192 |
1182 |
|
1183 MESMRCalEntry* calEntry( iInfoProvider.EntryL() ); |
|
1184 |
1193 switch ( aCommand ) |
1185 switch ( aCommand ) |
1194 { |
1186 { |
1195 case EESMRCmdEdit: //Fall through |
1187 case EESMRCmdEdit: //Fall through |
1196 case EESMRCmdEditLocal: //Fall through |
1188 case EESMRCmdEditLocal: //Fall through |
1197 case EESMRCmdCalEntryUIEdit: |
1189 case EESMRCmdCalEntryUIEdit: |
1198 { |
1190 { |
1199 this->MakeVisible(EFalse); |
1191 if ( calEntry->IsRecurrentEventL() ) |
1200 if ( iEntry.IsRecurrentEventL() ) |
|
1201 { |
1192 { |
1202 // Check is the currently viewed entry a modifying entry. |
1193 // Check is the currently viewed entry a modifying entry. |
1203 // MESMRCalEntry should provide this method. |
1194 // MESMRCalEntry should provide this method. |
1204 // if the entry is an exception to series, no query |
1195 // if the entry is an exception to series, no query |
1205 // should be asked in which mode the editor should be launched |
1196 // should be asked in which mode the editor should be launched |
1206 // in this occurance or series -mode. |
1197 // in this occurance or series -mode. |
1207 if ( iEntry.Entry().RecurrenceIdL().TimeUtcL() != |
1198 if ( calEntry->Entry().RecurrenceIdL().TimeUtcL() != |
1208 Time::NullTTime() ) |
1199 Time::NullTTime() ) |
1209 { |
1200 { |
1210 iEntry.SetModifyingRuleL( MESMRCalEntry::EESMRThisOnly ); |
1201 calEntry->SetModifyingRuleL( MESMRCalEntry::EESMRThisOnly ); |
1211 } |
1202 } |
1212 else |
1203 else |
1213 { |
1204 { |
1214 SetRecurrenceModRuleL( |
1205 SetRecurrenceModRuleL( |
1215 iEntry, |
1206 *calEntry, |
1216 CESMRListQuery::EESMROpenThisOccurenceOrSeriesQuery ); |
1207 CESMRListQuery::EESMROpenThisOccurenceOrSeriesQuery ); |
1217 } |
1208 } |
1218 } |
1209 } |
1219 |
1210 |
1220 MESMRMeetingRequestEntry* entry = NULL; |
1211 MESMRMeetingRequestEntry* entry = NULL; |
1221 if ( MESMRCalEntry::EESMRCalEntryMeetingRequest == iEntry.Type() ) |
1212 if ( MESMRCalEntry::EESMRCalEntryMeetingRequest == calEntry->Type() ) |
1222 { |
1213 { |
1223 entry = static_cast<MESMRMeetingRequestEntry*>(&iEntry); |
1214 entry = static_cast<MESMRMeetingRequestEntry*>(calEntry); |
1224 |
1215 |
1225 TESMRRole role = entry->RoleL(); |
1216 TESMRRole role = entry->RoleL(); |
1226 if ( role == EESMRRoleOrganizer ) |
1217 if ( role == EESMRRoleOrganizer ) |
1227 { |
1218 { |
1228 User::LeaveIfError( |
1219 User::LeaveIfError( |
1295 FUNC_LOG; |
1290 FUNC_LOG; |
1296 // we don't need MenuPane in CCalSend but we need it for the API |
1291 // we don't need MenuPane in CCalSend but we need it for the API |
1297 CEikMenuPane* pane=NULL; |
1292 CEikMenuPane* pane=NULL; |
1298 |
1293 |
1299 // Show menu to user |
1294 // Show menu to user |
1300 // CCalenSend handles selection internally, so we don't |
1295 // CCalenSend handles selection internally, so we don't |
1301 // get anything in return |
1296 // get anything in return |
1302 iESMRSendUI->DisplaySendCascadeMenuL(*pane); |
1297 iESMRSendUI->DisplaySendCascadeMenuL(*pane); |
1303 |
1298 |
1304 // Try to send |
1299 // Try to send |
1305 if (iESMRSendUI->CanSendL(aCommandId)) |
1300 if (iESMRSendUI->CanSendL(aCommandId)) |
1306 { |
1301 { |
1307 iESMRSendUI->SendAsVCalendarL(aCommandId, iEntry.Entry() ); |
1302 MESMRCalEntry* calEntry = iInfoProvider.EntryL(); |
1308 } |
1303 iESMRSendUI->SendAsVCalendarL(aCommandId, calEntry->Entry() ); |
1309 } |
1304 } |
1310 |
1305 } |
1311 // --------------------------------------------------------------------------- |
1306 |
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 |
1307 |
1348 // --------------------------------------------------------------------------- |
1308 // --------------------------------------------------------------------------- |
1349 // CESMRViewerDialog::HandleEmailSubmenuL |
1309 // CESMRViewerDialog::HandleEmailSubmenuL |
1350 // --------------------------------------------------------------------------- |
1310 // --------------------------------------------------------------------------- |
1351 // |
1311 // |
1352 void CESMRViewerDialog::HandleEmailSubmenuL( |
1312 void CESMRViewerDialog::HandleEmailSubmenuL( |
1353 TInt aResourceId, |
1313 TInt aResourceId, |
1354 CEikMenuPane* aMenuPane ) |
1314 CEikMenuPane* aMenuPane ) |
1355 { |
1315 { |
1356 FUNC_LOG; |
1316 FUNC_LOG; |
|
1317 |
|
1318 MESMRCalEntry* calEntry = iInfoProvider.EntryL(); |
|
1319 |
1357 // Insert send ui menu for all other entry types than meeting request |
1320 // Insert send ui menu for all other entry types than meeting request |
1358 if ( iEntry.Type() == MESMRCalEntry::EESMRCalEntryMeetingRequest ) |
1321 if ( calEntry->Type() == MESMRCalEntry::EESMRCalEntryMeetingRequest ) |
1359 { |
1322 { |
1360 if ( R_MRVIEWER_EMAIL_MENU == aResourceId ) |
1323 if ( R_MR_VIEWER_MENU == aResourceId ) |
1361 { |
1324 { |
1362 TInt menuItemCount( aMenuPane->NumberOfItemsInPane() ); |
1325 const CESMRPolicy& currentPolicy( |
1363 for ( TInt i(0); i < menuItemCount; ++i ) |
1326 iInfoProvider.PolicyProvider().CurrentPolicy() ); |
1364 { |
1327 |
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( |
1328 aMenuPane->SetItemDimmed( |
1388 EESMRCmdMailDelete, |
1329 EESMRCmdMailDelete, |
1389 !iCallback.IsCommandAvailable( |
1330 !iCallback.IsCommandAvailable( |
1390 EESMRCmdMailDelete) ); |
1331 EESMRCmdMailDelete) ); |
1391 aMenuPane->SetItemDimmed( |
1332 aMenuPane->SetItemDimmed( |
1553 |
1517 |
1554 // --------------------------------------------------------------------------- |
1518 // --------------------------------------------------------------------------- |
1555 // CESMRViewerDialog::SupportsAttendeeStatusL |
1519 // CESMRViewerDialog::SupportsAttendeeStatusL |
1556 // --------------------------------------------------------------------------- |
1520 // --------------------------------------------------------------------------- |
1557 // |
1521 // |
1558 TBool CESMRViewerDialog::SupportsAttendeeStatusL( ) |
1522 TBool CESMRViewerDialog::SupportsMailBoxCapabilityL( |
1559 { |
1523 MESMRBuilderExtension::TMRCFSMailBoxCapability aCapa ) |
1560 FUNC_LOG; |
1524 { |
1561 TBool supportsAttendeeStatus(EFalse); |
1525 FUNC_LOG; |
|
1526 TBool supportsCapability( EFalse ); |
1562 CESMRFieldBuilderInterface* plugin = NULL; |
1527 CESMRFieldBuilderInterface* plugin = NULL; |
1563 TRAPD( error, |
1528 TRAPD( error, |
1564 plugin = CESMRFieldBuilderInterface::CreatePluginL( |
1529 plugin = CESMRFieldBuilderInterface::CreatePluginL( |
1565 TUid::Uid(KESMRUIFieldBuilderPluginImplUId) ) ); |
1530 TUid::Uid(KESMRUIFieldBuilderPluginImplUId) ) ); |
1566 CleanupStack::PushL( plugin ); |
1531 CleanupStack::PushL( plugin ); |
1567 |
1532 |
1568 if (error == KErrNone && plugin) |
1533 if (error == KErrNone && plugin) |
1569 { |
1534 { |
1570 TUid uid = {0}; |
1535 TUid uid = {0}; |
1571 MESMRBuilderExtension* extension = |
1536 MESMRBuilderExtension* extension = |
1572 static_cast<MESMRBuilderExtension*>( plugin->ExtensionL(uid) ); |
1537 static_cast<MESMRBuilderExtension*>( plugin->ExtensionL(uid) ); |
1573 |
1538 |
1574 if (extension) |
1539 MESMRCalEntry* calEntry = iInfoProvider.EntryL(); |
1575 { |
1540 |
1576 supportsAttendeeStatus = |
1541 if ( extension && MESMRCalEntry::EESMRCalEntryMeetingRequest == calEntry->Type()) |
1577 extension->CFSMailBoxCapabilityL( |
1542 { |
1578 MESMRBuilderExtension::EMRCFSAttendeeStatus); |
1543 // Static cast is safe here. We know for sure that entry is MR |
|
1544 MESMRMeetingRequestEntry* mrEntry = |
|
1545 static_cast<MESMRMeetingRequestEntry*>( calEntry ); |
|
1546 |
|
1547 supportsCapability = extension->CFSMailBoxCapabilityL( |
|
1548 mrEntry->Entry().PhoneOwnerL()->Address(), |
|
1549 aCapa ); |
1579 } |
1550 } |
1580 } |
1551 } |
1581 |
1552 |
1582 CleanupStack::PopAndDestroy( plugin ); |
1553 CleanupStack::PopAndDestroy( plugin ); |
1583 |
1554 |
1584 return supportsAttendeeStatus; |
1555 return supportsCapability; |
1585 } |
1556 } |
1586 |
1557 |
1587 // --------------------------------------------------------------------------- |
1558 // --------------------------------------------------------------------------- |
1588 // CESMRViewerDialog::HandleMRExitL |
1559 // CESMRViewerDialog::HandleMRExitL |
1589 // --------------------------------------------------------------------------- |
1560 // --------------------------------------------------------------------------- |
1590 // |
1561 // |
1591 TBool CESMRViewerDialog::HandleMRExitL( TInt aCommand ) |
1562 TBool CESMRViewerDialog::HandleMRExitL( TInt aCommand ) |
1592 { |
1563 { |
1593 FUNC_LOG; |
1564 FUNC_LOG; |
1594 TBool deleteEntry( EFalse ); |
1565 TBool deleteEntry( EFalse ); |
1595 |
1566 |
1596 TBool queryAvailable( ETrue ); |
1567 TBool queryAvailable( ETrue ); |
1597 |
1568 |
1598 // disable EESMRRemoveAppointment query if exiting dialog |
1569 // disable EESMRRemoveAppointment query if exiting dialog |
1599 // through email-based option menu command, |
1570 // through email-based option menu command, |
1600 switch ( aCommand ) |
1571 switch ( aCommand ) |
1601 { |
1572 { |
1602 case EESMRCmdMailPreviousMessage: // Fall through |
1573 case EESMRCmdMailPreviousMessage: // Fall through |
1603 case EESMRCmdMailNextMessage: // Fall through |
1574 case EESMRCmdMailNextMessage: // Fall through |
1604 case EESMRCmdMailForwardAsMessage: // Fall through |
1575 case EESMRCmdMailForwardAsMessage: // Fall through |
1605 case EESMRCmdMailMoveMessage: // Fall through |
1576 case EESMRCmdMailMoveMessage: // Fall through |
1606 case EESMRCmdMailCopyMessage: // Fall through |
1577 case EESMRCmdMailCopyMessage: // Fall through |
1607 case EESMRCmdMailMoveMessageToDrafts: // Fall through |
1578 case EESMRCmdMailMoveMessageToDrafts: // Fall through |
1608 case EESMRCmdMailComposeMessage: // Fall through |
1579 case EESMRCmdMailComposeMessage: // Fall through |
1609 case EESMRCmdMailMessageDetails: // Fall through |
1580 case EESMRCmdMailMessageDetails: |
1610 case EESMRCmdForward: |
1581 case EESMRCmdForwardAsMeeting: // Fall through |
|
1582 case EESMRCmdForwardAsMail: |
1611 { |
1583 { |
1612 queryAvailable = EFalse; |
1584 queryAvailable = EFalse; |
1613 break; |
1585 break; |
1614 } |
1586 } |
|
1587 case EAknSoftkeyClose: |
|
1588 { |
|
1589 queryAvailable = EFalse; |
|
1590 break; |
|
1591 } |
1615 default: |
1592 default: |
1616 break; |
1593 break; |
1617 } |
1594 } |
1618 |
1595 |
1619 if ( MESMRCalEntry::EESMRCalEntryMeetingRequest == iEntry.Type() ) |
1596 MESMRCalEntry* calEntry = iInfoProvider.EntryL(); |
1620 { |
1597 |
1621 MESMRMeetingRequestEntry* mrEntry = static_cast<MESMRMeetingRequestEntry*>( &iEntry ); |
1598 if ( MESMRCalEntry::EESMRCalEntryMeetingRequest == calEntry->Type() ) |
1622 |
1599 { |
1623 if ( mrEntry->IsOpenedFromMail() && |
1600 // Static cast is safe here. We know for sure that entry is MR |
1624 queryAvailable && |
1601 MESMRMeetingRequestEntry* mrEntry = |
1625 EESMRRoleOrganizer != mrEntry->RoleL() && |
1602 static_cast<MESMRMeetingRequestEntry*>( calEntry ); |
1626 mrEntry->IsMeetingCancelledL() && |
1603 |
1627 EESMRAttendeeStatusDecline != mrEntry->AttendeeStatusL() && |
1604 // Restore the status pane layout |
1628 CESMRConfirmationQuery::ExecuteL( CESMRConfirmationQuery::EESMRRemoveAppointment) ) |
1605 CEikStatusPane* sp = iEikonEnv->AppUiFactory()->StatusPane(); |
1629 { |
1606 sp->SwitchLayoutL(R_AVKON_STATUS_PANE_LAYOUT_USUAL); |
1630 deleteEntry = ETrue; |
1607 |
|
1608 if ( mrEntry->IsOpenedFromMail() ) |
|
1609 { |
|
1610 |
|
1611 |
|
1612 if( queryAvailable && |
|
1613 EESMRRoleOrganizer != mrEntry->RoleL() && |
|
1614 ( mrEntry->IsMeetingCancelledL() || |
|
1615 mrEntry->IsEntryOutOfDateL() || |
|
1616 mrEntry->OccursInPastL() ) && |
|
1617 EESMRAttendeeStatusDecline != mrEntry->AttendeeStatusL() && |
|
1618 CESMRConfirmationQuery::ExecuteL( CESMRConfirmationQuery::EESMRRemoveAppointment) ) |
|
1619 { |
|
1620 deleteEntry = ETrue; |
|
1621 } |
1631 } |
1622 } |
1632 } |
1623 } |
1633 |
1624 |
1634 if ( deleteEntry ) |
1625 if ( deleteEntry ) |
1635 { |
1626 { |
1641 } |
1632 } |
1642 } |
1633 } |
1643 |
1634 |
1644 if ( EESMRCmdRemoveFromCalendar == aCommand ) |
1635 if ( EESMRCmdRemoveFromCalendar == aCommand ) |
1645 { |
1636 { |
1646 return deleteEntry; |
1637 return deleteEntry; |
1647 } |
1638 } |
1648 |
1639 |
1649 return ETrue; |
1640 return ETrue; |
1650 } |
1641 } |
1651 |
1642 |
1652 // --------------------------------------------------------------------------- |
1643 // --------------------------------------------------------------------------- |
1653 // CESMRViewerDialog::SupportsForwardingAsMeetingL |
1644 // CESMRViewerDialog::HandleForwardMenuL |
1654 // --------------------------------------------------------------------------- |
1645 // --------------------------------------------------------------------------- |
1655 // |
1646 // |
1656 TBool CESMRViewerDialog::SupportsForwardingAsMeetingL( |
1647 void CESMRViewerDialog::HandleForwardMenuL( |
1657 MESMRMeetingRequestEntry* aEntry, |
1648 TInt /*aResourceId*/, |
1658 TBool aForceResetDefaultMRMailbox ) |
1649 CEikMenuPane* aMenuPane ) |
1659 { |
1650 { |
1660 FUNC_LOG; |
1651 FUNC_LOG; |
1661 TBool sendingAsMRSupported( EFalse ); |
1652 MESMRCalEntry* calEntry = iInfoProvider.EntryL(); |
1662 TESMRMailPlugin currentPlugin = aEntry->CurrentPluginL(); |
1653 if ( calEntry->Type() == MESMRCalEntry::EESMRCalEntryMeetingRequest ) |
1663 |
1654 { |
1664 if ( EESMRIntelliSync != currentPlugin ) |
1655 // Because this is MR entry, it is safe to cast it. |
1665 { |
1656 MESMRMeetingRequestEntry* mrEntry = |
1666 if ( aEntry->IsOpenedFromMail() ) |
1657 (MESMRMeetingRequestEntry*)( calEntry ); |
1667 { |
1658 |
1668 // Set default MR mail box to the one used for this MR |
1659 __ASSERT_DEBUG( mrEntry, Panic( EESMRViewerDlgInvalidEntry) ); |
1669 // unless if it already is set |
1660 |
1670 CMRMailboxUtils* mbUtils = CMRMailboxUtils::NewL(); |
1661 TBool mrOriginatingEnabled( EFalse ); |
1671 CleanupStack::PushL( mbUtils ); |
1662 TESMRMailPlugin currentPlugin = mrEntry->CurrentPluginL(); |
1672 TInt currentEntryId = AccountIdL( aEntry->CurrentMailBoxIdL() ); |
1663 |
1673 CMRMailboxUtils::TMailboxInfo mrMailboxInfo; |
1664 if ( EESMRIntelliSync == currentPlugin ) |
1674 mbUtils->GetDefaultMRMailBoxL( mrMailboxInfo ); |
1665 { |
1675 if ( mrMailboxInfo.iEntryId != currentEntryId ) |
1666 mrOriginatingEnabled = EFalse; |
1676 { |
1667 } |
1677 mbUtils->SetDefaultMRMailBoxL( currentEntryId ); |
1668 else if ( mrEntry->IsOpenedFromMail() ) |
1678 } |
1669 { |
1679 CleanupStack::PopAndDestroy( mbUtils ); |
|
1680 |
|
1681 // When opened from email, we need to make sure that |
1670 // When opened from email, we need to make sure that |
1682 // meeting request sending is possible |
1671 // meeting request sending is possible |
1683 CESMRFieldBuilderInterface* plugin = |
1672 CESMRFieldBuilderInterface* plugin = NULL; |
|
1673 TRAPD( error, plugin = |
1684 CESMRFieldBuilderInterface::CreatePluginL( |
1674 CESMRFieldBuilderInterface::CreatePluginL( |
1685 TUid::Uid( KESMRUIFieldBuilderPluginImplUId ) ); |
1675 TUid::Uid(KESMRUIFieldBuilderPluginImplUId)) ); |
|
1676 |
1686 CleanupDeletePushL( plugin ); |
1677 CleanupDeletePushL( plugin ); |
1687 |
1678 |
1688 if ( plugin ) |
1679 if (error == KErrNone && plugin) |
1689 { |
1680 { |
1690 TUid uid = {0}; |
1681 TUid uid = {0}; |
1691 MESMRBuilderExtension* extension = |
1682 MESMRBuilderExtension* extension = |
1692 static_cast<MESMRBuilderExtension*>( |
1683 static_cast<MESMRBuilderExtension*>( |
1693 plugin->ExtensionL( uid ) ); |
1684 plugin->ExtensionL(uid) ); |
1694 |
1685 |
1695 if ( extension ) |
1686 if (extension) |
1696 { |
1687 { |
1697 sendingAsMRSupported = |
1688 mrOriginatingEnabled = |
1698 extension->MRCanBeOriginateedL( |
1689 extension->MRCanBeOriginateedL(); |
1699 aForceResetDefaultMRMailbox ); |
|
1700 } |
1690 } |
1701 } |
1691 } |
1702 CleanupStack::PopAndDestroy( plugin ); |
1692 CleanupStack::PopAndDestroy( plugin ); |
1703 plugin = NULL; |
1693 plugin = NULL; |
1704 } |
1694 } |
1705 else |
1695 else |
1706 { |
1696 { |
1707 sendingAsMRSupported = ETrue; |
1697 mrOriginatingEnabled = ETrue; |
1708 } |
1698 } |
1709 } |
1699 |
1710 |
1700 aMenuPane->SetItemDimmed( |
1711 return sendingAsMRSupported; |
1701 EESMRCmdForwardAsMeeting, |
1712 } |
1702 !mrOriginatingEnabled ); |
1713 |
1703 } |
|
1704 } |
1714 |
1705 |
1715 // --------------------------------------------------------------------------- |
1706 // --------------------------------------------------------------------------- |
1716 // CESMRViewerDialog::LocationPluginHandlerL |
1707 // CESMRViewerDialog::LocationPluginHandlerL |
1717 // --------------------------------------------------------------------------- |
1708 // --------------------------------------------------------------------------- |
1718 // |
1709 // |
1788 } |
1764 } |
1789 else |
1765 else |
1790 { |
1766 { |
1791 resourceId = R_MR_EDIT_SOFTKEY; |
1767 resourceId = R_MR_EDIT_SOFTKEY; |
1792 } |
1768 } |
1793 |
1769 |
1794 } |
1770 } |
1795 else if ( iPolicy->IsDefaultCommand( EESMRCmdCalEntryUIEdit ) ) |
1771 else if ( currentPolicy.IsDefaultCommand( EESMRCmdCalEntryUIEdit ) ) |
1796 { |
1772 { |
1797 // Set correct edit command in MSK. Dialog resource has EESMRCmdEdit |
1773 // Set correct edit command in MSK. Dialog resource has EESMRCmdEdit |
1798 resourceId = R_MR_CAL_EDIT_SOFTKEY; |
1774 resourceId = R_MR_CAL_EDIT_SOFTKEY; |
1799 } |
1775 } |
|
1776 |
|
1777 if ( resourceId != KErrNotFound ) |
|
1778 { |
|
1779 ButtonGroupContainer().SetCommandL( |
|
1780 CEikButtonGroupContainer::EMiddleSoftkeyPosition, |
|
1781 resourceId ); |
|
1782 } |
|
1783 } |
|
1784 |
|
1785 // ----------------------------------------------------------------------------- |
|
1786 // CESMRViewerDialog::ShowContextMenuL |
|
1787 // ----------------------------------------------------------------------------- |
|
1788 // |
|
1789 void CESMRViewerDialog::ShowContextMenuL() |
|
1790 { |
|
1791 FUNC_LOG; |
|
1792 |
|
1793 if ( iMenuBar ) |
|
1794 { |
|
1795 iMenuBar->TryDisplayContextMenuBarL(); |
|
1796 } |
|
1797 } |
|
1798 |
|
1799 // --------------------------------------------------------------------------- |
|
1800 // CESMRViewerDialog::HandleNaviArrowEventL |
|
1801 // --------------------------------------------------------------------------- |
|
1802 // |
|
1803 void CESMRViewerDialog::HandleNaviArrowEventL( const TInt aCommand ) |
|
1804 { |
|
1805 FUNC_LOG; |
|
1806 ProcessCommandL( aCommand ); |
|
1807 } |
|
1808 |
|
1809 // --------------------------------------------------------------------------- |
|
1810 // CESMRViewerDialog::UserWantToHandleAttachmentsL |
|
1811 // --------------------------------------------------------------------------- |
|
1812 // |
|
1813 TBool CESMRViewerDialog::UserWantToHandleAttachmentsL() |
|
1814 { |
|
1815 TBool retValue( EFalse ); |
|
1816 |
|
1817 MESMRCalEntry* calEntry = iInfoProvider.EntryL(); |
|
1818 MESMRMeetingRequestEntry* mrEntry = NULL; |
|
1819 if ( MESMRCalEntry::EESMRCalEntryMeetingRequest == calEntry->Type() ) |
|
1820 { |
|
1821 // This is meeting request |
|
1822 mrEntry = static_cast<MESMRMeetingRequestEntry*>( calEntry ); |
|
1823 |
|
1824 TBool openedFromEmail( mrEntry->IsOpenedFromMail() ); |
|
1825 |
|
1826 // If entry is opened from mail, contains remote attachments and |
|
1827 // mailbox is MfE, we show the query. |
|
1828 if ( openedFromEmail && mrEntry->ContainsRemoteAttachmentsL() && |
|
1829 mrEntry->CurrentPluginL() == EESMRActiveSync ) |
|
1830 { |
|
1831 retValue = |
|
1832 CESMRConfirmationQuery::ExecuteL( |
|
1833 CESMRConfirmationQuery::EESMRAttachments ); |
|
1834 } |
|
1835 } |
|
1836 |
|
1837 return retValue; |
|
1838 } |
|
1839 |
|
1840 // --------------------------------------------------------------------------- |
|
1841 // CESMRViewerDialog::InitLocationMenuL |
|
1842 // --------------------------------------------------------------------------- |
|
1843 // |
|
1844 void CESMRViewerDialog::InitLocationMenuL( CEikMenuPane* aMenuPane ) |
|
1845 { |
|
1846 FUNC_LOG; |
|
1847 |
|
1848 aMenuPane->SetItemDimmed( EESMRCmdSearchFromMap,ETrue ); |
|
1849 aMenuPane->SetItemDimmed( EESMRCmdShowOnMap, ETrue ); |
|
1850 } |
|
1851 |
|
1852 // --------------------------------------------------------------------------- |
|
1853 // CESMRViewerDialog::ConstructToolbarL |
|
1854 // --------------------------------------------------------------------------- |
|
1855 // |
|
1856 void CESMRViewerDialog::ConstructToolbarL() |
|
1857 { |
|
1858 FUNC_LOG; |
|
1859 if( iInfoProvider.EntryL()->Type() == |
|
1860 MESMRCalEntry::EESMRCalEntryMeetingRequest ) |
|
1861 { |
|
1862 MESMRMeetingRequestEntry* entry = |
|
1863 static_cast<MESMRMeetingRequestEntry*>( |
|
1864 iInfoProvider.EntryL() ); |
|
1865 |
|
1866 if( !entry->OccursInPastL() && |
|
1867 !entry->IsEntryOutOfDateL() && |
|
1868 !entry->IsMeetingCancelledL() ) |
|
1869 { |
|
1870 if ( entry->RoleL()== EESMRRoleRequiredAttendee || |
|
1871 entry->RoleL()== EESMRRoleOptionalAttendee ) |
|
1872 { |
|
1873 TSize screenSize = |
|
1874 iEikonEnv->ScreenDevice()->SizeInPixels(); |
|
1875 |
|
1876 TBool isVGA( EFalse ); |
|
1877 if( ( screenSize.iHeight == KVGAOneSide || |
|
1878 screenSize.iWidth == KVGAOneSide ) && |
|
1879 ( screenSize.iHeight == KVGAOtherSide || |
|
1880 screenSize.iWidth == KVGAOtherSide ) && |
|
1881 screenSize.iHeight != screenSize.iWidth ) |
|
1882 { |
|
1883 isVGA = ETrue; |
|
1884 } |
|
1885 |
|
1886 // Toolbar is disabled in VGA mode |
|
1887 if( !isVGA ) |
|
1888 { |
|
1889 // Toolbar is always shown in MR viewer when user |
|
1890 // is attendee |
|
1891 iToolbar->SetObserver( this ); |
|
1892 iToolbar->InitializeToolbarL( |
|
1893 CMRToolbar::EMRViewerAttendee ); |
|
1894 iToolbar->ShowToolbar( ETrue ); |
|
1895 |
|
1896 // Toolbar created, relayouting needed |
|
1897 iView->ReLayout(); |
|
1898 } |
|
1899 } |
|
1900 } |
|
1901 } |
|
1902 } |
|
1903 |
|
1904 // --------------------------------------------------------------------------- |
|
1905 // CESMRViewerDialog::ProcessCommandEventL |
|
1906 // --------------------------------------------------------------------------- |
|
1907 // |
|
1908 void CESMRViewerDialog::ProcessCommandEventL( const MESMRFieldEvent& aEvent ) |
|
1909 { |
|
1910 FUNC_LOG; |
1800 |
1911 |
1801 if ( resourceId != KErrNotFound ) |
1912 TInt* command = static_cast< TInt* >( aEvent.Param( 0 ) ); |
1802 { |
1913 |
1803 ButtonGroupContainer().SetCommandL( |
1914 switch ( *command ) |
1804 CEikButtonGroupContainer::EMiddleSoftkeyPosition, |
1915 { |
1805 resourceId ); |
1916 case EESMRCmdRestoreMiddleSoftKey: |
1806 } |
1917 { |
1807 } |
1918 SetDefaultMiddleSoftKeyL(); |
1808 |
1919 ButtonGroupContainer().DrawDeferred(); |
1809 // --------------------------------------------------------------------------- |
1920 break; |
1810 // CESMRViewerDialog::DigMailboxAndRemovePrefixL |
1921 } |
1811 // --------------------------------------------------------------------------- |
1922 case EESMRCmdEdit: // Fall through |
1812 // |
1923 case EESMRCmdViewTrack: // Fall through |
1813 TPtrC CESMRViewerDialog::DigMailboxAndRemovePrefixL() |
1924 case EESMRCmdOpenAttachment:// Fall through |
1814 { |
1925 case EESMRCmdOpenAttachmentView:// Fall through |
1815 CCalUser* calUser = iEntry.Entry().PhoneOwnerL(); |
1926 case EESMRCmdDownloadAttachment: // Fall through |
1816 TPtrC addrWithoutPrefix = calUser->Address(); |
1927 case EESMRCmdDownloadAllAttachments: // Fall through |
1817 TInt pos = KErrNotFound; |
1928 case EESMRCmdSaveAttachment: // Fall through |
1818 |
1929 case EESMRCmdSaveAllAttachments: // Fall through |
1819 do |
1930 case EESMRCmdMskOpenEmailAttachment: // Fall through |
1820 { |
1931 case EESMRCmdSearchFromMap: // Fall through |
1821 pos = addrWithoutPrefix.MatchF( KMailtoMatchPattern ); |
1932 case EESMRCmdShowOnMap: |
1822 if ( pos != KErrNotFound ) |
1933 case EMRCmdHideAttachmentIndicator: |
1823 { |
1934 { |
1824 addrWithoutPrefix.Set( addrWithoutPrefix.Mid( KMailtoLength ) ); |
1935 ProcessCommandL( *command ); |
1825 } |
1936 break; |
1826 } |
1937 } |
1827 while ( pos != KErrNotFound ); |
1938 case EMRLaunchAttachmentContextMenu: |
|
1939 case EAknSoftkeyContextOptions: |
|
1940 { |
|
1941 SetContextMenu(); |
|
1942 ShowContextMenuL(); |
|
1943 break; |
|
1944 } |
|
1945 case EESMRCmdAcceptMR: |
|
1946 case EESMRCmdTentativeMR: |
|
1947 case EESMRCmdDeclineMR: |
|
1948 case EESMRCmdRemoveFromCalendar: |
|
1949 { |
|
1950 ProcessCommandL( *command ); |
|
1951 } |
|
1952 break; |
|
1953 default: |
|
1954 { |
|
1955 break; |
|
1956 } |
|
1957 } |
|
1958 } |
|
1959 |
|
1960 // --------------------------------------------------------------------------- |
|
1961 // CESMRViewerDialog::ProcessFieldEventL |
|
1962 // --------------------------------------------------------------------------- |
|
1963 // |
|
1964 void CESMRViewerDialog::ProcessFieldEventL( const MESMRFieldEvent& aEvent ) |
|
1965 { |
|
1966 FUNC_LOG; |
|
1967 iView->ProcessEventL( aEvent ); |
|
1968 } |
1828 |
1969 |
1829 return addrWithoutPrefix; |
1970 // EOF |
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 } |
|