gssettingsuis/Gs/GSPrslnPlugin/src/GSPrslnPlugin.cpp
branchRCL_3
changeset 24 8ee96d21d9bf
parent 23 8bda91a87a00
child 25 7e0eff37aedb
equal deleted inserted replaced
23:8bda91a87a00 24:8ee96d21d9bf
     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:    Cpp file for plugin.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // Includes
       
    20 #include "GSPrslnPlugin.h"
       
    21 #include "GSLogger.h"
       
    22 
       
    23 #include <gsprslnpluginrsc.rsg>
       
    24 #include <GSPrslnPlugin.mbg>
       
    25 
       
    26 // Includes from GS framework:
       
    27 #include <GSFWViewUIDs.h>
       
    28 #include <GSPrivatePluginProviderIds.h>
       
    29 #include <GSMainView.h>
       
    30 #include <csxhelp/cp.hlp.hrh>
       
    31 
       
    32 #include <AknViewAppUi.h>
       
    33 #include <ConeResLoader.h>
       
    34 #include <barsread.h> // For TResourceReader
       
    35 #include <StringLoader.h>
       
    36 #include <FeatMgr.h>
       
    37 
       
    38 #include <eikbtgpc.h>
       
    39 
       
    40 #ifndef RD_CONTROL_PANEL
       
    41     #include <GSTabHelper.h>
       
    42 #endif //RD_CONTROL_PANEL
       
    43 
       
    44 // Constants
       
    45 // Active Idle UID.
       
    46 const TUid KScutActiveIdleUid       = { 0x102750F0 };
       
    47 
       
    48 // ========================= MEMBER FUNCTIONS ================================
       
    49 
       
    50 
       
    51 // ---------------------------------------------------------------------------
       
    52 // CGSPrslnPlugin::CGSPrslnPlugin()
       
    53 //
       
    54 //
       
    55 // ---------------------------------------------------------------------------
       
    56 //
       
    57 CGSPrslnPlugin::CGSPrslnPlugin()
       
    58     : CGSParentPlugin(), iResourceLoader( *iCoeEnv ), iCbaConstructed( EFalse )
       
    59     {
       
    60     __GSLOGSTRING( "[CGSPrslnPlugin] CGSPrslnPlugin()" );
       
    61 
       
    62     }
       
    63 
       
    64 
       
    65 // ---------------------------------------------------------------------------
       
    66 // CGSPrslnPlugin::~CGSPrslnPlugin()
       
    67 //
       
    68 //
       
    69 // ---------------------------------------------------------------------------
       
    70 //
       
    71 CGSPrslnPlugin::~CGSPrslnPlugin()
       
    72     {
       
    73     iResourceLoader.Close();
       
    74     
       
    75     #ifndef RD_CONTROL_PANEL
       
    76         delete iTabHelper;
       
    77     #endif //RD_CONTROL_PANEL
       
    78     __GSLOGSTRING( "[CGSPrslnPlugin] ~CGSPrslnPlugin()" );
       
    79     }
       
    80 
       
    81 
       
    82 // ---------------------------------------------------------------------------
       
    83 // CGSPrslnPlugin::ConstructL()
       
    84 //
       
    85 //
       
    86 // ---------------------------------------------------------------------------
       
    87 //
       
    88 void CGSPrslnPlugin::ConstructL()
       
    89     {
       
    90     __GSLOGSTRING( "[CGSPrslnPlugin] ConstructL()" );
       
    91     OpenLocalizedResourceFileL( KGSPrslnPluginResourceFileName,
       
    92                                 iResourceLoader );
       
    93     BaseConstructL( R_GS_PRSLN_VIEW, R_GS_PRSLN_VIEW_TITLE );
       
    94     
       
    95     #ifndef RD_CONTROL_PANEL
       
    96         iTabHelper = CGSTabHelper::NewL();
       
    97     #endif //RD_CONTROL_PANEL
       
    98     }
       
    99 
       
   100 
       
   101 // ---------------------------------------------------------------------------
       
   102 // CGSPrslnPlugin::NewL()
       
   103 //
       
   104 //
       
   105 // ---------------------------------------------------------------------------
       
   106 //
       
   107 CGSPrslnPlugin* CGSPrslnPlugin::NewL( TAny* /*aInitParams*/ )
       
   108 	{
       
   109 	__GSLOGSTRING( "[CGSPrslnPlugin] NewL()" );
       
   110 	CGSPrslnPlugin* self = new(ELeave) CGSPrslnPlugin();
       
   111 	CleanupStack::PushL(self);
       
   112 	self->ConstructL();
       
   113 	CleanupStack::Pop(self);
       
   114 	return self;
       
   115 	}
       
   116 
       
   117 
       
   118 // ---------------------------------------------------------------------------
       
   119 // CGSParentPlugin::Id()
       
   120 //
       
   121 //
       
   122 // ---------------------------------------------------------------------------
       
   123 //
       
   124 TUid CGSPrslnPlugin::Id() const
       
   125     {
       
   126     __GSLOGSTRING1( "[CGSPrslnPlugin] Id():0x%X", KGSPrslnPluginUid.iUid );
       
   127     return KGSPrslnPluginUid;
       
   128     }
       
   129 
       
   130 
       
   131 // ---------------------------------------------------------------------------
       
   132 // CGSParentPlugin::DoActivateL()
       
   133 //
       
   134 //
       
   135 // ---------------------------------------------------------------------------
       
   136 //
       
   137 void CGSPrslnPlugin::DoActivateL
       
   138     ( const TVwsViewId& aPrevViewId,
       
   139       TUid aCustomMessageId,
       
   140       const TDesC8& aCustomMessage )
       
   141     {
       
   142     
       
   143     CEikButtonGroupContainer* cba = Cba();
       
   144 
       
   145     if ( aCustomMessageId == KScutActiveIdleUid && !iCbaConstructed )
       
   146         {
       
   147         cba->SetCommandSetL( R_GS_PSLN_SOFTKEYS_OPTIONS_EXIT_OPEN );
       
   148         cba->DrawDeferred();
       
   149         }
       
   150     iCbaConstructed = ETrue;
       
   151         
       
   152     CGSParentPlugin::DoActivateL( aPrevViewId,
       
   153                                   aCustomMessageId,
       
   154                                   aCustomMessage );
       
   155     CGSMainView* parent =
       
   156         static_cast<CGSMainView*> ( AppUi()->View( KGSMainViewUid ) );
       
   157 
       
   158     #ifndef RD_CONTROL_PANEL
       
   159         // Create tab group for this view (do only if casting parent succeeds):
       
   160         if( parent )
       
   161             {
       
   162             iTabHelper->CreateTabGroupL( Id(), parent );
       
   163             }
       
   164     #endif //RD_CONTROL_PANEL
       
   165     }
       
   166 
       
   167 
       
   168 // ---------------------------------------------------------------------------
       
   169 // CGSParentPlugin::DoDeactivate()
       
   170 //
       
   171 //
       
   172 // ---------------------------------------------------------------------------
       
   173 //
       
   174 void CGSPrslnPlugin::DoDeactivate()
       
   175     {
       
   176     CGSParentPlugin::DoDeactivate();
       
   177     
       
   178     #ifndef RD_CONTROL_PANEL
       
   179         iTabHelper->RemoveTabGroup();
       
   180     #endif //RD_CONTROL_PANEL
       
   181     }
       
   182 
       
   183 
       
   184 // ========================= From CGSParentPlugin =====================
       
   185 
       
   186 
       
   187 // ---------------------------------------------------------------------------
       
   188 // CGSPrslnPlugin::UpperLevelViewUid()
       
   189 //
       
   190 //
       
   191 // ---------------------------------------------------------------------------
       
   192 //
       
   193 TUid CGSPrslnPlugin::UpperLevelViewUid()
       
   194     {
       
   195     #ifdef RD_CONTROL_PANEL
       
   196         return KGSMainViewUid;
       
   197     #else //RD_CONTROL_PANEL
       
   198         return KGSGenPluginUid;
       
   199     #endif //RD_CONTROL_PANEL
       
   200     }
       
   201 
       
   202 
       
   203 // -----------------------------------------------------------------------------
       
   204 // CGSPrslnPlugin::GetHelpContext()
       
   205 //
       
   206 //
       
   207 // -----------------------------------------------------------------------------
       
   208 //
       
   209 void CGSPrslnPlugin::GetHelpContext( TCoeHelpContext& aContext )
       
   210     {
       
   211     aContext.iMajor = KUidGS;
       
   212     aContext.iContext = KCP_HLP_PERSONAL;
       
   213     }
       
   214 
       
   215 
       
   216 // ========================= From CGSPluginInterface ==================
       
   217 
       
   218 
       
   219 // ---------------------------------------------------------------------------
       
   220 // CGSPrslnPlugin::GetCaptionL()
       
   221 //
       
   222 //
       
   223 // ---------------------------------------------------------------------------
       
   224 //
       
   225 void CGSPrslnPlugin::GetCaptionL( TDes& aCaption ) const
       
   226     {
       
   227     // The resource file is already opened by iResourceLoader.
       
   228     HBufC* result = StringLoader::LoadL( R_GS_PRSLN_VIEW_CAPTION );
       
   229     aCaption.Copy( *result );
       
   230     delete result;
       
   231     }
       
   232 
       
   233 
       
   234 // ---------------------------------------------------------------------------
       
   235 // CGSPrslnPlugin::CreateIconL
       
   236 //
       
   237 // Return the icon, if has one.
       
   238 // ---------------------------------------------------------------------------
       
   239 //
       
   240 CGulIcon* CGSPrslnPlugin::CreateIconL( const TUid aIconType )
       
   241     {
       
   242     //EMbm<Mbm_file_name><Bitmap_name>
       
   243     CGulIcon* icon;
       
   244     TParse* fp = new( ELeave ) TParse();
       
   245     CleanupStack::PushL( fp );
       
   246     fp->Set( KGSPrslnPluginIconDirAndName, &KDC_BITMAP_DIR, NULL );
       
   247 
       
   248     if( aIconType == KGSIconTypeLbxItem )
       
   249         {
       
   250         icon = AknsUtils::CreateGulIconL(
       
   251         AknsUtils::SkinInstance(),
       
   252         KAknsIIDQgnPropCpPerso,
       
   253         fp->FullName(),
       
   254         EMbmGsprslnpluginQgn_prop_cp_perso,
       
   255         EMbmGsprslnpluginQgn_prop_cp_perso_mask );
       
   256         }
       
   257        else
       
   258         {
       
   259         icon = CGSPluginInterface::CreateIconL( aIconType );
       
   260         }
       
   261 
       
   262     CleanupStack::PopAndDestroy( fp );
       
   263 
       
   264     return icon;
       
   265     }
       
   266 
       
   267 // ---------------------------------------------------------------------------
       
   268 // CGSPrslnPlugin::PluginProviderCategory()
       
   269 //
       
   270 //
       
   271 // ---------------------------------------------------------------------------
       
   272 //
       
   273 TInt CGSPrslnPlugin::PluginProviderCategory() const
       
   274     {
       
   275     return KGSPluginProviderInternal;
       
   276     }
       
   277 
       
   278 
       
   279 // ---------------------------------------------------------------------------
       
   280 // CGSPrslnPlugin::ListBoxType()
       
   281 //
       
   282 //
       
   283 // ---------------------------------------------------------------------------
       
   284 //
       
   285 TGSListboxTypes CGSPrslnPlugin::ListBoxType()
       
   286     {
       
   287     return EGSListBoxTypeSingleLarge;
       
   288     }
       
   289 
       
   290 
       
   291 // ----------------------------------------------------------------------------
       
   292 // CGSPrslnPlugin::DynInitMenuPaneL()
       
   293 // 
       
   294 // Display the dynamic menu
       
   295 // ----------------------------------------------------------------------------
       
   296 void CGSPrslnPlugin::DynInitMenuPaneL( TInt aResourceId,
       
   297                                        CEikMenuPane* aMenuPane )
       
   298     {
       
   299     FeatureManager::InitializeLibL();
       
   300     // show or hide the 'help' menu item when supported
       
   301     if( aResourceId == R_GS_MENU_ITEM_HELP )
       
   302         {
       
   303         User::LeaveIfNull( aMenuPane );
       
   304             
       
   305         if ( FeatureManager::FeatureSupported( KFeatureIdHelp ) )
       
   306             {
       
   307             aMenuPane->SetItemDimmed( EAknCmdHelp, EFalse );
       
   308             }
       
   309         else
       
   310             {
       
   311             aMenuPane->SetItemDimmed( EAknCmdHelp, ETrue );
       
   312             }
       
   313         }
       
   314     
       
   315     FeatureManager::UnInitializeLib();
       
   316     }
       
   317 
       
   318 // End of File