wvuing/wvuiprocess/Inc/CCAServerContactsArrayPC.h
changeset 0 094583676ce7
equal deleted inserted replaced
-1:000000000000 0:094583676ce7
       
     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:  Declares server contacts array
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CCASERVERCONTACTSARRAYPC_H
       
    21 #define CCASERVERCONTACTSARRAYPC_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include <bamdesca.h>
       
    25 #include <badesca.h>
       
    26 #include "ChatDefinitions.h" //KTab
       
    27 #include "MCAServerContactsArrayPC.h"
       
    28 
       
    29 // FORWARD DECLARATIONS
       
    30 
       
    31 class MCAStoredContact;
       
    32 
       
    33 
       
    34 // CLASS DECLARATION
       
    35 
       
    36 /**
       
    37 *  This class is decorated array for list box
       
    38 *
       
    39 *  @lib wvuiprocessng.dll
       
    40 *  @since 3.1
       
    41 */
       
    42 
       
    43 class CCAServerContactsArrayPC : public CBase,
       
    44             public MCAServerContactsArrayPC
       
    45     {
       
    46     public:  // Constructors and destructor
       
    47 
       
    48         /**
       
    49          * Two-phased constructor. Leaves with KErrArgument if any of the
       
    50          * arguments are NULL or they have different number of items.
       
    51          * Ownership of arguments are transferred only if construction of
       
    52          * the object is fully successfull.
       
    53          * @param aNickNames list of nicknames. Takes the ownership.
       
    54          * @param aWVIds list of WV-ids. Takes the ownership.
       
    55          * @param aIconTabulator Tabulator which is put before identification
       
    56          *                       when returning MdcaPoint
       
    57          * @param aShowContactExistInPhoneIcon Tells if icon should be shown
       
    58          *                                     on D-column, when contact
       
    59          *                                     already exists in phone.
       
    60          * @return New instance of server contacts array
       
    61          */
       
    62         static CCAServerContactsArrayPC* NewL( CDesCArray* aNickNames,
       
    63                                                CDesCArray* aWVIds,
       
    64                                                const TDesC& aIconTabulator = KTab,
       
    65                                                CDesCArray* aIdentifications = NULL,
       
    66                                                TBool aShowContactExistInPhoneIcon = EFalse
       
    67                                              );
       
    68 
       
    69         /**
       
    70          * Two-phased constructor.
       
    71          * Ownership of arguments are not transferred.
       
    72          * @param aContacts List of the contacts
       
    73          * @param aIconTabulator Tabulator which is put before identification
       
    74          *                       when returning MdcaPoint
       
    75          * @param aShowContactExistInPhoneIcon Tells if icon should be shown
       
    76          *                                     on D-column, when contact
       
    77          *                                     already exists in phone.
       
    78          * @return New instance of server contacts array
       
    79          */
       
    80         static CCAServerContactsArrayPC* NewL(
       
    81             RPointerArray<MCAStoredContact>& aContacts,
       
    82             const TDesC& aIconTabulator = KTab,
       
    83             TBool aShowContactExistInPhoneIcon = EFalse );
       
    84 
       
    85         /**
       
    86          * Destructor.
       
    87          */
       
    88         virtual ~CCAServerContactsArrayPC();
       
    89 
       
    90     public: // Functions from MDesCArray
       
    91 
       
    92         /**
       
    93          * From MDesCArray Returns the number of descriptor
       
    94          * elements in a descriptor array
       
    95          * @return The number of descriptor elements in a descriptor array
       
    96          */
       
    97         virtual TInt MdcaCount() const;
       
    98 
       
    99     public: // Functions from MDesCArray
       
   100 
       
   101         /**
       
   102          * From MDesCArray Indexes into a descriptor array
       
   103          * @param aIndex The position of the descriptor element within a
       
   104          *		  descriptor array. The position is relative to zero; i.e. zero
       
   105          *        implies the first descriptor element in a descriptor array.
       
   106          * @return A 16 bit non-modifiable pointer descriptor representing the
       
   107          *		   descriptor element located at position aIndex within a
       
   108          *		   descriptor array.
       
   109          */
       
   110         virtual TPtrC MdcaPoint( TInt aIndex ) const;
       
   111 
       
   112     public: // New functions
       
   113 
       
   114 
       
   115 
       
   116         /*
       
   117          * Inlined function separated in own file.
       
   118          *
       
   119          * inline const TCAServerContact& operator [] (TInt aIndex) const
       
   120          * { return iServerContacts[ aIndex ]; }
       
   121          */
       
   122         //const TCAServerContact& operator [] (TInt aIndex) const
       
   123         //{ return iServerContacts[ aIndex ]; }
       
   124 #include "CCAServerContactsArrayPC.inl"
       
   125 
       
   126         /**
       
   127          * Sorts the array
       
   128          */
       
   129         virtual void Sort();
       
   130 
       
   131         /**
       
   132          * Adds an item to iNickNames and iWVIds arrays.
       
   133          * @param aNickName nickname of the contact. can be KNullDesC
       
   134          * @param aWVId WV id of contact. mandatory
       
   135          */
       
   136         virtual void AddL( const TDesC& aNickName, const TDesC& aWVId );
       
   137 
       
   138         /**
       
   139          * Remove an item from given index
       
   140          */
       
   141         virtual void Remove( TInt aIndex );
       
   142 
       
   143         /**
       
   144          * Returns an index of given contact or KErrNotFound
       
   145          */
       
   146         TInt Find( const TDesC& aWVId ) const;
       
   147 
       
   148         /**
       
   149          * Returns the array of wv ids
       
   150          */
       
   151         const MDesCArray& WVIDArray() const;
       
   152 
       
   153         /**
       
   154          * Returns single contact from servercontacts array.
       
   155          * @param aIndex
       
   156          * @param aFindBoxTxt - Text in the findPane (Added for Fixing
       
   157 
       
   158          */
       
   159         const TCAServerContact* WVIdL( TInt aIndex,
       
   160                                        const TDesC& aFindBoxTxt = KNullDesC ) const;
       
   161 
       
   162         /**
       
   163          * Returns the array of nicknames
       
   164          * corresponds to WVIDArray
       
   165          */
       
   166         const MDesCArray& NickNameArray() const;
       
   167 
       
   168         /**
       
   169          * Replaces the existitn nicknemes,wvids with the new ones.
       
   170          * @param aNickNames: New set of nickenames to be set with.
       
   171          * @param aWVIds: New set of wvid's to be set with.
       
   172          */
       
   173         void ReplaceL( CDesCArray* aNickNames,
       
   174                        CDesCArray* aWVIds,
       
   175                        const TDesC& aIconTabulator,
       
   176                        CDesCArray* aIdentifications = NULL );
       
   177 
       
   178     private:
       
   179 
       
   180         /**
       
   181          * C++ default constructor.
       
   182          * @param aShowContactExistInPhoneIcon Tells if icon should be shown on
       
   183          *                                     D-column, when contact
       
   184          *                                     already exists in phone.
       
   185          */
       
   186         CCAServerContactsArrayPC( TBool aShowContactExistInPhoneIcon );
       
   187 
       
   188         /**
       
   189          * By default Symbian OS constructor is private.
       
   190          * @param aNickNames list of nicknames. Takes the ownership.
       
   191          * @param aWVIds list of WV-ids. Takes the ownership.
       
   192          * @see NewL
       
   193          */
       
   194         void ConstructL( CDesCArray* aNickNames,
       
   195                          CDesCArray* aWVIds,
       
   196                          const TDesC& aIconTabulator,
       
   197                          CDesCArray* aIdentifications = NULL );
       
   198 
       
   199         /**
       
   200          * By default Symbian OS constructor is private.
       
   201          * @see NewL
       
   202          */
       
   203         void ConstructL( RPointerArray<MCAStoredContact>& aContacts,
       
   204                          const TDesC& aIconTabulator );
       
   205 
       
   206         /**
       
   207          * common parts of the ConstructL methods
       
   208          * @see ConstructL
       
   209          */
       
   210         void CommonConstructL( const TDesC& aIconTabulator );
       
   211 
       
   212     private:    // Data
       
   213 
       
   214         //Owns. Array of nicknames.
       
   215         CDesCArray* iNickNames;
       
   216 
       
   217         //Owns. Array of identifications.
       
   218         CDesCArray* iIdentifications;
       
   219 
       
   220         //Owns. Array of wvid's
       
   221         CDesCArray* iWVIds;
       
   222 
       
   223         //Array of server contacts.
       
   224         RArray<TCAServerContact> iServerContacts;
       
   225 
       
   226         //owns
       
   227         HBufC* iLine;
       
   228 
       
   229         HBufC* iIconTabulator;
       
   230 
       
   231         // helper variable to know when contact existence in phone
       
   232         // should be checked, and related icon shown in D-column of listbox
       
   233         TBool iShowContactExistInPhoneIcon;
       
   234 
       
   235     };
       
   236 
       
   237 #endif      // CCASERVERCONTACTSARRAY_H
       
   238 
       
   239 // End of File