inc/MPEngContactItem.h
changeset 0 094583676ce7
equal deleted inserted replaced
-1:000000000000 0:094583676ce7
       
     1 /*
       
     2 * Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "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".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Contact item interface.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef __MPENGCONTACTITEM_H
       
    19 #define __MPENGCONTACTITEM_H
       
    20 
       
    21 
       
    22 //  INCLUDES
       
    23 #include <E32Std.h>
       
    24 
       
    25 
       
    26 
       
    27 // FORWARD DECLARATIONS
       
    28 class MPEngContactItemExt;
       
    29 
       
    30 // CONSTANTS
       
    31 /********************************************************/
       
    32 /* Contact Item property levels.                        */
       
    33 /* @since 3.0                                           */
       
    34 /********************************************************/
       
    35 
       
    36 
       
    37 /**
       
    38  * Presence Engine contact Item native permanent properties.
       
    39  * Those properties are permanent over the sessions.
       
    40  */
       
    41 const TUint KPEngCntItemPropertyNativePermanent =   0x00000010;
       
    42 
       
    43 
       
    44 /**
       
    45  * Presence Engine contact Item native cached properties.
       
    46  * These property values are discarded on the session close.
       
    47  */
       
    48 const TUint KPEngCntItemPropertyNativeCached =      0x00000020;
       
    49 
       
    50 
       
    51 /**
       
    52  * External permanent contact Item properties.
       
    53  *
       
    54  * These properties are not used by the Presence Engine but
       
    55  * the clients can use this level to store external
       
    56  * settings that must be permanent over the sessions.
       
    57  */
       
    58 const TUint KPEngCntItemPropertyExternalPermanent = 0x00000030;
       
    59 
       
    60 /**
       
    61  * External cached contact Item properties.
       
    62  *
       
    63  * These properties are not used by the Presence Engine but
       
    64  * the clients can use this level to store external settings
       
    65  * that needs to be cleared when the session is closed.
       
    66  */
       
    67 const TUint KPEngCntItemPropertyExternalCached =    0x00000040;
       
    68 
       
    69 
       
    70 
       
    71 
       
    72 
       
    73 // CLASS DECLARATION
       
    74 
       
    75 /**
       
    76  * Interface for one contact item in the contact list.
       
    77  *
       
    78  * @since 3.0
       
    79  */
       
    80 class MPEngContactItem
       
    81     {
       
    82     public: // Contact item values
       
    83 
       
    84         /**
       
    85          * Contact Id of the contact Item
       
    86          *
       
    87          * @since 3.0
       
    88          * @return Contact Id of the contact item.
       
    89          */
       
    90         virtual const TDesC& Id() const = 0;
       
    91 
       
    92 
       
    93         /**
       
    94          * Nick name of the contact Item
       
    95          *
       
    96          * If the contact doesn't have nick defined,
       
    97          * returns KNullDesC.
       
    98          *
       
    99          * @since 3.0
       
   100          * @return Nick name of the contact item.
       
   101          */
       
   102         virtual const TDesC& NickName() const = 0;
       
   103 
       
   104 
       
   105         /**
       
   106          * Update nick name of the contact item
       
   107          *
       
   108          * New nick name is assigned to the contact item. Old nick name
       
   109          * will be replaced once contact list is updated to the server.
       
   110          *
       
   111          * @since 3.0
       
   112          * @param aNickName New nick name.
       
   113          */
       
   114         virtual void UpdateNickNameL( const TDesC& aNickName ) = 0;
       
   115 
       
   116 
       
   117     public: // Property getters
       
   118 
       
   119         /**
       
   120          *  Gets a property.
       
   121          *
       
   122          *  Gets value of property.
       
   123          *  Overloaded version for different data types.
       
   124          *
       
   125          *  @since 3.0
       
   126          *  @param  aName Name of the property.
       
   127          *  @param  aLevel Level of the property to look for.
       
   128          *  @param  aValue Where value is be stored.
       
   129          *  @return KErrNone if property was found. Else KErrNotFound.
       
   130          */
       
   131         virtual TInt GetProperty( TUint aName,
       
   132                                   TUint aLevel,
       
   133                                   TInt& aValue ) const = 0;
       
   134 
       
   135         virtual TInt GetProperty( TUint aName,
       
   136                                   TUint aLevel,
       
   137                                   TPtrC8& aValue ) const = 0;
       
   138 
       
   139         virtual TInt GetProperty( TUint aName,
       
   140                                   TUint aLevel,
       
   141                                   TPtrC16& aValue ) const = 0;
       
   142 
       
   143         /**
       
   144          *  Gets a property.
       
   145          *
       
   146          *  @since 3.0
       
   147          *  @param  aName Name of the property.
       
   148          *  @param  aLevel Level of the property to look for.
       
   149          *  @return if property is found, its value, if not found
       
   150          *			zero is returned as default value
       
   151          */
       
   152         virtual TInt Property( TUint aName,
       
   153                                TUint aLevel ) const = 0;
       
   154 
       
   155     public: // Property setters
       
   156 
       
   157 
       
   158         /**
       
   159          *  Sets a property.
       
   160          *
       
   161          *  Sets value of property.
       
   162          *  Overloaded version for different data types.
       
   163          *
       
   164          *  @since 3.0
       
   165          *  @param  aName Name of the property
       
   166          *              Predefined Property names are specified above
       
   167          *				Client can also use own property names
       
   168          *  @param  aLevel Level of the property to set.
       
   169          *				Predefined levels are specified above.
       
   170          *  @param  aValue Value to be set.
       
   171          */
       
   172         virtual void SetPropertyL( TUint aName,
       
   173                                    TUint aLevel,
       
   174                                    TInt aValue ) = 0;
       
   175 
       
   176         virtual void SetPropertyL( TUint aName,
       
   177                                    TUint aLevel,
       
   178                                    const TDesC8& aValue ) = 0;
       
   179 
       
   180         virtual void SetPropertyL( TUint aName,
       
   181                                    TUint aLevel,
       
   182                                    const TDesC16& aValue ) = 0;
       
   183 
       
   184 
       
   185         /**
       
   186          *  Delete a property
       
   187          *
       
   188          *	Deletes property out of the contact list preferences
       
   189          *  Property defined by the PEC engine cannot be deleted
       
   190          *	if defined property is not found, function will do nothing
       
   191          *
       
   192          *  @since 3.0
       
   193          *  @param aName name of the property to delete
       
   194          *	@param aLevel level of the property to delete
       
   195          */
       
   196         virtual void DeletePropertyL( TUint aName, TUint aLevel ) = 0;
       
   197 
       
   198 
       
   199     public: // Those functions won't any longer supported
       
   200         // Opaque value extensions
       
   201 
       
   202 
       
   203         /**
       
   204          * Gets opaque values.
       
   205          */
       
   206         virtual TInt GetPermanentValue( const TDesC& aKey,
       
   207                                         TPtrC8& aValue ) const = 0;
       
   208         virtual TInt GetCachedValue( const TDesC& aKey,
       
   209                                      TPtrC8& aValue ) const = 0;
       
   210 
       
   211         /**
       
   212          * Sets opaque values.
       
   213          */
       
   214         virtual void SetPermanentValueL( const TDesC& aKey,
       
   215                                          const TDesC8& aValue ) = 0;
       
   216         virtual void SetCachedValueL( const TDesC& aKey,
       
   217                                       const TDesC8& aValue ) = 0;
       
   218 
       
   219         /**
       
   220          * Delete opaque values.
       
   221          */
       
   222         virtual void DeletePermanentValueL( const TDesC& aKey ) = 0;
       
   223         virtual void DeleteCachedValueL( const TDesC& aKey ) = 0;
       
   224 
       
   225     private: //Extensions interfaces
       
   226 
       
   227 
       
   228         /**
       
   229          * Contact item extension interface.
       
   230          *
       
   231          * @since 3.0
       
   232          * @return Contact item extension.
       
   233          */
       
   234         virtual MPEngContactItemExt* Extension() = 0;
       
   235         virtual const MPEngContactItemExt* Extension() const = 0;
       
   236 
       
   237 
       
   238 
       
   239     protected:  //Destructor
       
   240 
       
   241         /**
       
   242          * Virtual inline destructor.
       
   243          * Protected destructor to prohibits deletion
       
   244          * through the interface.
       
   245          */
       
   246         virtual ~MPEngContactItem() {};
       
   247 
       
   248     };
       
   249 #endif      //  __MPENGCONTACTITEM_H
       
   250 
       
   251 //  End of File
       
   252