|
1 /* |
|
2 * Copyright (c) 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: Provides interface method for CAttendeeDialogBase. |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include "cattendeedialogbase.h" |
|
22 #include "attendeeview.hrh" |
|
23 #include "cattendeeuiutils.h" |
|
24 #include "cattendeesender.h" |
|
25 #include "cattendeecaller.h" |
|
26 #include "attendeeviewuid.h" |
|
27 #include "mattendeeeng.h" |
|
28 #include "attendeeviewconsts.h" |
|
29 #include "attendeenotes.h" |
|
30 #include "cattendeedetailsdlg.h" |
|
31 #include <attendeeview.mbg> |
|
32 #include <attendeeview_res.rsg> |
|
33 #include <aknlists.h> |
|
34 #include <eikmenub.h> |
|
35 #include <sendnorm.rsg> // R_SENDUI_MENU |
|
36 #include <hlplch.h> |
|
37 #include <featmgr.h> |
|
38 #include <senduimtmuids.h> |
|
39 #include <cpbkcontactitem.h> |
|
40 #include <cpbkmmsaddressselect.h> |
|
41 #include <cpbksmsaddressselect.h> |
|
42 #include <cpbkemailaddressselect.h> |
|
43 #include <caluser.h> |
|
44 #include <cpbkdatasaveappui.h> |
|
45 #include <cpbkfieldsinfo.h> |
|
46 #include <cpbkcontactengine.h> |
|
47 #include <akniconarray.h> |
|
48 #include <gulicon.h> |
|
49 #include <aknsutils.h> |
|
50 #include <avkon.mbg> |
|
51 #include <cmessagedata.h> |
|
52 #include <csxhelp/cale.hlp.hrh> |
|
53 #include <mrcommands.hrh> |
|
54 #include <magnentryui.h> |
|
55 |
|
56 |
|
57 |
|
58 /// Unnamed namespace for local definitions |
|
59 namespace { |
|
60 _LIT( KPanicMsg, "CAttendeeDialogBase" ); |
|
61 |
|
62 enum TPanicCode |
|
63 { |
|
64 KAttPanicUnknownOperation = 1 |
|
65 }; |
|
66 |
|
67 void Panic( TPanicCode aReason ) |
|
68 { |
|
69 User::Panic( KPanicMsg, aReason ); |
|
70 } |
|
71 } // namespace |
|
72 |
|
73 // ============================ MEMBER FUNCTIONS ============================== |
|
74 |
|
75 // ---------------------------------------------------------------------------- |
|
76 // CAttendeeDialogBase::CAttendeeDialogBase |
|
77 // C++ default constructor can NOT contain any code, that |
|
78 // might leave. |
|
79 // ---------------------------------------------------------------------------- |
|
80 // |
|
81 CAttendeeDialogBase::CAttendeeDialogBase( |
|
82 MDesCArray *aArray, |
|
83 MAttendeeEng& aEngine, |
|
84 TInt aMenuBarResourceId, |
|
85 TInt aOkMenuBarResourceId, |
|
86 MAgnEntryUiCallback& aEntryUiCallback ): |
|
87 CAknMarkableListDialog( iIndex, NULL, aArray, |
|
88 aMenuBarResourceId, aOkMenuBarResourceId, NULL ), |
|
89 iLBModel( aArray ), |
|
90 iOwnership( EFalse ), |
|
91 iEngine( aEngine ), |
|
92 iEntryUiCallback( aEntryUiCallback ) |
|
93 |
|
94 { |
|
95 |
|
96 } |
|
97 |
|
98 // --------------------------------------------------------- |
|
99 // CAttendeeDialogBase::ConstructL |
|
100 // --------------------------------------------------------- |
|
101 // |
|
102 void CAttendeeDialogBase::ConstructL( TInt aMenuBarResourceId ) |
|
103 { |
|
104 FeatureManager::InitializeLibL(); |
|
105 |
|
106 iUiUtils = CAttendeeUiUtils::NewL(); |
|
107 |
|
108 CAknDialog::ConstructL( aMenuBarResourceId ); |
|
109 |
|
110 iUiUtils->StoreNaviPane(); |
|
111 |
|
112 iUiUtils->CreateNaviLabelL( R_ATTENDEE_NAVI_LABEL ); |
|
113 |
|
114 //Create CAttendeeSender instance |
|
115 iSender = CAttendeeSender::NewL(); |
|
116 |
|
117 iCaller = CAttendeeCaller::NewL(); |
|
118 |
|
119 iEngine.SetObserver( this ); |
|
120 |
|
121 iPbkDataSaveAppUi = CPbkDataSaveAppUi::NewL( iEngine.ContactEngine() ); |
|
122 |
|
123 iOwnership = ETrue; |
|
124 } |
|
125 |
|
126 // --------------------------------------------------------- |
|
127 // CAttendeeDialogBase::~CAttendeeDialogBase |
|
128 // --------------------------------------------------------- |
|
129 // |
|
130 CAttendeeDialogBase::~CAttendeeDialogBase() |
|
131 { |
|
132 FeatureManager::UnInitializeLib(); |
|
133 delete iPbkDataSaveAppUi; |
|
134 iEngine.RemoveObserver(); |
|
135 |
|
136 if ( iOwnership ) |
|
137 { |
|
138 delete iLBModel; |
|
139 } |
|
140 delete iCaller; |
|
141 delete iSender; |
|
142 delete iUiUtils; |
|
143 } |
|
144 |
|
145 // --------------------------------------------------------- |
|
146 // CAttendeeDialogBase::OfferKeyEventL |
|
147 // --------------------------------------------------------- |
|
148 // |
|
149 TKeyResponse CAttendeeDialogBase::OfferKeyEventL( const TKeyEvent &aKeyEvent, |
|
150 TEventCode aType ) |
|
151 { |
|
152 TBool shiftKeyPressed = ( aKeyEvent.iModifiers & EModifierShift ); |
|
153 if ( aKeyEvent.iCode == EKeyOK && aType == EEventKey |
|
154 && !shiftKeyPressed && iOkMenuBarResourceId ) |
|
155 { |
|
156 iMenuBar->SetMenuTitleResourceId( iOkMenuBarResourceId ); |
|
157 // This must be trapped so that menubar will be restored on leave |
|
158 TRAP_IGNORE( iMenuBar->TryDisplayMenuBarL() ); |
|
159 iEikonEnv->EikAppUi()->HandleStackChanged(); |
|
160 iMenuBar->SetMenuTitleResourceId( iMenuBarResourceId ); |
|
161 return EKeyWasConsumed; |
|
162 } |
|
163 |
|
164 if ( aKeyEvent.iCode == EKeyPhoneSend && aType == EEventKey ) |
|
165 { |
|
166 CallCmdL( EAttCallCmd ); |
|
167 return EKeyWasConsumed; |
|
168 } |
|
169 |
|
170 return CAknMarkableListDialog ::OfferKeyEventL( aKeyEvent, aType ); |
|
171 } |
|
172 |
|
173 // --------------------------------------------------------- |
|
174 // CAttendeeDialogBase::DynInitMenuPaneL |
|
175 // --------------------------------------------------------- |
|
176 // |
|
177 void CAttendeeDialogBase::DynInitMenuPaneL( TInt aResourceId, |
|
178 CEikMenuPane* aMenuPane ) |
|
179 { |
|
180 AknSelectionService::HandleMarkableListDynInitMenuPane( aResourceId, |
|
181 aMenuPane, |
|
182 ListBox() ); |
|
183 |
|
184 // Offer the menu to AIW first |
|
185 if ( iCaller && iCaller->HandleSubmenuL( *aMenuPane ) ) |
|
186 { |
|
187 // No need to continue |
|
188 return; |
|
189 } |
|
190 |
|
191 const TInt visible( ListBox()->Model()->NumberOfItems() ); |
|
192 const TInt marked( ListBox()->SelectionIndexes()->Count() ); |
|
193 switch( aResourceId ) |
|
194 { |
|
195 case R_ATTENDEEVIEW_BASE_MENU: |
|
196 { |
|
197 HandleHelpFeature( *aMenuPane ); |
|
198 |
|
199 if ( ( visible > 0 ) && ( marked <= 0 ) ) |
|
200 { |
|
201 iPbkDataSaveAppUi->AddMenuItemsL( aMenuPane, |
|
202 EAttAddToContacsCmd ); |
|
203 } |
|
204 else |
|
205 { |
|
206 aMenuPane->SetItemDimmed( EAttAddToContacsCmd, ETrue ); |
|
207 } |
|
208 break; |
|
209 } |
|
210 case R_ATTENDEEVIEW_CALL_MENU: |
|
211 { |
|
212 if ( ( visible > 0 ) && ( marked <= 0 ) ) |
|
213 { |
|
214 //Call menu is handled by the caller |
|
215 CAttendeeItem& attendeeItem = |
|
216 iEngine.At( ListBox()->CurrentItemIndex() ); |
|
217 if ( attendeeItem.ContactId() != KNullContactId ) |
|
218 { |
|
219 iCaller->InitializeServiceHandlerL( *aMenuPane, ETrue ); |
|
220 } |
|
221 else |
|
222 { |
|
223 iCaller->InitializeServiceHandlerL( *aMenuPane, EFalse ); |
|
224 } |
|
225 } |
|
226 else |
|
227 { |
|
228 //Call menu is handled by the caller |
|
229 iCaller->InitializeServiceHandlerL( *aMenuPane, EFalse ); |
|
230 } |
|
231 break; |
|
232 } |
|
233 case R_ATTENDEEVIEW_MESSAGE_MENU: |
|
234 { |
|
235 if ( visible > 0 ) |
|
236 { |
|
237 //"Create message" visible with or without sms |
|
238 aMenuPane->SetItemDimmed( EAttCmdSend, EFalse ); |
|
239 } |
|
240 else |
|
241 { |
|
242 //dim "Create message" |
|
243 aMenuPane->SetItemDimmed( EAttCmdSend, ETrue ); |
|
244 } |
|
245 break; |
|
246 } |
|
247 case R_AVKON_MENUPANE_MARKABLE_LIST: |
|
248 { |
|
249 if ( ListBox()->Model()->NumberOfItems() <= 0 ) |
|
250 { |
|
251 aMenuPane->SetItemDimmed( EAknCmdEditListMenu, ETrue ); |
|
252 } |
|
253 break; |
|
254 } |
|
255 default: |
|
256 { |
|
257 // Update Phonebook's data save submenu |
|
258 iPbkDataSaveAppUi->DynInitMenuPaneL( aResourceId, aMenuPane ); |
|
259 break; |
|
260 } |
|
261 } |
|
262 } |
|
263 |
|
264 // --------------------------------------------------------- |
|
265 // CAttendeeDialogBase::ProcessCommandL |
|
266 // --------------------------------------------------------- |
|
267 // |
|
268 void CAttendeeDialogBase::SelectionListProcessCommandL( TInt aCommandId ) |
|
269 { |
|
270 CAknMarkableListDialog::SelectionListProcessCommandL( aCommandId ); |
|
271 |
|
272 switch( aCommandId ) |
|
273 { |
|
274 case EAttAddToContacsCmd: |
|
275 case EAttAddToContacsCmd1: |
|
276 case EAttAddToContacsCmd2: |
|
277 { |
|
278 ContactsDataSaveCmdL( aCommandId ); |
|
279 iUiUtils->CreateNaviLabelL( R_ATTENDEE_NAVI_LABEL ); |
|
280 break; |
|
281 } |
|
282 case EAttDetails: |
|
283 { |
|
284 DetailsCmdL(); |
|
285 break; |
|
286 } |
|
287 case EAttCmdSend: |
|
288 { |
|
289 const TInt marked( ListBox()->SelectionIndexes()->Count() ); |
|
290 TBool smsVisible( EFalse ); |
|
291 if ( marked > 0 ) |
|
292 { |
|
293 CAttendeeItem* attendeeItem = NULL; |
|
294 for( TInt i(0); i < marked; ++i ) |
|
295 { |
|
296 attendeeItem = |
|
297 &iEngine.At( ListBox()->CurrentItemIndex() ); |
|
298 if ( attendeeItem && |
|
299 attendeeItem->ContactId() != KNullContactId ) |
|
300 { |
|
301 smsVisible = ETrue; |
|
302 } |
|
303 } |
|
304 } |
|
305 else |
|
306 { |
|
307 CAttendeeItem& attendeeItem = |
|
308 iEngine.At( ListBox()->CurrentItemIndex() ); |
|
309 if ( attendeeItem.ContactId() != KNullContactId ) |
|
310 { |
|
311 smsVisible = ETrue; |
|
312 } |
|
313 } |
|
314 SendCmdL( iSender->ShowSendQueryL( smsVisible ) ); |
|
315 break; |
|
316 } |
|
317 case EAknCmdHelp: |
|
318 { |
|
319 HlpLauncher::LaunchHelpApplicationL( iEikonEnv->WsSession(), |
|
320 static_cast<CAknAppUi*>( |
|
321 CEikonEnv::Static()->EikAppUi() )->AppHelpContextL() ); |
|
322 |
|
323 break; |
|
324 } |
|
325 case EAttRespondAccept: |
|
326 { |
|
327 iEntryUiCallback.ProcessCommandWithResultL( |
|
328 EMRCommandRespondAccept ); |
|
329 delete this; |
|
330 break; |
|
331 } |
|
332 |
|
333 case EAttRespondTentative: |
|
334 { |
|
335 iEntryUiCallback.ProcessCommandWithResultL( |
|
336 EMRCommandRespondTentative ); |
|
337 delete this; |
|
338 break; |
|
339 } |
|
340 |
|
341 case EAttRespondDecline: |
|
342 { |
|
343 iEntryUiCallback.ProcessCommandWithResultL( |
|
344 EMRCommandRespondDecline ); |
|
345 delete this; |
|
346 break; |
|
347 } |
|
348 |
|
349 case EAknSoftkeyBack: |
|
350 case EAknSoftkeyExit: |
|
351 case EEikCmdExit: |
|
352 case EAknCmdExit: |
|
353 { |
|
354 iUiUtils->RestoreOldNaviPaneL(); |
|
355 delete this; |
|
356 break; |
|
357 } |
|
358 default: |
|
359 { |
|
360 CallCmdL( aCommandId ); |
|
361 break; |
|
362 } |
|
363 } |
|
364 } |
|
365 |
|
366 // ----------------------------------------------------------------------------- |
|
367 // CAttendeeDialogBase::PrepareLC |
|
368 // ----------------------------------------------------------------------------- |
|
369 // |
|
370 void CAttendeeDialogBase::PrepareLC( TInt aResourceId ) |
|
371 { |
|
372 CAknDialog::PrepareLC( aResourceId ); |
|
373 |
|
374 LoadIconsL(); |
|
375 MakeEmptyTextListBoxL(); |
|
376 } |
|
377 |
|
378 // ----------------------------------------------------------------------------- |
|
379 // CAttendeeDialogBase::NotifyL |
|
380 // ----------------------------------------------------------------------------- |
|
381 // |
|
382 void CAttendeeDialogBase::NotifyL() |
|
383 { |
|
384 DrawNow(); |
|
385 } |
|
386 |
|
387 // ----------------------------------------------------------------------------- |
|
388 // CAttendeeDialogBase::NotifyError |
|
389 // ----------------------------------------------------------------------------- |
|
390 // |
|
391 void CAttendeeDialogBase::NotifyError( TInt aErrorCode ) |
|
392 { |
|
393 switch( aErrorCode ) |
|
394 { |
|
395 case KErrDelete: |
|
396 { |
|
397 TRAP_IGNORE( AttendeeNotes::InformationNoteL( |
|
398 R_ATTENDEE_ORGANIZER_DELETE_NOTE ) ); |
|
399 //no need to handle error |
|
400 break; |
|
401 } |
|
402 case KErrSetAs: |
|
403 { |
|
404 TRAP_IGNORE( AttendeeNotes::InformationNoteL( |
|
405 R_ATTENDEE_ORGANIZER_SET_AS_NOTE ) ); |
|
406 //no need to handle error |
|
407 break; |
|
408 } |
|
409 default: |
|
410 { |
|
411 CEikonEnv::Static()->HandleError( aErrorCode ); |
|
412 } |
|
413 } |
|
414 } |
|
415 |
|
416 |
|
417 // ----------------------------------------------------------------------------- |
|
418 // CAttendeeDialogBase::HandleHelpFeature |
|
419 // ----------------------------------------------------------------------------- |
|
420 // |
|
421 void CAttendeeDialogBase::HandleHelpFeature( CEikMenuPane& aMenuPane ) const |
|
422 { |
|
423 aMenuPane.SetItemDimmed( EAknCmdHelp, |
|
424 !FeatureManager::FeatureSupported( KFeatureIdHelp )); |
|
425 } |
|
426 |
|
427 // ----------------------------------------------------------------------------- |
|
428 // CAttendeeDialogBase::CallCmdL |
|
429 // ----------------------------------------------------------------------------- |
|
430 // |
|
431 void CAttendeeDialogBase::CallCmdL( TInt aCommandId ) |
|
432 { |
|
433 CPbkContactItem* pbkItem = |
|
434 iEngine.PbkContactItemL( ListBox()->CurrentItemIndex() ); |
|
435 |
|
436 //callUI |
|
437 if ( pbkItem ) |
|
438 { |
|
439 CleanupStack::PushL( pbkItem ); |
|
440 iCaller->CallCmdL( aCommandId, *pbkItem ); |
|
441 CleanupStack::PopAndDestroy(pbkItem); //pbkItem |
|
442 } |
|
443 } |
|
444 |
|
445 // ----------------------------------------------------------------------------- |
|
446 // CAttendeeDialogBase::SendCmdL |
|
447 // ----------------------------------------------------------------------------- |
|
448 // |
|
449 void CAttendeeDialogBase::SendCmdL( TUid aUid ) |
|
450 { |
|
451 if ( aUid == KNullUid ) |
|
452 { |
|
453 return; |
|
454 } |
|
455 |
|
456 CMessageData* messageData = CMessageData::NewL(); |
|
457 CleanupStack::PushL( messageData ); |
|
458 |
|
459 const TInt marked( ListBox()->SelectionIndexes()->Count() ); |
|
460 //Create SMS address arrays |
|
461 if ( marked ) |
|
462 { |
|
463 for ( TInt i( 0 ); i < marked; ++i ) |
|
464 { |
|
465 |
|
466 const TInt index( ListBox()->SelectionIndexes()->At( i ) ); |
|
467 CreateAddressArraysL( index, |
|
468 aUid, |
|
469 *messageData ); |
|
470 } |
|
471 } |
|
472 else |
|
473 { |
|
474 CreateAddressArraysL( ListBox()->CurrentItemIndex(), |
|
475 aUid, |
|
476 *messageData ); |
|
477 } |
|
478 |
|
479 ListBox()->ClearSelection(); |
|
480 iSender->CreateAndSendL( aUid, messageData ); |
|
481 CleanupStack::PopAndDestroy(messageData); //messageData |
|
482 } |
|
483 |
|
484 // ----------------------------------------------------------------------------- |
|
485 // CAttendeeDialogBase::SelectSmsAddressL |
|
486 // ----------------------------------------------------------------------------- |
|
487 // |
|
488 const TPbkContactItemField* CAttendeeDialogBase::SelectSmsAddressL( |
|
489 CPbkContactItem& aContactItem ) |
|
490 { |
|
491 CPbkSmsAddressSelect::TParams params( aContactItem ); |
|
492 CPbkSmsAddressSelect* dlg = new(ELeave)CPbkSmsAddressSelect; |
|
493 dlg->ExecuteLD( params ); |
|
494 return params.SelectedField(); |
|
495 } |
|
496 |
|
497 // ----------------------------------------------------------------------------- |
|
498 // CAttendeeDialogBase::SelectMmsAddressL |
|
499 // ----------------------------------------------------------------------------- |
|
500 // |
|
501 const TPbkContactItemField* CAttendeeDialogBase::SelectMmsAddressL( |
|
502 CPbkContactItem& aContactItem ) |
|
503 { |
|
504 CPbkMmsAddressSelect::TParams params( aContactItem ); |
|
505 CPbkMmsAddressSelect* dlg = new(ELeave)CPbkMmsAddressSelect; |
|
506 dlg->ExecuteLD( params ); |
|
507 return params.SelectedField(); |
|
508 } |
|
509 |
|
510 // --------------------------------------------------------- |
|
511 // CAttendeeDialogBase::SelectEmailAddressL |
|
512 // --------------------------------------------------------- |
|
513 // |
|
514 const TPbkContactItemField* CAttendeeDialogBase::SelectEmailAddressL( |
|
515 CPbkContactItem& aContactItem ) |
|
516 { |
|
517 CPbkEmailAddressSelect::TParams params( aContactItem ); |
|
518 CPbkEmailAddressSelect* dlg = new(ELeave)CPbkEmailAddressSelect; |
|
519 dlg->ExecuteLD( params ); |
|
520 return params.SelectedField(); |
|
521 } |
|
522 |
|
523 // --------------------------------------------------------- |
|
524 // CAttendeeDialogBase::CreateAddressArraysL |
|
525 // --------------------------------------------------------- |
|
526 // |
|
527 void CAttendeeDialogBase::CreateAddressArraysL( const TInt aIndex, |
|
528 const TUid aUid, |
|
529 CMessageData& aMessageData ) |
|
530 { |
|
531 CPbkContactItem* pbkItem = iEngine.PbkContactItemL( aIndex ); |
|
532 if ( pbkItem ) |
|
533 { |
|
534 CleanupStack::PushL( pbkItem ); |
|
535 ContactField ptr = NULL; |
|
536 switch( aUid.iUid ) |
|
537 { |
|
538 case KSenduiMtmSmsUidValue: |
|
539 { |
|
540 ptr = &CAttendeeDialogBase::SelectSmsAddressL; |
|
541 break; |
|
542 } |
|
543 case KSenduiMtmMmsUidValue: |
|
544 { |
|
545 ptr = &CAttendeeDialogBase::SelectMmsAddressL; |
|
546 break; |
|
547 } |
|
548 case KSenduiMtmSmtpUidValue: |
|
549 { |
|
550 ptr = &CAttendeeDialogBase::SelectEmailAddressL; |
|
551 break; |
|
552 } |
|
553 default: |
|
554 { |
|
555 CleanupStack::PopAndDestroy(pbkItem); //pbkItem |
|
556 Panic( KAttPanicUnknownOperation ); |
|
557 break; |
|
558 } |
|
559 } |
|
560 |
|
561 const TPbkContactItemField* field = ( this->*ptr )( *pbkItem ); |
|
562 CAttendeeItem& item = iEngine.At( aIndex ); |
|
563 if ( field ) |
|
564 { |
|
565 aMessageData.AppendToAddressL( field->Text(), |
|
566 *item.ContactTitle() ); |
|
567 } |
|
568 else if ( aUid != KSenduiMtmSmsUid ) |
|
569 { |
|
570 aMessageData.AppendToAddressL( item.AgnAttendee()->Address(), |
|
571 *item.ContactTitle() ); |
|
572 } |
|
573 else{ |
|
574 AttendeeNotes::InformationNoteL( R_ATTENDEE_CAN_NOT_SEND_MESSAGE_NOTE, |
|
575 *item.ContactTitle() ); |
|
576 } |
|
577 |
|
578 CleanupStack::PopAndDestroy(pbkItem); //pbkItem |
|
579 } |
|
580 else |
|
581 { |
|
582 CAttendeeItem& item = iEngine.At( aIndex ); |
|
583 if ( aUid != KSenduiMtmSmsUid ) |
|
584 { |
|
585 aMessageData.AppendToAddressL( item.AgnAttendee()->Address() ); |
|
586 } |
|
587 else{ |
|
588 AttendeeNotes::InformationNoteL( R_ATTENDEE_CAN_NOT_SEND_MESSAGE_NOTE, |
|
589 item.AgnAttendee()->Address() ); |
|
590 } |
|
591 } |
|
592 } |
|
593 |
|
594 // --------------------------------------------------------- |
|
595 // CAttendeeDialogBase::ContactsDataSaveCmdL |
|
596 // --------------------------------------------------------- |
|
597 // |
|
598 void CAttendeeDialogBase::ContactsDataSaveCmdL( TInt aCommandId ) |
|
599 { |
|
600 const TInt currentIndex( ListBox()->CurrentItemIndex() ); |
|
601 |
|
602 if ( currentIndex < 0 ) |
|
603 { |
|
604 //no need to continue |
|
605 return; |
|
606 } |
|
607 |
|
608 CAttendeeItem& item = iEngine.At( currentIndex ); |
|
609 |
|
610 if ( item.ContactId() == KNullContactId ) |
|
611 { |
|
612 //Select Email field types. |
|
613 CArrayPtrFlat<CPbkFieldInfo>* filteredFieldTypes = |
|
614 new(ELeave)CArrayPtrFlat<CPbkFieldInfo>( 8 ); |
|
615 CleanupStack::PushL( filteredFieldTypes ); |
|
616 const CPbkFieldsInfo& fieldsInfo = |
|
617 iEngine.ContactEngine().FieldsInfo(); |
|
618 const TInt count( fieldsInfo.Count() ); |
|
619 for ( TInt i( 0 ); i < count; ++i ) |
|
620 { |
|
621 if ( fieldsInfo[i]->FieldId() == EPbkFieldIdEmailAddress ) |
|
622 { |
|
623 filteredFieldTypes->AppendL( fieldsInfo[i] ); |
|
624 } |
|
625 } |
|
626 |
|
627 // Call CPbkDataSaveAppUi to handle the command |
|
628 iPbkDataSaveAppUi->HandleCommandL( aCommandId, |
|
629 *filteredFieldTypes, |
|
630 item.AgnAttendee()->Address() ); |
|
631 |
|
632 // Cleanup |
|
633 CleanupStack::PopAndDestroy( filteredFieldTypes ); //filteredFieldTypes |
|
634 } |
|
635 else |
|
636 { |
|
637 AttendeeNotes::InformationNoteL( R_ATTENDEE_ADD_TO_CONTACTS_NOTE ); |
|
638 } |
|
639 } |
|
640 |
|
641 |
|
642 |
|
643 // --------------------------------------------------------- |
|
644 // CAttendeeDialogBase::CreateContactL |
|
645 // --------------------------------------------------------- |
|
646 // |
|
647 CPbkContactItem* CAttendeeDialogBase::CreateContactL( |
|
648 TPtrC aEmailAddress ) const |
|
649 { |
|
650 CPbkContactItem* pbkItem = iEngine.ContactEngine().CreateEmptyContactL(); |
|
651 CleanupStack::PushL( pbkItem ); |
|
652 |
|
653 CPbkFieldInfo& fieldInfo = *iEngine.ContactEngine().FieldsInfo().Find( |
|
654 EPbkFieldIdEmailAddress ); |
|
655 |
|
656 TPbkContactItemField* field; |
|
657 field = pbkItem->AddOrReturnUnusedFieldL( fieldInfo ); |
|
658 CleanupStack::PushL( field ); |
|
659 |
|
660 HBufC* email = aEmailAddress.AllocL(); |
|
661 field->TextStorage()->SetText( email ); |
|
662 |
|
663 CleanupStack::Pop( 2 ); // field, pbkItem |
|
664 return pbkItem; |
|
665 } |
|
666 |
|
667 // ----------------------------------------------------------------------------- |
|
668 // CAttendeeDialogBase::LoadIconsL |
|
669 // ----------------------------------------------------------------------------- |
|
670 // |
|
671 void CAttendeeDialogBase::LoadIconsL() |
|
672 { |
|
673 CAknIconArray* icons = new(ELeave)CAknIconArray( KLBIconArrayGranularity ); |
|
674 CleanupStack::PushL( icons ); |
|
675 |
|
676 TFileName iconFile( AknIconUtils::AvkonIconFileName() ); |
|
677 |
|
678 //Default avkon icons |
|
679 AddIconL( icons, |
|
680 KAknsIIDQgnIndiMarkedAdd, |
|
681 iconFile, |
|
682 EMbmAvkonQgn_indi_marked_add, |
|
683 EMbmAvkonQgn_indi_marked_add_mask ); |
|
684 |
|
685 AddIconL( icons, |
|
686 KAknsIIDQgnPropEmpty, |
|
687 iconFile, |
|
688 EMbmAvkonQgn_prop_empty, |
|
689 EMbmAvkonQgn_prop_empty_mask ); |
|
690 |
|
691 //AttendeeView's icons |
|
692 //If you remove, add or change order of icons, |
|
693 //remember update AttendeeView.hrh file also |
|
694 AddIconL( icons, |
|
695 KAknsIIDQgnPropCaleOrganizer, |
|
696 iUiUtils->AttendeeViewIconFileL(), |
|
697 EMbmAttendeeviewQgn_prop_cale_organizer, |
|
698 EMbmAttendeeviewQgn_prop_cale_organizer_mask ); |
|
699 |
|
700 AddIconL( icons, |
|
701 KAknsIIDQgnPropCaleAccepted, |
|
702 iUiUtils->AttendeeViewIconFileL(), |
|
703 EMbmAttendeeviewQgn_prop_cale_accepted, |
|
704 EMbmAttendeeviewQgn_prop_cale_accepted_mask ); |
|
705 |
|
706 AddIconL( icons, |
|
707 KAknsIIDQgnPropCaleTentative, |
|
708 iUiUtils->AttendeeViewIconFileL(), |
|
709 EMbmAttendeeviewQgn_prop_cale_tentative, |
|
710 EMbmAttendeeviewQgn_prop_cale_tentative_mask ); |
|
711 |
|
712 AddIconL( icons, |
|
713 KAknsIIDQgnPropCaleRejected, |
|
714 iUiUtils->AttendeeViewIconFileL(), |
|
715 EMbmAttendeeviewQgn_prop_cale_rejected, |
|
716 EMbmAttendeeviewQgn_prop_cale_rejected_mask ); |
|
717 |
|
718 AddIconL( icons, |
|
719 KAknsIIDQgnPropCaleNotanswered, |
|
720 iUiUtils->AttendeeViewIconFileL(), |
|
721 EMbmAttendeeviewQgn_prop_cale_notanswered, |
|
722 EMbmAttendeeviewQgn_prop_cale_notanswered_mask ); |
|
723 |
|
724 |
|
725 SetIconArrayL( icons ); |
|
726 CleanupStack::Pop(); //icons |
|
727 } |
|
728 |
|
729 // ----------------------------------------------------------------------------- |
|
730 // CAttendeeDialogBase::AddIconL |
|
731 // ----------------------------------------------------------------------------- |
|
732 // |
|
733 void CAttendeeDialogBase::AddIconL( CAknIconArray* aIcons, |
|
734 const TAknsItemID aSkinID, |
|
735 const TDesC& aIconFileWithPath, |
|
736 TInt aIconGraphicsIndex, |
|
737 TInt aIconGraphicsMaskIndex ) |
|
738 { |
|
739 CFbsBitmap* bitmap; |
|
740 CFbsBitmap* mask; |
|
741 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
742 AknsUtils::CreateIconLC( skin, |
|
743 aSkinID, |
|
744 bitmap, |
|
745 mask, |
|
746 aIconFileWithPath, |
|
747 aIconGraphicsIndex, |
|
748 aIconGraphicsMaskIndex ); |
|
749 |
|
750 // Append it to icons array |
|
751 CGulIcon* icon = CGulIcon::NewL( bitmap, mask ); |
|
752 CleanupStack::Pop( 2 ); // mask, bitmap. icon has now ownership |
|
753 CleanupStack::PushL( icon ); |
|
754 aIcons->AppendL( icon ); |
|
755 CleanupStack::Pop(icon); // icon |
|
756 } |
|
757 |
|
758 // End of File |