2 * Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of the License "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: Declaration of FavouritesItem
19 #ifndef FAVOURITES_ITEM_H
20 #define FAVOURITES_ITEM_H
25 #include <favouriteslimits.h>
26 #include <favouriteswapap.h>
28 // FORWARD DECLARATION
30 class CFavouritesItemImpl;
37 * CFavouritesItem is the base class for representing one favourites entry (item or folder).
38 * Instances of this class are used to exchange data between the Favourites
39 * Engine and clients using it.
41 class CFavouritesItem: public CBase
47 * Defines the type of an item (item or folder).
49 enum TType /// Type of an item (item or folder).
52 * Invalid value, can not be set for a CFavouritesItem
53 * @see For more informaiton on ENone, see CFavouritesItem.
58 * @see For more informaiton on ENone, see CFavouritesItem.
63 * @see For more informaiton on ENone, see CFavouritesItem.
68 public: // Constructors and destructor
71 * Two-phased constructor. Leaves on failure. Places the instance on the
74 * @return The constructed item.
76 IMPORT_C static CFavouritesItem* NewLC();
79 * Two-phased constructor. Leaves on failure.
81 * @return The constructed item.
83 IMPORT_C static CFavouritesItem* NewL();
89 IMPORT_C virtual ~CFavouritesItem();
92 * Assignment operator.
94 * @param aCopyFrom Assign from this.
96 IMPORT_C CFavouritesItem& operator=
97 ( const CFavouritesItem& aCopyFrom );
102 * Get unique id of the item.
104 * @return The unique id.
106 IMPORT_C TInt Uid() const;
109 * Get the uid of the parent folder of this item.
111 * @return The unique id of the parent folder.
113 IMPORT_C TInt ParentFolder() const;
116 * Get type of the item (item or folder).
118 * @return The type of the item. It is either EFolder or EItem
122 IMPORT_C TType Type() const;
125 * Get the name of this item.
127 * @return The name of this item.
129 IMPORT_C const TPtrC Name() const;
132 * Get the URL of this item.
134 * @return The URL of this item.
136 IMPORT_C const TPtrC Url() const;
139 * Get WAP Access Point id associated with this item.
141 * @return The WAP Access Point id.
143 IMPORT_C TFavouritesWapAp WapAp() const;
146 * Get the username associated with this item.
148 * @return The username.
150 IMPORT_C const TPtrC UserName() const;
153 * Get password associated with this item.
155 * @return The password.
157 IMPORT_C const TPtrC Password() const;
160 * Get context id associated with this item.
162 * @return The context id.
164 IMPORT_C TInt32 ContextId() const;
167 * Check if this is an item (not folder).
169 * @return ETrue if this is an item.
171 IMPORT_C TBool IsItem() const;
174 * Check if this is a folder.
176 * @return ETrue if this is a folder.
178 IMPORT_C TBool IsFolder() const;
181 * Check if this is a factory item.
183 * @return ETrue if this is a factory item.
185 IMPORT_C TBool IsFactoryItem() const;
188 * Check if this is a read-only in database. Note that ETrue value does
189 * not prevent modifying this CFavouritesItem object.
191 * @return ETrue if this is read-only in database.
193 IMPORT_C TBool IsReadOnly() const;
196 * Get last modification time (of database entry), universal time.
197 * This can be zero if:
198 * - Last modification time is not available in database (old
200 * - Engine does not support this feature.
201 * Note that zero means Modified().Int64() == 0, and not
204 * @return TTime, last modification time
206 IMPORT_C TTime Modified() const;
211 * Reset the item to default values.
215 IMPORT_C void ClearL();
220 * @param aId The unique id of the parent folder.
223 IMPORT_C void SetParentFolder( TInt aId );
226 * Set item type (item or folder).
228 * @param aType The type to be set. ENone cannot be set (if that is
229 * specified, it is ignored).
232 IMPORT_C void SetType( TType aType );
235 * Set name of the item. Leading or trailing whitespace is trimmed.
236 * Length limit is KFavouritesMaxName (leaves with KErrOverflow).
238 * @param aName The name to be set.
241 IMPORT_C void SetNameL( const TDesC& aName );
244 * Set URL of the item.
246 * Length limit is KFavouritesMaxURL (leaves with KErrOverflow).
247 * @param aUrl The URL to be set.
250 IMPORT_C void SetUrlL( const TDesC& aUrl );
253 * Set WAP Access Point of the item.
255 * @param aAccessPoint The WAP Access point to be set.
258 IMPORT_C void SetWapAp( const TFavouritesWapAp& aAccessPoint );
261 * Set username of the item.
262 * Length limit is KFavouritesMaxUserName (leaves with KErrOverflow).
264 * @param aUserName The username to be set.
267 IMPORT_C void SetUserNameL( const TDesC& aUserName );
271 * Length limit is KFavouritesMaxPassword (leaves with KErrOverflow).
273 * @param aPassword The password to be set.
276 IMPORT_C void SetPasswordL( const TDesC& aPassword );
279 * Set context id of the item.
281 * @param aContextId The context id to be set.
284 IMPORT_C void SetContextId( TInt32 aContextId );
287 * Check if this is a hidden.
289 * @return ETrue if this is hidden.
291 IMPORT_C TBool IsHidden() const;
294 * Set hidden value of the item.
296 * @param aHidden The hidden value to be set.
299 IMPORT_C TBool SetHidden(TBool aHidden) const;
301 public: // (But not exported:) Streaming
304 * Externalize into a stream.
306 * @param aStream The stream to externalize to.
309 void ExternalizeL( RWriteStream& aStream ) const;
312 * Internalize from a stream.
314 * @param aStream The stream to externalize from.
317 void InternalizeL( RReadStream& aStream );
319 private: // Constructors
328 * Second-phase constructor.
335 CFavouritesItemImpl* iImpl; ///< Implementation. Owned.
339 // Setting UID and accessing implementation is granted to this.
340 friend class RFavouritesDb;