williamr@4: /* williamr@4: * Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies). williamr@4: * All rights reserved. williamr@4: * This component and the accompanying materials are made available williamr@4: * under the terms of "Eclipse Public License v1.0" williamr@4: * which accompanies this distribution, and is available williamr@4: * at the URL "http://www.eclipse.org/legal/epl-v10.html". williamr@4: * williamr@4: * Initial Contributors: williamr@4: * Nokia Corporation - initial contribution. williamr@4: * williamr@4: * Contributors: williamr@4: * williamr@4: * Description: Phonebook 2 sort order manager. williamr@4: * williamr@4: */ williamr@4: williamr@4: williamr@4: #ifndef CPBK2SORTORDERMANAGER_H williamr@4: #define CPBK2SORTORDERMANAGER_H williamr@4: williamr@4: // INCLUDE FILES williamr@4: #include williamr@4: williamr@4: // FORWARD DECLARATIONS williamr@4: class MVPbkContactViewBase; williamr@4: class MVPbkFieldTypeList; williamr@4: class RFs; williamr@4: class CPbk2SortOrderManagerImpl; williamr@4: williamr@4: /** williamr@4: * Observer interface for receiving notifications of williamr@4: * view sort order changes. williamr@4: */ williamr@4: class MPbk2SortOrderObserver williamr@4: { williamr@4: public: // Interface williamr@4: williamr@4: /** williamr@4: * Called when sort order has changed. williamr@4: */ williamr@4: virtual void SortOrderChanged() = 0; williamr@4: williamr@4: protected: // Disabled functions williamr@4: ~MPbk2SortOrderObserver() williamr@4: {} williamr@4: }; williamr@4: williamr@4: /** williamr@4: * Phonebook 2 sort order manager. williamr@4: * Responsible for managing the sort order of the contacts in williamr@4: * a contact view. williamr@4: */ williamr@4: class CPbk2SortOrderManager : public CBase williamr@4: { williamr@4: public: // Enumerations williamr@4: williamr@4: /// Name display orders williamr@4: enum TPbk2NameDisplayOrder williamr@4: { williamr@4: /// Last name First name williamr@4: EPbk2NameDisplayOrderLastNameFirstName, williamr@4: /// First name Last name williamr@4: EPbk2NameDisplayOrderFirstNameLastName, williamr@4: /// Last name First Name williamr@4: EPbk2NameDisplayOrderLastNameSeparatorFirstName williamr@4: }; williamr@4: williamr@4: public: // Construction and destruction williamr@4: williamr@4: /** williamr@4: * Creates a new instance of this class. williamr@4: * williamr@4: * @param aMasterFieldTypeList Master field type list. williamr@4: * Can be retrieved from Virtual williamr@4: * Phonebook contact manager. williamr@4: * @param aFs A file system session williamr@4: * reference for resource file williamr@4: * handling. If NULL then williamr@4: * an own session is created. williamr@4: * @return A new instance of this class. williamr@4: */ williamr@4: IMPORT_C static CPbk2SortOrderManager* NewL( williamr@4: const MVPbkFieldTypeList& aMasterFieldTypeList, williamr@4: RFs* aFs = NULL ); williamr@4: williamr@4: /** williamr@4: * Destructor. williamr@4: */ williamr@4: ~CPbk2SortOrderManager(); williamr@4: williamr@4: public: // Interface williamr@4: williamr@4: /** williamr@4: * Sets the contact view that this manager manages. williamr@4: * Takes in use the sort order from the given view. williamr@4: * williamr@4: * @param aContactView The contact view to manage. williamr@4: */ williamr@4: IMPORT_C void SetContactViewL( williamr@4: MVPbkContactViewBase& aContactView ); williamr@4: williamr@4: /** williamr@4: * Adds an observer. williamr@4: * williamr@4: * @param aObserver The observer to add. williamr@4: */ williamr@4: IMPORT_C void AddObserverL( williamr@4: MPbk2SortOrderObserver& aObserver ); williamr@4: williamr@4: /** williamr@4: * Removes an observer. williamr@4: * williamr@4: * @param aObserver The observer to remove. williamr@4: */ williamr@4: IMPORT_C void RemoveObserver( williamr@4: MPbk2SortOrderObserver& aObserver ); williamr@4: williamr@4: /** williamr@4: * Sets the name displaying order for the managed contact view. williamr@4: * williamr@4: * @param aNameDisplayOrder New name display order for williamr@4: * the managed contact view. williamr@4: * @param aSeparator Custom separator to be used between williamr@4: * lastname and firstname if it exists. williamr@4: * If KNullDesC is given, space is used williamr@4: * as separator. williamr@4: */ williamr@4: IMPORT_C void SetNameDisplayOrderL( williamr@4: TPbk2NameDisplayOrder aNameDisplayOrder, williamr@4: const TDesC& aSeparator = KNullDesC ); williamr@4: williamr@4: /** williamr@4: * Returns the current name display order. williamr@4: * williamr@4: * @return Current name display order. williamr@4: */ williamr@4: IMPORT_C TPbk2NameDisplayOrder NameDisplayOrder() const; williamr@4: williamr@4: /** williamr@4: * Returns the current sort order. williamr@4: * williamr@4: * @return Current sort order. williamr@4: */ williamr@4: IMPORT_C const MVPbkFieldTypeList& SortOrder() const; williamr@4: williamr@4: /** williamr@4: * Returns the language specific default separator. williamr@4: * This can not be changed run time. williamr@4: * williamr@4: * @return the language specific default separator. williamr@4: */ williamr@4: IMPORT_C const TDesC& DefaultSeparator(); williamr@4: williamr@4: /** williamr@4: * Returns the current separator. This the separator that williamr@4: * can be changed run time and saved to Central Repository. williamr@4: * williamr@4: * @return A current separator. williamr@4: */ williamr@4: IMPORT_C const TDesC& CurrentSeparator() const; williamr@4: williamr@4: private: // Implementation williamr@4: void ConstructL( williamr@4: const MVPbkFieldTypeList& aMasterFieldTypeList, williamr@4: RFs* aFs ); williamr@4: williamr@4: private: // Data williamr@4: /// Own: Implementation object williamr@4: CPbk2SortOrderManagerImpl* iImpl; williamr@4: }; williamr@4: williamr@4: #endif // CPBK2SORTORDERMANAGER_H williamr@4: williamr@4: // End of File