|
1 /* |
|
2 * Copyright (c) 2007 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: Definition of the class PbkxRclUtils. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef PBKXRCLUTILS_H |
|
20 #define PBKXRCLUTILS_H |
|
21 |
|
22 #include <CPbkContactItem.h> |
|
23 #include <tpbkxremotecontactlookupprotocolaccountid.h> |
|
24 |
|
25 class CPbkContactEngine; |
|
26 |
|
27 /** |
|
28 * Class that offers static helper methods. |
|
29 * |
|
30 * @lib pbkxrclengine.lib |
|
31 * @since S60 3.1 |
|
32 */ |
|
33 class PbkxRclUtils |
|
34 { |
|
35 public: // static methods |
|
36 |
|
37 /** |
|
38 * Returns text of the given field of the given contact. |
|
39 * |
|
40 * If there are multiple fields with given id, first one is returned. |
|
41 * |
|
42 * @param aItem Contact item which field text is asked. |
|
43 * @param aId Field id. |
|
44 * @return Text of the field or empty text if none is found. |
|
45 */ |
|
46 static HBufC* FieldTextL( const CPbkContactItem* aItem, TPbkFieldId aId ); |
|
47 |
|
48 /** |
|
49 * Returns tet of the given field. |
|
50 * |
|
51 * @param aField Field which text is wanted. |
|
52 * @return Field text. |
|
53 */ |
|
54 static HBufC* FieldTextL( TPbkContactItemField& aField ); |
|
55 |
|
56 /** |
|
57 * Returns the text in the given field, if such field exists and it's type is |
|
58 * text. |
|
59 * |
|
60 * If there are more than one fields with given type, the first one is returned. |
|
61 * |
|
62 * @param aCard Contact card. |
|
63 * @param aFieldType Type of the field. |
|
64 */ |
|
65 static TPtrC FieldText( const CContactCard* aCard, TFieldType aFieldType ); |
|
66 |
|
67 /** |
|
68 * Gets the default protocol account id. |
|
69 * |
|
70 * Leaves with KErrNotFound if default account id is not set. |
|
71 */ |
|
72 static TPbkxRemoteContactLookupProtocolAccountId DefaultProtocolAccountIdL(); |
|
73 |
|
74 /** |
|
75 * Stores default protocol account id. |
|
76 * |
|
77 * @param aId Account id to be stored. |
|
78 */ |
|
79 static void StoreDefaultProtocolAccountIdL( |
|
80 TPbkxRemoteContactLookupProtocolAccountId aId ); |
|
81 |
|
82 /** |
|
83 * Returns ETrue if given text contains at least one alpha |
|
84 * characters. |
|
85 * |
|
86 * @param aText Text to be investigated. |
|
87 * @return ETrue if given text contains at least one alpha character. |
|
88 */ |
|
89 static TBool HasAlphaCharsInString( const TDesC& aText ); |
|
90 |
|
91 /** |
|
92 * Creates new contact item of the given contact card. |
|
93 * |
|
94 * @param aCard Contact card. |
|
95 * @param aEngine Contact engine. |
|
96 * @return Created item. Ownership is transferred. |
|
97 */ |
|
98 static CPbkContactItem* CreateContactItemL( |
|
99 CContactCard* aCard, |
|
100 CPbkContactEngine& aEngine ); |
|
101 |
|
102 }; |
|
103 |
|
104 #endif |