|
1 /* |
|
2 * Copyright (c) 2005-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: Phonebook 2 sort order manager. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CPBK2SORTORDERMANAGER_H |
|
20 #define CPBK2SORTORDERMANAGER_H |
|
21 |
|
22 // INCLUDE FILES |
|
23 #include <e32base.h> |
|
24 |
|
25 // FORWARD DECLARATIONS |
|
26 class MVPbkContactViewBase; |
|
27 class MVPbkFieldTypeList; |
|
28 class RFs; |
|
29 class CPbk2SortOrderManagerImpl; |
|
30 |
|
31 /** |
|
32 * Observer interface for receiving notifications of |
|
33 * view sort order changes. |
|
34 */ |
|
35 class MPbk2SortOrderObserver |
|
36 { |
|
37 public: // Interface |
|
38 |
|
39 /** |
|
40 * Called when sort order has changed. |
|
41 */ |
|
42 virtual void SortOrderChanged() = 0; |
|
43 |
|
44 protected: // Disabled functions |
|
45 ~MPbk2SortOrderObserver() |
|
46 {} |
|
47 }; |
|
48 |
|
49 /** |
|
50 * Phonebook 2 sort order manager. |
|
51 * Responsible for managing the sort order of the contacts in |
|
52 * a contact view. |
|
53 */ |
|
54 class CPbk2SortOrderManager : public CBase |
|
55 { |
|
56 public: // Enumerations |
|
57 |
|
58 /// Name display orders |
|
59 enum TPbk2NameDisplayOrder |
|
60 { |
|
61 /// Last name First name |
|
62 EPbk2NameDisplayOrderLastNameFirstName, |
|
63 /// First name Last name |
|
64 EPbk2NameDisplayOrderFirstNameLastName, |
|
65 /// Last name<separator> First Name |
|
66 EPbk2NameDisplayOrderLastNameSeparatorFirstName |
|
67 }; |
|
68 |
|
69 public: // Construction and destruction |
|
70 |
|
71 /** |
|
72 * Creates a new instance of this class. |
|
73 * |
|
74 * @param aMasterFieldTypeList Master field type list. |
|
75 * Can be retrieved from Virtual |
|
76 * Phonebook contact manager. |
|
77 * @param aFs A file system session |
|
78 * reference for resource file |
|
79 * handling. If NULL then |
|
80 * an own session is created. |
|
81 * @return A new instance of this class. |
|
82 */ |
|
83 IMPORT_C static CPbk2SortOrderManager* NewL( |
|
84 const MVPbkFieldTypeList& aMasterFieldTypeList, |
|
85 RFs* aFs = NULL ); |
|
86 |
|
87 /** |
|
88 * Destructor. |
|
89 */ |
|
90 ~CPbk2SortOrderManager(); |
|
91 |
|
92 public: // Interface |
|
93 |
|
94 /** |
|
95 * Sets the contact view that this manager manages. |
|
96 * Takes in use the sort order from the given view. |
|
97 * |
|
98 * @param aContactView The contact view to manage. |
|
99 */ |
|
100 IMPORT_C void SetContactViewL( |
|
101 MVPbkContactViewBase& aContactView ); |
|
102 |
|
103 /** |
|
104 * Adds an observer. |
|
105 * |
|
106 * @param aObserver The observer to add. |
|
107 */ |
|
108 IMPORT_C void AddObserverL( |
|
109 MPbk2SortOrderObserver& aObserver ); |
|
110 |
|
111 /** |
|
112 * Removes an observer. |
|
113 * |
|
114 * @param aObserver The observer to remove. |
|
115 */ |
|
116 IMPORT_C void RemoveObserver( |
|
117 MPbk2SortOrderObserver& aObserver ); |
|
118 |
|
119 /** |
|
120 * Sets the name displaying order for the managed contact view. |
|
121 * |
|
122 * @param aNameDisplayOrder New name display order for |
|
123 * the managed contact view. |
|
124 * @param aSeparator Custom separator to be used between |
|
125 * lastname and firstname if it exists. |
|
126 * If KNullDesC is given, space is used |
|
127 * as separator. |
|
128 */ |
|
129 IMPORT_C void SetNameDisplayOrderL( |
|
130 TPbk2NameDisplayOrder aNameDisplayOrder, |
|
131 const TDesC& aSeparator = KNullDesC ); |
|
132 |
|
133 /** |
|
134 * Returns the current name display order. |
|
135 * |
|
136 * @return Current name display order. |
|
137 */ |
|
138 IMPORT_C TPbk2NameDisplayOrder NameDisplayOrder() const; |
|
139 |
|
140 /** |
|
141 * Returns the current sort order. |
|
142 * |
|
143 * @return Current sort order. |
|
144 */ |
|
145 IMPORT_C const MVPbkFieldTypeList& SortOrder() const; |
|
146 |
|
147 /** |
|
148 * Returns the language specific default separator. |
|
149 * This can not be changed run time. |
|
150 * |
|
151 * @return the language specific default separator. |
|
152 */ |
|
153 IMPORT_C const TDesC& DefaultSeparator(); |
|
154 |
|
155 /** |
|
156 * Returns the current separator. This the separator that |
|
157 * can be changed run time and saved to Central Repository. |
|
158 * |
|
159 * @return A current separator. |
|
160 */ |
|
161 IMPORT_C const TDesC& CurrentSeparator() const; |
|
162 |
|
163 private: // Implementation |
|
164 void ConstructL( |
|
165 const MVPbkFieldTypeList& aMasterFieldTypeList, |
|
166 RFs* aFs ); |
|
167 |
|
168 private: // Data |
|
169 /// Own: Implementation object |
|
170 CPbk2SortOrderManagerImpl* iImpl; |
|
171 }; |
|
172 |
|
173 #endif // CPBK2SORTORDERMANAGER_H |
|
174 |
|
175 // End of File |