|
1 /* |
|
2 * Copyright (c) 2006 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: Stores found contacts and keeps track of the references. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef CPHCNTFOUNDCONTACTS_H |
|
21 #define CPHCNTFOUNDCONTACTS_H |
|
22 |
|
23 #include <e32base.h> |
|
24 |
|
25 class CPhCntContact; |
|
26 |
|
27 /** |
|
28 * Responsible to hold found contacts. Takes the ownership of the contacts. |
|
29 * The contacts must be removed using MPhCntContact::Release when contact |
|
30 * no longer needed. |
|
31 * |
|
32 * @lib PhoneCntFinder |
|
33 * @since S60 v3.1 |
|
34 */ |
|
35 NONSHARABLE_CLASS( CPhCntFoundContacts ) : public CBase |
|
36 { |
|
37 public: |
|
38 |
|
39 static CPhCntFoundContacts* NewL(); |
|
40 |
|
41 static CPhCntFoundContacts* NewLC(); |
|
42 |
|
43 virtual ~CPhCntFoundContacts(); |
|
44 |
|
45 /** |
|
46 * Adds contact. Takes the ownership. |
|
47 * |
|
48 * @since S60 v3.1 |
|
49 * @param aContact Contact |
|
50 * @param aOriginalNumber Number used to match aContact. |
|
51 */ |
|
52 void AddL( CPhCntContact* aContact, const TDesC& aOriginalNumber ); |
|
53 |
|
54 /** |
|
55 * Removes and deletes contact. Even if contact |
|
56 * is not found, aContact is deleted. |
|
57 * |
|
58 * @since S60 v3.1 |
|
59 * @param aContact Contact to be deleted. |
|
60 */ |
|
61 void Remove( CPhCntContact* aContact ); |
|
62 |
|
63 /** |
|
64 * Finds a contact which has been stored here. |
|
65 * |
|
66 * @since S60 v3.1 |
|
67 * @param aTelNumber Number used for matching contact. |
|
68 * @return Found contact or NULL if contact not found. |
|
69 * Ownership is NOT given to client. CPhCntContact |
|
70 * must be destroyed using Release method of CPhCntContact. |
|
71 */ |
|
72 CPhCntContact* FindContact( const TDesC& aTelNumber ); |
|
73 |
|
74 /** |
|
75 * Finds a contact which has been stored here. |
|
76 * |
|
77 * @since S60 v3.1 |
|
78 * @param aTelNumber Number used for matching contact. |
|
79 * @param aContactLink ContactLink of the wanted contact. |
|
80 * @return Found contact or NULL if contact not found. |
|
81 * Ownership is NOT given to client. CPhCntContact |
|
82 * can be destroyed using Release method of CPhCntContact. |
|
83 */ |
|
84 CPhCntContact* FindContact( |
|
85 const TDesC& aTelNumber, |
|
86 const MVPbkContactLink& aContactLink ); |
|
87 |
|
88 /** |
|
89 * Finds contact which has been stored here. |
|
90 * |
|
91 * @since s60 v3.1 |
|
92 * @param aContactLink Contact link of wanted contact. |
|
93 * @return Found contact or NULL if contact not found. |
|
94 * Ownership is NOT given to client. CPhCntContact |
|
95 * can be destroyed using Release method of CPhCntContact. |
|
96 */ |
|
97 CPhCntContact* FindContact(const MVPbkContactLink& aContactLink ); |
|
98 |
|
99 private: |
|
100 |
|
101 CPhCntFoundContacts(); |
|
102 |
|
103 void ConstructL(); |
|
104 |
|
105 private: // data |
|
106 |
|
107 /** |
|
108 * Array of contacts already found. |
|
109 * Own. |
|
110 */ |
|
111 RPointerArray<CPhCntContact> iFoundContacts; |
|
112 }; |
|
113 |
|
114 |
|
115 #endif // CPHCNTFOUNDCONTACTS_H |