calendarui/customisationmanager/src/calencustomisationmanager.cpp
changeset 49 5de72ea7a065
parent 18 c198609911f9
child 50 579cc610882e
equal deleted inserted replaced
37:360d55486d7f 49:5de72ea7a065
    25 #include "calencustomisationmanager.h"
    25 #include "calencustomisationmanager.h"
    26 #include "calencommandhandler.h"
    26 #include "calencommandhandler.h"
    27 #include "calenservices.h"
    27 #include "calenservices.h"
    28 #include "calencustomisation.h"
    28 #include "calencustomisation.h"
    29 #include <ecom/ecom.h>
    29 #include <ecom/ecom.h>
       
    30 #include <e32lang.h>
    30 #include "calenservices.h"
    31 #include "calenservices.h"
    31 #include "calenservicesfactory.h"
    32 #include "calenservicesfactory.h"
       
    33 #include "CalenUid.h"
    32 
    34 
    33 
    35 
    34 
    36 
    35 
    37 
    36 // ----------------------------------------------------------------------------
    38 // ----------------------------------------------------------------------------
   181     
   183     
   182     iPluginInfo.ResetAndDestroy();
   184     iPluginInfo.ResetAndDestroy();
   183     iActivePlugins.Reset();
   185     iActivePlugins.Reset();
   184     iRomBasedPlugins.Reset();
   186     iRomBasedPlugins.Reset();
   185 
   187 
   186     //Added resolver for corolla release
       
   187     // Set resolver params
       
   188     TLanguage lang = User::Language();
       
   189     TBuf8<40> langStr;
       
   190     langStr.Format( _L8("language(%d)"), lang );
       
   191 
       
   192     TEComResolverParams resolverParams;
       
   193     resolverParams.SetDataType( langStr );
       
   194     resolverParams.SetGenericMatch( ETrue );
       
   195     
       
   196    // REComSession::ListImplementationsL( KCalenCustomisationInterfaceUid, resolverParams, iPluginInfo );
       
   197     REComSession::ListImplementationsL( KCalenCustomisationInterfaceUid, iPluginInfo );
   188     REComSession::ListImplementationsL( KCalenCustomisationInterfaceUid, iPluginInfo );
       
   189     
       
   190     LoadPluginsBasedOnVariantL();
       
   191     
   198     TInt pluginCount = iPluginInfo.Count();
   192     TInt pluginCount = iPluginInfo.Count();
   199     
   193     
   200     for ( TInt pluginIndex(0); pluginIndex < pluginCount; ++pluginIndex )
   194     if(pluginCount) 
   201         {
   195 		{
   202         TUid pluginUid = iPluginInfo[pluginIndex]->ImplementationUid();
   196     	for ( TInt pluginIndex(0); pluginIndex < pluginCount; ++pluginIndex )
   203         
   197 			{
   204             // If the plugin can not be found or if it is enabled
   198     		TUid pluginUid = iPluginInfo[pluginIndex]->ImplementationUid();
   205             // add it to the list of active plugins
   199 
   206             iActivePlugins.AppendL( pluginUid );
   200     		// If the plugin can not be found or if it is enabled
   207             
   201     		// add it to the list of active plugins
   208             // If the plugin is rom-based, store its uid
   202     		iActivePlugins.AppendL( pluginUid );
   209             if ( iPluginInfo[pluginIndex]->RomBased() )
   203 
   210                 {
   204     		// If the plugin is rom-based, store its uid
   211                 iRomBasedPlugins.AppendL( pluginUid );
   205     		if ( iPluginInfo[pluginIndex]->RomBased() )
   212                 }
   206 				{
   213             
   207     			iRomBasedPlugins.AppendL( pluginUid );
   214         }
   208 				}
   215 
   209 
   216     TRACE_EXIT_POINT;
   210 			}
   217     }
   211 		}
       
   212 
       
   213     TRACE_EXIT_POINT;
       
   214     }
       
   215 
       
   216 // ----------------------------------------------------------------------------
       
   217 // CCalenCustomisationManager::LoadPluginsBasedOnVariantL
       
   218 // Loads the plugin based on the language variant
       
   219 // ----------------------------------------------------------------------------
       
   220 //
       
   221 void CCalenCustomisationManager::LoadPluginsBasedOnVariantL()
       
   222 {
       
   223 	TLanguage languge = User::Language();
       
   224 	RArray<TUid> needsToBeRemoved;
       
   225 	
       
   226 	switch(languge) 
       
   227 		{
       
   228 		case ELangTaiwanChinese:
       
   229 		case ELangPrcChinese:
       
   230 		case ELangHongKongChinese:
       
   231 			// TODO: Remove the other regional plugins Thai, Vietnamese etc.
       
   232 			break;
       
   233 		case ELangThai:
       
   234 		case ELangEnglish_Thailand:
       
   235 			needsToBeRemoved.Append(KCalenChineseImplUid);
       
   236 			// TODO: Remove the other regional plugin Vietnamese.
       
   237 			break;
       
   238 		case ELangVietnamese:
       
   239 			needsToBeRemoved.Append(KCalenChineseImplUid);
       
   240 			// TODO: Remove the other regional plugin Thai.
       
   241 			break;
       
   242 
       
   243 		default:
       
   244 			needsToBeRemoved.Append(KCalenChineseImplUid);
       
   245 			// TODO: Remove the other regional plugins Thai, Vietnamese etc.
       
   246 			break;
       
   247 		}
       
   248 	TInt count = needsToBeRemoved.Count();
       
   249 	if(count) 
       
   250 		{
       
   251 		for(TInt i=0; i< count; i++) 
       
   252 			{
       
   253 			TInt index = iPluginInfo.Find(needsToBeRemoved[i],
       
   254 								CCalenCustomisationManager::PluginInfoFinder);
       
   255 			if( index != KErrNotFound ) 
       
   256 				{
       
   257 				CImplementationInformation* impl = iPluginInfo[index];
       
   258 				iPluginInfo.Remove(index);
       
   259 				delete impl;
       
   260 				}
       
   261 			}
       
   262 		}
       
   263 	needsToBeRemoved.Close();
       
   264 }
       
   265 
       
   266 // ----------------------------------------------------------------------------
       
   267 // CCalenCustomisationManager::PluginInfoFinder(
       
   268 // Matches an uid in pluginInfo.
       
   269 // ----------------------------------------------------------------------------
       
   270 //
       
   271 TBool CCalenCustomisationManager::PluginInfoFinder( const TUid* aUid,
       
   272 								const CImplementationInformation&  aArrayItem )
       
   273 {
       
   274 	return (*aUid  == aArrayItem.ImplementationUid() );
       
   275 }
   218 
   276 
   219 // ----------------------------------------------------------------------------
   277 // ----------------------------------------------------------------------------
   220 // CCalenCustomisationManager::SetPluginAvailabilityL
   278 // CCalenCustomisationManager::SetPluginAvailabilityL
   221 // Enables or disables the given plugin.
   279 // Enables or disables the given plugin.
   222 // ----------------------------------------------------------------------------
   280 // ----------------------------------------------------------------------------
   366 // made.
   424 // made.
   367 // (other items were commented in a header).
   425 // (other items were commented in a header).
   368 // ----------------------------------------------------------------------------
   426 // ----------------------------------------------------------------------------
   369 //
   427 //
   370 void CCalenCustomisationManager::HandleNotificationL(TCalenNotification aNotification)
   428 void CCalenCustomisationManager::HandleNotificationL(TCalenNotification aNotification)
   371     {
   429 	{
   372     TRACE_ENTRY_POINT;
   430 	TRACE_ENTRY_POINT;
   373 	Q_UNUSED(aNotification);
   431 	switch( aNotification )
       
   432 		{
       
   433 		case ECalenNotifySystemLanguageChanged:
       
   434 			{
       
   435 			CreateActivePluginListL();
       
   436 			DoImmediatePluginLoadingL();
       
   437 			}
       
   438 			break;
       
   439 	}
   374 	TRACE_EXIT_POINT;
   440 	TRACE_EXIT_POINT;
   375     }  
   441     }  
   376 
   442 
   377 
   443 
   378 // ----------------------------------------------------------------------------
   444 // ----------------------------------------------------------------------------