|
1 /* |
|
2 * Copyright (c) 2002-2004 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: Implementation of base description dialog |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 // INCLUDE FILES |
|
22 #include "CMRDescriptionDlgBase.h" |
|
23 #include "MMRModelInterface.h" |
|
24 #include "CMRMsgBaseControlAdapter.h" |
|
25 #include "CMRDataFillerMeetingRequest.h" |
|
26 #include "meetingrequestviewers.hrh" |
|
27 #include "MRViewersPanic.h" |
|
28 #include <e32std.h> |
|
29 #include <MAgnEntryUi.h> //MAgnEntryUi |
|
30 #include <eikmenup.h> //menupane |
|
31 #include <eikenv.h> //eikonenv |
|
32 #include <EIKAPPUI.H> //eikappui |
|
33 #include <crichbio.h> //rich bio for displaying MR data |
|
34 #include <AknsControlContext.h> |
|
35 #include <AknsBasicBackgroundControlContext.h> |
|
36 #include <AknsDrawUtils.h> |
|
37 #include <msgeditorview.h> // messaging editor base |
|
38 #include <MsgEditorAppUi.rsg> // resource identifiers |
|
39 #include <MsgMailViewer.rsg> |
|
40 #include <MsgBaseControl.h> |
|
41 #include <coeaui.h> |
|
42 #include <MsgAddressControl.h> |
|
43 #include <miutpars.h> // TImMessageField |
|
44 #include <txtrich.h> // CRichText |
|
45 #include <aiwservicehandler.h> // CAiwServiceHandler |
|
46 #include <AiwContactAssignDataTypes.h> // aiw |
|
47 #include <CommonUiInternalCRKeys.h> |
|
48 #include <FindItem.hrh> |
|
49 #include <finditemmenu.rsg> |
|
50 #include <finditemmenu.h> |
|
51 #include <centralrepository.h> |
|
52 |
|
53 using namespace AiwContactAssign; |
|
54 |
|
55 // CONSTANTS |
|
56 /// Unnamed namespace for local definitions |
|
57 namespace { |
|
58 _LIT( KPanicMsg, "CMRDescriptionDlgBase" ); |
|
59 |
|
60 void Panic( TPanicCode aReason ) |
|
61 { |
|
62 User::Panic( KPanicMsg, aReason ); |
|
63 } |
|
64 |
|
65 } // namespace |
|
66 |
|
67 // ============================ MEMBER FUNCTIONS =============================== |
|
68 |
|
69 // ----------------------------------------------------------------------------- |
|
70 // CMRDescriptionDlgBase::?classname |
|
71 // C++ default constructor can NOT contain any code, that |
|
72 // might leave. |
|
73 // ----------------------------------------------------------------------------- |
|
74 // |
|
75 CMRDescriptionDlgBase::CMRDescriptionDlgBase( |
|
76 MAgnEntryUiCallback& aHandlerCallback ) |
|
77 : CMRDialogBase( aHandlerCallback ) |
|
78 { |
|
79 } |
|
80 |
|
81 // ----------------------------------------------------------------------------- |
|
82 // CMRDescriptionDlgBase::ConstructL |
|
83 // Symbian 2nd phase constructor can leave. |
|
84 // ----------------------------------------------------------------------------- |
|
85 // |
|
86 void CMRDescriptionDlgBase::ConstructL() |
|
87 { |
|
88 CAknDialog::ConstructL( R_MR_DESCRDLG_OPTIONS_MENUBAR ); |
|
89 |
|
90 iCenRep = CRepository::NewL( KCRUidCommonUi ); |
|
91 iServiceHandler = CAiwServiceHandler::NewL(); |
|
92 |
|
93 TUint32 flags( 0 ); |
|
94 flags |= CMsgEditorView::EMsgDoNotUseDefaultBodyControl; |
|
95 flags |= CMsgEditorView::EMsgReadOnly; |
|
96 iView = CMsgEditorView::NewL(*this, flags); |
|
97 iView->SetMopParent(this); |
|
98 iEikonEnv->EikAppUi()->AddToStackL(iView,ECoeStackPriorityCba); |
|
99 |
|
100 iRichBio = new( ELeave ) CRichBio( ERichBioModeStandard ); |
|
101 |
|
102 CMsgBaseControl* adapter = CMRMsgBaseControlAdapter::NewL(iView,*iRichBio); |
|
103 CleanupStack::PushL(adapter); |
|
104 |
|
105 CMsgBaseControl* bodycontrol = iView->RemoveControlL(EMsgComponentIdBody); |
|
106 delete bodycontrol; |
|
107 bodycontrol = NULL; |
|
108 |
|
109 iView->AddControlL(adapter,EMsgComponentIdBody, |
|
110 EMsgAppendControl, |
|
111 EMsgBody); |
|
112 CleanupStack::Pop(); // adapter |
|
113 |
|
114 iView->SetControlsModified( EFalse ); |
|
115 ActivateL(); |
|
116 } |
|
117 |
|
118 // ----------------------------------------------------------------------------- |
|
119 // CMRDescriptionDlgBase::NewL |
|
120 // Two-phased constructor. |
|
121 // ----------------------------------------------------------------------------- |
|
122 // |
|
123 CMRDescriptionDlgBase* CMRDescriptionDlgBase::NewL( |
|
124 MAgnEntryUiCallback& aHandlerCallback ) |
|
125 { |
|
126 CMRDescriptionDlgBase* self = |
|
127 new( ELeave ) CMRDescriptionDlgBase( aHandlerCallback ); |
|
128 |
|
129 CleanupStack::PushL( self ); |
|
130 self->ConstructL(); |
|
131 CleanupStack::Pop(); |
|
132 |
|
133 return self; |
|
134 } |
|
135 |
|
136 // Destructor |
|
137 CMRDescriptionDlgBase::~CMRDescriptionDlgBase() |
|
138 { |
|
139 if ( iCenRepNotifyHandler ) |
|
140 { |
|
141 iCenRepNotifyHandler->StopListening(); |
|
142 delete iCenRepNotifyHandler; |
|
143 } |
|
144 delete iCenRep; |
|
145 delete iFindItemMenu; |
|
146 delete iServiceHandler; |
|
147 delete iRichBio; |
|
148 delete iDataFillerInterface; |
|
149 delete iView; |
|
150 } |
|
151 |
|
152 TInt CMRDescriptionDlgBase::ExecuteLD() |
|
153 { |
|
154 TInt retVal( 0 ); |
|
155 retVal = CAknDialog::ExecuteLD( R_MR_DESCRIPTION_DLG ); |
|
156 return retVal; |
|
157 } |
|
158 |
|
159 //----------------------------------------------------------------------------- |
|
160 // CMsgMailSendOptionsDlg::GetHelpContext() |
|
161 //----------------------------------------------------------------------------- |
|
162 void CMRDescriptionDlgBase::GetHelpContext( |
|
163 TCoeHelpContext& /*aContext*/ ) const |
|
164 { |
|
165 } |
|
166 |
|
167 void CMRDescriptionDlgBase::DynInitMenuPaneL( |
|
168 TInt aMenuId, |
|
169 CEikMenuPane* aMenuPane ) |
|
170 { |
|
171 #ifdef RD_MESSAGING_VIRTUAL_PHONEBOOK |
|
172 // Offer the menu for AIW framework first |
|
173 TBool wasConsumed = iServiceHandler->HandleSubmenuL( *aMenuPane ); |
|
174 if ( wasConsumed ) |
|
175 { |
|
176 return; |
|
177 } |
|
178 else if ( iMRModel ) |
|
179 #else // !RD_MESSAGING_VIRTUAL_PHONEBOOK |
|
180 if ( iMRModel ) |
|
181 #endif // RD_MESSAGING_VIRTUAL_PHONEBOOK |
|
182 { |
|
183 if ( aMenuId == R_MR_DESCRDLG_MENUPANE ) |
|
184 { |
|
185 AddFindItemMenuL( aMenuPane, EFalse ); |
|
186 |
|
187 #ifdef RD_MESSAGING_VIRTUAL_PHONEBOOK |
|
188 |
|
189 if ( FromFieldHighlighted() ) |
|
190 { |
|
191 TUint assignFlags = 0; |
|
192 |
|
193 CAiwGenericParamList& inParamList = iServiceHandler->InParamListL(); |
|
194 inParamList.AppendL( |
|
195 TAiwGenericParam( |
|
196 EGenericParamContactAssignData, |
|
197 TAiwVariant(TAiwSingleContactAssignDataV1Pckg( |
|
198 TAiwSingleContactAssignDataV1().SetFlags(assignFlags))))); |
|
199 |
|
200 inParamList.AppendL( |
|
201 TAiwGenericParam( |
|
202 EGenericParamEmailAddress, |
|
203 TAiwVariant() |
|
204 )); |
|
205 |
|
206 // Let provider add its menu items to the menu |
|
207 iServiceHandler->InitializeMenuPaneL( *aMenuPane, |
|
208 aMenuId, |
|
209 KAiwCmdAssign, |
|
210 inParamList ); |
|
211 } |
|
212 else |
|
213 { |
|
214 aMenuPane->SetItemDimmed( KAiwCmdAssign, ETrue ); |
|
215 } |
|
216 |
|
217 #endif // RD_MESSAGING_VIRTUAL_PHONEBOOK |
|
218 |
|
219 TBool canRespond( iMRModel->IsCmdAvailable( EMRCommandRespondAccept ) || |
|
220 iMRModel->IsCmdAvailable( EMRCommandRespondTentative ) || |
|
221 iMRModel->IsCmdAvailable( EMRCommandRespondDecline ) ); |
|
222 aMenuPane->SetItemDimmed( EMRCommandRespondSubmenu, !canRespond ); |
|
223 aMenuPane->SetItemDimmed( EMRCommandRemoveFromCalendar, |
|
224 !iMRModel->IsCmdAvailable( EMRCommandRemoveFromCalendar ) ); |
|
225 TBool canReply( iMRModel->IsCmdAvailable( EMRCommandReplyToSender ) || |
|
226 iMRModel->IsCmdAvailable( EMRCommandReplyToOrganiser ) || |
|
227 iMRModel->IsCmdAvailable( EMRCommandReplyToAll ) ); |
|
228 aMenuPane->SetItemDimmed( EMRCommandReplySubmenu, !canReply ); |
|
229 aMenuPane->SetItemDimmed( EMRCommandForward, |
|
230 !iMRModel->IsCmdAvailable( EMRCommandForward ) ); |
|
231 aMenuPane->SetItemDimmed( EMRCommandSaveFromFile, |
|
232 !iMRModel->IsCmdAvailable( EMRCommandSaveFromFile ) ); |
|
233 TBool canRetrieve( iMRModel->IsCmdAvailable( EMRCommandRetrieve ) && |
|
234 iHandlerCallback.IsCommandAvailable( EMRCommandRetrieve ) ); |
|
235 aMenuPane->SetItemDimmed( EMRCommandRetrieve, !canRetrieve ); |
|
236 TBool canShowAtta( iMRModel->IsCmdAvailable( EMRCommandAttachments ) && |
|
237 iHandlerCallback.IsCommandAvailable( EMRCommandAttachments ) ); |
|
238 aMenuPane->SetItemDimmed( EMRCommandAttachments, !canShowAtta ); |
|
239 aMenuPane->SetItemDimmed( EMRCommandDisableAlarm, |
|
240 !iMRModel->IsCmdAvailable( EMRCommandDisableAlarm) ); |
|
241 } |
|
242 else if ( aMenuId == R_DESCR_VIEW_OKOPTIONS_MENUPANE ) |
|
243 { |
|
244 AddFindItemMenuL( aMenuPane, ETrue ); |
|
245 |
|
246 TBool canRespond( iMRModel->IsCmdAvailable( EMRCommandRespondAccept ) || |
|
247 iMRModel->IsCmdAvailable( EMRCommandRespondTentative ) || |
|
248 iMRModel->IsCmdAvailable( EMRCommandRespondDecline ) ); |
|
249 aMenuPane->SetItemDimmed( EMRCommandRespondSubmenu, !canRespond ); |
|
250 aMenuPane->SetItemDimmed( EMRCommandSaveFromFile, |
|
251 !iMRModel->IsCmdAvailable( EMRCommandSaveFromFile ) ); |
|
252 aMenuPane->SetItemDimmed( EMRCommandRemoveFromCalendar, |
|
253 !iMRModel->IsCmdAvailable( EMRCommandRemoveFromCalendar ) ); |
|
254 TBool canReply( iMRModel->IsCmdAvailable( EMRCommandReplyToSender ) || |
|
255 iMRModel->IsCmdAvailable( EMRCommandReplyToOrganiser ) || |
|
256 iMRModel->IsCmdAvailable( EMRCommandReplyToAll ) ); |
|
257 aMenuPane->SetItemDimmed( EMRCommandReplySubmenu, !canReply ); |
|
258 aMenuPane->SetItemDimmed( EMRCommandForward, |
|
259 !iMRModel->IsCmdAvailable( EMRCommandForward ) ); |
|
260 } |
|
261 else if ( aMenuId == R_MR_RESPOND_SUBMENU ) |
|
262 { |
|
263 aMenuPane->SetItemDimmed( EMRCommandRespondAccept, |
|
264 !iMRModel->IsCmdAvailable( EMRCommandRespondAccept ) ); |
|
265 aMenuPane->SetItemDimmed( EMRCommandRespondTentative, |
|
266 !iMRModel->IsCmdAvailable( EMRCommandRespondTentative ) ); |
|
267 aMenuPane->SetItemDimmed( EMRCommandRespondDecline, |
|
268 !iMRModel->IsCmdAvailable( EMRCommandRespondDecline ) ); |
|
269 } |
|
270 else if (aMenuId == R_MR_REPLY_TO_SUBMENU) |
|
271 { |
|
272 aMenuPane->SetItemDimmed( EMRCommandReplyToSender, |
|
273 !iMRModel->IsCmdAvailable( EMRCommandReplyToSender ) ); |
|
274 aMenuPane->SetItemDimmed( EMRCommandReplyToOrganiser, |
|
275 !iMRModel->IsCmdAvailable( EMRCommandReplyToOrganiser ) ); |
|
276 aMenuPane->SetItemDimmed( EMRCommandReplyToAll, |
|
277 !iMRModel->IsCmdAvailable( EMRCommandReplyToAll ) ); |
|
278 } |
|
279 else |
|
280 { |
|
281 if ( iFindItemMenu ) |
|
282 { |
|
283 iFindItemMenu->UpdateItemFinderMenuL( aMenuId, aMenuPane ); |
|
284 } |
|
285 } |
|
286 } |
|
287 else |
|
288 { |
|
289 if ( aMenuId == R_MR_DESCRDLG_MENUPANE ) |
|
290 { |
|
291 aMenuPane->SetItemDimmed( EMRCommandRespondSubmenu, ETrue ); |
|
292 aMenuPane->SetItemDimmed( EMRCommandRemoveFromCalendar, ETrue ); |
|
293 aMenuPane->SetItemDimmed( EMRCommandReplySubmenu, ETrue ); |
|
294 aMenuPane->SetItemDimmed( EMRCommandForward, ETrue ); |
|
295 aMenuPane->SetItemDimmed( EMRCommandRetrieve, ETrue ); |
|
296 aMenuPane->SetItemDimmed( EMRCommandSaveFromFile, ETrue ); |
|
297 aMenuPane->SetItemDimmed( EMRCommandAttachments, ETrue ); |
|
298 aMenuPane->SetItemDimmed( EMRCommandMessageDetails, ETrue ); |
|
299 aMenuPane->SetItemDimmed( EMRCommandDisableAlarm, ETrue); |
|
300 } |
|
301 } |
|
302 } |
|
303 |
|
304 //----------------------------------------------------------------------------- |
|
305 // CMRDescriptionDlgBase::ProcessCommandL() |
|
306 //----------------------------------------------------------------------------- |
|
307 void CMRDescriptionDlgBase::ProcessCommandL( TInt aCommandId ) |
|
308 { |
|
309 if ( iFindItemMenu && iFindItemMenu->CommandIsValidL( aCommandId ) ) |
|
310 { |
|
311 HideMenu(); |
|
312 iFindItemMenu->HandleItemFinderCommandL( aCommandId ); |
|
313 } |
|
314 #ifdef RD_MESSAGING_VIRTUAL_PHONEBOOK |
|
315 else if( iServiceHandler->ServiceCmdByMenuCmd( aCommandId ) != KAiwCmdNone ) |
|
316 { |
|
317 CreateContactL( aCommandId ); |
|
318 } |
|
319 #endif // RD_MESSAGING_VIRTUAL_PHONEBOOK |
|
320 else |
|
321 { |
|
322 CMRDialogBase::ProcessCommandL( aCommandId ); |
|
323 } |
|
324 } |
|
325 |
|
326 // ---------------------------------------------------------------------------- |
|
327 // CMRDescriptionDlgBase::HandleDlgExitingL |
|
328 // Desctiption dialog is always in view only mode, so nothing needs to be saved |
|
329 // ---------------------------------------------------------------------------- |
|
330 // |
|
331 TInt CMRDescriptionDlgBase::HandleDlgExitingL( TInt aCommandId ) |
|
332 { |
|
333 TInt retCmd( EEikCmdCanceled ); |
|
334 |
|
335 if ( aCommandId == EAknSoftkeyBack && iMRModel ) |
|
336 { |
|
337 //In case of "Back" we are checking if this is a response message, and |
|
338 //if so let the user exit the meeting request views from description |
|
339 //view otherwise we change back to meeting request view |
|
340 CCalEntry::TMethod method = iMRModel->MethodL(); |
|
341 if ( method == CCalEntry::EMethodReply ) |
|
342 { |
|
343 retCmd = EMRCommandExitDialogs; |
|
344 } |
|
345 else |
|
346 { |
|
347 retCmd = EMRCommandShowSummaryView; |
|
348 } |
|
349 } |
|
350 |
|
351 return retCmd; |
|
352 } |
|
353 |
|
354 void CMRDescriptionDlgBase::PreLayoutDynInitL() |
|
355 { |
|
356 // TODO: if we can't be sure that iMRModel exists, then we should |
|
357 // handle a case when it doesn't. |
|
358 if ( iMRModel->MailHeadersAvailable() ) |
|
359 { |
|
360 iView->AddControlFromResourceL( |
|
361 R_MAIL_VIEWER_FROM, EMsgAddressControl, 0, EMsgHeader ); |
|
362 |
|
363 iView->AddControlFromResourceL( |
|
364 R_MAIL_VIEWER_SUBJECT, EMsgExpandableControl, 1, EMsgHeader ); |
|
365 |
|
366 HBufC* fromAddr = iMRModel->MailHeaderFromFieldLC(); |
|
367 SetAddressFieldTextL( *fromAddr ); |
|
368 CleanupStack::PopAndDestroy( fromAddr ); |
|
369 |
|
370 HBufC* subject = iMRModel->MailHeaderSubjectFieldLC(); |
|
371 SetSubjectL( *subject ); |
|
372 CleanupStack::PopAndDestroy( subject ); |
|
373 |
|
374 #ifdef RD_MESSAGING_VIRTUAL_PHONEBOOK |
|
375 iServiceHandler->AttachMenuL( R_MR_DESCRDLG_MENUPANE, |
|
376 R_MR_DATA_ASSIGN_INTEREST ); |
|
377 #endif // RD_MESSAGING_VIRTUAL_PHONEBOOK |
|
378 |
|
379 iFindItemMenu = CFindItemMenu::NewL( EMRCommandFindItem ); |
|
380 iFindItemMenu->AttachItemFinderMenuL( R_MR_DESCRDLG_MENUPANE ); |
|
381 |
|
382 iCenRepNotifyHandler = CCenRepNotifyHandler::NewL( |
|
383 *this, |
|
384 *iCenRep, |
|
385 CCenRepNotifyHandler::EIntKey, |
|
386 KCuiAutomaticHighlight ); |
|
387 iCenRepNotifyHandler->StartListeningL(); |
|
388 ReadCRSetAutomaticHighlightL(); |
|
389 } |
|
390 |
|
391 iView->ExecuteL( iEikonEnv->EikAppUi()->ClientRect(), EMsgComponentIdNull ); |
|
392 } |
|
393 |
|
394 TInt CMRDescriptionDlgBase::CountComponentControls() const |
|
395 { |
|
396 return 0; |
|
397 } |
|
398 |
|
399 CCoeControl* CMRDescriptionDlgBase::ComponentControl(TInt /*aIndex*/) const |
|
400 { |
|
401 return NULL; |
|
402 } |
|
403 |
|
404 void CMRDescriptionDlgBase::SizeChanged() |
|
405 { |
|
406 } |
|
407 |
|
408 // TODO: we could prevent user from opening description dialog (or other dialogs) |
|
409 // before data and model is ready. Then we could assure that description dialog |
|
410 // always has a model. This method and the complexity caused by it would also be |
|
411 // avoided. |
|
412 void CMRDescriptionDlgBase::HandleSetModelL() |
|
413 { |
|
414 __ASSERT_DEBUG( !iDataFillerInterface, Panic( EDataFillerExists ) ); |
|
415 |
|
416 iDataFillerInterface = iMRModel->DataFillerL( iRichBio ); |
|
417 iDataFillerInterface->FillViewerWithDataL(); |
|
418 |
|
419 // MsgEditorView should be drawn here again because model contents have changed |
|
420 //CMsgAddressControl* addressControl = AddressControl( EMsgComponentIdFrom ); |
|
421 } |
|
422 |
|
423 void CMRDescriptionDlgBase::RefreshData() |
|
424 { |
|
425 __ASSERT_DEBUG( iDataFillerInterface, Panic( EDataFillerNull ) ); |
|
426 TRAP_IGNORE( iDataFillerInterface->FillViewerWithDataL() ); |
|
427 iView->DrawDeferred(); |
|
428 } |
|
429 |
|
430 TKeyResponse CMRDescriptionDlgBase::OfferKeyEventL( |
|
431 const TKeyEvent& aKeyEvent, |
|
432 TEventCode aType) |
|
433 { |
|
434 if ( aKeyEvent.iCode == EKeyOK && aType == EEventKey ) |
|
435 { |
|
436 // Show context sensitive options menu: |
|
437 iMenuBar->SetMenuTitleResourceId( R_DESCR_VIEW_OKOPTIONS_MENUBAR ); |
|
438 iMenuBar->TryDisplayMenuBarL(); |
|
439 iMenuBar->SetMenuTitleResourceId( R_MR_DESCRDLG_OPTIONS_MENUBAR ); |
|
440 return EKeyWasConsumed; |
|
441 } |
|
442 else |
|
443 { |
|
444 //the MsgEditorView should handle all the keyevents |
|
445 return iView->OfferKeyEventL( aKeyEvent,aType ); |
|
446 } |
|
447 } |
|
448 |
|
449 void CMRDescriptionDlgBase::Draw(const TRect& /*aRect*/ ) const |
|
450 { |
|
451 } |
|
452 |
|
453 // ----------------------------------------------------------------------------- |
|
454 // CMRDescriptionDlgBase::HandleNotifyInt |
|
455 // ----------------------------------------------------------------------------- |
|
456 // |
|
457 void CMRDescriptionDlgBase::HandleNotifyInt( |
|
458 TUint32 aId, |
|
459 TInt aNewValue ) |
|
460 { |
|
461 // Notifies changes on KCuiAutomaticHighlight |
|
462 if ( aId == KCuiAutomaticHighlight ) |
|
463 { |
|
464 TRAP_IGNORE( SetAutomaticHighlightL( aNewValue ) ); |
|
465 } |
|
466 } |
|
467 |
|
468 // ----------------------------------------------------------------------------- |
|
469 // CMRDescriptionDlgBase::HandleNotifyError |
|
470 // ----------------------------------------------------------------------------- |
|
471 // |
|
472 void CMRDescriptionDlgBase::HandleNotifyError( |
|
473 TUint32 /* aId */, |
|
474 TInt /* aError */, |
|
475 CCenRepNotifyHandler* /* aHandler */ ) |
|
476 { |
|
477 // Do nothing |
|
478 } |
|
479 |
|
480 void CMRDescriptionDlgBase::EditorObserver( |
|
481 TMsgEditorObserverFunc /*aFunc*/, |
|
482 TAny* /*aArg1*/, |
|
483 TAny* /*aArg2*/, |
|
484 TAny* /*aArg3*/ ) |
|
485 { |
|
486 } |
|
487 |
|
488 // ---------------------------------------------------------------------------- |
|
489 // CMsgMailAppUi::AddressControl() |
|
490 // Returns the pointer to the address control (header field). |
|
491 // ---------------------------------------------------------------------------- |
|
492 // |
|
493 CMsgAddressControl* CMRDescriptionDlgBase::AddressControl() const |
|
494 { |
|
495 CMsgAddressControl* addressCtrl( NULL ); |
|
496 CMsgBaseControl* ctrl = iView->ControlById( EMsgComponentIdFrom ); |
|
497 if ( ctrl && ctrl->ControlType() == EMsgAddressControl ) |
|
498 { |
|
499 addressCtrl = static_cast<CMsgAddressControl*>( ctrl ); |
|
500 } |
|
501 return addressCtrl; |
|
502 } |
|
503 |
|
504 void CMRDescriptionDlgBase::SetAddressFieldTextL( const TDesC& aText ) |
|
505 { |
|
506 CMsgAddressControl* addressControl = AddressControl(); |
|
507 if ( addressControl ) |
|
508 { |
|
509 TImMessageField msgField; |
|
510 HBufC* address = msgField.GetValidInternetEmailAddressFromString( |
|
511 aText ).AllocLC(); |
|
512 HBufC* alias = msgField.GetValidAlias( aText ).AllocLC(); |
|
513 addressControl->Reset(); |
|
514 // restored recipients don't have contact id, so 0 used instead |
|
515 addressControl->AddRecipientL( *alias, *address, ETrue, NULL ); |
|
516 CleanupStack::PopAndDestroy( 2 ); // alias, address |
|
517 } |
|
518 } |
|
519 |
|
520 CMsgExpandableControl* CMRDescriptionDlgBase::SubjectControl() const |
|
521 { |
|
522 CMsgExpandableControl* subjectCtrl( NULL ); |
|
523 |
|
524 CMsgBaseControl* ctrl = iView->ControlById( EMsgComponentIdSubject ); |
|
525 if ( ctrl && ctrl->ControlType() == EMsgExpandableControl ) |
|
526 { |
|
527 subjectCtrl = static_cast<CMsgExpandableControl*>( ctrl ); |
|
528 } |
|
529 return subjectCtrl; |
|
530 } |
|
531 |
|
532 void CMRDescriptionDlgBase::SetSubjectL( const TDesC& aText ) |
|
533 { |
|
534 CMsgExpandableControl* subjectControl = SubjectControl(); |
|
535 if ( subjectControl ) |
|
536 { |
|
537 CRichText& subject = subjectControl->TextContent(); |
|
538 subject.Reset(); |
|
539 subject.InsertL( 0, aText ); |
|
540 } |
|
541 } |
|
542 |
|
543 void CMRDescriptionDlgBase::SetAutomaticHighlightL( TInt aValue ) |
|
544 { |
|
545 CMsgAddressControl* addressControl = AddressControl(); |
|
546 if ( addressControl ) |
|
547 { |
|
548 addressControl->SetAddressFieldAutoHighlight( aValue ); |
|
549 } |
|
550 } |
|
551 |
|
552 // ----------------------------------------------------------------------------- |
|
553 // CMRDescriptionDlgBase::CreateContactL() |
|
554 // aCommand is "create new" or "update existing" |
|
555 // ----------------------------------------------------------------------------- |
|
556 // |
|
557 void CMRDescriptionDlgBase::CreateContactL( TInt aCommand ) |
|
558 { |
|
559 // address control is the only highlightable control |
|
560 CMsgAddressControl* addressControl = AddressControl(); |
|
561 if ( addressControl ) |
|
562 { |
|
563 CMsgRecipientArray* addrArray = addressControl->GetRecipientsL(); |
|
564 // must be exactly one address in "From" field |
|
565 __ASSERT_DEBUG( addrArray && addrArray->Count() == 1, |
|
566 Panic( EIllegalMailHeader ) ); |
|
567 |
|
568 CAiwGenericParamList& inParamList = iServiceHandler->InParamListL(); |
|
569 const TDesC& addr = *( addrArray->At( 0 )->Address() ); |
|
570 inParamList.AppendL( TAiwGenericParam( EGenericParamEmailAddress, |
|
571 TAiwVariant( addr ) ) ); |
|
572 iServiceHandler->ExecuteMenuCmdL( aCommand, |
|
573 inParamList, |
|
574 iServiceHandler->OutParamListL() ); |
|
575 } |
|
576 } |
|
577 |
|
578 // ----------------------------------------------------------------------------- |
|
579 // CMRDescriptionDlgBase::FromFieldHighlighted |
|
580 // ----------------------------------------------------------------------------- |
|
581 // |
|
582 TBool CMRDescriptionDlgBase::FromFieldHighlighted() |
|
583 { |
|
584 TInt retVal( EFalse ); |
|
585 CMsgBaseControl* focusedControl = iView->FocusedControl(); |
|
586 CMsgAddressControl* addressControl = AddressControl(); |
|
587 if ( addressControl && |
|
588 focusedControl == addressControl && |
|
589 addressControl->AddressFieldAutoHighlight() ) |
|
590 { |
|
591 retVal = ETrue; |
|
592 } |
|
593 return retVal; |
|
594 } |
|
595 |
|
596 // ------------------------------------------------------------------------------ |
|
597 // CMRDescriptionDlgBase::AddFindItemMenuL() |
|
598 // ------------------------------------------------------------------------------ |
|
599 // |
|
600 void CMRDescriptionDlgBase::AddFindItemMenuL( |
|
601 CEikMenuPane* aMenuPane, |
|
602 TBool aIsContextMenu ) |
|
603 { |
|
604 TFindItemMenuCommands placeHolder = aIsContextMenu ? |
|
605 EFindItemContextMenuPlaceHolder : |
|
606 EFindItemMenuPlaceHolder; |
|
607 if ( iFindItemMenu ) |
|
608 { |
|
609 // Add find item menu |
|
610 iFindItemMenu->AddItemFindMenuL( NULL, |
|
611 aMenuPane, |
|
612 placeHolder, |
|
613 KNullDesC, |
|
614 ETrue, |
|
615 aIsContextMenu ); |
|
616 } |
|
617 } |
|
618 |
|
619 |
|
620 // ------------------------------------------------------------------------------ |
|
621 // CMRDescriptionDlgBase::ReadCRSetAutomaticHighlightL() |
|
622 // ------------------------------------------------------------------------------ |
|
623 // |
|
624 void CMRDescriptionDlgBase::ReadCRSetAutomaticHighlightL() |
|
625 { |
|
626 TInt value( 0 ); |
|
627 TInt err = iCenRep->Get( KCuiAutomaticHighlight, value ); |
|
628 if ( err == KErrNone ) |
|
629 { |
|
630 SetAutomaticHighlightL( value ); |
|
631 } |
|
632 } |
|
633 |
|
634 // End of File |