|
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: Utility class to store settings for predictive search. |
|
15 * Used to set the desired data stores to search and |
|
16 * the display fields for predictive search. |
|
17 * |
|
18 */ |
|
19 |
|
20 #ifndef __CPS_SETTINGS_H__ |
|
21 #define __CPS_SETTINGS_H__ |
|
22 |
|
23 // SYSTEM INCLUDES |
|
24 #include <e32base.h> |
|
25 #include <s32strm.h> |
|
26 #include <CPcsDefs.h> |
|
27 |
|
28 // CLASS DECLARATION |
|
29 |
|
30 /** |
|
31 * Utility class to store settings for predictive search. |
|
32 * |
|
33 * @lib pcsutils.lib |
|
34 * @since S60 v3.2 |
|
35 */ |
|
36 class CPsSettings : public CBase |
|
37 { |
|
38 public: |
|
39 |
|
40 /** |
|
41 * Two phase construction. |
|
42 * |
|
43 * @return Instance of CPsSettings |
|
44 */ |
|
45 IMPORT_C static CPsSettings* NewL(); |
|
46 |
|
47 /** |
|
48 * Destructor. |
|
49 */ |
|
50 IMPORT_C ~CPsSettings(); |
|
51 |
|
52 /** |
|
53 * Creates a clone of the settings |
|
54 */ |
|
55 IMPORT_C CPsSettings* CloneL() const; |
|
56 |
|
57 /** |
|
58 * Sets the list of URIs to search from. |
|
59 * |
|
60 * @param aSearchUri The list of database URIs to be searched. |
|
61 */ |
|
62 IMPORT_C void SetSearchUrisL(const RPointerArray<TDesC>& aSearchUri); |
|
63 |
|
64 /** |
|
65 * Sets the list of fields to display. |
|
66 * |
|
67 * @param aDisplayFields The list of fields to display. |
|
68 */ |
|
69 IMPORT_C void SetDisplayFieldsL(const RArray<TInt>& aDisplayFields); |
|
70 |
|
71 /** |
|
72 * Sets the maximum number of elements (contacts) to be given to client. |
|
73 * If number is set to -1: The entire search result will be returned. |
|
74 * Otherwise: Top N search results will be returned |
|
75 * |
|
76 * @param aMaxResults The maximum number of elements. |
|
77 */ |
|
78 IMPORT_C void SetMaxResults(const TInt aMaxResults); |
|
79 |
|
80 /** |
|
81 * Returns the list of URIs configured to search from. |
|
82 * |
|
83 * @return aSearchUri - Contains the Uris that will be searched |
|
84 */ |
|
85 IMPORT_C void SearchUrisL(RPointerArray<TDesC>& aSearchUri) const; |
|
86 |
|
87 /** |
|
88 * Sets the sort type based on which sorting will be done |
|
89 */ |
|
90 IMPORT_C void SetSortType(const TSortType aSortType); |
|
91 |
|
92 /* |
|
93 * Returns the list of fields to display. |
|
94 * |
|
95 * @return aDisplayFields - Contains the fileds that will be displayed |
|
96 */ |
|
97 IMPORT_C void DisplayFieldsL(RArray<TInt>& aDisplayFields) const; |
|
98 |
|
99 /** |
|
100 * Returns the maximum number of elements (contacts) to be given to client. |
|
101 * |
|
102 * @return TInt The maximum number of elements. |
|
103 */ |
|
104 IMPORT_C TInt MaxResults() const; |
|
105 |
|
106 /** |
|
107 * Returns the GroupId from the settings |
|
108 * |
|
109 * @param - aGroupIdArray - Array of GroupIds |
|
110 * @return - none |
|
111 */ |
|
112 IMPORT_C void GetGroupIdsL(RArray<TInt>& aGroupIdArray); |
|
113 |
|
114 /** |
|
115 * Returns the sort type |
|
116 */ |
|
117 IMPORT_C TSortType GetSortType() const; |
|
118 |
|
119 /** |
|
120 * Writes 'this' to the stream. |
|
121 * |
|
122 * @param aStream WriteStream with externalized contents. |
|
123 */ |
|
124 IMPORT_C virtual void ExternalizeL(RWriteStream& aStream) const; |
|
125 |
|
126 /** |
|
127 * Initializes 'this' from stream. |
|
128 * |
|
129 * @param aStream ReadStream with data contents to be internalized. |
|
130 */ |
|
131 IMPORT_C virtual void InternalizeL(RReadStream& aStream); |
|
132 |
|
133 private: |
|
134 |
|
135 /** |
|
136 * Default Constructor |
|
137 */ |
|
138 CPsSettings(); |
|
139 |
|
140 /** |
|
141 * Second phase constructor |
|
142 */ |
|
143 void ConstructL(); |
|
144 |
|
145 private: |
|
146 |
|
147 /** |
|
148 * Database URIs |
|
149 */ |
|
150 RPointerArray<TDesC> iSearchUri; |
|
151 |
|
152 /** |
|
153 * Display fields |
|
154 */ |
|
155 RArray<TInt> iDisplayFields; |
|
156 |
|
157 /** |
|
158 * Maximum number of results that will be displayed to the client |
|
159 * (Top N contacts will be displayed) |
|
160 */ |
|
161 TInt iMaxResults; |
|
162 /** |
|
163 * Sort type whether to sort based on alphabets or on match patterns |
|
164 */ |
|
165 TSortType iSortType; |
|
166 |
|
167 }; |
|
168 |
|
169 #endif // __CPS_SETTINGS_H__ |
|
170 |
|
171 // End of file |