omads/omadsextensions/adapters/agenda/src/nsmlagendadataprovider.cpp
changeset 19 2691f6aa1921
parent 4 e6e896426eac
child 20 e1de7d03f843
equal deleted inserted replaced
4:e6e896426eac 19:2691f6aa1921
     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 agenda data provider
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include <SmlDataProvider.h>
       
    21 #include <ecom.h>
       
    22 #include <barsc.h>
       
    23 #include <bautils.h>
       
    24 #include <nsmlagendadatastore_1_1_2.rsg>
       
    25 #include <SmlDataFormat.h>
       
    26 #include <implementationproxy.h>
       
    27 #include <data_caging_path_literals.hrh>
       
    28 #include <e32property.h>
       
    29 #include <DataSyncInternalPSKeys.h>
       
    30 #include <nsmldebug.h>
       
    31 #include "nsmlagendadataprovider.h"
       
    32 #include "nsmlagendadatastore.h"
       
    33 #include "nsmlagendadebug.h"
       
    34 #include "nsmldsimpluids.h"
       
    35 
       
    36 // ====================================== MEMBER FUNCTIONS ========================================
       
    37 
       
    38 // ------------------------------------------------------------------------------------------------
       
    39 // CNSmlAgendaDataProvider::CNSmlAgendaDataProvider
       
    40 // C++ default constructor can NOT contain any code, that
       
    41 // might leave.
       
    42 // ------------------------------------------------------------------------------------------------
       
    43 //
       
    44 CNSmlAgendaDataProvider::CNSmlAgendaDataProvider()
       
    45 	{
       
    46 	FLOG(_L("CNSmlAgendaDataProvider::CNSmlAgendaDataProvider(): BEGIN"));
       
    47 	FLOG(_L("CNSmlAgendaDataProvider::CNSmlAgendaDataProvider(): END"));
       
    48 	}
       
    49 
       
    50 // ------------------------------------------------------------------------------------------------
       
    51 // CNSmlAgendaDataProvider::ConstructL
       
    52 // Symbian 2nd phase constructor can leave.
       
    53 // ------------------------------------------------------------------------------------------------
       
    54 //
       
    55 void CNSmlAgendaDataProvider::ConstructL( )
       
    56 	{
       
    57 	FLOG(_L("CNSmlAgendaDataProvider::NewL: BEGIN"));
       
    58 	iAgnDataStore = CNSmlAgendaDataStore::NewL();
       
    59 	FLOG(_L("CNSmlAgendaDataProvider::NewL: END"));
       
    60 	}
       
    61 
       
    62 // ------------------------------------------------------------------------------------------------
       
    63 // CNSmlAgendaDataProvider::NewL
       
    64 // Two-phased constructor.
       
    65 // ------------------------------------------------------------------------------------------------
       
    66 //
       
    67 CNSmlAgendaDataProvider* CNSmlAgendaDataProvider::NewL()
       
    68 	{
       
    69 	FLOG(_L("CNSmlAgendaDataProvider::NewL: BEGIN"));
       
    70 	CNSmlAgendaDataProvider* self = new ( ELeave ) CNSmlAgendaDataProvider();
       
    71 	CleanupStack::PushL( self );
       
    72 	self->ConstructL();
       
    73 	CleanupStack::Pop( self );
       
    74 	FLOG(_L("CNSmlAgendaDataProvider::NewL: END"));
       
    75 	return self;
       
    76 	}
       
    77 
       
    78 // ------------------------------------------------------------------------------------------------
       
    79 // CNSmlAgendaDataProvider::~CNSmlAgendaDataProvider
       
    80 // Destructor.
       
    81 // ------------------------------------------------------------------------------------------------
       
    82 //
       
    83 CNSmlAgendaDataProvider::~CNSmlAgendaDataProvider()
       
    84 	{
       
    85 	FLOG(_L("CNSmlAgendaDataProvider::~CNSmlAgendaDataProvider(): BEGIN"));
       
    86 	delete iDSFormat;
       
    87 	delete iAgnDataStore;
       
    88 	iFilterArray.ResetAndDestroy();
       
    89 	iFilterArray.Close();
       
    90 	FLOG(_L("CNSmlAgendaDataProvider::~CNSmlAgendaDataProvider(): END"));
       
    91 	}
       
    92 
       
    93 // ------------------------------------------------------------------------------------------------
       
    94 // CNSmlAgendaDataProvider::DoOnFrameworkEvent
       
    95 // Not supported.
       
    96 // ------------------------------------------------------------------------------------------------
       
    97 //
       
    98 void CNSmlAgendaDataProvider::DoOnFrameworkEvent( TSmlFrameworkEvent /*aEvent*/, TInt /*aParam1*/, TInt /*aParam2*/ )
       
    99     {
       
   100 	FLOG(_L("CNSmlAgendaDataProvider::DoOnFrameworkEvent: BEGIN"));
       
   101 	FLOG(_L("CNSmlAgendaDataProvider::DoOnFrameworkEvent: END"));
       
   102     }
       
   103 
       
   104 // ------------------------------------------------------------------------------------------------
       
   105 // CNSmlAgendaDataProvider::DoSupportsOperation
       
   106 // Return supported operation uid.
       
   107 // ------------------------------------------------------------------------------------------------
       
   108 //
       
   109 TBool CNSmlAgendaDataProvider::DoSupportsOperation( TUid aOpId ) const
       
   110     {
       
   111 	FLOG(_L("CNSmlAgendaDataProvider::DoSupportsOperation: BEGIN"));
       
   112 	if ( aOpId == KUidSmlSupportMultipleStores )
       
   113 		{
       
   114 		FLOG(_L("CNSmlAgendaDataProvider::DoSupportsOperation: END"));
       
   115 		return ETrue;
       
   116 		}
       
   117 	FLOG(_L("CNSmlAgendaDataProvider::DoSupportsOperation: END"));
       
   118 	return EFalse;
       
   119     }
       
   120 
       
   121 // ------------------------------------------------------------------------------------------------
       
   122 // CNSmlAgendaDataProvider::DoStoreFormatL
       
   123 // Return the current data store format.
       
   124 // ------------------------------------------------------------------------------------------------
       
   125 //
       
   126 const CSmlDataStoreFormat& CNSmlAgendaDataProvider::DoStoreFormatL()
       
   127     {
       
   128 	FLOG(_L("CNSmlAgendaDataProvider::DoStoreFormatL(): BEGIN"));
       
   129 	
       
   130 	if ( iDSFormat )
       
   131 		{
       
   132        	delete iDSFormat;
       
   133        	iDSFormat = NULL;
       
   134 		}
       
   135 	// RD_MULTICAL
       
   136 	iDSFormat = iAgnDataStore->StoreFormatL();
       
   137 	// RD_MULTICAL
       
   138 	return *iDSFormat;
       
   139     }
       
   140 
       
   141 // ------------------------------------------------------------------------------------------------
       
   142 // CNSmlAgendaDataProvider::DoListStoresLC
       
   143 // Return the list of datastore names.
       
   144 // ------------------------------------------------------------------------------------------------
       
   145 //
       
   146 CDesCArray* CNSmlAgendaDataProvider::DoListStoresLC()
       
   147     {
       
   148 	FLOG(_L("CNSmlAgendaDataProvider::DoListStoresLC(): BEGIN"));
       
   149 	FLOG(_L("CNSmlAgendaDataProvider::DoListStoresLC(): END"));
       
   150 	return iAgnDataStore->DoListAgendaFilesLC();
       
   151     }
       
   152 
       
   153 // ------------------------------------------------------------------------------------------------
       
   154 // CNSmlAgendaDataProvider::DoDefaultStoreL
       
   155 // Return the name of default store name.
       
   156 // ------------------------------------------------------------------------------------------------
       
   157 //
       
   158 const TDesC& CNSmlAgendaDataProvider::DoDefaultStoreL()
       
   159     {
       
   160 	FLOG(_L("CNSmlAgendaDataProvider::DoDefaultStoreL(): BEGIN"));
       
   161 	FLOG(_L("CNSmlAgendaDataProvider::DoDefaultStoreL(): END"));
       
   162 	return iAgnDataStore->DoGetDefaultFileNameL();
       
   163     }
       
   164 
       
   165 // ------------------------------------------------------------------------------------------------
       
   166 // CNSmlAgendaDataProvider::DoNewStoreInstanceLC
       
   167 // Return instance of data store
       
   168 // ------------------------------------------------------------------------------------------------
       
   169 //
       
   170 CSmlDataStore* CNSmlAgendaDataProvider::DoNewStoreInstanceLC()
       
   171     {
       
   172 	FLOG(_L("CNSmlAgendaDataProvider::DoNewStoreInstanceLC(): BEGIN"));
       
   173 	CNSmlAgendaDataStore* newStore = CNSmlAgendaDataStore::NewL();
       
   174 	CleanupStack::PushL( newStore );
       
   175 	FLOG(_L("CNSmlAgendaDataProvider::DoNewStoreInstanceLC(): END"));
       
   176 	return newStore;
       
   177     } 
       
   178 
       
   179 // ------------------------------------------------------------------------------------------------
       
   180 // CNSmlAgendaDataProvider::DoSupportedServerFiltersL
       
   181 // 
       
   182 // ------------------------------------------------------------------------------------------------
       
   183 const RPointerArray<CSyncMLFilter>& CNSmlAgendaDataProvider::DoSupportedServerFiltersL()
       
   184 	{
       
   185 	// This method returns empty array. It means that this Data Provider does not support filtering
       
   186 	FLOG(_L("CNSmlAgendaDataProvider::DoSupportedServerFiltersL(): BEGIN"));
       
   187 	FLOG(_L("CNSmlAgendaDataProvider::DoSupportedServerFiltersL(): END"));
       
   188 	return iFilterArray;
       
   189 	}
       
   190 
       
   191 // ------------------------------------------------------------------------------------------------
       
   192 // CNSmlAgendaDataProvider::DoCheckSupportedServerFiltersL
       
   193 // 
       
   194 // ------------------------------------------------------------------------------------------------
       
   195 void CNSmlAgendaDataProvider::DoCheckSupportedServerFiltersL( const CSmlDataStoreFormat& /*aServerDataStoreFormat*/, RPointerArray<CSyncMLFilter>& /*aFilters*/, TSyncMLFilterChangeInfo& /*aChangeInfo*/ )
       
   196 	{
       
   197 	FLOG(_L("CNSmlAgendaDataProvider::DoCheckSupportedServerFiltersL(): BEGIN"));
       
   198 	FLOG(_L("CNSmlAgendaDataProvider::DoCheckSupportedServerFiltersL(): END"));
       
   199 	User::Leave( KErrNotSupported );
       
   200 	}
       
   201 
       
   202 // ------------------------------------------------------------------------------------------------
       
   203 // CNSmlAgendaDataProvider::CheckServerFiltersL
       
   204 // 
       
   205 // ------------------------------------------------------------------------------------------------
       
   206 void CNSmlAgendaDataProvider::DoCheckServerFiltersL( RPointerArray<CSyncMLFilter>& /*aFilters*/, TSyncMLFilterChangeInfo& /*aChangeInfo*/ )
       
   207 	{
       
   208 	FLOG(_L("CNSmlAgendaDataProvider::DoCheckServerFiltersL(): BEGIN"));
       
   209 	FLOG(_L("CNSmlAgendaDataProvider::DoCheckServerFiltersL(): END"));
       
   210 	User::Leave( KErrNotSupported );
       
   211 	}
       
   212 
       
   213 // ------------------------------------------------------------------------------------------------
       
   214 // CNSmlAgendaDataProvider::DoGenerateRecordFilterQueryLC
       
   215 // 
       
   216 // ------------------------------------------------------------------------------------------------
       
   217 HBufC* CNSmlAgendaDataProvider::DoGenerateRecordFilterQueryLC( const RPointerArray<CSyncMLFilter>& /*aFilters*/, TSyncMLFilterMatchType /*aMatch*/, TDes& /*aFilterMimeType*/, TSyncMLFilterType& /*aFilterType*/, TDesC& /*aStoreName*/ )
       
   218 	{
       
   219 	FLOG(_L("CNSmlAgendaDataProvider::DoGenerateRecordFilterQueryLC(): BEGIN"));
       
   220 	FLOG(_L("CNSmlAgendaDataProvider::DoGenerateRecordFilterQueryLC(): END"));
       
   221 	User::Leave( KErrNotSupported );
       
   222 	return NULL;
       
   223 	}
       
   224 	
       
   225 // ------------------------------------------------------------------------------------------------
       
   226 // CNSmlAgendaDataProvider::DoGenerateFieldFilterQueryL
       
   227 // 
       
   228 // ------------------------------------------------------------------------------------------------
       
   229 void CNSmlAgendaDataProvider::DoGenerateFieldFilterQueryL( const RPointerArray<CSyncMLFilter>& /*aFilters*/, TDes& /*aFilterMimeType*/, RPointerArray<CSmlDataProperty>& /*aProperties*/, TDesC& /*aStoreName*/ )
       
   230 	{
       
   231 	FLOG(_L("CNSmlAgendaDataProvider::DoGenerateFieldFilterQueryL(): BEGIN"));
       
   232 	FLOG(_L("CNSmlAgendaDataProvider::DoGenerateFieldFilterQueryL(): END"));
       
   233 	User::Leave( KErrNotSupported );
       
   234 	}
       
   235 
       
   236 // =================================== OTHER EXPORTED FUNCTIONS ===================================
       
   237 #ifndef IMPLEMENTATION_PROXY_ENTRY
       
   238 #define IMPLEMENTATION_PROXY_ENTRY( aUid, aFuncPtr ) { { aUid }, ( aFuncPtr ) }
       
   239 #endif
       
   240 
       
   241 const TImplementationProxy ImplementationTable[] = 
       
   242     {
       
   243 	IMPLEMENTATION_PROXY_ENTRY( KNSmlAgendaAdapterImplUid, CNSmlAgendaDataProvider::NewL )
       
   244     };
       
   245 
       
   246 // ------------------------------------------------------------------------------------------------
       
   247 // ImplementationGroupProxy
       
   248 // Framework needs this.
       
   249 // ------------------------------------------------------------------------------------------------
       
   250 //
       
   251 EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount )
       
   252     {
       
   253 	FLOG(_L("ImplementationGroupProxy() for CNSmlAgendaDataProvider: begin"));
       
   254     aTableCount = sizeof( ImplementationTable ) / sizeof( TImplementationProxy );
       
   255 	FLOG(_L("ImplementationGroupProxy() for CNSmlAgendaDataProvider: end"));
       
   256     return ImplementationTable;
       
   257 	}
       
   258 
       
   259 
       
   260 //  End of File