|
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: |
|
13 * |
|
14 * Description: Provides methods for Attendee View's engine utilities class. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include "AttendeeEngUtils.h" |
|
22 #include "CAttendeeItemList.h" |
|
23 #include "CAttendeeItem.h" |
|
24 #include <calentry.h> |
|
25 #include <cpbkcontactitem.h> |
|
26 #include <caluser.h> |
|
27 |
|
28 // ============================ MEMBER FUNCTIONS ============================== |
|
29 // --------------------------------------------------------- |
|
30 // AttendeeEngUtils::FindLastRequiredItem |
|
31 // --------------------------------------------------------- |
|
32 // |
|
33 TInt AttendeeEngUtils::FindLastRequiredItemL( CAttendeeItemList& aAttendees ) |
|
34 { |
|
35 const TInt count( aAttendees.Count() ); |
|
36 TInt i( 0 ); |
|
37 for ( ; i < count; ++i ) |
|
38 { |
|
39 CAttendeeItem* item = aAttendees.At( i ); |
|
40 |
|
41 if(!item->IsOrganizer() && |
|
42 item->AttendanceL() != CAttendeeItem::ERequire ) |
|
43 { |
|
44 return ++i; |
|
45 } |
|
46 } |
|
47 |
|
48 return i; |
|
49 } |
|
50 |
|
51 // --------------------------------------------------------- |
|
52 // AttendeeEngUtils::CheckIfDeleted |
|
53 // --------------------------------------------------------- |
|
54 // |
|
55 void AttendeeEngUtils::CheckIfDeleted( CAttendeeItem& aItem, |
|
56 CAttendeeItemList& aDeleted ) |
|
57 { |
|
58 const TInt count( aDeleted.Count() ); |
|
59 for ( TInt i( 0 ); i < count; ++i ) |
|
60 { |
|
61 CAttendeeItem* temp = aDeleted.At( i ); |
|
62 if ( aItem.ContactId() == temp->ContactId() ) |
|
63 { |
|
64 if ( aItem.AgnAttendee()->Address().Compare( |
|
65 temp->AgnAttendee()->Address() ) == 0 ) |
|
66 { |
|
67 aDeleted.Remove( i ); |
|
68 delete temp; |
|
69 temp = NULL; |
|
70 } |
|
71 } |
|
72 } |
|
73 } |
|
74 |
|
75 // --------------------------------------------------------- |
|
76 // AttendeeEngUtils::Compare |
|
77 // --------------------------------------------------------- |
|
78 // |
|
79 TBool AttendeeEngUtils::Compare( CPbkContactItem& aContactItem, |
|
80 CAttendeeItem& aAttendeeItem ) |
|
81 { |
|
82 TInt index( 0 ); |
|
83 const TInt count( aContactItem.PbkFieldCount() ); |
|
84 while ( index < count ) |
|
85 { |
|
86 TPbkContactItemField* itemField = |
|
87 aContactItem.FindField( EPbkFieldIdEmailAddress, index ); |
|
88 if ( itemField ) |
|
89 { |
|
90 if ( itemField->Text().Compare( |
|
91 aAttendeeItem.AgnAttendee()->Address() ) == 0 ) |
|
92 { |
|
93 return ETrue; |
|
94 } |
|
95 } |
|
96 ++index; |
|
97 } |
|
98 |
|
99 return EFalse; |
|
100 } |
|
101 |
|
102 // End of File |