contentctrl_plat/ds_contact_adapter_customization_api/inc/nsmlcontactsdataprovider.h
changeset 50 00439341df81
equal deleted inserted replaced
46:38e18a8b16c7 50:00439341df81
       
     1 /*
       
     2 * Copyright (c) 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:  DS contacts dataprovider.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef __NSMLCONTACTSDATAPROVIDER_H__
       
    19 #define __NSMLCONTACTSDATAPROVIDER_H__
       
    20 
       
    21 // INCLUDES
       
    22 #include <f32file.h>
       
    23 #include <smldataprovider.h>
       
    24 #include <nsmlcontactsdatastore.h>
       
    25 
       
    26 // CLASS DECLARATION
       
    27 
       
    28 // ------------------------------------------------------------------------------------------------
       
    29 //  CNSmlContactsDataProvider
       
    30 //
       
    31 //  @lib nsmlcontactsdataprovider.lib
       
    32 // ------------------------------------------------------------------------------------------------
       
    33 class CNSmlContactsDataProvider : public CSmlDataProvider 
       
    34 	{
       
    35 	public:
       
    36 		/**
       
    37 		* Two-phased constructor.
       
    38 		*/
       
    39 		IMPORT_C static CNSmlContactsDataProvider* NewL();
       
    40 
       
    41 		/**
       
    42 		* Destructor.
       
    43 		*/
       
    44 		IMPORT_C virtual ~CNSmlContactsDataProvider();
       
    45 
       
    46 	protected:
       
    47 		/**
       
    48 		* Two-phased constructor.
       
    49 		*/
       
    50 		IMPORT_C static CNSmlContactsDataProvider* NewLC();
       
    51 
       
    52 		/**
       
    53 		* This method handles framework events.
       
    54 		* @param					Frameworks event.
       
    55 		* @param	aParam1			First parameter.
       
    56 		* @param	aParam2			Second parameter.
       
    57 		*/
       
    58 		IMPORT_C void DoOnFrameworkEvent(TSmlFrameworkEvent, TInt aParam1, TInt aParam2);
       
    59 
       
    60 		/**
       
    61 		* Check if operation is supported by dataprovider.
       
    62 		* @param	aOpId			Operations type.
       
    63 		* @return	ETrue if the operation is supported.
       
    64 		*/
       
    65 		IMPORT_C TBool DoSupportsOperation(TUid aOpId) const;
       
    66 
       
    67 		/**
       
    68 		* Gets dataproviders own StoreFormat.
       
    69 		*/
       
    70 		IMPORT_C const CSmlDataStoreFormat& DoStoreFormatL();
       
    71 
       
    72 		/**
       
    73 		* Lists all contacts databases on client.
       
    74 		* @return List of contact databases.
       
    75 		*/
       
    76 		IMPORT_C CDesCArray* DoListStoresLC();
       
    77 
       
    78 		/**
       
    79 		* Gets default storename on client.
       
    80 		* @return Default storename.
       
    81 		*/
       
    82 		IMPORT_C const TDesC& DoDefaultStoreL();
       
    83 
       
    84 		/**
       
    85 		* Constructs new instance of datastore.
       
    86 		* @return Newly created instance.
       
    87 		*/
       
    88 		IMPORT_C CSmlDataStore* DoNewStoreInstanceLC();
       
    89 
       
    90 		/**
       
    91 		This method returns the set of filters that can be used to send to the SyncML server.
       
    92 		* @return New filters.
       
    93 		*/
       
    94 		IMPORT_C const RPointerArray<CSyncMLFilter>& DoSupportedServerFiltersL();
       
    95 		
       
    96 		/**
       
    97 		This method checks what filters are supported by server.
       
    98 		@param	aServerDataStoreFormat	The store format of server
       
    99 		@param	aFilters				The array that includes filters
       
   100 		@param	aChangeInfo				The change information about changes that data provider did
       
   101 		*/
       
   102 		IMPORT_C void DoCheckSupportedServerFiltersL(const CSmlDataStoreFormat& aServerDataStoreFormat, RPointerArray<CSyncMLFilter>& aFilters, TSyncMLFilterChangeInfo& aChangeInfo);
       
   103 		
       
   104 		/**
       
   105 		This method updates dynamic filters up-to-date.
       
   106 		@param	aFilters				The array that includes filters
       
   107 		@param	aChangeInfo				The change information about changes that data provider did
       
   108 		*/
       
   109 		IMPORT_C void DoCheckServerFiltersL(RPointerArray<CSyncMLFilter>& aFilters, TSyncMLFilterChangeInfo& aChangeInfo);
       
   110 		
       
   111 		/**
       
   112 		This method generates a record filter query to be sent to the SyncML server for the provided filters.
       
   113 		@param	aFilters			The filters to be used for the query generation
       
   114 		@param	aMatch				The filter match type to be used
       
   115 		@param	aFilterMimeType		The mime type of the returned filter query
       
   116 		@param	TSyncMLFilterType 	The filter type of the returned filter query
       
   117 		@param	aStoreName			The name of used store
       
   118 		@return						The record filter query to be sent to the SyncML server - empty if no record filter involved
       
   119 									for this specific filter
       
   120 		*/
       
   121 		IMPORT_C HBufC* DoGenerateRecordFilterQueryLC(const RPointerArray<CSyncMLFilter>& aFilters, TSyncMLFilterMatchType aMatch, TDes& aFilterMimeType, TSyncMLFilterType& aFilterType, TDesC& aStoreName);
       
   122 		
       
   123 		/**
       
   124 		This method generates a field filter query to be sent to the SyncML server for the provided filters.
       
   125 		@param	aFilters		The filters to be used for the query generation
       
   126 		@param	aFilterMimeType		The mime type of the returned filter query
       
   127 		@param	aProperties		The field filter query to be sent to the SyncML server - empty if no field filter involved
       
   128 								for this specific filter
       
   129 		@param  aStoreName		The name of used store
       
   130 		*/
       
   131 		IMPORT_C void DoGenerateFieldFilterQueryL(const RPointerArray<CSyncMLFilter>& aFilters, TDes& aFilterMimeType, RPointerArray<CSmlDataProperty>& aProperties, TDesC& aStoreName);
       
   132 
       
   133 		/**
       
   134 		* C++ constructor.
       
   135 		*/
       
   136 		IMPORT_C CNSmlContactsDataProvider();
       
   137 
       
   138 		/**
       
   139 		* 2nd phase constructor.
       
   140 		*/
       
   141 		IMPORT_C void ConstructL();
       
   142 
       
   143 	protected: // New 
       
   144 		
       
   145 		IMPORT_C virtual const TDesC& GetStoreFormatResourceFileL() const;
       
   146     	
       
   147 		IMPORT_C virtual CNSmlContactsDataStore* CreateDataStoreLC() const;
       
   148 		
       
   149 	private: // data
       
   150 		CNSmlContactsDataStore* iContactsDataStore; 
       
   151 		RPointerArray<CSyncMLFilter> iFilterArray;
       
   152 		RFs iRfs;
       
   153 		RStringPool iStringPool;
       
   154 		CSmlDataStoreFormat* iStoreFormat;
       
   155 	};
       
   156 	
       
   157 #endif // __NSMLCONTACTSDATAPROVIDER_H__
       
   158 
       
   159 // End of File