diff -r 000000000000 -r 094583676ce7 PECengine/ListLibrary2/ContactListSrc/CPEngContactListSettings.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/PECengine/ListLibrary2/ContactListSrc/CPEngContactListSettings.h Thu Dec 17 08:41:52 2009 +0200 @@ -0,0 +1,414 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Container for contact list settings. +* +*/ + + + +#ifndef __CPENGCONTACTLISTSETTINGS_H__ +#define __CPENGCONTACTLISTSETTINGS_H__ + +// INCLUDES +#include +#include "MPEngContactListProperties.h" +#include "TPEngContactListBaseSettings.h" + +// CONSTANTS + +/** + * Contact list TInt property name. + * Property level: KPEngCntLstPropertyNativeCached + * + * Has contact list been synchronized + * + * Possible property values: + * - 0: (Default) not synchronized + * - 1: synchronized + */ +const TUint KPEngHasBeenSynchronized = 0x0000101; // 257 + + +/** + * Contact list TInt property name. + * Property level: KPEngCntLstPropertyNativeCached + * + * Does contact list exist on the server + * + * Possible property values: + * - 0: (Default) Does not exist on server + * - 1: list exists on the server + */ +const TUint KPEngListExistsOnServer = 0x0000103; //259 + +/** + * Contact list TInt property name. + * Property level: KPEngCntLstPropertyNativeCached + * + * Update of the contact list properties needed + * + * Possible property values: + * - 0: (Default) not updated required + * - 1: updated required + */ +const TUint KPEngPropertiesUpdateNeeded = 0x0000104; //260 + +/** + * Contact list TInt property name. + * Property level: KPEngCntLstPropertyNativeCached + * + * Should contact list be deleted from server + * + * Possible property values: + * - 0: (Default) no delete needed + * - 1: Delete of the contact list needed + */ +const TUint KPEngContactListDeleteNeeded = 0x0000105; //261 + +/** + * Contact list TInt property name. + * Property level: KPEngCntLstPropertyNativeCached + * + * Flag if update of the subscription is needed + * + * Possible property values: + * - 0: (Default) no need of update + * - 1: update of the subscription needed + */ +const TUint KPEngSubcriptionUpdate = 0x0000106; //262 + +/** + * Contact list TInt property name. + * Property level: KPEngCntLstPropertyNativeCached + * + * Flag if contact list is new default contact list + * + * Possible property values: + * - 0: (Default) not det as new default contact list + * - 1: marked as to be new default contact list + */ +const TUint KPEngNewDefaultContactList = 0x0000107; //263 + + + + +// FORWARD DECLARATIONS +class RWriteStream; +class MPEngContactListSettingsManager; +class CPEngContactListProperty; + +// CLASS DECLARATION + +/** + * Container of one contact list item. + * It includes, contact id, nick name, set of optional features + * + * @lib PEngListLib2 + * @since 3.0 + */ +NONSHARABLE_CLASS( CPEngContactListSettings ) : + public CBase, + public MPEngContactListProperties + + { +public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CPEngContactListSettings* NewLC( + const TDesC& aContactList, + const TPEngContactListBaseSettings& aBaseSettings, + MPEngContactListSettingsManager& aManager ); + + /** + * Two-phased constructor. + */ + static CPEngContactListSettings* NewServerLC( + const TDesC& aContactList, + const TDesC& aServerName, + MPEngContactListSettingsManager& aManager ); + + /** + * Two-phased constructor. + */ + static CPEngContactListSettings* NewStreamLC( + RReadStream& aStream, + MPEngContactListSettingsManager& aManager ); + /** + * Destructor. + */ + virtual ~CPEngContactListSettings(); + + + +public: // From MPEngContactListProperties + + /** + * Is contact list synchronized? + * @see + */ + TBool Synchronized() const; + + + /** + * Contact list local name. + * @see + */ + const TDesC& Name() const; + + + /** + * Contact list server name. + * @see + */ + const TDesC& ServerName() const; + + + /** + * Contact list display name. + * @see + */ + TInt DisplayName( TPtrC& aDispName ) const; + + + /** + * Sets a new display name for the contact list. + * @see + */ + void SetDisplayNameL( const TDesC& aDisplayName ); + + + /** + * Is the contact list the default list? + * @see + */ + TBool IsDefault() const; + + + /** + * Gets presence attributes used for subscription. + * @see + */ + const RArray& SubscriptionAttributes() const; + + + /** + * Sets used presence attributes for subscription. + * @see + */ + TBool SetSubscriptionAttributesL( + const MPEngAttributeList2& aAttributelist ); + TBool SetSubscriptionAttributesL( + const TArray& aAttributelist ); + + /** + * Activates subscription for the contact list + * @see + */ + TBool ActivateSubscriptionL(); + + + /** + * De Activates subscription for the contact list + * @see + */ + TBool DeActivateSubscriptionL(); + + + /** + * Gets contact list base settings. + * @see + */ + const TPEngContactListBaseSettings& BaseSettings() const; + + + /** + * Gets a property. + * @see + */ + TInt GetProperty( TUint aName, + TUint aLevel, + TInt& aValue ) const; + + TInt GetProperty( TUint aName, + TUint aLevel, + TPtrC8& aValue ) const; + + TInt GetProperty( TUint aName, + TUint aLevel, + TPtrC16& aValue ) const; + + /** + * Gets a property. + * @see + */ + TInt Property( TUint aName, TUint aLevel ) const; + + /** + * Sets a property. + * @see + */ + void SetPropertyL( TUint aName, + TUint aLevel, + TInt aValue ); + + void SetPropertyL( TUint aName, + TUint aLevel, + const TDesC8& aValue ); + + void SetPropertyL( TUint aName, + TUint aLevel, + const TDesC16& aValue ); + + /** + * Delete a property + * @see + */ + void DeletePropertyL( TUint aName, TUint aLevel ); + + + /** + * Contact list properties extension interface. + * @see + */ + inline MPEngContactListPropertiesExt* Extension() + { + return NULL; + } + + inline const MPEngContactListPropertiesExt* Extension() const + { + return NULL; + } + + + +public: // New functions + + /** + * Update contact list server name. + * Server name is composed from the user name and domain address. + * + * @since 3.0 + * @param aUserName user name + * @param aDomain domain address + */ + void UpdateListServerNameL( const TDesC& aUserName, + const TDesC& aDomain ); + + /** + * Display name + * This can be called even when contact list hasn't been + * synchronized + * + * @since 3.0 + * @return display name + */ + const TDesC& DispName() const; + + + /** + * Push Display name update. + * Update display name, flag for property update it skipped + * Ownership of given buffer is taken in all cases. + * + * @since 3.0 + * @param aDispName New display name. + */ + void PushUpdateDisplayNameL( HBufC* aDispName ); + + + /** + * Updates contact list type. + * + * @since 3.0 + * @param aContactListType New type for the contact list. + */ + void UpdateListTypeL( TPEngContactListType aContactListType ); + + + /** + * Externalizes contact list settings to the stream + * + * @since 3.0 + * @param aStream Stream to write to. + */ + void ExternalizeL( RWriteStream& aStream, + TInt aStorageType ) const; + + /** + * Internalize contact list settings from the stream + * + * @since 3.0 + * @param aStream stream to read from + */ + void InternalizeL( RReadStream& aStream, + TInt aStorageType ); + +private: + + /** + * C++ constructor. + */ + CPEngContactListSettings( + const TPEngContactListBaseSettings& aBaseSettings, + MPEngContactListSettingsManager& aManager ); + + /** + * C++ constructor. + */ + CPEngContactListSettings( + MPEngContactListSettingsManager& aManager ); + + /** + * Symbian 2nd phase constructor + */ + void ConstructL( const TDesC& aContactList ); + + /** + * Symbian 2nd phase constructor + */ + void ConstructServerL( const TDesC& aContactList, + const TDesC& aServerName ); + + +private: // Data + + /// REF: Store entry of contact list settings + MPEngContactListSettingsManager& iSettingsManager; + + /// OWN: Store Id of the contact list, same as local name of contact list + HBufC* iName; + + /// OWN: Contact list server name + HBufC* iServerName; + + /// OWN: Display name of the contact list + HBufC* iDisplayName; + + /// OWN: Contact list base behavior + TPEngContactListBaseSettings iBehavior; + + /// OWN: properties of the contact list + RPointerArray iProperties; + + /// OWN: Presence attributes for subscription + RArray iSubscriptionAttrs; + }; + +#endif // __CPENGCONTACTLISTSETTINGS_H__ + +// End of File +