ccservices/cmsservices/cmsengine/inc/cmscontactfield.h
changeset 0 e686773b3f54
equal deleted inserted replaced
-1:000000000000 0:e686773b3f54
       
     1 /*
       
     2 * Copyright (c) 2007 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: 
       
    15 *       
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef __CMSCONTACTFIELD__
       
    21 #define __CMSCONTACTFIELD__
       
    22 
       
    23 // INCLUDES
       
    24 #include <s32std.h>
       
    25 #include "cmscontactbase.h"
       
    26 #include "cmscontactfielditem.h"
       
    27 
       
    28 enum TCmsVoIPSupport
       
    29     {
       
    30     ECmsVoIPSupportBasic    = 1,
       
    31     ECmsVoIPSupportXspId    = 2,
       
    32     ECmsVoIPSupportCallout  = 4,
       
    33 	ECmsVoIPSupportSip = 8
       
    34     };
       
    35 
       
    36 class RCmsContact;
       
    37 class CCmsContactFieldItem;
       
    38 
       
    39 // CLASS DECLARATION
       
    40 class CCmsContactField : public CCmsContactBase
       
    41     {
       
    42     public :
       
    43     	
       
    44         /**
       
    45     	* Get the number of items in this field
       
    46         * 
       
    47         * @return TInt Number of items
       
    48     	*/
       
    49 		IMPORT_C TInt ItemCount() const;
       
    50         
       
    51         /**
       
    52     	* Get the type of this field
       
    53         * 
       
    54         * @return CCmsContactFieldItem::TCmsContactField Field type
       
    55     	*/
       
    56         IMPORT_C CCmsContactFieldItem::TCmsContactField Type() const;
       
    57 
       
    58         /**
       
    59     	* Get the type of the group this field belongs to
       
    60         * 
       
    61         * @return CCmsContactFieldItem::TCmsContactFieldGroup Group type
       
    62     	*/
       
    63         IMPORT_C CCmsContactFieldItem::TCmsContactFieldGroup GroupType() const;
       
    64 
       
    65         /**
       
    66     	* Get the indexed item
       
    67         * 
       
    68         * @param TInt Item index
       
    69         * @return const CCmsContactFieldItem& Field item
       
    70     	*/
       
    71 		IMPORT_C const CCmsContactFieldItem& ItemL( TInt aIndex ) const;
       
    72 
       
    73         /** 
       
    74         * Get the field item of given default attribute type.
       
    75         * Leaves with KErrNotFound if nothing found.
       
    76         *
       
    77         * @see TCmsDefaultAttributeTypes enum from CCmsContactFieldItem
       
    78         * @param TCmsDefaultAttributeTypes default type
       
    79         * @return const CCmsContactFieldItem& Field item
       
    80         */        
       
    81         IMPORT_C const CCmsContactFieldItem& ItemL( CCmsContactFieldItem::TCmsDefaultAttributeTypes aDefaultType ) const;            
       
    82 
       
    83         /**
       
    84     	* Get all the items
       
    85         * 
       
    86         * @return const RPointerArray<CCmsContactFieldItem>& Item array
       
    87     	*/
       
    88 		IMPORT_C const RPointerArray<CCmsContactFieldItem>& Items() const;
       
    89 
       
    90         /** 
       
    91         * For asking if field has default attributes.
       
    92         *
       
    93         * @see TCmsDefaultAttributeTypes enum from CCmsContactFieldItem
       
    94         * @param TCmsDefaultAttributeTypes default type
       
    95         * @return TBool
       
    96         */        
       
    97         IMPORT_C TBool HasDefaultAttribute( CCmsContactFieldItem::TCmsDefaultAttributeTypes aDefaultType ) const;            
       
    98 
       
    99         /** 
       
   100         * Go through all field items and returns bitmasks of default attributes.
       
   101         *
       
   102         * @see TCmsDefaultAttributeTypes enum from CCmsContactFieldItem
       
   103         * @return TInt: TCmsDefaultAttributeTypes bitmask
       
   104         */        
       
   105         IMPORT_C TInt HasDefaultAttribute() const;            
       
   106         
       
   107     public:
       
   108 	    
       
   109         /**
       
   110     	* Symbian constructor
       
   111         *
       
   112         * @param RCmsContact& Handle to the client-side contact
       
   113         * @return CCmsContactField* New instance
       
   114     	*/
       
   115 		static CCmsContactField* NewL( RCmsContact& aContact,
       
   116                                        CCmsContactFieldItem::TCmsContactField aFieldType );
       
   117 
       
   118         /**
       
   119     	* Symbian constructor
       
   120         *
       
   121         * @param RCmsContact& Handle to the client-side contact
       
   122         * @param TRequestStatus& Request status of the caller
       
   123         * @return CCmsContactField* New instance
       
   124     	*/
       
   125 		static CCmsContactField* NewL( RCmsContact& aContact,
       
   126                                        TRequestStatus& aClientStatus,
       
   127                                        CCmsContactFieldItem::TCmsContactField aFieldType );
       
   128 
       
   129         /**
       
   130     	* Symbian constructor
       
   131         *
       
   132         * @param RCmsContact& Handle to the client-side contact
       
   133         * @param TRequestStatus& Request status of the caller
       
   134         * @param CCmsContactFieldItem::TCmsContactFieldGroup Field group
       
   135         * @return CCmsContactField* New instance
       
   136     	*/
       
   137 		static CCmsContactField* NewL( RCmsContact& aContact,
       
   138                                        TRequestStatus& aClientStatus,
       
   139                                        CCmsContactFieldItem::TCmsContactFieldGroup aFieldGroup );
       
   140 
       
   141         /**
       
   142 	    * Create a new field item 
       
   143         * 
       
   144         * @param const TDesC& The data for the item
       
   145         * @param const TDesC& The infofor the item        
       
   146         * @param const TInt Default attribute value   
       
   147         * @return void
       
   148 	    */
       
   149         void CreateFieldItemL( const TDesC& aItemData, const TDesC& aItemInfo, const TInt aDefaultAttribute = 0 );
       
   150     
       
   151 		/**
       
   152 		* Destructor
       
   153 	    */
       
   154 		~CCmsContactField();
       
   155 
       
   156     private:
       
   157         
       
   158         /**
       
   159 	    * C++ constructor is private
       
   160         *
       
   161         * @return CCmsContactField
       
   162 	    */
       
   163         CCmsContactField( RCmsContact& aContact,
       
   164                           CCmsContactFieldItem::TCmsContactField aFieldType );
       
   165         
       
   166         /**
       
   167 	    * C++ constructor is private
       
   168         *
       
   169         * @param RCmsContact& Handle to the client-side contact
       
   170         * @param TRequestStatus& Request status of the caller
       
   171         * @return CCmsContactField
       
   172 	    */
       
   173         CCmsContactField( RCmsContact& aContact,
       
   174                           TRequestStatus& aClientStatus,
       
   175                           CCmsContactFieldItem::TCmsContactFieldGroup aFieldGroupp );
       
   176         
       
   177 
       
   178         /**
       
   179 	    * C++ constructor is private
       
   180         *
       
   181         * @param RCmsContact& Handle to the client-side contact
       
   182         * @param TRequestStatus& Request status of the caller
       
   183         * @return CCmsContactField
       
   184 	    */
       
   185         CCmsContactField( RCmsContact& aContact,
       
   186                           TRequestStatus& aClientStatus,
       
   187                           CCmsContactFieldItem::TCmsContactField aFieldType );
       
   188 
       
   189         /**
       
   190 	    * Symbian OS second-phase constructor
       
   191 	    */
       
   192 		void ConstructL();
       
   193         
       
   194         /**
       
   195 	    * Select the type of the field
       
   196         * 
       
   197         * @return void
       
   198 	    */
       
   199         void SelectFieldType();
       
   200         
       
   201         /**
       
   202 	    * Handle textual data   
       
   203         * 
       
   204         * @return void
       
   205 	    */
       
   206         void HandleSixteenBitDataL();
       
   207         
       
   208         /**
       
   209 	    * Handle binary data   
       
   210         * 
       
   211         * @return void
       
   212 	    */
       
   213         void HandleBinaryDataL();
       
   214         
       
   215         /**
       
   216 	    * Handle basic binary data   
       
   217         * 
       
   218         * @return void
       
   219 	    */
       
   220         void HandleBasicDataL();
       
   221         
       
   222         /**
       
   223 	    * Handle presence data   
       
   224         * 
       
   225         * @return void
       
   226 	    */
       
   227         void HandlePresenceDataL();
       
   228         
       
   229         /**
       
   230 	    * Handle presence data   
       
   231         * 
       
   232         * @return void
       
   233 	    */
       
   234         TInt ExtractFieldType( TPtr8& aDataDesc );
       
   235         
       
   236         /**
       
   237 	    * Handle presence data   
       
   238         * 
       
   239         * @return void
       
   240 	    */
       
   241         TPtrC8 ExtractData( const TDesC8& aDataDesc, TInt& aDelIndex );
       
   242         
       
   243         /**
       
   244 	    * Handle presence data   
       
   245         * 
       
   246         * @return void
       
   247 	    */
       
   248         void HandlePresencePackageL( const TDesC8& aPresenceData );
       
   249 
       
   250         /**
       
   251 	    * Handle binary data
       
   252         * 
       
   253         * @return void
       
   254 	    */
       
   255         void CreateFieldItemL( const TDesC8& aItemData );
       
   256 
       
   257    private:  //From CActive
       
   258         
       
   259         /**
       
   260 	    * Complete an asynchronous operation
       
   261 	    */
       
   262         void RunL();
       
   263 
       
   264     private : // data
       
   265         
       
   266 		RPointerArray<CCmsContactFieldItem>             iFieldItems;
       
   267         CCmsContactFieldItem::TCmsContactField          iFieldType;
       
   268         CCmsContactFieldItem::TCmsContactFieldGroup     iFieldGroup;
       
   269     };
       
   270 
       
   271 #endif  //__CMSCONTACTFIELD__
       
   272 
       
   273 
       
   274 // End of File