1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/epoc32/include/app/CPbk2SortOrderManager.h Wed Mar 31 12:33:34 2010 +0100
1.3 @@ -0,0 +1,175 @@
1.4 +/*
1.5 +* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
1.6 +* All rights reserved.
1.7 +* This component and the accompanying materials are made available
1.8 +* under the terms of "Eclipse Public License v1.0"
1.9 +* which accompanies this distribution, and is available
1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.11 +*
1.12 +* Initial Contributors:
1.13 +* Nokia Corporation - initial contribution.
1.14 +*
1.15 +* Contributors:
1.16 +*
1.17 +* Description: Phonebook 2 sort order manager.
1.18 +*
1.19 +*/
1.20 +
1.21 +
1.22 +#ifndef CPBK2SORTORDERMANAGER_H
1.23 +#define CPBK2SORTORDERMANAGER_H
1.24 +
1.25 +// INCLUDE FILES
1.26 +#include <e32base.h>
1.27 +
1.28 +// FORWARD DECLARATIONS
1.29 +class MVPbkContactViewBase;
1.30 +class MVPbkFieldTypeList;
1.31 +class RFs;
1.32 +class CPbk2SortOrderManagerImpl;
1.33 +
1.34 +/**
1.35 + * Observer interface for receiving notifications of
1.36 + * view sort order changes.
1.37 + */
1.38 +class MPbk2SortOrderObserver
1.39 + {
1.40 + public: // Interface
1.41 +
1.42 + /**
1.43 + * Called when sort order has changed.
1.44 + */
1.45 + virtual void SortOrderChanged() = 0;
1.46 +
1.47 + protected: // Disabled functions
1.48 + ~MPbk2SortOrderObserver()
1.49 + {}
1.50 + };
1.51 +
1.52 +/**
1.53 + * Phonebook 2 sort order manager.
1.54 + * Responsible for managing the sort order of the contacts in
1.55 + * a contact view.
1.56 + */
1.57 +class CPbk2SortOrderManager : public CBase
1.58 + {
1.59 + public: // Enumerations
1.60 +
1.61 + /// Name display orders
1.62 + enum TPbk2NameDisplayOrder
1.63 + {
1.64 + /// Last name First name
1.65 + EPbk2NameDisplayOrderLastNameFirstName,
1.66 + /// First name Last name
1.67 + EPbk2NameDisplayOrderFirstNameLastName,
1.68 + /// Last name<separator> First Name
1.69 + EPbk2NameDisplayOrderLastNameSeparatorFirstName
1.70 + };
1.71 +
1.72 + public: // Construction and destruction
1.73 +
1.74 + /**
1.75 + * Creates a new instance of this class.
1.76 + *
1.77 + * @param aMasterFieldTypeList Master field type list.
1.78 + * Can be retrieved from Virtual
1.79 + * Phonebook contact manager.
1.80 + * @param aFs A file system session
1.81 + * reference for resource file
1.82 + * handling. If NULL then
1.83 + * an own session is created.
1.84 + * @return A new instance of this class.
1.85 + */
1.86 + IMPORT_C static CPbk2SortOrderManager* NewL(
1.87 + const MVPbkFieldTypeList& aMasterFieldTypeList,
1.88 + RFs* aFs = NULL );
1.89 +
1.90 + /**
1.91 + * Destructor.
1.92 + */
1.93 + ~CPbk2SortOrderManager();
1.94 +
1.95 + public: // Interface
1.96 +
1.97 + /**
1.98 + * Sets the contact view that this manager manages.
1.99 + * Takes in use the sort order from the given view.
1.100 + *
1.101 + * @param aContactView The contact view to manage.
1.102 + */
1.103 + IMPORT_C void SetContactViewL(
1.104 + MVPbkContactViewBase& aContactView );
1.105 +
1.106 + /**
1.107 + * Adds an observer.
1.108 + *
1.109 + * @param aObserver The observer to add.
1.110 + */
1.111 + IMPORT_C void AddObserverL(
1.112 + MPbk2SortOrderObserver& aObserver );
1.113 +
1.114 + /**
1.115 + * Removes an observer.
1.116 + *
1.117 + * @param aObserver The observer to remove.
1.118 + */
1.119 + IMPORT_C void RemoveObserver(
1.120 + MPbk2SortOrderObserver& aObserver );
1.121 +
1.122 + /**
1.123 + * Sets the name displaying order for the managed contact view.
1.124 + *
1.125 + * @param aNameDisplayOrder New name display order for
1.126 + * the managed contact view.
1.127 + * @param aSeparator Custom separator to be used between
1.128 + * lastname and firstname if it exists.
1.129 + * If KNullDesC is given, space is used
1.130 + * as separator.
1.131 + */
1.132 + IMPORT_C void SetNameDisplayOrderL(
1.133 + TPbk2NameDisplayOrder aNameDisplayOrder,
1.134 + const TDesC& aSeparator = KNullDesC );
1.135 +
1.136 + /**
1.137 + * Returns the current name display order.
1.138 + *
1.139 + * @return Current name display order.
1.140 + */
1.141 + IMPORT_C TPbk2NameDisplayOrder NameDisplayOrder() const;
1.142 +
1.143 + /**
1.144 + * Returns the current sort order.
1.145 + *
1.146 + * @return Current sort order.
1.147 + */
1.148 + IMPORT_C const MVPbkFieldTypeList& SortOrder() const;
1.149 +
1.150 + /**
1.151 + * Returns the language specific default separator.
1.152 + * This can not be changed run time.
1.153 + *
1.154 + * @return the language specific default separator.
1.155 + */
1.156 + IMPORT_C const TDesC& DefaultSeparator();
1.157 +
1.158 + /**
1.159 + * Returns the current separator. This the separator that
1.160 + * can be changed run time and saved to Central Repository.
1.161 + *
1.162 + * @return A current separator.
1.163 + */
1.164 + IMPORT_C const TDesC& CurrentSeparator() const;
1.165 +
1.166 + private: // Implementation
1.167 + void ConstructL(
1.168 + const MVPbkFieldTypeList& aMasterFieldTypeList,
1.169 + RFs* aFs );
1.170 +
1.171 + private: // Data
1.172 + /// Own: Implementation object
1.173 + CPbk2SortOrderManagerImpl* iImpl;
1.174 + };
1.175 +
1.176 +#endif // CPBK2SORTORDERMANAGER_H
1.177 +
1.178 +// End of File