wvuing/wvuistorage/inc/MCAStoredContacts.h
changeset 0 094583676ce7
equal deleted inserted replaced
-1:000000000000 0:094583676ce7
       
     1 /*
       
     2 * Copyright (c) 2002-2005 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:  Stored contact data container interface
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef MCASTOREDCONTACTS_H
       
    21 #define MCASTOREDCONTACTS_H
       
    22 
       
    23 #include "impsbuilddefinitions.h"
       
    24 #include "TStorageManagerGlobals.h"
       
    25 
       
    26 #include <e32std.h>
       
    27 #include <badesca.h>
       
    28 #include "MCAStoredContact.h"
       
    29 
       
    30 // FORWARD DECLARATIONS
       
    31 class MCAStoredContactsObserver;
       
    32 class MCAContactList;
       
    33 
       
    34 // CLASS DECLARATION
       
    35 
       
    36 /**
       
    37  *  Interface for stored contacts container
       
    38  *
       
    39  *  @lib CAStorage.dll
       
    40  *  @since 3.0
       
    41  */
       
    42 class MCAStoredContacts
       
    43     {
       
    44     public: // Definitions
       
    45 
       
    46         enum TContactListProperty
       
    47             {
       
    48             EPrimaryCollapseInUse,
       
    49             ESecondaryCollapseInUse
       
    50             };
       
    51 
       
    52     public: // New functions
       
    53 
       
    54         /**
       
    55          * Add an observer.
       
    56          * @param aObserver The observer
       
    57          */
       
    58         virtual void AddObserverL( MCAStoredContactsObserver* aObserver ) = 0;
       
    59 
       
    60         /**
       
    61          * Remove an observer.
       
    62          * @param aObserver The observer
       
    63          */
       
    64         virtual void RemoveObserver(
       
    65             MCAStoredContactsObserver* aObserver ) = 0;
       
    66 
       
    67         /**
       
    68          * Remove a given contact
       
    69          * @param aListId List which contains contact.
       
    70          * @param aContactId The contact to remove
       
    71          */
       
    72         virtual void RemoveContact( const TDesC& aListId,
       
    73                                     const TDesC& aContactId ) = 0;
       
    74 
       
    75         /**
       
    76          * Find a contact from the store by wv User ID
       
    77          * @param aContactListId List which contains contact.
       
    78          * @param aId the User ID of the contact to find
       
    79          * @return The contact
       
    80          */
       
    81         virtual MCAStoredContact* FindContact( const TDesC& aContactListId,
       
    82                                                const TDesC& aId ) = 0;
       
    83 
       
    84         virtual MCAStoredContact* FindContact( const TDesC& aContactListId,
       
    85                                                const TDesC& aId,
       
    86                                                MCAContactList*& aContactList ) = 0;
       
    87 
       
    88         /**
       
    89          * Find any contact which id is aContactId
       
    90          * @param aContactId Contactid to recognize contact.
       
    91          * @return First one which matches contactId. If not found return NULL
       
    92          */
       
    93         virtual MCAStoredContact* FindAnyContact( const TDesC& aContactId ) = 0;
       
    94 
       
    95         /**
       
    96          * Find any contact which nick is aNick
       
    97          * @param aNick Nickname to recognize contact.
       
    98          * @return First one which matches nickname. If not found return NULL
       
    99          */
       
   100         virtual MCAStoredContact* FindAnyContactByNick( const TDesC& aNick ) = 0;
       
   101 
       
   102         /**
       
   103          * Count of lists.
       
   104          * @return Count of lists.
       
   105          */
       
   106         virtual TInt ListCount() const = 0;
       
   107 
       
   108         /**
       
   109          * List in index.
       
   110          * @param aIndex. Index of list.
       
   111          * return Contact list.
       
   112          */
       
   113         virtual MCAContactList& ListAt( TInt aIndex ) const = 0;
       
   114 
       
   115         /**
       
   116          * Find contact list by id
       
   117          * @param aListId. Id to find.
       
   118          * @return Contactlist. If not found return NULL
       
   119          */
       
   120         virtual MCAContactList* FindContactList( const TDesC& aListId ) = 0;
       
   121 
       
   122         /**
       
   123          * Ownership of contacts does not go to the caller.
       
   124          * MUST NOT delete contacts in array.
       
   125          * @param aArray Array where contacts are appended.
       
   126          * @param aContacftId Id of contacts that are appended to array.
       
   127          */
       
   128         virtual void FindContacts( RPointerArray< MCAStoredContact >& aArray,
       
   129                                    const TDesC& aContactId ) const = 0;
       
   130 
       
   131         /**
       
   132          * Find out if contact exists in all list.
       
   133          * @param aContactId. Id to check.
       
   134          * @return ETrue if contact is in all lists. EFalse if not.
       
   135          */
       
   136         virtual TBool ContactInAllLists( const TDesC& aContactId ) const = 0;
       
   137 
       
   138         /**
       
   139          * Add new contact list.
       
   140          * @param aContactListId Id for new contact list.
       
   141          * @param aDisplayName Display name of new contact list.
       
   142          */
       
   143         virtual MCAContactList* AddContactListIdL( const TDesC& aContactListId,
       
   144                                                    const TDesC& aDisplayName,
       
   145                                                    TBool aNotify = ETrue ) = 0;
       
   146 
       
   147         /**
       
   148          * Remove contact list from store.
       
   149          * @param aContactListId. Id of contact list to be removed.
       
   150          */
       
   151         virtual void RemoveContactList( const TDesC& aContactListId ) = 0;
       
   152 
       
   153         /**
       
   154          * Set collapsed status of contact list.
       
   155          * @param aContactListId. Id of contact list to be collapsed
       
   156          *                        or expanded.
       
   157          * @param aCollapsed. Status of collapsed. ETrue if collapsed.
       
   158          *                    EFalse if expanded.
       
   159          */
       
   160         virtual void SetContactListCollapsed( const TDesC& aContactListId,
       
   161                                               TBool aCollapsed ) = 0;
       
   162 
       
   163 
       
   164         /**
       
   165          * Creates an empty contact. The contact is also made to phone book.
       
   166          * The caller needs to set appropriate data to the contact,
       
   167          * and call the SaveChangesL method afterwards.
       
   168          * Ownership of contact is in storage.
       
   169          * @param aContactListId, Id of contactlist where contact is created.
       
   170          * @param aNickname The nick name, or KNullDesC if there's no nickname
       
   171          * @param aWVID The wv id
       
   172          * @return The created contact, or NULL if the wvid already existed
       
   173          */
       
   174         virtual MCAStoredContact* CreateContactL(
       
   175             const TDesC& aContactListId,
       
   176             const TDesC& aNickname,
       
   177             const TDesC& aWVID ) = 0;
       
   178 
       
   179         /**
       
   180          * Inserts contact to the defined contact list
       
   181          * If contact already exists in the contact list,
       
   182          * call is ignored and existing contact item is returned instead
       
   183          */
       
   184         virtual MCAStoredContact* CreateContactL(
       
   185             MCAContactList& aContactList,
       
   186             const TDesC& aNickname,
       
   187             const TDesC& aWVID,
       
   188             TStorageManagerGlobals::TPresenceStatus aStatus,
       
   189             TStorageManagerGlobals::TClientType aType,
       
   190             const TDesC& aAlias,
       
   191             const TDesC& aStatusText ) = 0;
       
   192 
       
   193 
       
   194         /**
       
   195          * Helper routine for handling observer events for contacts
       
   196          * @param aList Contact list where contact can be found
       
   197          */
       
   198         virtual void SendContactListUpdatedEvent( MCAContactList& aList ) = 0;
       
   199 
       
   200         /**
       
   201          * Removes all contacts.
       
   202          */
       
   203         virtual void RemoveAllContactsL() = 0;
       
   204 
       
   205         /**
       
   206          * Clears all selected-flags
       
   207          */
       
   208         virtual void ClearSelected() = 0;
       
   209 
       
   210         /**
       
   211          * Gets all selected contacts
       
   212          * @parram aSelected. Array of selected contacts.
       
   213          *                    Ownership is not transferred.
       
   214          *                    MUST NOT delete items from array.
       
   215          * @param aFilter Filter for contact selection @see TStorageManagerGlobals::TFilterType.
       
   216          */
       
   217         virtual void GetSelectedL( RPointerArray<MCAStoredContact>& aSelected,
       
   218                                    TStorageManagerGlobals::TFilterType aFilter ) = 0;
       
   219 
       
   220         /**
       
   221          * Count of stored contacts
       
   222          * @param aSkipOfflineContacts ETrue skip offline contacts.
       
   223          *                             EFalse Do not skip.
       
   224          * @return Count of contacts
       
   225          */
       
   226         virtual TInt ContactCount(
       
   227             TBool aSkipOfflineContacts = EFalse ) const = 0;
       
   228 
       
   229         /**
       
   230          * Enable or disable WV hiding
       
   231          * @param aHiding ETrue if hidden
       
   232          */
       
   233         virtual void SetWVHiding( TBool aHiding ) = 0;
       
   234 
       
   235         /**
       
   236          * Enable or disable WV hiding only Prefix( i.e "wv:")
       
   237          * @param aHiding ETrue if hidden
       
   238          */
       
   239         virtual void SetWVHidingPrefixOnly( TBool aHidingPrefixOnly ) = 0;  // UI CR ID:101-39728: Show domain part of the user ID
       
   240         /**
       
   241          *  CAUtils depends now from storage :(
       
   242          * Accessor for WV hiding flag
       
   243          * @return ETrue if hiding is enabled
       
   244          */
       
   245         virtual TBool WVHiding() = 0;
       
   246         /**
       
   247          *  CAUtils depends now from storage :(
       
   248          * Accessor for WV hiding flag
       
   249          * @return ETrue if hiding only prefix  is enabled
       
   250          */
       
   251         virtual TBool WVHidingPrefixOnly() = 0;      // UI CR ID: 101-39728: Show domain part of the user ID
       
   252 
       
   253         /**
       
   254          * Enable or disable Capitalization of contactlists
       
   255          * @param aCapital ETrue if capitalizing is enabled.
       
   256          */
       
   257         virtual void SetCapitalizingEnabled( TBool aCapital ) = 0; // UI CR ID: 101-39727
       
   258 
       
   259         /**
       
   260          *  CAUtils depends now from storage :(
       
   261          * @return ETrue if if capitalizing is enabled.
       
   262          */
       
   263         virtual TBool CapitalizingEnabled() = 0;       // UI CR ID:101-39727
       
   264         /**
       
   265          * Set watched status
       
   266          * @param aContactId. Id which watch status is changed.
       
   267          * @param aStatus. ETrue if watched. EFalse if not.
       
   268          */
       
   269         virtual void SetWatched( const TDesC& aContactId, TBool aStatus ) = 0;
       
   270 
       
   271         /**
       
   272          * Set watched status
       
   273          * @param aContactId. Id which watch status is changed.
       
   274          * @param aAmount Amount of pending messages.
       
   275          */
       
   276         virtual void SetPendingMessages( const TDesC& aContactId, TInt aAmount ) = 0;
       
   277 
       
   278         /**
       
   279          * Set blocked status
       
   280          * @param aContactId. Id which blocked status is changed.
       
   281          * @param aStatus. ETrue if blocked. EFalse if not.
       
   282          */
       
   283         virtual void SetBlocked( const TDesC& aContactId, TBool aStatus ) = 0;
       
   284 
       
   285         /**
       
   286          * Set block status. Only contact list aListId is checked
       
   287          * for aContactId, if id is found inside aListId its blocked
       
   288          * status is set according to aStatus.
       
   289          * @since S60 v3.2
       
   290          * @param aContactId Id which blocked status is changed.
       
   291          * @param aListId List id from which aContactId is searched.
       
   292          * @aStatus ETrue if blocked, EFalse if not.
       
   293          */
       
   294         virtual void SetBlocked( const TDesC& aContactId,
       
   295                                  const TDesC& aListId,
       
   296                                  TBool aStatus ) = 0;
       
   297         /**
       
   298         * Online status of user.
       
   299         * @param aContactId Id which status is wanted.
       
   300         * @return Onlinestatus of user.
       
   301         */
       
   302         virtual TStorageManagerGlobals::TPresenceStatus OnlineStatus(
       
   303             const TDesC& aContactId ) = 0;
       
   304 
       
   305         /**
       
   306          * Update presence information of contact.
       
   307          * @param aContactId Id of contact which presence is updated.
       
   308          * @param aStatus. New presence status
       
   309          * @param aAlias. New alias.
       
   310          * @param aStatusText New status message text.
       
   311          */
       
   312         virtual MCAStoredContact* UpdatePresenceL( const TDesC& aContactId,
       
   313                                                    TStorageManagerGlobals::TPresenceStatus aStatus,
       
   314                                                    TStorageManagerGlobals::TClientType aType,
       
   315                                                    const TDesC& aAlias,
       
   316                                                    const TDesC& aStatusText,
       
   317                                                    TStorageManagerGlobals::TPresenceStatus& aOldOnlineStatus ) = 0;
       
   318 
       
   319         /**
       
   320          * Identification of contact. This is resolved from known
       
   321          * identifications.
       
   322          * Alias, nickname and contactId.
       
   323          * Nickname is shown if set.
       
   324          * @param aContactId Id of contact which identification needed.
       
   325          * @return Identification of contact.
       
   326          *      Alias if nickname is not set and alias is enabled.
       
   327          *      Wvid without domain and prefix if nickname does not
       
   328                 exists and alias is not enabled or not exists.
       
   329          */
       
   330         virtual const TPtrC Identification( const TDesC& aContactId ) = 0;
       
   331 
       
   332         /**
       
   333          * Sort contacts by current algorithm.
       
   334          * @aContactListId. Contact list to be sorted.
       
   335          * If KNullDesC -> All lists are sorted.
       
   336          */
       
   337         virtual void Sort( const TDesC& aContactListId = KNullDesC ) = 0;
       
   338 
       
   339         /**
       
   340          * Resort one contact, what ever contact list it is in
       
   341          */
       
   342         virtual void ResortContactInAll( MCAStoredContact* aContact ) = 0;
       
   343 
       
   344         /**
       
   345          * Set sorting algorithm. Two possible algorithms.
       
   346          * Alphabetically or by presence.
       
   347          * @param aAlgorithm. Algorithm for sorting.
       
   348          */
       
   349         virtual void SetSortAlgorithm(
       
   350             MCAStoredContact::TSortAlgorithm aAlgorithm ) = 0;
       
   351 
       
   352         /**
       
   353          * Own status.
       
   354          * @return Contact which contains own status.
       
   355          */
       
   356         virtual MCAStoredContact& OwnStatus() = 0;
       
   357 
       
   358         /**
       
   359          * Set the value to show nickname or not
       
   360          * @param aShowNickName 'Show nick name' -value
       
   361          */
       
   362         virtual void SetShowNickname( TBool aShowNickName ) = 0;
       
   363 
       
   364         /**
       
   365          * Lock/unlock contact list. When lock is on
       
   366          * contact list cannot be expanded or collapsed.
       
   367          * @param aLocked ETrue if locked, EFalse if unlocked.
       
   368          */
       
   369         virtual void SetContactListLock( TBool aLocked ) = 0;
       
   370 
       
   371         /**
       
   372          * Reset contact lists for default values. For example
       
   373          * expande/collapse status. If only one lists exists,
       
   374          * it is expanded, and if more, then all are collapsed.
       
   375          */
       
   376         virtual void ResetContactLists() = 0;
       
   377 
       
   378         /**
       
   379          * Set contact list property. For example choose between
       
   380          * primary and secondary list properties. ( Collapsed/expanded )
       
   381          */
       
   382         virtual void SetContactListProperty( TContactListProperty aProperty ) = 0;
       
   383 
       
   384         /**
       
   385          * Initialize synchronise processing. Set current item etc.
       
   386          * @return KErrNotFound if no lists found.
       
   387          */
       
   388         virtual TInt InitSynchroniseProcess() = 0;
       
   389 
       
   390         /**
       
   391          * Set next contact list for synch.
       
   392          * @return KErrNotFound if no lists found.
       
   393          */
       
   394         virtual TInt SetNextForSynchroniseProcess() = 0;
       
   395 
       
   396         /**
       
   397          * Get current list which is processed.
       
   398          * @return Reference to current list.
       
   399          * @leaves with KErrNotFound, if no list found.
       
   400          */
       
   401         virtual MCAContactList& ListInSyncProcessL() = 0;
       
   402 
       
   403         /**
       
   404          * Check if all lists are synchronised or not.
       
   405          * @return ETrue if all are synchronised.
       
   406          */
       
   407         virtual TBool IsAllSynchronised( TBool &aIsFailed ) const = 0;
       
   408 
       
   409         /**
       
   410          * Check if contact is found in storage.
       
   411          * @param aContact contact to find.
       
   412          * @return ETrue if contact is found from storage
       
   413          */
       
   414         virtual TBool IsContactValid( const MCAStoredContact* aContact ) const = 0;
       
   415 
       
   416         /**
       
   417          * Sorts contact lists alphabetically.
       
   418          * @since S60 v3.2
       
   419          */
       
   420         virtual void SortContactLists() = 0;
       
   421     protected:
       
   422         /**
       
   423          * For protection.
       
   424          */
       
   425         virtual ~MCAStoredContacts() {};
       
   426     };
       
   427 
       
   428 #endif      // MCASTOREDCONTACTS_H
       
   429 
       
   430 // End of File