gssettingsuis/Gs/GSTelPlugin/Src/GSTelPlugin.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-2006 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:  GSTelPlugin source code.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // Includes
       
    20 #include "GSTelPlugin.h"
       
    21 #include "GsLogger.h"
       
    22 #include <gsfwviewuids.h>
       
    23 #include <gstelplugin.mbg> // Icons
       
    24 #include <gstelpluginrsc.rsg>
       
    25 #include <gsmainview.h>
       
    26 #include <gsprivatepluginproviderids.h>
       
    27 #include <csxhelp/cp.hlp.hrh>
       
    28 #include <aknViewAppUi.h>
       
    29 #include <ConeResLoader.h>
       
    30 #include <StringLoader.h>
       
    31 #include <barsread.h> // For TResourceReader
       
    32 #include <featmgr.h>
       
    33 
       
    34 #ifndef RD_CONTROL_PANEL
       
    35     #include <GSTabHelper.h>
       
    36 #endif //RD_CONTROL_PANEL
       
    37 
       
    38 
       
    39 // Constants
       
    40 
       
    41 
       
    42 // ========================= MEMBER FUNCTIONS ================================
       
    43 
       
    44 
       
    45 // ---------------------------------------------------------------------------
       
    46 // CGSTelPlugin::CGSTelPlugin()
       
    47 //
       
    48 //
       
    49 // ---------------------------------------------------------------------------
       
    50 //
       
    51 CGSTelPlugin::CGSTelPlugin()
       
    52     : CGSParentPlugin(), iResourceLoader( *iCoeEnv )
       
    53     {
       
    54     __GSLOGSTRING( "[CGSTelPlugin] CGSTelPlugin()" );
       
    55 
       
    56     }
       
    57 
       
    58 
       
    59 // ---------------------------------------------------------------------------
       
    60 // CGSTelPlugin::~CGSTelPlugin()
       
    61 //
       
    62 //
       
    63 // ---------------------------------------------------------------------------
       
    64 //
       
    65 CGSTelPlugin::~CGSTelPlugin()
       
    66     {
       
    67     __GSLOGSTRING( "[CGSTelPlugin] ~CGSTelPlugin()|->" );
       
    68     iResourceLoader.Close();
       
    69     
       
    70     #ifndef RD_CONTROL_PANEL
       
    71         if ( iTabHelper )
       
    72             {
       
    73             delete iTabHelper;
       
    74             }
       
    75     #endif //RD_CONTROL_PANEL
       
    76     __GSLOGSTRING( "[CGSTelPlugin] ~CGSTelPlugin()-|" );
       
    77     }
       
    78 
       
    79 
       
    80 // ---------------------------------------------------------------------------
       
    81 // CGSTelPlugin::ConstructL()
       
    82 //
       
    83 //
       
    84 // ---------------------------------------------------------------------------
       
    85 //
       
    86 void CGSTelPlugin::ConstructL()
       
    87     {
       
    88     __GSLOGSTRING( "[CGSTelPlugin] ConstructL()|->" );
       
    89     OpenLocalizedResourceFileL( KGSTelPluginResourceFileName,
       
    90                                 iResourceLoader );
       
    91     BaseConstructL( R_GS_TEL_VIEW, R_GS_TEL_VIEW_TITLE );
       
    92     
       
    93     #ifndef RD_CONTROL_PANEL
       
    94         iTabHelper = CGSTabHelper::NewL();
       
    95     #endif //RD_CONTROL_PANEL
       
    96     __GSLOGSTRING( "[CGSTelPlugin] ConstructL()-|" );
       
    97     }
       
    98 
       
    99 
       
   100 // ---------------------------------------------------------------------------
       
   101 // CGSTelPlugin::NewL()
       
   102 //
       
   103 //
       
   104 // ---------------------------------------------------------------------------
       
   105 //
       
   106 CGSTelPlugin* CGSTelPlugin::NewL( TAny* /*aInitParams*/ )
       
   107     {
       
   108     __GSLOGSTRING( "[CGSTelPlugin] NewL()" );
       
   109 
       
   110     CGSTelPlugin* self = new(ELeave) CGSTelPlugin();
       
   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 CGSTelPlugin::Id() const
       
   125     {
       
   126     __GSLOGSTRING1( "[CGSTelPlugin] Id():0x%X", KGSTelPluginUid.iUid );
       
   127     return KGSTelPluginUid;
       
   128     }
       
   129 
       
   130 
       
   131 // ---------------------------------------------------------------------------
       
   132 // CGSParentPlugin::DoActivateL()
       
   133 //
       
   134 //
       
   135 // ---------------------------------------------------------------------------
       
   136 //
       
   137 void CGSTelPlugin::DoActivateL
       
   138     ( const TVwsViewId& aPrevViewId,
       
   139       TUid aCustomMessageId,
       
   140       const TDesC8& aCustomMessage )
       
   141     {
       
   142     __GSLOGSTRING( "[CGSTelPlugin] DoActivateL()|->" );
       
   143     CGSParentPlugin::DoActivateL( aPrevViewId,
       
   144                                   aCustomMessageId,
       
   145                                   aCustomMessage );
       
   146     CGSMainView* parent =
       
   147         static_cast<CGSMainView*> ( AppUi()->View( KGSMainViewUid ) );
       
   148 
       
   149     #ifndef RD_CONTROL_PANEL
       
   150         // Create tab group for this view (do only if casting parent succeeds):
       
   151         if( parent )
       
   152             {
       
   153             iTabHelper->CreateTabGroupL( Id(), parent );
       
   154             }
       
   155     #endif //RD_CONTROL_PANEL
       
   156     __GSLOGSTRING( "[CGSTelPlugin] DoActivateL()-|" );
       
   157     }
       
   158 
       
   159 
       
   160 // ---------------------------------------------------------------------------
       
   161 // CGSParentPlugin::DoDeactivate()
       
   162 //
       
   163 //
       
   164 // ---------------------------------------------------------------------------
       
   165 //
       
   166 void CGSTelPlugin::DoDeactivate()
       
   167     {
       
   168     __GSLOGSTRING( "[CGSTelPlugin] DoDeactivate()|->" );
       
   169     CGSParentPlugin::DoDeactivate();
       
   170     
       
   171     #ifndef RD_CONTROL_PANEL
       
   172         iTabHelper->RemoveTabGroup();
       
   173     #endif //RD_CONTROL_PANEL
       
   174     __GSLOGSTRING( "[CGSTelPlugin] DoDeactivate()-|" );
       
   175     }
       
   176 
       
   177 
       
   178 // ========================= From CGSParentPlugin =====================
       
   179 
       
   180 
       
   181 // ---------------------------------------------------------------------------
       
   182 // CGSTelPlugin::UpperLevelViewUid()
       
   183 //
       
   184 //
       
   185 // ---------------------------------------------------------------------------
       
   186 //
       
   187 TUid CGSTelPlugin::UpperLevelViewUid()
       
   188     {
       
   189     return KGSMainViewUid;
       
   190     }
       
   191 
       
   192 
       
   193 // ========================= From CGSPluginInterface ==================
       
   194 
       
   195 
       
   196 // ---------------------------------------------------------------------------
       
   197 // CGSTelPlugin::GetCaptionL()
       
   198 //
       
   199 //
       
   200 // ---------------------------------------------------------------------------
       
   201 //
       
   202 void CGSTelPlugin::GetCaptionL( TDes& aCaption ) const
       
   203     {
       
   204     __GSLOGSTRING( "[CGSTelPlugin] GetCaptionL()|->" );
       
   205     // The resource file is already opened by iResourceLoader.
       
   206     HBufC* result = StringLoader::LoadL( R_GS_TEL_VIEW_CAPTION );
       
   207     aCaption.Copy( *result );
       
   208     delete result;
       
   209     __GSLOGSTRING( "[CGSTelPlugin] GetCaptionL()-|" );
       
   210     }
       
   211 
       
   212 
       
   213 // ---------------------------------------------------------------------------
       
   214 // CGSTelPlugin::PluginProviderCategory()
       
   215 //
       
   216 //
       
   217 // ---------------------------------------------------------------------------
       
   218 //
       
   219 TInt CGSTelPlugin::PluginProviderCategory() const
       
   220     {
       
   221     return KGSPluginProviderInternal;
       
   222     }
       
   223 
       
   224 
       
   225 // -----------------------------------------------------------------------------
       
   226 // CGSTelPlugin::GetHelpContext()
       
   227 //
       
   228 //
       
   229 // -----------------------------------------------------------------------------
       
   230 //
       
   231 void CGSTelPlugin::GetHelpContext( TCoeHelpContext& aContext )
       
   232     {
       
   233     aContext.iMajor = KUidGS;
       
   234     aContext.iContext = KCP_HLP_TELEPHONY;
       
   235     }
       
   236 
       
   237 
       
   238 // -----------------------------------------------------------------------------
       
   239 // CGSTelPlugin::CreateIconL()
       
   240 //
       
   241 //
       
   242 // -----------------------------------------------------------------------------
       
   243 //
       
   244 CGulIcon* CGSTelPlugin::CreateIconL( const TUid aIconType )
       
   245     {
       
   246     //EMbm<Mbm_file_name><Bitmap_name>
       
   247     CGulIcon* icon;
       
   248 
       
   249     if( aIconType == KGSIconTypeLbxItem )
       
   250         {
       
   251         icon = AknsUtils::CreateGulIconL(
       
   252         AknsUtils::SkinInstance(),
       
   253         KAknsIIDQgnPropCpTele,
       
   254         KGSDefaultTelIconFileName,
       
   255         EMbmGstelpluginQgn_prop_cp_tele,
       
   256         EMbmGstelpluginQgn_prop_cp_tele_mask );
       
   257         }
       
   258        else
       
   259         {
       
   260         icon = CGSPluginInterface::CreateIconL( aIconType );
       
   261         }
       
   262 
       
   263     return icon;
       
   264     }
       
   265 
       
   266 // ----------------------------------------------------------------------------
       
   267 // CGSTelPlugin::DynInitMenuPaneL()
       
   268 // 
       
   269 // Display the dynamic menu
       
   270 // ----------------------------------------------------------------------------
       
   271 void CGSTelPlugin::DynInitMenuPaneL( TInt aResourceId,
       
   272                                      CEikMenuPane* aMenuPane )
       
   273     {
       
   274     FeatureManager::InitializeLibL();
       
   275 	// show or hide the 'help' menu item when supported
       
   276     if( aResourceId == R_GS_MENU_ITEM_HELP )
       
   277         {
       
   278         User::LeaveIfNull( aMenuPane );
       
   279             
       
   280         if ( FeatureManager::FeatureSupported( KFeatureIdHelp ) )
       
   281             {
       
   282             aMenuPane->SetItemDimmed( EAknCmdHelp, EFalse );
       
   283             }
       
   284         else
       
   285             {
       
   286             aMenuPane->SetItemDimmed( EAknCmdHelp, ETrue );
       
   287             }
       
   288         }
       
   289 	
       
   290 	FeatureManager::UnInitializeLib();
       
   291     }
       
   292 // End of File