diff -r 6465d5bb863a -r 13e71d907dc3 gssettingsuis/Gs/GSGenPlugin/src/GSGenPlugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gssettingsuis/Gs/GSGenPlugin/src/GSGenPlugin.cpp Thu Nov 04 13:38:47 2010 +0800 @@ -0,0 +1,298 @@ +/* +* 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: GSGenPlugin source code. +* +*/ + + +// Includes +#include "GSGenPlugin.h" +#include "GsLogger.h" +#include +#include // Icons +#include +#include +#include +#include +#include +#include +#include +#include // For TResourceReader +#include + +#ifndef RD_CONTROL_PANEL + #include +#endif //RD_CONTROL_PANEL + +// Constants + + +// ========================= MEMBER FUNCTIONS ================================ + + +// --------------------------------------------------------------------------- +// CGSGenPlugin::CGSGenPlugin() +// +// +// --------------------------------------------------------------------------- +// +CGSGenPlugin::CGSGenPlugin() + : CGSParentPlugin(), iResourceLoader( *iCoeEnv ) + { + __GSLOGSTRING( "[CGSGenPlugin] CGSGenPlugin()" ); + + } + + +// --------------------------------------------------------------------------- +// CGSGenPlugin::~CGSGenPlugin() +// +// +// --------------------------------------------------------------------------- +// +CGSGenPlugin::~CGSGenPlugin() + { + __GSLOGSTRING( "[CGSGenPlugin] ~CGSGenPlugin()|->" ); + FeatureManager::UnInitializeLib(); + iResourceLoader.Close(); + + #ifndef RD_CONTROL_PANEL + if ( iTabHelper ) + { + delete iTabHelper; + } + #endif //RD_CONTROL_PANEL + __GSLOGSTRING( "[CGSGenPlugin] ~CGSGenPlugin()-|" ); + } + + +// --------------------------------------------------------------------------- +// CGSGenPlugin::ConstructL() +// +// +// --------------------------------------------------------------------------- +// +void CGSGenPlugin::ConstructL() + { + __GSLOGSTRING( "[CGSGenPlugin] ConstructL()|->" ); + FeatureManager::InitializeLibL(); + OpenLocalizedResourceFileL( KGSGenPluginResourceFileName, + iResourceLoader ); + BaseConstructL( R_GS_GEN_VIEW, R_GS_GEN_VIEW_TITLE ); + + #ifndef RD_CONTROL_PANEL + iTabHelper = CGSTabHelper::NewL(); + #endif //RD_CONTROL_PANEL + __GSLOGSTRING( "[CGSGenPlugin] ConstructL()-|" ); + } + + +// --------------------------------------------------------------------------- +// CGSGenPlugin::NewL() +// +// +// --------------------------------------------------------------------------- +// +CGSGenPlugin* CGSGenPlugin::NewL( TAny* /*aInitParams*/ ) + { + __GSLOGSTRING( "[CGSGenPlugin] NewL()" ); + + CGSGenPlugin* self = new(ELeave) CGSGenPlugin(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + + +// --------------------------------------------------------------------------- +// CGSParentPlugin::Id() +// +// +// --------------------------------------------------------------------------- +// +TUid CGSGenPlugin::Id() const + { + __GSLOGSTRING1( "[CGSGenPlugin] Id():0x%X", KGSGenPluginUid.iUid ); + return KGSGenPluginUid; + } + + +// --------------------------------------------------------------------------- +// CGSParentPlugin::DoActivateL() +// +// +// --------------------------------------------------------------------------- +// +void CGSGenPlugin::DoActivateL + ( const TVwsViewId& aPrevViewId, + TUid aCustomMessageId, + const TDesC8& aCustomMessage ) + { + __GSLOGSTRING( "[CGSGenPlugin] DoActivateL()|->" ); + CGSParentPlugin::DoActivateL( aPrevViewId, + aCustomMessageId, + aCustomMessage ); + CGSMainView* parent = + static_cast ( AppUi()->View( KGSMainViewUid ) ); + + + #ifndef RD_CONTROL_PANEL + // Create tab group for this view (do only if casting parent succeeds): + if( parent ) + { + iTabHelper->CreateTabGroupL( Id(), parent ); + } + #endif //RD_CONTROL_PANEL + __GSLOGSTRING( "[CGSGenPlugin] DoActivateL()-|" ); + } + + +// --------------------------------------------------------------------------- +// CGSParentPlugin::DoDeactivate() +// +// +// --------------------------------------------------------------------------- +// +void CGSGenPlugin::DoDeactivate() + { + __GSLOGSTRING( "[CGSGenPlugin] DoDeactivate()|->" ); + CGSParentPlugin::DoDeactivate(); + + #ifndef RD_CONTROL_PANEL + iTabHelper->RemoveTabGroup(); + #endif //RD_CONTROL_PANEL + __GSLOGSTRING( "[CGSGenPlugin] DoDeactivate()-|" ); + } + + +// ========================= From CGSParentPlugin ===================== + + +// --------------------------------------------------------------------------- +// CGSGenPlugin::UpperLevelViewUid() +// +// +// --------------------------------------------------------------------------- +// +TUid CGSGenPlugin::UpperLevelViewUid() + { + return KGSMainViewUid; + } + + +// ========================= From CGSPluginInterface ================== + + +// --------------------------------------------------------------------------- +// CGSGenPlugin::GetCaptionL() +// +// +// --------------------------------------------------------------------------- +// +void CGSGenPlugin::GetCaptionL( TDes& aCaption ) const + { + __GSLOGSTRING( "[CGSGenPlugin] GetCaptionL()|->" ); + // The resource file is already opened by iResourceLoader. + HBufC* result = StringLoader::LoadL( R_GS_GEN_VIEW_CAPTION ); + aCaption.Copy( *result ); + delete result; + __GSLOGSTRING( "[CGSGenPlugin] GetCaptionL()-|" ); + } + + +// --------------------------------------------------------------------------- +// CGSGenPlugin::PluginProviderCategory() +// +// +// --------------------------------------------------------------------------- +// +TInt CGSGenPlugin::PluginProviderCategory() const + { + return KGSPluginProviderInternal; + } + + +// ----------------------------------------------------------------------------- +// CGSGenPlugin::GetHelpContext() +// +// +// ----------------------------------------------------------------------------- +// +void CGSGenPlugin::GetHelpContext( TCoeHelpContext& aContext ) + { + aContext.iMajor = KUidGS; + aContext.iContext = KCP_HLP_DEVICE; + } + + +// ----------------------------------------------------------------------------- +// CGSGenPlugin::CreateIconL() +// +// +// ----------------------------------------------------------------------------- +// +CGulIcon* CGSGenPlugin::CreateIconL( const TUid aIconType ) + { + //EMbm + CGulIcon* icon; + TParse* fp = new( ELeave ) TParse(); + CleanupStack::PushL( fp ); + fp->Set( KGSGenPluginIconDirAndName, &KDC_BITMAP_DIR, NULL ); + + if( aIconType == KGSIconTypeLbxItem ) + { + icon = AknsUtils::CreateGulIconL( + AknsUtils::SkinInstance(), + KAknsIIDQgnPropCpDev, + fp->FullName(), + EMbmGsgenpluginQgn_prop_cp_dev, + EMbmGsgenpluginQgn_prop_cp_dev_mask ); + } + else + { + icon = CGSPluginInterface::CreateIconL( aIconType ); + } + + CleanupStack::PopAndDestroy( fp ); + + return icon; + } + + +// ---------------------------------------------------------------------------- +// CGSGenPlugin::DynInitMenuPaneL() +// +// Display the dynamic menu +// ---------------------------------------------------------------------------- +void CGSGenPlugin::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