diff -r 8ee96d21d9bf -r 7e0eff37aedb gssettingsuis/Gs/GSAppsPlugin/src/GSAppsPlugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gssettingsuis/Gs/GSAppsPlugin/src/GSAppsPlugin.cpp Wed Sep 01 12:20:44 2010 +0100 @@ -0,0 +1,297 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: GSAppsPlugin source code. +* +*/ + + +// Includes +#include "GSAppsPlugin.h" +#include "GsLogger.h" +#include +#include +#include +#include +#include +#include +#include +#include // For TResourceReader +#include // Icons +#include +#include + +#ifndef RD_CONTROL_PANEL + #include + #include +#endif //RD_CONTROL_PANEL + +// Constants + +// ========================= MEMBER FUNCTIONS ================================ + + +// --------------------------------------------------------------------------- +// CGSAppsPlugin::CGSAppsPlugin() +// Constructor +// +// --------------------------------------------------------------------------- +// +CGSAppsPlugin::CGSAppsPlugin() + : CGSParentPlugin(), iResources( *iCoeEnv ) + { + __GSLOGSTRING( "[CGSAppsPlugin] CGSAppsPlugin()" ); + } + + +// --------------------------------------------------------------------------- +// CGSAppsPlugin::~CGSAppsPlugin() +// Destructor +// +// --------------------------------------------------------------------------- +// +CGSAppsPlugin::~CGSAppsPlugin() + { + FeatureManager::UnInitializeLib(); + iResources.Close(); + + #ifndef RD_CONTROL_PANEL + delete iTabHelper; + #endif //RD_CONTROL_PANEL + + __GSLOGSTRING( "[CGSAppsPlugin] ~CGSAppsPlugin()" ); + } + + +// --------------------------------------------------------------------------- +// CGSAppsPlugin::ConstructL(const TRect& aRect) +// Symbian OS two-phased constructor +// +// --------------------------------------------------------------------------- +// +void CGSAppsPlugin::ConstructL() + { + FeatureManager::InitializeLibL(); + OpenLocalizedResourceFileL( KGSAppsPluginResourceFileName, iResources ); + + // Do not load content of this view untill/unless this view is activated. + // This will save memory as well as optimize loading performance for other + // plugins. + TBitFlags flags; + flags.Set( EGSLoadChildrenOnActivation ); + SetOptionFlags( flags ); + + BaseConstructL( R_GS_APPLICATIONS_VIEW, R_GS_APPS_VIEW_TITLE ); + + #ifndef RD_CONTROL_PANEL + iTabHelper = CGSTabHelper::NewL(); + #endif //RD_CONTROL_PANEL + } + + +// --------------------------------------------------------------------------- +// CGSAppsPlugin::NewL() +// Static constructor +// +// --------------------------------------------------------------------------- +// +CGSAppsPlugin* CGSAppsPlugin::NewL( TAny* /*aInitParams*/ ) + { + CGSAppsPlugin* self = new(ELeave) CGSAppsPlugin(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + + +// ----------------------------------------------------------------------------- +// CGSAppsPlugin::Id() +// +// +// ----------------------------------------------------------------------------- +// +TUid CGSAppsPlugin::Id() const + { + return KGSAppsPluginUid; + } + + +// ----------------------------------------------------------------------------- +// CGSAppsPlugin::DoActivateL() +// +// +// ----------------------------------------------------------------------------- +// +void CGSAppsPlugin::DoActivateL( const TVwsViewId& aPrevViewId, + TUid aCustomMessageId, + const TDesC8& aCustomMessage ) + { + CGSParentPlugin::DoActivateL( aPrevViewId, + aCustomMessageId, + aCustomMessage ); + CGSMainView* parent = + static_cast ( AppUi()->View( KGSMainViewUid ) ); + + // Create tab group for this view (do only if casting succeeds): + #ifndef RD_CONTROL_PANEL + if( parent ) + { + iTabHelper->CreateTabGroupL( Id(), parent ); + } + #endif //RD_CONTROL_PANEL + } + + +// ----------------------------------------------------------------------------- +// CGSAppsPlugin::DoDeactivate() +// +// +// ----------------------------------------------------------------------------- +// +void CGSAppsPlugin::DoDeactivate() + { + CGSParentPlugin::DoDeactivate(); + + #ifndef RD_CONTROL_PANEL + iTabHelper->RemoveTabGroup(); + #endif //RD_CONTROL_PANEL + } + + +// ========================= From CGSParentPlugin ===================== + + +// ----------------------------------------------------------------------------- +// CGSAppsPlugin::UpperLevelViewUid() +// +// +// ----------------------------------------------------------------------------- +// +TUid CGSAppsPlugin::UpperLevelViewUid() + { + return KGSMainViewUid; + } + + +// ========================= From CGSPluginInterface ================== + + +// ----------------------------------------------------------------------------- +// CGSAppsPlugin::GetCaptionL() +// +// +// ----------------------------------------------------------------------------- +// +void CGSAppsPlugin::GetCaptionL( TDes& aCaption ) const + { + // The resource file is already opened. + HBufC* result = StringLoader::LoadL( R_GS_APPS_VIEW_CAPTION ); + aCaption.Copy( *result ); + delete result; + } + + +// ----------------------------------------------------------------------------- +// CGSAppsPlugin::PluginProviderCategory() +// +// +// ----------------------------------------------------------------------------- +// +TInt CGSAppsPlugin::PluginProviderCategory() const + { + return KGSPluginProviderInternal; + } + + +// ----------------------------------------------------------------------------- +// CGSAppsPlugin::GetHelpContext() +// +// +// ----------------------------------------------------------------------------- +// +void CGSAppsPlugin::GetHelpContext( TCoeHelpContext& aContext ) + { + aContext.iMajor = KUidGS; + aContext.iContext = KCP_HLP_APPILICATION_SETTINGS; + } + + +// ----------------------------------------------------------------------------- +// CGSAppsPlugin::CreateIconL() +// +// +// ----------------------------------------------------------------------------- +// +CGulIcon* CGSAppsPlugin::CreateIconL( const TUid aIconType ) + { + //EMbm + CGulIcon* icon; + TParse* fp = new( ELeave ) TParse(); + CleanupStack::PushL( fp ); + fp->Set( KGSAppsPluginIconDirAndName, &KDC_BITMAP_DIR, NULL ); + + if( aIconType == KGSIconTypeLbxItem ) + { + icon = AknsUtils::CreateGulIconL( + AknsUtils::SkinInstance(), + KAknsIIDQgnPropSetAppsSub, + fp->FullName(), + EMbmGsappspluginQgn_prop_set_apps_sub, + EMbmGsappspluginQgn_prop_set_apps_sub_mask ); + } + else if( aIconType == KGSIconTypeTab ) + { + icon = AknsUtils::CreateGulIconL( + AknsUtils::SkinInstance(), + KAknsIIDQgnPropSetAppsTab4, + fp->FullName(), + EMbmGsappspluginQgn_prop_set_apps_tab4, + EMbmGsappspluginQgn_prop_set_apps_tab4_mask ); + } + else + { + icon = CGSPluginInterface::CreateIconL( aIconType ); + } + + CleanupStack::PopAndDestroy( fp ); + + return icon; + } + + +// ---------------------------------------------------------------------------- +// CGSAppsPlugin::DynInitMenuPaneL() +// +// Display the dynamic menu +// ---------------------------------------------------------------------------- +void CGSAppsPlugin::DynInitMenuPaneL( TInt aResourceId, + CEikMenuPane* aMenuPane ) + { + // show or hide the 'help' menu item when supported + if( aResourceId == R_GS_MENU_ITEM_HELP ) + { + User::LeaveIfNull( aMenuPane ); + + if ( FeatureManager::FeatureSupported( KFeatureIdHelp ) ) + { + aMenuPane->SetItemDimmed( EAknCmdHelp, EFalse ); + } + else + { + aMenuPane->SetItemDimmed( EAknCmdHelp, ETrue ); + } + } + } + +// End of File