PECengine/ListLibrary2/ToolsSrc/PEngListLibTools.h
branchRCL_3
changeset 13 a941bc465d9f
parent 0 094583676ce7
equal deleted inserted replaced
12:6ca72c0fe49a 13:a941bc465d9f
       
     1 /*
       
     2 * Copyright (c) 2006 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:  Various tools for List Library
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef PENGLISTLIBTOOLS_H__
       
    19 #define PENGLISTLIBTOOLS_H__
       
    20 
       
    21 //  INCLUDES
       
    22 #include <e32base.h>
       
    23 #include "PEngContactIdsTools.h"
       
    24 #include "PEngWVCspVersion.h"
       
    25 #include "CPEngContactListModBase.h"
       
    26 #include "CPEngContactListModItemContainer.h"
       
    27 
       
    28 
       
    29 
       
    30 
       
    31 // FORWARD DECLARATION
       
    32 class CPEngSessionSlotId;
       
    33 class MPEngXMLSerializer;
       
    34 class MPEngXMLParser;
       
    35 class CPEngContactListModBase;
       
    36 class CPEngContactListModItemContainer;
       
    37 class CPEngContactListSettings;
       
    38 class CPEngTransactionStatus;
       
    39 class MPEngContactListTransactionManager;
       
    40 
       
    41 
       
    42 
       
    43 
       
    44 
       
    45 // CLASS DEFINITION
       
    46 
       
    47 
       
    48 /**
       
    49  * Contaclist view wrapper.
       
    50  * Maps contact items contact ID to MDesCArray.
       
    51  */
       
    52 NONSHARABLE_CLASS( TPEngContactlistDesViewWraper ) :
       
    53         public MDesCArray
       
    54     {
       
    55 public:
       
    56 
       
    57     /**
       
    58      * C++ constructor.
       
    59      */
       
    60     inline TPEngContactlistDesViewWraper(
       
    61         CPEngContactListModBase& aContactList )
       
    62             : iContactList( aContactList )
       
    63         {
       
    64         }
       
    65 
       
    66 
       
    67 public: // from MDesC16Array
       
    68 
       
    69 
       
    70     /**
       
    71      * Gets count of the wrapped array.
       
    72      * @return The count of array elements.
       
    73      */
       
    74     inline TInt MdcaCount() const
       
    75         {
       
    76         return iContactList.Count();
       
    77         }
       
    78 
       
    79 
       
    80     /**
       
    81      * Gets the element from the wrapped array.
       
    82      * @param aIndex The element index.
       
    83      * @return The array element.
       
    84      */
       
    85     inline TPtrC16 MdcaPoint( TInt aIndex ) const
       
    86         {
       
    87         return iContactList.ContactItem( aIndex ).Id();
       
    88         }
       
    89 
       
    90 private: // data
       
    91 
       
    92     //OWN: The wrapped contact list
       
    93     CPEngContactListModBase&    iContactList;
       
    94     };
       
    95 
       
    96 
       
    97 
       
    98 
       
    99 
       
   100 
       
   101 
       
   102 
       
   103 
       
   104 
       
   105 
       
   106 
       
   107 
       
   108 
       
   109 
       
   110 
       
   111 
       
   112 
       
   113 
       
   114 
       
   115 // NAMESPACE DEFINITION
       
   116 
       
   117 /**
       
   118  * Namespace encapsulating a collection of
       
   119  * List Library utility functions.
       
   120  */
       
   121 namespace NListLibTools
       
   122     {
       
   123     /**
       
   124      * Leave if there is error except, KErrAlreadyExists.
       
   125      *
       
   126      * @since 3.0
       
   127      * @param aError The errorcode which to handle
       
   128      */
       
   129     void LeaveIfMajorErrorL( TInt aError );
       
   130 
       
   131 
       
   132     /**
       
   133      * Parses contacts in the nick list response.
       
   134      *
       
   135      * @since 3.0
       
   136      * @param aResponse buffer with response to parse
       
   137      * @param aParsedContacts array to store parsed contacts
       
   138      * @param aContactList contact list model to look for contacts
       
   139      * @param aXMLparser1 XML parser1
       
   140      * @param aXMLparser2 XML parser2
       
   141      * @param aUpdateNickname
       
   142      * @param aNewContactCount count is goint to be increased for each new contact
       
   143      */
       
   144     TBool ParseContactListNickListL(
       
   145         const TDesC8& aResponse,
       
   146         RPointerArray<CPEngContactListModItemContainer>& aParsedContacts,
       
   147         CPEngContactListModBase& aContactList,
       
   148         MPEngXMLParser& aXMLparser1,
       
   149         MPEngXMLParser& aXMLparser2,
       
   150         TBool aUpdateNickname,
       
   151         TInt* aNewContactCount = NULL );
       
   152 
       
   153 
       
   154 
       
   155     /**
       
   156      * Parses plain contact IDs from the list response.
       
   157      *
       
   158      * @since 3.0
       
   159      * @param aResponse buffer with response to parse
       
   160      * @param aParsedContacts array to store parsed contacts
       
   161      * @param aContactList contact list model to look for contacts
       
   162      * @param aXMLparser1 XML parser1
       
   163      * @param aXMLparser2 XML parser2
       
   164      * @param aUpdateNickname
       
   165      * @param aNewContactCount count is goint to be increased for each new contact
       
   166      */
       
   167     TBool ParseContactListIDsL(
       
   168         const TDesC8& aResponse,
       
   169         RPointerArray<CPEngContactListModItemContainer>& aParsedContacts,
       
   170         CPEngContactListModBase& aContactList,
       
   171         MPEngXMLParser& aXMLparser1,
       
   172         TBool aUpdateNickname,
       
   173         TInt* aNewContactCount = NULL );
       
   174 
       
   175 
       
   176 
       
   177     /**
       
   178      * Parse Contact list properties
       
   179      *
       
   180      * @since 3.0
       
   181      * @param aResponse buffer with response to parse
       
   182      * @param aSettings contact list settings, to store parsed data
       
   183      * @param aXMLparser1 XML parser1
       
   184      * @param aXMLparser2 XML parser2
       
   185      */
       
   186     TBool ParseContactListPropertiesL(
       
   187         const TDesC8& aResponse,
       
   188         CPEngContactListSettings& aSettings,
       
   189         MPEngXMLParser& aXMLparser1,
       
   190         MPEngXMLParser& aXMLparser2 );
       
   191 
       
   192 
       
   193     /**
       
   194      * Remove bad contact from the contact list(local, network view)
       
   195      *
       
   196      * @since 3.0
       
   197      * @param aTransactionStatus transaction status with the bad contact ids
       
   198      * @param aContactList contact list
       
   199      */
       
   200     void RemoveBadContactsL(
       
   201         const CPEngTransactionStatus& aTransactionStatus,
       
   202         CPEngContactListModBase& aContactList );
       
   203 
       
   204 
       
   205     /**
       
   206      * Remove bad contact Ids from the local view, so they will be removed
       
   207      * from the server at next transaction.
       
   208      *
       
   209      * @since 3.0
       
   210      * @param aTransactionStatus transaction status with the bad contact ids
       
   211      * @param aContactList contact list
       
   212      */
       
   213     void MarkForRemoveBadContactsL(
       
   214         const CPEngTransactionStatus& aTransactionStatus,
       
   215         CPEngContactListModBase& aContactList );
       
   216 
       
   217 
       
   218 
       
   219     /**
       
   220      * Harmonizes default contact list settings
       
   221      *
       
   222      * Function is called after properties of the contact list
       
   223      * have been updated. Harmonizes the default contact list settings
       
   224      *
       
   225      * @since 3.0
       
   226      * @param aCntListSettings The contact list.
       
   227      * @param aManager The contact list manager.
       
   228      */
       
   229     void HarmonizeDefaultContactListSettingsL(
       
   230         CPEngContactListSettings& aCntListSettings,
       
   231         MPEngContactListTransactionManager& aManager );
       
   232 
       
   233 
       
   234 
       
   235 
       
   236     /**
       
   237      * Register Presence attributes of the contacts from passed array
       
   238      * to be accepter by the presence engine
       
   239      *
       
   240      * @since 3.0
       
   241      * @param aContacts array of contact ids
       
   242      * @param aSessionSlotId Session slot Id
       
   243      */
       
   244     void ActivatePresenceAttributesL(
       
   245         const MDesCArray& aContacts,
       
   246         const CPEngSessionSlotId& aSessionSlotId );
       
   247 
       
   248 
       
   249     /**
       
   250      * Unregister Presence attributes of the contacts from passed array
       
   251      *
       
   252      * @since 3.0
       
   253      * @param aContacts array of contact ids
       
   254      * @param aSessionSlotId Session slot Id
       
   255      */
       
   256     void DeactivatePresenceAttributesL(
       
   257         const MDesCArray& aContacts,
       
   258         const CPEngSessionSlotId& aSessionSlotId );
       
   259 
       
   260 
       
   261 
       
   262     /**
       
   263      * Append transaction content to the start of the buffer
       
   264      * @since 3.0
       
   265      * @param aXMLSerializer XML serializer
       
   266      * @param aCSPVersion CPS Version
       
   267      */
       
   268     void AppendTransactionContentTagXmlL(
       
   269         MPEngXMLSerializer& aXMLSerializer,
       
   270         TPEngWVCspVersion& aCSPVersion );
       
   271 
       
   272 
       
   273     /**
       
   274      * Append contact list name to the XML buffer
       
   275      * @since 3.0
       
   276      * @param aXMLSerializer XML serializer
       
   277      * @param aSettings contact list settings
       
   278      */
       
   279     void AppendContactListNameXmlL(
       
   280         MPEngXMLSerializer& aXmlSerializer,
       
   281         const CPEngContactListSettings& aSettings );
       
   282 
       
   283 
       
   284     /**
       
   285      * Append Presence Attributes for subscription to the XML buffer
       
   286      *
       
   287      * @since 3.0
       
   288      * @param aAttributes
       
   289      * @param aXMLSerializer XML serializer
       
   290      * @param aSessionSlotId Session slot Id
       
   291      * @param aCSPVersion CSP Version
       
   292      */
       
   293     void AppendAttributesForSubscriptionXmlL(
       
   294         const RArray<TUint32> aAttributes,
       
   295         MPEngXMLSerializer& aXmlSerializer,
       
   296         const CPEngSessionSlotId& aSessionSlotId,
       
   297         TPEngWVCspVersion& aCSPVersion );
       
   298 
       
   299 
       
   300 
       
   301     /**
       
   302      * Append Contact list properties into the XML buffer
       
   303      *
       
   304      * @since 3.0
       
   305      * @param aXMLSerializer XML serializer
       
   306      * @param aSettings contact list settings
       
   307      */
       
   308     void AppendContactListPropertiesXmlL(
       
   309         MPEngXMLSerializer& aXmlSerializer,
       
   310         const CPEngContactListSettings& aSettings );
       
   311 
       
   312 
       
   313 
       
   314     /**
       
   315      * Append Contact list "ReceiveList" tag for the
       
   316      * "ListManage-Request" request, if it is supported
       
   317      *
       
   318      * @since 3.0
       
   319      * @param aXMLSerializer XML serializer
       
   320      * @param aCSPVersion version of the CSP
       
   321      * @param aValue value of the ReceiveList tag
       
   322      */
       
   323     void ApppendReceiveListTagL(
       
   324         MPEngXMLSerializer& aXmlSerializer,
       
   325         TPEngWVCspVersion& aCSPVersion,
       
   326         TBool aValue );
       
   327 
       
   328     } //namespace NListLibTools
       
   329 
       
   330 
       
   331 
       
   332 
       
   333 #endif // PENGLISTLIBTOOLS_H__
       
   334 
       
   335 
       
   336 //  End of File
       
   337