williamr@2: /* williamr@2: * Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). williamr@2: * All rights reserved. williamr@2: * This component and the accompanying materials are made available williamr@2: * under the terms of the License "Eclipse Public License v1.0" williamr@2: * which accompanies this distribution, and is available williamr@2: * at the URL "http://www.eclipse.org/legal/epl-v10.html". williamr@2: * williamr@2: * Initial Contributors: williamr@2: * Nokia Corporation - initial contribution. williamr@2: * williamr@2: * Contributors: williamr@2: * williamr@2: * Description: Declaration of FavouritesItem williamr@2: * williamr@2: */ williamr@2: williamr@2: williamr@2: #ifndef FAVOURITES_ITEM_H williamr@2: #define FAVOURITES_ITEM_H williamr@2: williamr@2: // INCLUDES williamr@2: williamr@2: #include williamr@2: #include williamr@2: #include williamr@2: williamr@2: // FORWARD DECLARATION williamr@2: williamr@2: class CFavouritesItemImpl; williamr@2: class RWriteStream; williamr@2: class RReadStream; williamr@2: williamr@2: // CLASS DECLARATION williamr@2: williamr@2: /** williamr@2: * CFavouritesItem is the base class for representing one favourites entry (item or folder). williamr@2: * Instances of this class are used to exchange data between the Favourites williamr@2: * Engine and clients using it. williamr@2: */ williamr@2: class CFavouritesItem: public CBase williamr@2: { williamr@2: williamr@2: public: // Data types williamr@2: williamr@2: /** williamr@2: * Defines the type of an item (item or folder). williamr@2: */ williamr@2: enum TType /// Type of an item (item or folder). williamr@2: { williamr@2: /* williamr@2: * Invalid value, can not be set for a CFavouritesItem williamr@2: * @see For more informaiton on ENone, see CFavouritesItem. williamr@2: */ williamr@2: ENone, williamr@2: /* williamr@2: * Favourites item williamr@2: * @see For more informaiton on ENone, see CFavouritesItem. williamr@2: */ williamr@2: EItem, williamr@2: /* williamr@2: * Favourites folder. williamr@2: * @see For more informaiton on ENone, see CFavouritesItem. williamr@2: */ williamr@2: EFolder williamr@2: }; williamr@2: williamr@2: public: // Constructors and destructor williamr@2: williamr@2: /** williamr@2: * Two-phased constructor. Leaves on failure. Places the instance on the williamr@2: * cleanup stack. williamr@2: * @since 0.9 williamr@2: * @return The constructed item. williamr@2: */ williamr@2: IMPORT_C static CFavouritesItem* NewLC(); williamr@2: williamr@2: /** williamr@2: * Two-phased constructor. Leaves on failure. williamr@2: * @since 0.9 williamr@2: * @return The constructed item. williamr@2: */ williamr@2: IMPORT_C static CFavouritesItem* NewL(); williamr@2: williamr@2: /** williamr@2: * Destructor. williamr@2: * @since 0.9 williamr@2: */ williamr@2: IMPORT_C virtual ~CFavouritesItem(); williamr@2: williamr@2: /** williamr@2: * Assignment operator. williamr@2: * @since 0.9 williamr@2: * @param aCopyFrom Assign from this. williamr@2: */ williamr@2: IMPORT_C CFavouritesItem& operator= williamr@2: ( const CFavouritesItem& aCopyFrom ); williamr@2: williamr@2: public: // Query williamr@2: williamr@2: /** williamr@2: * Get unique id of the item. williamr@2: * @since 0.9 williamr@2: * @return The unique id. williamr@2: */ williamr@2: IMPORT_C TInt Uid() const; williamr@2: williamr@2: /** williamr@2: * Get the uid of the parent folder of this item. williamr@2: * @since 0.9 williamr@2: * @return The unique id of the parent folder. williamr@2: */ williamr@2: IMPORT_C TInt ParentFolder() const; williamr@2: williamr@2: /** williamr@2: * Get type of the item (item or folder). williamr@2: * @since 0.9 williamr@2: * @return The type of the item. It is either EFolder or EItem williamr@2: * (never ENone). williamr@2: */ williamr@2: williamr@2: IMPORT_C TType Type() const; williamr@2: williamr@2: /** williamr@2: * Get the name of this item. williamr@2: * @since 0.9 williamr@2: * @return The name of this item. williamr@2: */ williamr@2: IMPORT_C const TPtrC Name() const; williamr@2: williamr@2: /** williamr@2: * Get the URL of this item. williamr@2: * @since 0.9 williamr@2: * @return The URL of this item. williamr@2: */ williamr@2: IMPORT_C const TPtrC Url() const; williamr@2: williamr@2: /** williamr@2: * Get WAP Access Point id associated with this item. williamr@2: * @since 0.9 williamr@2: * @return The WAP Access Point id. williamr@2: */ williamr@2: IMPORT_C TFavouritesWapAp WapAp() const; williamr@2: williamr@2: /** williamr@2: * Get the username associated with this item. williamr@2: * @since 0.9 williamr@2: * @return The username. williamr@2: */ williamr@2: IMPORT_C const TPtrC UserName() const; williamr@2: williamr@2: /** williamr@2: * Get password associated with this item. williamr@2: * @since 0.9 williamr@2: * @return The password. williamr@2: */ williamr@2: IMPORT_C const TPtrC Password() const; williamr@2: williamr@2: /** williamr@2: * Get context id associated with this item. williamr@2: * @since 0.9 williamr@2: * @return The context id. williamr@2: */ williamr@2: IMPORT_C TInt32 ContextId() const; williamr@2: williamr@2: /** williamr@2: * Check if this is an item (not folder). williamr@2: * @since 0.9 williamr@2: * @return ETrue if this is an item. williamr@2: */ williamr@2: IMPORT_C TBool IsItem() const; williamr@2: williamr@2: /** williamr@2: * Check if this is a folder. williamr@2: * @since 0.9 williamr@2: * @return ETrue if this is a folder. williamr@2: */ williamr@2: IMPORT_C TBool IsFolder() const; williamr@2: williamr@2: /** williamr@2: * Check if this is a factory item. williamr@2: * @since 0.9 williamr@2: * @return ETrue if this is a factory item. williamr@2: */ williamr@2: IMPORT_C TBool IsFactoryItem() const; williamr@2: williamr@2: /** williamr@2: * Check if this is a read-only in database. Note that ETrue value does williamr@2: * not prevent modifying this CFavouritesItem object. williamr@2: * @since 0.9 williamr@2: * @return ETrue if this is read-only in database. williamr@2: */ williamr@2: IMPORT_C TBool IsReadOnly() const; williamr@2: williamr@2: /** williamr@2: * Get last modification time (of database entry), universal time. williamr@2: * This can be zero if: williamr@2: * - Last modification time is not available in database (old williamr@2: * databases); or williamr@2: * - Engine does not support this feature. williamr@2: * Note that zero means Modified().Int64() == 0, and not williamr@2: * Time::NullTTime(). williamr@2: * @since 0.9 williamr@2: * @return TTime, last modification time williamr@2: */ williamr@2: IMPORT_C TTime Modified() const; williamr@2: williamr@2: public: // update williamr@2: williamr@2: /** williamr@2: * Reset the item to default values. williamr@2: * @since 0.9 williamr@2: * @return void williamr@2: */ williamr@2: IMPORT_C void ClearL(); williamr@2: williamr@2: /** williamr@2: * Set parent folder. williamr@2: * @since 0.9 williamr@2: * @param aId The unique id of the parent folder. williamr@2: * @return void williamr@2: */ williamr@2: IMPORT_C void SetParentFolder( TInt aId ); williamr@2: williamr@2: /** williamr@2: * Set item type (item or folder). williamr@2: * @since 0.9 williamr@2: * @param aType The type to be set. ENone cannot be set (if that is williamr@2: * specified, it is ignored). williamr@2: * @return void williamr@2: */ williamr@2: IMPORT_C void SetType( TType aType ); williamr@2: williamr@2: /** williamr@2: * Set name of the item. Leading or trailing whitespace is trimmed. williamr@2: * Length limit is KFavouritesMaxName (leaves with KErrOverflow). williamr@2: * @since 0.9 williamr@2: * @param aName The name to be set. williamr@2: * @return void williamr@2: */ williamr@2: IMPORT_C void SetNameL( const TDesC& aName ); williamr@2: williamr@2: /** williamr@2: * Set URL of the item. williamr@2: * @since 0.9 williamr@2: * Length limit is KFavouritesMaxURL (leaves with KErrOverflow). williamr@2: * @param aUrl The URL to be set. williamr@2: * @return void williamr@2: */ williamr@2: IMPORT_C void SetUrlL( const TDesC& aUrl ); williamr@2: williamr@2: /** williamr@2: * Set WAP Access Point of the item. williamr@2: * @since 0.9 williamr@2: * @param aAccessPoint The WAP Access point to be set. williamr@2: * @return void williamr@2: */ williamr@2: IMPORT_C void SetWapAp( const TFavouritesWapAp& aAccessPoint ); williamr@2: williamr@2: /** williamr@2: * Set username of the item. williamr@2: * Length limit is KFavouritesMaxUserName (leaves with KErrOverflow). williamr@2: * @since 0.9 williamr@2: * @param aUserName The username to be set. williamr@2: * @return void williamr@2: */ williamr@2: IMPORT_C void SetUserNameL( const TDesC& aUserName ); williamr@2: williamr@2: /** williamr@2: * Set password. williamr@2: * Length limit is KFavouritesMaxPassword (leaves with KErrOverflow). williamr@2: * @since 0.9 williamr@2: * @param aPassword The password to be set. williamr@2: * @return void williamr@2: */ williamr@2: IMPORT_C void SetPasswordL( const TDesC& aPassword ); williamr@2: williamr@2: /** williamr@2: * Set context id of the item. williamr@2: * @since 0.9 williamr@2: * @param aContextId The context id to be set. williamr@2: * @return void williamr@2: */ williamr@2: IMPORT_C void SetContextId( TInt32 aContextId ); williamr@2: williamr@2: /** williamr@2: * Check if this is a hidden. williamr@2: * @since 0.9 williamr@2: * @return ETrue if this is hidden. williamr@2: */ williamr@2: IMPORT_C TBool IsHidden() const; williamr@2: williamr@2: /** williamr@2: * Set hidden value of the item. williamr@2: * @since 0.9 williamr@2: * @param aHidden The hidden value to be set. williamr@2: * @return void williamr@2: */ williamr@2: IMPORT_C TBool SetHidden(TBool aHidden) const; williamr@2: williamr@2: public: // (But not exported:) Streaming williamr@2: williamr@2: /** williamr@2: * Externalize into a stream. williamr@2: * @since 0.9 williamr@2: * @param aStream The stream to externalize to. williamr@2: * @return void williamr@2: */ williamr@2: void ExternalizeL( RWriteStream& aStream ) const; williamr@2: williamr@2: /** williamr@2: * Internalize from a stream. williamr@2: * @since 0.9 williamr@2: * @param aStream The stream to externalize from. williamr@2: * @return void williamr@2: */ williamr@2: void InternalizeL( RReadStream& aStream ); williamr@2: williamr@2: private: // Constructors williamr@2: williamr@2: /** williamr@2: * C++ constructor. williamr@2: * @since 0.9 williamr@2: */ williamr@2: CFavouritesItem(); williamr@2: williamr@2: /** williamr@2: * Second-phase constructor. williamr@2: * @since 0.9 williamr@2: */ williamr@2: void ConstructL(); williamr@2: williamr@2: private: // Data williamr@2: williamr@2: CFavouritesItemImpl* iImpl; ///< Implementation. Owned. williamr@2: williamr@2: private: // friends williamr@2: williamr@2: // Setting UID and accessing implementation is granted to this. williamr@2: friend class RFavouritesDb; williamr@2: williamr@2: }; williamr@2: williamr@2: #endif williamr@2: williamr@2: // End of File