--- a/calendarui/customisationmanager/src/calencustomisationmanager.cpp Thu Aug 19 09:53:43 2010 +0300
+++ b/calendarui/customisationmanager/src/calencustomisationmanager.cpp Tue Aug 31 15:13:43 2010 +0300
@@ -16,22 +16,28 @@
*/
-#include <eikmenup.h>
+
+#include <vwsdef.h> // TVwsViewId
+#include <apadef.h> // TApaCommand
+#include "calendarui_debug.h"
+#include <hbwidget.h>
+#include <hblabel.h>
+#include "calencustomisationmanager.h"
+#include "calencommandhandler.h"
+#include "calenservices.h"
+#include "calencustomisation.h"
#include <ecom/ecom.h>
-#include <Calendar.rsg>
-#include <aknsettingitemlist.h> // CAknSettingItem
-#include <calencommandhandler.h>
-#include <calencustomisation.h>
-#include <calenservices.h>
-#include <mcalenpreview.h>
+#include <e32lang.h>
+#include "calenservices.h"
+#include "calenservicesfactory.h"
+#include "CalenUid.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "calencustomisationmanagerTraces.h"
+#endif
-#include "calensend.h"
-#include "calenviewinfo.h"
-#include "calendarui_debug.h"
-#include "calencustomisationmanager.h"
-#include "calencontroller.h"
-#include "calensetting.h"
-#include "CalenUid.h"
+
+
// ----------------------------------------------------------------------------
@@ -40,24 +46,20 @@
// (other items were commented in a header).
// ----------------------------------------------------------------------------
//
-EXPORT_C CCalenCustomisationManager* CCalenCustomisationManager::NewL(
+ CCalenCustomisationManager* CCalenCustomisationManager::NewL(
MCalenServicesFactory& aFactory,
- CCalenPluginStatusArray& aPluginSettingsStatus,
- MCalenServices& aServices,
- RPointerArray<CCalenViewInfo>& aViewArray )
+ MCalenServices& aServices
+ )
{
- TRACE_ENTRY_POINT;
-
+ OstTraceFunctionEntry0( CCALENCUSTOMISATIONMANAGER_NEWL_ENTRY );
CCalenCustomisationManager* self = new( ELeave ) CCalenCustomisationManager(
aFactory,
- aServices,
- aViewArray,
- aPluginSettingsStatus );
+ aServices );
CleanupStack::PushL( self );
self->ConstructL();
CleanupStack::Pop( self );
- TRACE_EXIT_POINT;
+ OstTraceFunctionExit0( CCALENCUSTOMISATIONMANAGER_NEWL_EXIT );
return self;
}
@@ -68,17 +70,12 @@
// ----------------------------------------------------------------------------
//
CCalenCustomisationManager::CCalenCustomisationManager( MCalenServicesFactory& aFactory,
- MCalenServices& aServices,
- RPointerArray<CCalenViewInfo>& aViewArray,
- CCalenPluginStatusArray& aPluginSettingsStatus )
- : iServicesFactory( aFactory ),
- iViewInfoArray( aViewArray ),
- iSortOrder( CCalenViewInfo::CyclePositionComparison ),
- iServices( aServices ),
- iPluginSettingsStatus( aPluginSettingsStatus )
+ MCalenServices& aServices )
+ : iServicesFactory( aFactory ),
+ iServices( aServices )
{
- TRACE_ENTRY_POINT;
- TRACE_EXIT_POINT;
+ OstTraceFunctionEntry0( CCALENCUSTOMISATIONMANAGER_CCALENCUSTOMISATIONMANAGER_ENTRY );
+ OstTraceFunctionExit0( CCALENCUSTOMISATIONMANAGER_CCALENCUSTOMISATIONMANAGER_EXIT );
}
// ----------------------------------------------------------------------------
@@ -89,22 +86,14 @@
//
void CCalenCustomisationManager::ConstructL()
{
- TRACE_ENTRY_POINT;
- iInfoBarProviderUid = TUid::Uid(0);
- iPreviewPaneProviderUid = TUid::Uid(0);
-
- // Get a pointer to the global data and controller
- iGlobalData = CCalenGlobalData::InstanceL();
-
- // Get the setting singleton. We update it when settings change.
- iSetting = CCalenSetting::InstanceL();
-
+ OstTraceFunctionEntry0( CCALENCUSTOMISATIONMANAGER_CONSTRUCTL_ENTRY );
+
CreateActivePluginListL();
// Load any enabled plugins
DoImmediatePluginLoadingL();
- TRACE_EXIT_POINT;
+ OstTraceFunctionExit0( CCALENCUSTOMISATIONMANAGER_CONSTRUCTL_EXIT );
}
// ----------------------------------------------------------------------------
@@ -113,9 +102,9 @@
// (other items were commented in a header).
// ----------------------------------------------------------------------------
//
-EXPORT_C CCalenCustomisationManager::~CCalenCustomisationManager()
+ CCalenCustomisationManager::~CCalenCustomisationManager()
{
- TRACE_ENTRY_POINT;
+ OstTraceFunctionEntry0( DUP1_CCALENCUSTOMISATIONMANAGER_CCALENCUSTOMISATIONMANAGER_ENTRY );
// Reset and destroy the contents of the owned arrays,
// this will delete the plugins.
@@ -126,99 +115,63 @@
iActivePlugins.Reset();
iRomBasedPlugins.Reset();
- // reset deferred unload plugins list
- iDefferedUnloadPluginList.Reset();
-
-
// Close the ECOM interface
REComSession::FinalClose();
+
+ iDefferedUnloadPluginList.Reset();
- // Release the global data and controller
- if ( iGlobalData )
- {
- iGlobalData->Release();
- }
-
- if(iSetting)
- {
- iSetting->Release();
- }
- iHiddenViews.Reset();
-
- TRACE_EXIT_POINT;
+ OstTraceFunctionExit0( DUP1_CCALENCUSTOMISATIONMANAGER_CCALENCUSTOMISATIONMANAGER_EXIT );
}
-
-// ----------------------------------------------------------------------------
-// CCalenCustomisationManager::GetCommandHandlerL
-// Get a command handler for a specific command. Ownership remains with the
-// plugin
-// ----------------------------------------------------------------------------
-EXPORT_C MCalenCommandHandler* CCalenCustomisationManager::GetCommandHandlerL( TInt aCommand )
- {
- TRACE_ENTRY_POINT;
+ // ----------------------------------------------------------------------------
+ // CCalenCustomisationManager::GetCommandHandlerL
+ // Get a command handler for a specific command. Ownership remains with the
+ // plugin
+ // ----------------------------------------------------------------------------
+ MCalenCommandHandler* CCalenCustomisationManager::GetCommandHandlerL( TInt aCommand )
+ {
+ OstTraceFunctionEntry0( CCALENCUSTOMISATIONMANAGER_GETCOMMANDHANDLERL_ENTRY );
- MCalenCommandHandler* handler( NULL );
-
- // Loop though all the enabled plugins asking for a command handler
- // to handle this command with. Returns NULL if no plugin wants to
- // handle the command.
-
- TInt count = iPlugins.Count();
- for ( TInt index = 0; index < count && !handler; ++index )
- {
- TRAPD( error,
- // Loop though until a command handler is found
- for (; index < count && !handler; ++index )
- {
- if ( !iPlugins[index]->IsDisabled() )
- {
- handler = iPlugins[index]->Plugin().CommandHandlerL( aCommand );
- }
- }
- );
+ MCalenCommandHandler* handler( NULL );
+
+ // Loop though all the enabled plugins asking for a command handler
+ // to handle this command with. Returns NULL if no plugin wants to
+ // handle the command.
+
+ TInt count = iPlugins.Count();
+ for ( TInt index = 0; index < count && !handler; ++index )
+ {
+ TRAPD( error,
+ // Loop though until a command handler is found
+ for (; index < count && !handler; ++index )
+ {
+ //if ( !iPlugins[index]->IsDisabled() )
+ {
+ handler = iPlugins[index]->Plugin().CommandHandlerL( aCommand );
+ }
+ }
+ );
- if ( error )
- {
- // Report a problem with plugin.
- }
- }
-
- TRACE_EXIT_POINT;
- return handler;
- }
+ if ( error )
+ {
+ // Report a problem with plugin.
+ }
+ }
+
+ OstTraceFunctionExit0( CCALENCUSTOMISATIONMANAGER_GETCOMMANDHANDLERL_EXIT );
+ return handler;
+ }
-// ----------------------------------------------------------------------------
-// CCalenCustomisationManager::GetPluginSettingsL
-// Gets custom settings from the specified plugin
-// ----------------------------------------------------------------------------
-//
-EXPORT_C void CCalenCustomisationManager::GetPluginSettingsL( TUid aPluginUid,
- RPointerArray<CAknSettingItem>& aSettingArray )
- {
- TRACE_ENTRY_POINT;
- CCalenCustomisation* plugin = FindPluginL( aPluginUid );
- User::LeaveIfNull( plugin );
-
- TRAPD( error, plugin->GetCustomSettingsL( aSettingArray ));
- if ( error )
- {
- // Report a problem with plugin.
- }
-
- TRACE_EXIT_POINT;
- }
// ----------------------------------------------------------------------------
// CCalenCustomisationManager::ActivePlugins
// Returns a reference to an array of active plugins uids
// ----------------------------------------------------------------------------
//
-EXPORT_C const RArray<TUid>& CCalenCustomisationManager::ActivePlugins() const
+ const RArray<TUid>& CCalenCustomisationManager::ActivePlugins() const
{
- TRACE_ENTRY_POINT;
- TRACE_EXIT_POINT;
-
+ OstTraceFunctionEntry0( CCALENCUSTOMISATIONMANAGER_ACTIVEPLUGINS_ENTRY );
+ OstTraceFunctionExit0( CCALENCUSTOMISATIONMANAGER_ACTIVEPLUGINS_EXIT );
return iActivePlugins;
}
@@ -229,170 +182,112 @@
//
void CCalenCustomisationManager::CreateActivePluginListL()
{
- TRACE_ENTRY_POINT;
-
+ OstTraceFunctionEntry0( CCALENCUSTOMISATIONMANAGER_CREATEACTIVEPLUGINLISTL_ENTRY );
iPluginInfo.ResetAndDestroy();
iActivePlugins.Reset();
iRomBasedPlugins.Reset();
-
- //Added resolver for corolla release
- // Set resolver params
- /*TLanguage lang = User::Language();
- TBuf8<40> langStr;
- langStr.Format( _L8("language(%d)"), lang );
- TEComResolverParams resolverParams;
- resolverParams.SetDataType( langStr );
- resolverParams.SetGenericMatch( ETrue );*/
-
- REComSession::ListImplementationsL( KCalenCustomisationInterfaceUid,/* resolverParams,*/ iPluginInfo );
+ REComSession::ListImplementationsL( KCalenCustomisationInterfaceUid, iPluginInfo );
LoadPluginsBasedOnVariantL();
TInt pluginCount = iPluginInfo.Count();
- for ( TInt pluginIndex(0); pluginIndex < pluginCount; ++pluginIndex )
- {
- TUid pluginUid = iPluginInfo[pluginIndex]->ImplementationUid();
-
- // Find the plugin in the list of known plugins
- TInt position = iPluginSettingsStatus.Find( pluginUid, PluginAvailabilityFinder );
- if ( ( position == KErrNotFound ) || ( iPluginSettingsStatus[position].iEnabled ) )
- {
- // If the plugin can not be found or if it is enabled
- // add it to the list of active plugins
- iActivePlugins.AppendL( pluginUid );
-
- // If the plugin is rom-based, store its uid
- if ( iPluginInfo[pluginIndex]->RomBased() )
- {
- iRomBasedPlugins.AppendL( pluginUid );
- }
- }
- }
+ if(pluginCount)
+ {
+ for ( TInt pluginIndex(0); pluginIndex < pluginCount; ++pluginIndex )
+ {
+ TUid pluginUid = iPluginInfo[pluginIndex]->ImplementationUid();
+
+ // If the plugin can not be found or if it is enabled
+ // add it to the list of active plugins
+ iActivePlugins.AppendL( pluginUid );
- TRACE_EXIT_POINT;
+ // If the plugin is rom-based, store its uid
+ if ( iPluginInfo[pluginIndex]->RomBased() )
+ {
+ iRomBasedPlugins.AppendL( pluginUid );
+ }
+
+ }
+ }
+
+ OstTraceFunctionExit0( CCALENCUSTOMISATIONMANAGER_CREATEACTIVEPLUGINLISTL_EXIT );
}
// ----------------------------------------------------------------------------
-// CCalenCustomisationManager::GetCustomViewsL
-// GetCustomViews returns custom views info in an array for a given
-// plugin.
-// NOTE: The contents of the array are owned by the caller - caller
-// must guarantee to call ResetAndDestroy on the array in all cases.
+// CCalenCustomisationManager::LoadPluginsBasedOnVariantL
+// Loads the plugin based on the language variant
// ----------------------------------------------------------------------------
//
-EXPORT_C void CCalenCustomisationManager::GetCustomViewsL( TUid aPluginUid,
- RPointerArray<CCalenView>& aViews )
- {
- TRACE_ENTRY_POINT;
-
- CCalenCustomisation* plugin = FindPluginL( aPluginUid );
- User::LeaveIfNull( plugin );
-
- TRAPD( error, plugin->GetCustomViewsL( aViews ));
- if ( error )
- {
- // Report a problem with plugin.
- }
-
- TInt numViews = aViews.Count();
- for ( TInt index( 0 ); index < numViews; ++index )
- {
- CCalenView* customView = aViews[index];
-
- // Add to view info array
- const TUid viewId = customView->Id();
-
- // Check for duplicate view ids.
- TInt position = iViewInfoArray.Find( viewId ,
- CCalenViewInfo::ViewInfoIdentifier );
-
- if ( position == KErrNotFound )
- {
- const TDesC& menuName = customView->LocalisedViewNameL( CCalenView::EMenuName );
- const TDesC& settingsName = customView->LocalisedViewNameL( CCalenView::ESettingsName );
- const CCalenView::TCyclePosition cyclePos = customView->CyclePosition();
+void CCalenCustomisationManager::LoadPluginsBasedOnVariantL()
+{
+ OstTraceFunctionEntry0( CCALENCUSTOMISATIONMANAGER_LOADPLUGINSBASEDONVARIANTL_ENTRY );
+ TLanguage languge = User::Language();
+ RArray<TUid> needsToBeRemoved;
+
+ switch(languge)
+ {
+ case ELangTaiwanChinese:
+ case ELangPrcChinese:
+ case ELangHongKongChinese:
+ // TODO: Remove the other regional plugins Thai, Vietnamese etc.
+ break;
+ case ELangThai:
+ case ELangEnglish_Thailand:
+ needsToBeRemoved.Append(KCalenChineseImplUid);
+ // TODO: Remove the other regional plugin Vietnamese.
+ break;
+ case ELangVietnamese:
+ needsToBeRemoved.Append(KCalenChineseImplUid);
+ // TODO: Remove the other regional plugin Thai.
+ break;
- CCalenViewInfo* viewInfo = CCalenViewInfo::NewL( viewId,
- aPluginUid,
- menuName,
- settingsName,
- cyclePos );
-
- // Check if the view has already been hidden.
- TBool hidden = ( iHiddenViews.Find( viewId.iUid ) != KErrNotFound );
- viewInfo->Hide( hidden );
-
- ViewInfoArray().InsertInOrderAllowRepeatsL( viewInfo, iSortOrder );
- }
- else
- {
- // A plugin with the same id already exists. ( It could be a replacement
- // view provided by a rom plugin, as currently preventing rom plugins from
- // being disabled if required is not implemented, it needs to be handled)
- delete customView;
- aViews.Remove( index );
- index--;
- numViews--;
-
- // Report a problem with plugin.
- }
- }
- RArray<TInt> hiddenViews;
- CleanupClosePushL( hiddenViews );
- plugin->RemoveViewsFromCycle( hiddenViews );
- TInt hiddenViewCount = hiddenViews.Count();
- if ( hiddenViewCount )
- {
- // Get the default view form the settings to check if it is going to be hidden
- // by the installed plugin
- TUid defaultView = iSetting->DefaultView();
- for ( TInt index(0); index < hiddenViewCount; ++index )
- {
- TInt hiddenViewId = hiddenViews[index];
- // iHiddenViews.InsertInOrderAllowRepeatsL( hiddenViewId );
-
- // If this view is already on the view cycle list it needs
- // to be hidden.
- TUid hiddenViewUid = TUid::Uid( hiddenViewId );
-
- // If the current default view is hidden, then set the newly
- // installed plugin view as default view
- if(defaultView == hiddenViewUid)
- {
- TInt position = iViewInfoArray.Find( aPluginUid,
- CCalenViewInfo::ViewPluginIdentifier );
- if(position != -1)
- {
- for(TInt i = position; i < iViewInfoArray.Count(); i++)
- {
- if((iViewInfoArray[i]->PluginUid() == aPluginUid) &&
- (iViewInfoArray[i]->CyclePosition() != CCalenView::ENoCyclePosition))
- {
- iSetting->SetDefaultView(iViewInfoArray[i]->ViewUid());
- break;
- }
- }
- }
- }
- }
- }
- CleanupStack::PopAndDestroy(); // removedViews
+ default:
+ needsToBeRemoved.Append(KCalenChineseImplUid);
+ // TODO: Remove the other regional plugins Thai, Vietnamese etc.
+ break;
+ }
+ TInt count = needsToBeRemoved.Count();
+ if(count)
+ {
+ for(TInt i=0; i< count; i++)
+ {
+ TInt index = iPluginInfo.Find(needsToBeRemoved[i],
+ CCalenCustomisationManager::PluginInfoFinder);
+ if( index != KErrNotFound )
+ {
+ CImplementationInformation* impl = iPluginInfo[index];
+ iPluginInfo.Remove(index);
+ delete impl;
+ }
+ }
+ }
+ needsToBeRemoved.Close();
+ OstTraceFunctionExit0( CCALENCUSTOMISATIONMANAGER_LOADPLUGINSBASEDONVARIANTL_EXIT );
+}
- TRACE_EXIT_POINT;
- }
+// ----------------------------------------------------------------------------
+// CCalenCustomisationManager::PluginInfoFinder(
+// Matches an uid in pluginInfo.
+// ----------------------------------------------------------------------------
+//
+TBool CCalenCustomisationManager::PluginInfoFinder( const TUid* aUid,
+ const CImplementationInformation& aArrayItem )
+{
+ OstTraceFunctionEntry0( CCALENCUSTOMISATIONMANAGER_PLUGININFOFINDER_ENTRY );
+ return (*aUid == aArrayItem.ImplementationUid() );
+}
// ----------------------------------------------------------------------------
// CCalenCustomisationManager::SetPluginAvailabilityL
// Enables or disables the given plugin.
// ----------------------------------------------------------------------------
//
-EXPORT_C void CCalenCustomisationManager::SetPluginAvailabilityL( TUid aPluginUid,
+ void CCalenCustomisationManager::SetPluginAvailabilityL( TUid aPluginUid,
TBool aEnabled )
{
- TRACE_ENTRY_POINT;
-
+ OstTraceFunctionEntry0( CCALENCUSTOMISATIONMANAGER_SETPLUGINAVAILABILITYL_ENTRY );
if ( aEnabled )
{
EnablePluginL( aPluginUid );
@@ -402,7 +297,7 @@
DisablePluginL( aPluginUid );
}
- TRACE_EXIT_POINT;
+ OstTraceFunctionExit0( CCALENCUSTOMISATIONMANAGER_SETPLUGINAVAILABILITYL_EXIT );
}
// ----------------------------------------------------------------------------
@@ -412,8 +307,7 @@
//
void CCalenCustomisationManager::DisablePluginL( TUid aPluginUid )
{
- TRACE_ENTRY_POINT;
-
+ OstTraceFunctionEntry0( CCALENCUSTOMISATIONMANAGER_DISABLEPLUGINL_ENTRY );
// Find the plugins
TInt index = iPlugins.Find( aPluginUid, CPluginInfo::Identifier );
if ( index != KErrNotFound )
@@ -428,61 +322,19 @@
// Remove the plugin from the active plugin list
TInt position = iActivePlugins.Find( aPluginUid );
- if(position == KErrNotFound ) // plugin has already been removed
- {
- return ;
- }
+ ASSERT( position != KErrNotFound );
- iActivePlugins.Remove( position );
-
- // Does this plugin hide any views
- RArray<TInt> removedViews;
- CleanupClosePushL( removedViews );
- CCalenCustomisation& plugin = pluginInfo->Plugin();
- plugin.RemoveViewsFromCycle( removedViews );
- TInt hiddenViewsCount = removedViews.Count();
- if ( hiddenViewsCount )
- {
- // Need to recalculate which views have been hidden, as
- // more than one plugin might have hidden the same view.
- for ( TInt index( 0 ); index < hiddenViewsCount; ++index )
- {
- TUid viewUid = TUid::Uid( removedViews[index] );
- CheckHiddenViewL( viewUid, aPluginUid );
- }
- }
+ iActivePlugins.Remove( position );
- // If the plugin does not offer any views, or the current
- // info or preview bar it can be deleted immediately,
- // otherwise the customisation needs to wait until it
- // is told it is safe to do so.
-
- // Does this plugin does not offer any views and the plugin
- // doesn't offer the current infobar or preview pane
- // bar it can be deleted immediately
- TInt offerViews = iViewInfoArray.Find( aPluginUid,
- CCalenViewInfo::ViewPluginIdentifier );
-
- if ( offerViews == KErrNotFound &&
- iInfoBarProviderUid != aPluginUid
- && iPreviewPaneProviderUid != aPluginUid )
- {
- RArray<TUid> pluginArray;
- CleanupClosePushL( pluginArray );
- pluginArray.AppendL( aPluginUid );
- UnloadPluginsL( pluginArray );
- CleanupStack::PopAndDestroy(); // pluginArray
- }
// Issue notification of plugin been disabled
- iPluginsEnabledDisabled = ETrue;
- iServices.IssueNotificationL( ECalenNotifyPluginEnabledDisabled );
- CleanupStack::PopAndDestroy(); // removedViews
+ iPluginsEnabledDisabled = ETrue;
+
}
- }
+ }
- TRACE_EXIT_POINT;
+ OstTraceFunctionExit0( CCALENCUSTOMISATIONMANAGER_DISABLEPLUGINL_EXIT );
}
// ----------------------------------------------------------------------------
@@ -492,9 +344,9 @@
// is called when it is safe to unload the plugin.
// ----------------------------------------------------------------------------
//
-EXPORT_C void CCalenCustomisationManager::UnloadPluginsL( const RArray<TUid>& aPlugins )
+ void CCalenCustomisationManager::UnloadPluginsL( const RArray<TUid>& aPlugins )
{
- TRACE_ENTRY_POINT;
+ OstTraceFunctionEntry0( CCALENCUSTOMISATIONMANAGER_UNLOADPLUGINSL_ENTRY );
// Check plugin isn't already enabled
TInt count = aPlugins.Count();
for (TInt index = 0; index < count; ++index )
@@ -502,27 +354,20 @@
TInt position = iPlugins.Find( aPlugins[index], CPluginInfo::Identifier );
if ( position != KErrNotFound )
{
- TUid pluginUid = iPlugins[ position]->Uid();
- if(!iPluginInfo[position]->RomBased())
- {
- if((iInfoBarProviderUid != iPlugins[position]->Uid())
- && (iPreviewPaneProviderUid != iPlugins[ position]->Uid()))
- {
- CPluginInfo* removedPlugin = iPlugins[ position ];
- iPlugins.Remove( position );
- delete removedPlugin;
- }
- else
- {
- iPlugins[position]->Disable(ETrue);
- iDefferedUnloadPluginList.AppendL(iPlugins[position]->Uid());
- iInfoBarProviderUid = KNullUid;
- iPreviewPaneProviderUid = KNullUid;
- }
- }
+ if((iInfoBarProviderUid != iPlugins[position]->Uid()))
+ {
+ CPluginInfo* removedPlugin = iPlugins[ position ];
+ iPlugins.Remove( position );
+ delete removedPlugin;
+ }
+ else
+ {
+ iPlugins[position]->Disable(ETrue);
+ iDefferedUnloadPluginList.AppendL(iPlugins[position]->Uid());
+ }
}
}
- TRACE_EXIT_POINT;
+ OstTraceFunctionExit0( CCALENCUSTOMISATIONMANAGER_UNLOADPLUGINSL_EXIT );
}
// ----------------------------------------------------------------------------
@@ -533,8 +378,7 @@
//
void CCalenCustomisationManager::EnablePluginL( TUid aPluginUid )
{
- TRACE_ENTRY_POINT;
-
+ OstTraceFunctionEntry0( CCALENCUSTOMISATIONMANAGER_ENABLEPLUGINL_ENTRY );
// Check plugin isn't already enabled
TInt index = iPlugins.Find( aPluginUid, CPluginInfo::Identifier);
@@ -554,95 +398,10 @@
iPluginsEnabledDisabled = ETrue;
iServices.IssueNotificationL( ECalenNotifyPluginEnabledDisabled );
}
- else
- {
- // Ensure plugin is enabled
- if(iPlugins[index]->IsDisabled())
- {
- iPlugins[index]->Disable( EFalse );
- iServices.IssueNotificationL( ECalenNotifyPluginEnabledDisabled );
- }
- }
-
- TRACE_EXIT_POINT;
- }
-
-
-// ----------------------------------------------------------------------------
-// CCalenCustomisationManager::LoadPluginsBasedOnVariant
-// From MCalenNotificationHandler. Handles notifications.
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-void CCalenCustomisationManager::LoadPluginsBasedOnVariantL()
- {
- TRACE_ENTRY_POINT
-
- TLanguage lang = User::Language();
-
- // Based on the variant the plugins will be loaded
- // Eg. for 01 Euro regional plugins are not needed so all regional plugins will be removed
- // other than non regional plugins.
- // for Chinese variant Thai and vietnamese plugins will be removed
- // leaving chinese plugin and other non regional plugins.
- RArray<TUid> needsToBeRemoved;
- switch(lang)
- {
- case ELangThai:
- case ELangEnglish_Thailand:
- needsToBeRemoved.Append(KCalenChineseImplUid);
- needsToBeRemoved.Append(KCalenVietnameseImplUid);
- break;
- case ELangTaiwanChinese:
- case ELangHongKongChinese:
- case ELangPrcChinese:
- needsToBeRemoved.Append(KCalenThaiImplUid);
- needsToBeRemoved.Append(KCalenVietnameseImplUid);
- break;
- case ELangVietnamese:
- needsToBeRemoved.Append(KCalenThaiImplUid);
- needsToBeRemoved.Append(KCalenChineseImplUid);
- break;
- default:
- needsToBeRemoved.Append(KCalenThaiImplUid);
- needsToBeRemoved.Append(KCalenChineseImplUid);
- needsToBeRemoved.Append(KCalenVietnameseImplUid);
- break;
- }
+ OstTraceFunctionExit0( CCALENCUSTOMISATIONMANAGER_ENABLEPLUGINL_EXIT );
+ }
- if(needsToBeRemoved.Count())
- {
- for(TInt i = 0 ; i < needsToBeRemoved.Count() ; i++)
- {
- TInt index = iPluginInfo.Find(needsToBeRemoved[i],CCalenCustomisationManager::PluginInfoFinder);
- if( index != KErrNotFound )
- {
- CImplementationInformation* impl = iPluginInfo[index];
- iPluginInfo.Remove(index);
- delete impl;
- }
- }
- }
-
- needsToBeRemoved.Close();
-
- TRACE_EXIT_POINT
- }
-
-// ----------------------------------------------------------------------------
-// CCalenCustomisationManager::PluginInfoFinder(
-// Matches an uid in pluginInfo.
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-TBool CCalenCustomisationManager::PluginInfoFinder( const TUid* aUid , const CImplementationInformation& aArrayItem)
- {
- TRACE_ENTRY_POINT;
- TRACE_EXIT_POINT;
- return (*aUid == aArrayItem.ImplementationUid() );
- }
-
// ----------------------------------------------------------------------------
// CCalenCustomisationManager::HandleNotificationL
// From MCalenNotificationHandler. Handles notifications.
@@ -651,11 +410,9 @@
//
void CCalenCustomisationManager::HandleNotification(const TCalenNotification aNotification )
{
- TRACE_ENTRY_POINT;
-
+ OstTraceFunctionEntry0( CCALENCUSTOMISATIONMANAGER_HANDLENOTIFICATION_ENTRY );
PIM_TRAPD_HANDLE( HandleNotificationL(aNotification) );
-
- TRACE_EXIT_POINT;
+ OstTraceFunctionExit0( CCALENCUSTOMISATIONMANAGER_HANDLENOTIFICATION_EXIT );
}
// ----------------------------------------------------------------------------
@@ -669,53 +426,20 @@
// ----------------------------------------------------------------------------
//
void CCalenCustomisationManager::HandleNotificationL(TCalenNotification aNotification)
- {
- TRACE_ENTRY_POINT;
-
- switch( aNotification )
- {
- case ECalenNotifyCheckPluginUnloading:
- {
- if(iDefferedUnloadPluginList.Count() > 0)
- {
- UnloadPluginsL(iDefferedUnloadPluginList);
- }
- }
- break;
- case ECalenNotifySettingsChanged:
- {
- // Make sure that any plugins marked as enabled are enabled, and
- // any plugins marked as disabled are disabled.
- iPluginsEnabledDisabled = EFalse;
- TInt pluginCount = iPluginSettingsStatus.Count();
- for ( TInt pluginIndex(0); pluginIndex < pluginCount; ++pluginIndex )
- {
- TUid pluginUid = iPluginSettingsStatus[pluginIndex].iUid;
- TBool enabled = iPluginSettingsStatus[pluginIndex].iEnabled;
-
- SetPluginAvailabilityL( pluginUid, enabled );
- }
-
- if ( iPluginsEnabledDisabled )
- {
- iServices.IssueNotificationL( ECalenNotifySettingsChanged );
- }
- }
- break;
- case ECalenNotifyEComRegistryChanged:
- {
- CreateActivePluginListL();
- iSetting->UpdatePluginListL(*this);
- DoImmediatePluginLoadingL();
- iServices.IssueNotificationL(ECalenNotifyPluginEnabledDisabled);
- iServices.IssueNotificationL(ECalenNotifySettingsChanged );
- }
- default:
- break;
- }
+ {
+ OstTraceFunctionEntry0( CCALENCUSTOMISATIONMANAGER_HANDLENOTIFICATIONL_ENTRY );
+ switch( aNotification )
+ {
+ case ECalenNotifySystemLanguageChanged:
+ {
+ CreateActivePluginListL();
+ DoImmediatePluginLoadingL();
+ }
+ break;
+ }
+ OstTraceFunctionExit0( CCALENCUSTOMISATIONMANAGER_HANDLENOTIFICATIONL_EXIT );
+ }
- TRACE_EXIT_POINT;
- }
// ----------------------------------------------------------------------------
// CCalenCustomisationManager::PluginInfoArray
@@ -723,25 +447,14 @@
// (other items were commented in a header).
// ----------------------------------------------------------------------------
//
-EXPORT_C const RImplInfoPtrArray& CCalenCustomisationManager::PluginInfoArray() const
+ const RImplInfoPtrArray& CCalenCustomisationManager::PluginInfoArray() const
{
- TRACE_ENTRY_POINT;
- TRACE_EXIT_POINT;
+ OstTraceFunctionEntry0( CCALENCUSTOMISATIONMANAGER_PLUGININFOARRAY_ENTRY );
+ OstTraceFunctionExit0( CCALENCUSTOMISATIONMANAGER_PLUGININFOARRAY_EXIT );
return iPluginInfo;
}
-// ----------------------------------------------------------------------------
-// CCalenCustomisationManager::Views
-// Returns a const reference to the views array.
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-EXPORT_C const RPointerArray<CCalenViewInfo>& CCalenCustomisationManager::Views() const
- {
- TRACE_ENTRY_POINT;
- TRACE_EXIT_POINT;
- return iViewInfoArray;
- }
+
// ----------------------------------------------------------------------------
// CCalenCustomisationManager::DoImmediatePluginLoadingL
@@ -752,9 +465,7 @@
//
void CCalenCustomisationManager::DoImmediatePluginLoadingL()
{
- TRACE_ENTRY_POINT;
-
-
+ OstTraceFunctionEntry0( CCALENCUSTOMISATIONMANAGER_DOIMMEDIATEPLUGINLOADINGL_ENTRY );
for(TInt i = 0 ; i < iPlugins.Count() ; i++)
{
RArray<TUid> pluginArray;
@@ -770,9 +481,7 @@
for ( TInt index( 0 ); index < pluginCount; ++index )
{
TUid pluginUid = iPluginInfo[index]->ImplementationUid();
-
- if ( iActivePlugins.Find( pluginUid ) != KErrNotFound )
-
+ if ( iActivePlugins.Find( pluginUid ) != KErrNotFound )
{
TRAPD( error, LoadPluginL( pluginUid ) );
if ( error )
@@ -782,8 +491,8 @@
}
}
}
-
- TRACE_EXIT_POINT;
+
+ OstTraceFunctionExit0( CCALENCUSTOMISATIONMANAGER_DOIMMEDIATEPLUGINLOADINGL_EXIT );
}
// ----------------------------------------------------------------------------
@@ -794,519 +503,122 @@
//
void CCalenCustomisationManager::LoadPluginL( TUid aPluginUid )
{
- TRACE_ENTRY_POINT;
-
+ OstTraceFunctionEntry0( CCALENCUSTOMISATIONMANAGER_LOADPLUGINL_ENTRY );
// Get a new services object from global data
MCalenServices* services = iServicesFactory.NewServicesL();
-
+ CleanupStack::PushL( services );
// Creates the plugin and transfers ownership of the services
// object to the plugin.
CCalenCustomisation* plugin =
CCalenCustomisation::CreateImplementationL( aPluginUid, services );
-
- CleanupStack::PushL( plugin );
+ CleanupStack::PushL( plugin );
// the plugin array takes ownership of the plugin
AddPluginL( plugin, aPluginUid );
+
+ // Cleanup
CleanupStack::Pop( plugin );
-
-
- RArray<TInt> hiddenViews;
- CleanupClosePushL( hiddenViews );
- plugin->RemoveViewsFromCycle( hiddenViews );
- TInt hiddenViewCount = hiddenViews.Count();
- if ( hiddenViewCount )
- {
- // Get the default view form the settings to check if it is going to be hidden
- // by the installed plugin
- TUid defaultView = iSetting->DefaultView();
- for ( TInt index(0); index < hiddenViewCount; ++index )
- {
- TInt hiddenViewId = hiddenViews[index];
- iHiddenViews.InsertInOrderAllowRepeatsL( hiddenViewId );
-
- // If this view is already on the view cycle list it needs
- // to be hidden.
- TUid hiddenViewUid = TUid::Uid( hiddenViewId );
-
- // If the current default view is hidden, then set the newly
- // installed plugin view as default view
- if(defaultView == hiddenViewUid)
- iSetting->SetDefaultView(aPluginUid);
-
- TInt position = iViewInfoArray.Find( hiddenViewUid,
- CCalenViewInfo::ViewInfoIdentifier );
-
- if ( position != KErrNotFound )
- {
- CCalenViewInfo* viewInfo = iViewInfoArray[position];
- viewInfo->Hide( ETrue );
-
- // By hiding the view, the cycleposition order may be changed
- // so the view info array needs to be resorted.
- iViewInfoArray.Sort( iSortOrder );
- }
- }
- }
- CleanupStack::PopAndDestroy(); // removedViews
-
- TRACE_EXIT_POINT;
- }
-
- // ----------------------------------------------------------------------------
-// CCalenCustomisationManager::OfferMenuPaneL
-// Offers a menupane for customisation by plugins
-// and the controller.
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-EXPORT_C void CCalenCustomisationManager::OfferMenuPaneL( TInt aResourceId,
- CEikMenuPane* aMenuPane )
- {
- TRACE_ENTRY_POINT;
-
- // Offer the menu to registered plugins
- OfferMenuPaneToPluginsL( aResourceId, aMenuPane );
-
- // If the menupane is a main menu, a check needs to be made that the
- // exit and switch view commands exist
-
- // Replace the send menu if it exists
- TInt position( 0 );
- if ( aMenuPane->MenuItemExists( ECalenSend, position) )
- {
- // Delete the existing send menu option
- aMenuPane->DeleteMenuItem(ECalenSend);
-
- // Insert the calensend menu item
- iGlobalData->CalenSendL().DisplaySendMenuItemL( *aMenuPane, position );
- }
+ CleanupStack::Pop( services );
- // If the menu has a view switch menu item, it is up to the
- // customisation manager to decide if the menu should be
- // cascading or a selection list box.
- if ( aMenuPane->MenuItemExists( ECalenSwitchView, position) )
- {
- CEikMenuPaneItem::SData& switchItem = aMenuPane->ItemData( ECalenSwitchView );
- if ( iActivePlugins.Count() == 0 )
- {
- // Create a cascading menu
- switchItem.iCascadeId = R_CALENDAR_CHANGE_VIEW_MENUPANE;
- }
- else
- {
- switchItem.iCascadeId = 0;
- }
- }
- TRACE_EXIT_POINT;
- }
-
-// ----------------------------------------------------------------------------
-// CCalenCustomisationManager::CheckHiddenViewL(
-// A check needs to be made to see if any other plugins hide the same view.
-// ----------------------------------------------------------------------------
-//
-void CCalenCustomisationManager::CheckHiddenViewL( TUid aViewUid, TUid aPluginUid )
- {
- TRACE_ENTRY_POINT;
-
- // Find the viewId in the hidden view list, and remove it
- TInt viewId = aViewUid.iUid;
- TInt position = iHiddenViews.Find( viewId );
- if ( position != KErrNotFound )
- {
- iHiddenViews.Remove( position );
-
- // Try to find the view again, in case it is hidden by another view
- position = iHiddenViews.Find( viewId );
- if ( position == KErrNotFound )
- {
- // If it can't be found in the hidden view list,
- // it can be unhidden.
- TInt viewInfoPos = iViewInfoArray.Find( aViewUid ,
- CCalenViewInfo::ViewInfoIdentifier );
-
- if ( viewInfoPos != KErrNotFound )
- {
- // Unhide the view
- CCalenViewInfo* viewInfo = iViewInfoArray[viewInfoPos];
- viewInfo->Hide( EFalse );
-
- // Set hidden view as default view if the currently disabled plugin
- // is the default view
- TInt position = iViewInfoArray.Find( aPluginUid,
- CCalenViewInfo::ViewPluginIdentifier );
- if(position != -1)
- {
- for(TInt i = position; i < iViewInfoArray.Count(); i++)
- {
- if((iViewInfoArray[i]->PluginUid() == aPluginUid) &&
- iViewInfoArray[i]->ViewUid() == iSetting->DefaultView())
- {
- iSetting->SetDefaultView(aViewUid);
- break;
- }
- }
- }
-
- // By unhiding the view, the cycleposition order may be changed
- // so the view info array needs to be resorted.
- iViewInfoArray.Sort( iSortOrder );
- }
- }
- }
- TRACE_EXIT_POINT;
+ OstTraceFunctionExit0( CCALENCUSTOMISATIONMANAGER_LOADPLUGINL_EXIT );
}
-// ----------------------------------------------------------------------------
-// CCalenCustomisationManager::GetReplacePluginViewIdL
-// Returns the view ID of the plugin that hides a particular view
-// ----------------------------------------------------------------------------
-//
-EXPORT_C TUid CCalenCustomisationManager::GetReplacePluginViewIdL( TUid aHiddenViewId )
- {
- TRACE_ENTRY_POINT;
-
- RArray<TInt> removedViews;
- CCalenCustomisation* plugin = NULL;
- TInt i = 0;
- for( ;i < iActivePlugins.Count(); i++)
- {
- plugin = FindPluginL(iActivePlugins[i]);
- plugin->RemoveViewsFromCycle(removedViews);
- if(removedViews.Count())
- {
- TInt position = removedViews.Find(aHiddenViewId.iUid);
- if(position != KErrNotFound)
- break;
- else
- continue;
- }
- else
- {
- continue;
- }
- }
- removedViews.Reset();
-
- // Get all the views provided by the plugin
- //plugin->GetCustomViewsL()
- TInt position = iViewInfoArray.Find( iActivePlugins[i],
- CCalenViewInfo::ViewPluginIdentifier );
- while((position < iViewInfoArray.Count()) && ((iViewInfoArray[position]->CyclePosition() == CCalenView::ENoCyclePosition) ||
- (iActivePlugins[i] != (iViewInfoArray[position]->PluginUid()))))
- {
- // go to the next view position
- position++;
- }
- TRACE_EXIT_POINT;
-
- return (iViewInfoArray[position]->ViewUid());
- }
-
-// ----------------------------------------------------------------------------
-// CCalenCustomisationManager::GetReplacePluginViewIdL
-// Returns the hidden views list
-// ----------------------------------------------------------------------------
-//
-EXPORT_C void CCalenCustomisationManager::GetHiddenViewIdL( TUid aPluginUid, RArray<TInt>& aHiddenViews )
- {
- TRACE_ENTRY_POINT;
-
- // Get the plugin instance
- CCalenCustomisation* plugin = FindPluginL(aPluginUid);
-
- plugin->RemoveViewsFromCycle(aHiddenViews);
-
- TRACE_EXIT_POINT;
- }
+
-// ----------------------------------------------------------------------------
-// CCalenCustomisationManager::CustomPreviewPaneL
-// Returns the preview pane
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-EXPORT_C MCalenPreview* CCalenCustomisationManager::CustomPreviewPaneL( TRect& aRect )
- {
- MCalenPreview* previewPane = NULL;
-
-
- // Loop though all the command handlers, within two interlinked
- // for loops. If PreviewPaneL leaves for one plugin, a plugin
- // error message will be displayed and the loop will continue with
- // the next command handler. If none of the plugins leave, there will
- // be only one TRAP used.
- TInt count = iPlugins.Count();
- for ( TInt index = 0; index < count && !previewPane; ++index )
- {
- TRAPD( error,
- {
- // Loop though until an infobar is found
- for (; index < count && !previewPane; ++index )
- {
- if ( !iPlugins[index]->IsDisabled() )
- {
- previewPane = iPlugins[index]->Plugin().CustomPreviewPaneL( aRect );
- }
- }
- }
- );
- if ( error )
- {
- // Report a problem with plugin.
- }
- }
-
- TRACE_EXIT_POINT;
- return previewPane;
- }
-// ----------------------------------------------------------------------------
-// CCalenCustomisationManager::PreviewPane
-// Returns the preview pane
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-EXPORT_C CCoeControl* CCalenCustomisationManager::PreviewPane( TRect& aRect )
- {
- TRACE_ENTRY_POINT;
-
- iInfoBarProviderUid = TUid::Uid(0);;
- iPreviewPaneProviderUid = TUid::Uid(0);
-
- CCoeControl* previewPane = NULL;
-
- // Loop though all the command handlers, within two interlinked
- // for loops. If PreviewPaneL leaves for one plugin, a plugin
- // error message will be displayed and the loop will continue with
- // the next command handler. If none of the plugins leave, there will
- // be only one TRAP used.
- TInt count = iPlugins.Count();
- for ( TInt index = 0; index < count && !previewPane; ++index )
- {
- TRAPD( error,
- // Loop though until an infobar is found
- for (; index < count && !previewPane; ++index )
- {
-
- if ( !iPlugins[index]->IsDisabled() )
- {
- previewPane = iPlugins[index]->Plugin().PreviewPaneL( aRect );
- if(previewPane)
- {
- iPreviewPaneProviderUid = iPlugins[index]->Uid();
- }
- }
-
- }
- );
-
- if ( error )
- {
- // Report a problem with plugin.
- }
- }
-
- TRACE_EXIT_POINT;
- return previewPane;
- }
// ----------------------------------------------------------------------------
// CCalenCustomisationManager::Infobar
// Returns the infobar.
// (other items were commented in a header).
// ----------------------------------------------------------------------------
-EXPORT_C CCoeControl* CCalenCustomisationManager::Infobar(const TRect& aRect )
+ HbWidget* CCalenCustomisationManager::Infobar( )
{
- TRACE_ENTRY_POINT;
-
+ OstTraceFunctionEntry0( CCALENCUSTOMISATIONMANAGER_INFOBAR_ENTRY );
iInfoBarProviderUid = TUid::Uid(0);
- iPreviewPaneProviderUid = TUid::Uid(0);
-
- CCoeControl* infoBar = NULL;
+
+ HbWidget* infoBar =NULL;
// Loop though all the command handlers, within two interlinked
// for loops. If GetInfoBarL leaves for one plugin, a plugin
// error message will be displayed and the loop will continue with
// the next command handler. If none of the plugins leave, there will
// be only one TRAP used.
TInt count = iPlugins.Count();
+ /*if(count > 0)
+ {
+ infoBar = iPlugins[0]->Plugin().InfobarL();
+ iInfoBarProviderUid = iPlugins[0]->Uid();
+ }*/
+
for ( TInt index = 0; index < count && !infoBar; ++index )
{
TRAPD( error,
// Loop though until an infobar is found
for (; index < count && !infoBar; ++index )
{
- if ( !iPlugins[index]->IsDisabled() )
+ //if ( !iPlugins[index]->IsDisabled() )
{
- infoBar = iPlugins[index]->Plugin().InfobarL( aRect );
- iInfoBarProviderUid = iPlugins[index]->Uid();
- }
- }
- );
-
- if ( error )
- {
- // Report a problem with plugin.
- }
- }
-
- TRACE_EXIT_POINT;
- return infoBar;
- }
-
-// ----------------------------------------------------------------------------
-// CCalenCustomisationManager::Infobar
-// Returns the infobar.
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-EXPORT_C const TDesC& CCalenCustomisationManager::Infobar()
- {
- TRACE_ENTRY_POINT;
-
- iInfoBarProviderUid = TUid::Uid(0);
- iPreviewPaneProviderUid = TUid::Uid(0);
-
- iInfoBarStr.Set(KNullDesC);
- // Loop though all the command handlers, within two interlinked
- // for loops. If GetInfoBarL leaves for one plugin, a plugin
- // error message will be displayed and the loop will continue with
- // the next command handler. If none of the plugins leave, there will
- // be only one TRAP used.
- TBool infoBarFound = EFalse;
- TInt count = iPlugins.Count();
- for ( TInt index = 0; index < count && !infoBarFound; ++index )
- {
- TRAPD( error,
- // Loop though until an infobar is found
- for (; index < count && !infoBarFound; ++index )
- {
- if ( !iPlugins[index]->IsDisabled() )
- {
- iInfoBarStr.Set( iPlugins[index]->Plugin().InfobarL() );
- if(iInfoBarStr.Length())
- {
- infoBarFound = ETrue;
- }
+ infoBar = iPlugins[index]->Plugin().InfobarL();
iInfoBarProviderUid = iPlugins[index]->Uid();
}
}
);
-
- if ( error )
- {
- // Report a problem with plugin.
- }
+ if(error)
+ {
+ // Need to handle the error case
+ }
}
- TRACE_EXIT_POINT;
- return iInfoBarStr;
- }
-
-// ----------------------------------------------------------------------------
-// CCalenCustomisationManager::HiddenView
-// Return ETrue if a view has been hidden by a plugin
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-EXPORT_C TBool CCalenCustomisationManager::HiddenView( TUid aHiddenView) const
- {
- TRACE_ENTRY_POINT;
- TRACE_EXIT_POINT;
- return ( iHiddenViews.Find( aHiddenView.iUid ) != KErrNotFound );
- }
-
-
-// ----------------------------------------------------------------------------
-// CCalenCustomisationManager::RomBased(
-// Return ETrue if a view has been provided by a rom-based plugin
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-EXPORT_C TBool CCalenCustomisationManager::IsViewRomBased( TUid aViewUid ) const
- {
- TRACE_ENTRY_POINT;
-
- TBool isRomBased = EFalse;
-
- TInt viewInfoPos = iViewInfoArray.Find( aViewUid ,
- CCalenViewInfo::ViewInfoIdentifier );
- if ( viewInfoPos != KErrNotFound )
- {
- TUid plugUid = iViewInfoArray[viewInfoPos]->PluginUid();
- TInt position = iRomBasedPlugins.Find( plugUid );
- if ( position != KErrNotFound )
- {
- isRomBased = ETrue;
- }
- }
-
- TRACE_EXIT_POINT;
- return isRomBased;
+ OstTraceFunctionExit0( CCALENCUSTOMISATIONMANAGER_INFOBAR_EXIT );
+ return infoBar;
}
-// ----------------------------------------------------------------------------
-// CCalenCustomisationManager::CanBeEnabledDisabled(
-// Return ETrue if plugins can be enabled/disabled from settings
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-EXPORT_C TBool CCalenCustomisationManager::CanBeEnabledDisabledL(TUid aPluginUid)
- {
- TRACE_ENTRY_POINT;
- TBool enabledDisabled = EFalse;
-
- CCalenCustomisation* plugin = FindPluginL(aPluginUid);
- if(plugin)
- {
- enabledDisabled = plugin->CanBeEnabledDisabled();
- }
-
- TRACE_EXIT_POINT;
- return enabledDisabled;
- }
-
-// ----------------------------------------------------------------------------
-// CCalenCustomisationManager::OfferMenuPaneL
-// Offers a menupane to all interested plugins
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-void CCalenCustomisationManager::OfferMenuPaneToPluginsL( TInt aResourceId,
- CEikMenuPane* aMenuPane )
+ // ----------------------------------------------------------------------------
+ // CCalenCustomisationManager::InfobarTextL
+ // @returns info bar text
+ // (other items were commented in a header).
+ // ----------------------------------------------------------------------------
+ //
+ QString* CCalenCustomisationManager::InfobarTextL()
{
- TRACE_ENTRY_POINT;
-
- // Get the number of command handlers
- // TInt count = iCommandHandlers.Count();
- const TInt count = iPlugins.Count();
-
- // Loop though all the command handlers, within two interlinked
- // for loops. If customiseMenuPane leaves for one plugin, a plugin
- // error message will be displayed and the loop will continue with
- // the next command handler. If none of the plugins leave, there will
- // be only one TRAP used.
- for ( TInt index = 0; index < count; ++index )
- {
- TRAPD( error,
- for (; index < count; ++index )
- {
- if ( !iPlugins[index]->IsDisabled() )
- {
- iPlugins[index]->Plugin().CustomiseMenuPaneL( aResourceId,
- aMenuPane );
-
- // The commands added should be checked to see that
- // they match the expected command range for the plugin
- }
- }
- );
-
- if ( error )
- {
- // Report a problem with plugin.
- }
- }
-
- TRACE_EXIT_POINT;
+ OstTraceFunctionEntry0( CCALENCUSTOMISATIONMANAGER_INFOBARTEXTL_ENTRY );
+ iInfoBarProviderUid = TUid::Uid(0);
+
+ QString* infoBarText =NULL;
+ // Loop though all the command handlers, within two interlinked
+ // for loops. If GetInfoBarL leaves for one plugin, a plugin
+ // error message will be displayed and the loop will continue with
+ // the next command handler. If none of the plugins leave, there will
+ // be only one TRAP used.
+ TInt count = iPlugins.Count();
+ /*if(count > 0)
+ {
+ infoBar = iPlugins[0]->Plugin().InfobarL();
+ iInfoBarProviderUid = iPlugins[0]->Uid();
+ }*/
+
+ for ( TInt index = 0; index < count && !infoBarText; ++index )
+ {
+ TRAPD( error,
+ // Loop though until an infobar is found
+ for (; index < count && !infoBarText; ++index )
+ {
+ //if ( !iPlugins[index]->IsDisabled() )
+ {
+ infoBarText = iPlugins[index]->Plugin().InfobarTextL();
+ iInfoBarProviderUid = iPlugins[index]->Uid();
+ }
+ }
+ );
+ if(error)
+ {
+ // Need to handle the error case
+ }
+
+ }
+
+ OstTraceFunctionExit0( CCALENCUSTOMISATIONMANAGER_INFOBARTEXTL_EXIT );
+ return infoBarText;
}
// ----------------------------------------------------------------------------
@@ -1318,8 +630,7 @@
//
CCalenCustomisation* CCalenCustomisationManager::FindPluginL( TUid aUid )
{
- TRACE_ENTRY_POINT;
-
+ OstTraceFunctionEntry0( CCALENCUSTOMISATIONMANAGER_FINDPLUGINL_ENTRY );
TInt index = iPlugins.Find( aUid, CPluginInfo::Identifier );
CCalenCustomisation* plugin = NULL;
@@ -1328,7 +639,7 @@
plugin = &( iPlugins[index]->Plugin() );
}
- TRACE_EXIT_POINT;
+ OstTraceFunctionExit0( CCALENCUSTOMISATIONMANAGER_FINDPLUGINL_EXIT );
return plugin;
}
@@ -1344,8 +655,8 @@
: iPlugin( aPlugin ),
iUid( aUid )
{
- TRACE_ENTRY_POINT;
- TRACE_EXIT_POINT;
+ OstTraceFunctionEntry0( CPLUGININFO_CPLUGININFO_ENTRY );
+ OstTraceFunctionExit0( CPLUGININFO_CPLUGININFO_EXIT );
}
// ----------------------------------------------------------------------------
@@ -1356,11 +667,10 @@
//
CCalenCustomisationManager::CPluginInfo::~CPluginInfo()
{
- TRACE_ENTRY_POINT;
-
+ OstTraceFunctionEntry0( DUP1_CPLUGININFO_CPLUGININFO_ENTRY );
delete iPlugin;
- TRACE_EXIT_POINT;
+ OstTraceFunctionExit0( DUP1_CPLUGININFO_CPLUGININFO_EXIT );
}
// ----------------------------------------------------------------------------
@@ -1371,9 +681,9 @@
//
CCalenCustomisation& CCalenCustomisationManager::CPluginInfo::Plugin()
{
- TRACE_ENTRY_POINT;
- TRACE_EXIT_POINT;
+OstTraceFunctionEntry0( CPLUGININFO_PLUGIN_ENTRY );
+ OstTraceFunctionExit0( CPLUGININFO_PLUGIN_EXIT );
return *iPlugin;
}
@@ -1385,9 +695,8 @@
//
TUid CCalenCustomisationManager::CPluginInfo::Uid() const
{
- TRACE_ENTRY_POINT;
- TRACE_EXIT_POINT;
-
+ OstTraceFunctionEntry0( CPLUGININFO_UID_ENTRY );
+ OstTraceFunctionExit0( CPLUGININFO_UID_EXIT );
return iUid;
}
@@ -1399,11 +708,10 @@
//
void CCalenCustomisationManager::CPluginInfo::Disable( TBool aDisable)
{
- TRACE_ENTRY_POINT;
-
+ OstTraceFunctionEntry0( CPLUGININFO_DISABLE_ENTRY );
iDisabled = aDisable;
- TRACE_EXIT_POINT;
+ OstTraceFunctionExit0( CPLUGININFO_DISABLE_EXIT );
}
// ----------------------------------------------------------------------------
@@ -1414,12 +722,12 @@
//
TBool CCalenCustomisationManager::CPluginInfo::IsDisabled()
{
- TRACE_ENTRY_POINT;
-
+ OstTraceFunctionEntry0( CPLUGININFO_ISDISABLED_ENTRY );
+ OstTraceFunctionExit0( CPLUGININFO_ISDISABLED_EXIT );
return iDisabled;
-
- TRACE_EXIT_POINT;
}
+
+
// ----------------------------------------------------------------------------
// CCalenCustomisationManager::AddPluginL
@@ -1430,17 +738,12 @@
void CCalenCustomisationManager::AddPluginL( CCalenCustomisation* aPlugin,
TUid aUid )
{
- TRACE_ENTRY_POINT;
- TInt index = iPlugins.Find( aUid, CPluginInfo::Identifier );
- if ( index == KErrNotFound )
- {
+ OstTraceFunctionEntry0( CCALENCUSTOMISATIONMANAGER_ADDPLUGINL_ENTRY );
CPluginInfo* newPlugin = new ( ELeave ) CPluginInfo( aPlugin, aUid);
CleanupStack::PushL( newPlugin );
iPlugins.AppendL( newPlugin );
CleanupStack::Pop( newPlugin );
- }
-
- TRACE_EXIT_POINT;
+ OstTraceFunctionExit0( CCALENCUSTOMISATIONMANAGER_ADDPLUGINL_EXIT );
}
// ----------------------------------------------------------------------------
@@ -1453,28 +756,14 @@
TBool CCalenCustomisationManager::CPluginInfo::Identifier( const TUid* aUid,
const CPluginInfo& aArray )
{
- TRACE_ENTRY_POINT;
- TRACE_EXIT_POINT;
-
+ OstTraceFunctionEntry0( CPLUGININFO_IDENTIFIER_ENTRY );
return ( *aUid == aArray.Uid() );
}
-// ----------------------------------------------------------------------------
-// CCalenCustomisationManager::ViewInfoArray
-// returns a reference to the view info array.
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-RPointerArray<CCalenViewInfo>& CCalenCustomisationManager::ViewInfoArray()
- {
- TRACE_ENTRY_POINT;
- TRACE_EXIT_POINT;
- return iViewInfoArray;
- }
// ----------------------------------------------------------------------------
-// CCalenCustomisationManager::PluginAvailabilityFinder
+// CCalenCustomisationManager::Identifier(
// Matches an uid and a plugin uid. Used by when finding the disabled plugins
// (other items were commented in a header).
// ----------------------------------------------------------------------------
@@ -1482,126 +771,50 @@
TBool CCalenCustomisationManager::PluginAvailabilityFinder( const TUid* aUid,
const TCalenPluginAvailability& aArrayItem )
{
- TRACE_ENTRY_POINT;
- TRACE_EXIT_POINT;
+ OstTraceFunctionEntry0( CCALENCUSTOMISATIONMANAGER_PLUGINAVAILABILITYFINDER_ENTRY );
+ OstTraceFunctionExit0( CCALENCUSTOMISATIONMANAGER_PLUGINAVAILABILITYFINDER_EXIT );
return ( *aUid == aArrayItem.iUid);
- }
+ }
// ----------------------------------------------------------------------------
-// CCalenCustomisationManager::DoPluginLoadingL
-// Load all plugins
-// ----------------------------------------------------------------------------
-//
-EXPORT_C void CCalenCustomisationManager::DoPluginLoadingL()
- {
- TRACE_ENTRY_POINT;
- // Reset and destroy the contents of the owned arrays
- //iPlugins.ResetAndDestroy();
- iHiddenViews.Reset();
- iDefferedUnloadPluginList.Reset();
- // create active plugin list
- CreateActivePluginListL();
-
- DoImmediatePluginLoadingL();
- iSetting->LoadL();
- iSetting->UpdatePluginListL(*this);
-
- TRACE_EXIT_POINT;
- }
-
-// ----------------------------------------------------------------------------
-// CCalenCustomisationManager::DisableAllPluginsL
-// Disable all plugins
-// ----------------------------------------------------------------------------
-//
-EXPORT_C void CCalenCustomisationManager::DisableAllPluginsL()
- {
- TRACE_ENTRY_POINT;
-
- TInt pluginCount = iPluginInfo.Count();
- for(TInt index = 0;index<pluginCount;index++)
- {
- TUid pluginUid = iPluginInfo[index]->ImplementationUid();
- if ((iActivePlugins.Find(pluginUid) != KErrNotFound)
- && !(iRomBasedPlugins.Find(pluginUid) != KErrNotFound))
- {
- DisablePluginOnFakeExitL(pluginUid);
- }
- }
-
- TRACE_EXIT_POINT;
- }
-
-// ----------------------------------------------------------------------------
-// CCalenCustomisationManager::DisablePluginOnFakeExitL
-// Disable plugin on fake exit
+// CCalenCustomisationManager::OfferMenu
+// Offers a menupane for customisation by plugins
+// and the controller.
+// (other items were commented in a header).
// ----------------------------------------------------------------------------
//
-void CCalenCustomisationManager::DisablePluginOnFakeExitL(TUid aPluginUid)
+void CCalenCustomisationManager::OfferMenu(HbMenu* aHbMenu )
{
- TRACE_ENTRY_POINT;
-
- TInt index = iPlugins.Find( aPluginUid, CPluginInfo::Identifier );
- if ( index != KErrNotFound )
+ OstTraceFunctionEntry0( CCALENCUSTOMISATIONMANAGER_OFFERMENU_ENTRY );
+ // Get the number of command handlers
+ // TInt count = iCommandHandlers.Count();
+ const TInt count = iPlugins.Count();
+
+ // Loop though all the command handlers, within two interlinked
+ // for loops. If customiseMenuPane leaves for one plugin, a plugin
+ // error message will be displayed and the loop will continue with
+ // the next command handler. If none of the plugins leave, there will
+ // be only one TRAP used.
+ for ( TInt index = 0; index < count; ++index )
{
- CPluginInfo* pluginInfo = iPlugins[index];
-
- // Remove the plugin from the active plugin list
- TInt position = iActivePlugins.Find( aPluginUid );
- ASSERT( position != KErrNotFound );
-
- if(iActivePlugins.Count())
- {
- iActivePlugins.Remove( position );
- }
-
- // Does this plugin hide any views
- RArray<TInt> removedViews;
- CleanupClosePushL( removedViews );
- CCalenCustomisation& plugin = pluginInfo->Plugin();
- plugin.RemoveViewsFromCycle( removedViews );
- TInt hiddenViewsCount = removedViews.Count();
- if ( hiddenViewsCount )
- {
- // Need to recalculate which views have been hidden, as
- // more than one plugin might have hidden the same view.
- for ( TInt index( 0 ); index < hiddenViewsCount; ++index )
+ TRAPD( error,
+ for (; index < count; ++index )
{
- TUid viewUid = TUid::Uid( removedViews[index] );
- CheckHiddenViewL( viewUid, aPluginUid );
+ iPlugins[index]->Plugin().CustomiseMenu(aHbMenu );
+
+ // The commands added should be checked to see that
+ // they match the expected command range for the plugin
}
+ );
+
+ if ( error )
+ {
+ // Report a problem with plugin.
}
-
- // If the plugin does not offer any views, or the current
- // info or preview bar it can be deleted immediately,
- // otherwise the customisation needs to wait until it
- // is told it is safe to do so.
-
- // Does this plugin does not offer any views and the plugin
- // doesn't offer the current infobar or preview pane
- // bar it can be deleted immediately
- TInt offerViews = iViewInfoArray.Find( aPluginUid,
- CCalenViewInfo::ViewPluginIdentifier );
-
- if ( offerViews == KErrNotFound &&
- iInfoBarProviderUid != aPluginUid
- && iPreviewPaneProviderUid != aPluginUid )
- {
- RArray<TUid> pluginArray;
- CleanupClosePushL( pluginArray );
- pluginArray.AppendL( aPluginUid );
- UnloadPluginsL( pluginArray );
- CleanupStack::PopAndDestroy(); // pluginArray
- }
-
- // Issue notification of plugin been disabled
- iPluginsEnabledDisabled = ETrue;
- iServices.IssueNotificationL( ECalenNotifyPluginEnabledDisabled );
- CleanupStack::PopAndDestroy(); // removedViews
}
- TRACE_EXIT_POINT;
+
+ OstTraceFunctionExit0( CCALENCUSTOMISATIONMANAGER_OFFERMENU_EXIT );
}
// End of File
-