2 * Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
14 * Description: Phonebook 2 sort order manager.
19 #ifndef CPBK2SORTORDERMANAGER_H
20 #define CPBK2SORTORDERMANAGER_H
25 // FORWARD DECLARATIONS
26 class MVPbkContactViewBase;
27 class MVPbkFieldTypeList;
29 class CPbk2SortOrderManagerImpl;
32 * Observer interface for receiving notifications of
33 * view sort order changes.
35 class MPbk2SortOrderObserver
40 * Called when sort order has changed.
42 virtual void SortOrderChanged() = 0;
44 protected: // Disabled functions
45 ~MPbk2SortOrderObserver()
50 * Phonebook 2 sort order manager.
51 * Responsible for managing the sort order of the contacts in
54 class CPbk2SortOrderManager : public CBase
56 public: // Enumerations
58 /// Name display orders
59 enum TPbk2NameDisplayOrder
61 /// Last name First name
62 EPbk2NameDisplayOrderLastNameFirstName,
63 /// First name Last name
64 EPbk2NameDisplayOrderFirstNameLastName,
65 /// Last name<separator> First Name
66 EPbk2NameDisplayOrderLastNameSeparatorFirstName
69 public: // Construction and destruction
72 * Creates a new instance of this class.
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.
83 IMPORT_C static CPbk2SortOrderManager* NewL(
84 const MVPbkFieldTypeList& aMasterFieldTypeList,
90 ~CPbk2SortOrderManager();
95 * Sets the contact view that this manager manages.
96 * Takes in use the sort order from the given view.
98 * @param aContactView The contact view to manage.
100 IMPORT_C void SetContactViewL(
101 MVPbkContactViewBase& aContactView );
106 * @param aObserver The observer to add.
108 IMPORT_C void AddObserverL(
109 MPbk2SortOrderObserver& aObserver );
112 * Removes an observer.
114 * @param aObserver The observer to remove.
116 IMPORT_C void RemoveObserver(
117 MPbk2SortOrderObserver& aObserver );
120 * Sets the name displaying order for the managed contact view.
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
129 IMPORT_C void SetNameDisplayOrderL(
130 TPbk2NameDisplayOrder aNameDisplayOrder,
131 const TDesC& aSeparator = KNullDesC );
134 * Returns the current name display order.
136 * @return Current name display order.
138 IMPORT_C TPbk2NameDisplayOrder NameDisplayOrder() const;
141 * Returns the current sort order.
143 * @return Current sort order.
145 IMPORT_C const MVPbkFieldTypeList& SortOrder() const;
148 * Returns the language specific default separator.
149 * This can not be changed run time.
151 * @return the language specific default separator.
153 IMPORT_C const TDesC& DefaultSeparator();
156 * Returns the current separator. This the separator that
157 * can be changed run time and saved to Central Repository.
159 * @return A current separator.
161 IMPORT_C const TDesC& CurrentSeparator() const;
163 private: // Implementation
165 const MVPbkFieldTypeList& aMasterFieldTypeList,
169 /// Own: Implementation object
170 CPbk2SortOrderManagerImpl* iImpl;
173 #endif // CPBK2SORTORDERMANAGER_H