uiservicetab/vimpststorage/inc/mvimpststorageserviceview.h
branchRCL_3
changeset 22 3104fc151679
parent 21 2b7283837edb
child 23 9a48e301e94b
equal deleted inserted replaced
21:2b7283837edb 22:3104fc151679
     1 /*
       
     2 * Copyright (c) 2008 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 #ifndef MVIMPSTSTORAGESERVICEVIEW_H
       
    20 #define MVIMPSTSTORAGESERVICEVIEW_H
       
    21 
       
    22 
       
    23 #include "tvimpstenums.h"
       
    24 
       
    25 #include <e32std.h>
       
    26 #include <badesca.h>
       
    27 #include "mvimpststoragecontact.h"
       
    28 
       
    29 // FORWARD DECLARATIONS
       
    30 class MVIMPSTStorageContactsObserver;
       
    31 class MVIMPSTStorageContactList;
       
    32 class MVIMPSTStorageContact;
       
    33 class MVPbkContactLink;
       
    34 
       
    35 // CLASS DECLARATION
       
    36 
       
    37 class MVIMPSTStorageServiceCacheWriter
       
    38 	{
       
    39 	public:
       
    40 
       
    41 		/**
       
    42 		* update existing contact 
       
    43 		* @param aContactLink contact id to be updatated
       
    44 		* @param aUserId contact id to be updated
       
    45 		* @param aDisplayName contact display name to be updated
       
    46 		* @reurn the storage contact pointer if found else NULL
       
    47 		*/
       
    48 		virtual MVIMPSTStorageContact* UpdateCacheContactL(const MVPbkContactLink& aContactLink,
       
    49 												 const TDesC& aUserId, 
       
    50 								   	   	         const TDesC& aDisplayName,
       
    51 								   	   	         const TDesC8& aAvatarContent ) = 0 ;
       
    52 
       
    53 		/**
       
    54 		* add a new contact to cache  
       
    55 		* @param aContactLink contact id to be add
       
    56 		* @param aUserId contact id to be add
       
    57 		* @param aDisplayName contact display name to be add 
       
    58 		* @reurn the new storage contact pointer if contact is already exist return the smae 
       
    59 		
       
    60 		*/		 					   	   	       
       
    61 		virtual MVIMPSTStorageContact* AddContactToCacheL(const MVPbkContactLink& aContactLink,
       
    62 										 const TDesC& aUserId, 
       
    63 						   	   	         const TDesC& aDisplayName,
       
    64 						   	   	         const TDesC8& aAvatarContent,
       
    65 						   	   	         TVIMPSTEnums::TVIMPSTStorgaeEventType aType ) =0  ;
       
    66 					   	   	               
       
    67 		/*
       
    68 		* remopve existing contact 
       
    69 		* @param aContactLink contact id to be removed
       
    70 		* @param aUserId contact id to be removed
       
    71 		* @param aDisplayName contact display name to be removed
       
    72 		* @reurn the error if any
       
    73 		*/
       
    74 		virtual TInt RemoveContactFromCacheL(const MVPbkContactLink& aContactLink,TVIMPSTEnums::TVIMPSTStorgaeEventType aType ) = 0;
       
    75 
       
    76 
       
    77 		/**
       
    78 		* Removes all contacts from cache and notify to observers
       
    79 		*/
       
    80 		virtual void RemoveAllCacheContactsL() = 0;
       
    81 
       
    82 		/**
       
    83 		* Read the default contact list if exist else create default list
       
    84 		* @return contact list pointer
       
    85 		*/
       
    86 		virtual MVIMPSTStorageContactList* GetDefaultContactListL() =0;
       
    87 
       
    88 		/**
       
    89 		* send the notificatoion about fetch completion
       
    90 		*/
       
    91 		virtual void NotifyServiceViewL(TVIMPSTEnums::TVIMPSTStorgaeEventType aEventType, MVIMPSTStorageContact* aContact = NULL ) = 0 ;
       
    92 
       
    93 		/**
       
    94 		* find contact by user id
       
    95 		* @param aUserId contact id to be find
       
    96 		* @return storage contact pointer if found else NULL
       
    97 		*/
       
    98 		virtual MVIMPSTStorageContact* FindCacheContactByUserId( const TDesC& aUserId ) = 0 ;
       
    99 		
       
   100 		
       
   101 		/**
       
   102 		* find contact by user id
       
   103 		* @param aContactLink contact link to be find
       
   104 		* @return storage contact pointer if found else NULL
       
   105 		*/
       
   106 		virtual MVIMPSTStorageContact* FindCacheContactByLink(const MVPbkContactLink& aContactLink) = 0 ;
       
   107 
       
   108 		/**
       
   109 		* add contact to the contact cache and notify the observers
       
   110 		* @param aContact contact id to be added.
       
   111 		*/
       
   112 	    virtual	TInt AddStorageContactToCacheL(MVIMPSTStorageContact* aContactToAdd ) = 0 ;
       
   113 		
       
   114 	
       
   115 	};
       
   116 /**
       
   117  *  Interface for stored contacts container
       
   118  *
       
   119  *  @lib VIMPSTStorage.dll
       
   120  *  @since 5.0
       
   121  */
       
   122 class MVIMPSTStorageServiceView
       
   123     {
       
   124     public: // Definitions
       
   125        
       
   126         /**
       
   127          * Add an observer.
       
   128          * @param aObserver The observer
       
   129          */
       
   130         virtual void AddObserverL( MVIMPSTStorageContactsObserver* aObserver ) = 0;
       
   131 
       
   132         /**
       
   133          * Remove an observer.
       
   134          * @param aObserver The observer
       
   135          */
       
   136         virtual void RemoveObserver( MVIMPSTStorageContactsObserver* aObserver ) = 0;
       
   137 
       
   138       	
       
   139 		/**
       
   140          * Find a contact from the store by using Service ID         
       
   141          * @param aServiceId the Service ID of the contact to find
       
   142          * @return The contact
       
   143          */
       
   144 		virtual MVIMPSTStorageContact* FindContactByUserId( const TDesC& aUserId ) = 0;
       
   145         
       
   146        
       
   147         /**
       
   148          * Count of lists.
       
   149          * @return Count of lists.
       
   150          */
       
   151         virtual TInt ListCount() const = 0;
       
   152         
       
   153         /**
       
   154          * List in index.
       
   155          * @param aIndex. Index of list.
       
   156          * return Contact list.
       
   157          */
       
   158         virtual MVIMPSTStorageContactList& ListAt( TInt aIndex ) const = 0;
       
   159 
       
   160         /**
       
   161          * Find contact list by id
       
   162          * @param aListId. Id to find.
       
   163          * @return Contactlist. If not found return NULL
       
   164          */        
       
   165         virtual MVIMPSTStorageContactList* FindContactList( const TDesC& aListId ) = 0;
       
   166 
       
   167          /**
       
   168          * Add new contact list.
       
   169          * @param aContactListId Id for new contact list.
       
   170          * @param aDisplayName Display name of new contact list.
       
   171          */
       
   172         virtual MVIMPSTStorageContactList* CreateContactListL( const TDesC& aContactListId, 
       
   173                                         				      const TDesC& aDisplayName ) = 0;
       
   174         
       
   175         /**
       
   176          * Remove contact list from store.
       
   177          * @param aContactListId. Id of contact list to be removed.
       
   178          */
       
   179         virtual void RemoveContactList( const TDesC& aContactListId ) = 0;
       
   180                 
       
   181        
       
   182         /**
       
   183          * Count of stored contacts
       
   184          * @param aSkipOfflineContacts ETrue skip offline contacts. 
       
   185          *                             EFalse Do not skip.
       
   186          * @return TInt Count of contacts
       
   187          */
       
   188         virtual TInt ContactCount(TBool aSkipOfflineContacts = EFalse ) const = 0;
       
   189             
       
   190           
       
   191         /** 
       
   192          * Update presence information of contact.
       
   193          * @param aContactId Id of contact which presence is updated.
       
   194          * @param aStatus. New presence status
       
   195          * @param aAlias. New alias.
       
   196          * @param aStatusText New status message text.
       
   197          * @param aAvatarData  avatar content,
       
   198          * @param aIsClearingAvatar set to ETrue while clearing the avatar
       
   199          * @return MVIMPSTStorageContact* pointer of the contact
       
   200          */
       
   201         virtual MVIMPSTStorageContact* UpdatePresenceL(const TDesC& aContactId, 
       
   202 							                           TVIMPSTEnums::TOnlineStatus aStatus, 
       
   203 							                           const TDesC& aStatusText,
       
   204 							                           const TDesC8& aAvatarData,
       
   205 							                           TBool aIsClearingAvatar = EFalse) = 0;
       
   206          
       
   207          /** 
       
   208          * Update presence information of contact.
       
   209          * @param aContactId Id of contact which presence is updated.
       
   210          * @param aStatus. New presence status
       
   211          * @param aAlias. New alias.
       
   212          * @param aStatusText New status message text.
       
   213          * @return MVIMPSTStorageContact* pointer of the contact
       
   214          */
       
   215         virtual MVIMPSTStorageContact* UpdateAvatarL(const TDesC& aContactId,
       
   216 							                         const TDesC8& aAvatarData ) = 0;
       
   217         
       
   218         /**
       
   219          * add contact ot the virtual phonebook.
       
   220          * @param aContact contact id to be added.
       
   221          */
       
   222         virtual MVIMPSTStorageContact* CreateNewContactL(const TDesC& aUserId, 
       
   223         										         const TDesC& aDisplayName = KNullDesC,
       
   224         										         TBool aIsInvitationItem = EFalse ,
       
   225         										         TBool aInvitationAutoAccept = EFalse) = 0;
       
   226         
       
   227         /**
       
   228          * add contact ot the virtual phonebook.
       
   229          * @param aContact contact id to be added.
       
   230          */
       
   231         virtual TInt CreateNewContactFromRetrivedIdL(  TInt aIndexToUse  ) = 0;
       
   232         
       
   233         /**
       
   234          * add contact ot the virtual phonebook.
       
   235          * @param aContact contact id to be added.
       
   236          */
       
   237         virtual TInt DeleteNewContactFromRetrivedIdL(  TInt aIndexToUse  ) = 0;
       
   238         		
       
   239 		/**
       
   240          * add contact ot the virtual phonebook.
       
   241          * @param aContact contact id to be added.
       
   242          */
       
   243         virtual TInt RemoveContactL( MVIMPSTStorageContact* aContact  )  = 0 ;
       
   244         
       
   245         
       
   246         /**
       
   247          * add contact ot the virtual phonebook.
       
   248          * @param aContact contact id to be added.
       
   249          */
       
   250         virtual void CreateNewFetchContactsL( RArray <TPtrC> &aFirstNameList, 
       
   251                                              RArray <TPtrC> &aServiceField ) = 0;
       
   252         
       
   253         
       
   254         /**
       
   255          * returns ETrue if Local Store, EFalse if XSP Store
       
   256          * @return TBool
       
   257          */
       
   258         virtual TBool  IsLocalStore() const = 0;
       
   259         
       
   260       	
       
   261   		/**
       
   262          * From MVIMPSTStorageServiceView
       
   263          */
       
   264   		virtual TInt RetriveLinkXSPIdsL(const TDesC8& aContactPackLink ) = 0 ;
       
   265         
       
   266         /**
       
   267          * From MVIMPSTStorageServiceView
       
   268          */
       
   269         virtual const TDesC& GetRetrieveXSPIdL(TInt aIndex )  = 0 ;
       
   270        
       
   271        	/**
       
   272          * From MVIMPSTStorageServiceView
       
   273          */
       
   274 	   virtual MVIMPSTStorageContact* FindContactByLink(const MVPbkContactLink& aContactLink ) = 0  ;
       
   275 	   
       
   276 	   
       
   277 	   virtual void Sort( const TDesC& aContactListId  = KNullDesC ) = 0 ;
       
   278 	   
       
   279 	   virtual MVIMPSTStorageContact& OwnContactL() = 0 ;
       
   280 	   
       
   281 	   virtual void DeleteDatabaseL() = 0 ;
       
   282 	   
       
   283 	   virtual void SetOwnUserIdL(const TDesC& aUserId ) = 0 ; 
       
   284 	   
       
   285 		/**
       
   286 		* From MVIMPSTStorageServiceView
       
   287 		* takes the ownership of aUnnamedText
       
   288 		*/
       
   289   	   virtual void SetUnnamedTextL(HBufC* aUnnamedText ) = 0 ;
       
   290 	
       
   291     protected:
       
   292         /**
       
   293          * virtual destructor.
       
   294          */ 
       
   295         virtual ~MVIMPSTStorageServiceView(){};
       
   296     };
       
   297     
       
   298 #endif      // MVIMPSTSTORAGESERVICEVIEW_H
       
   299 
       
   300 // End of File