gssettingsuis/Gs/GSSecurityPlugin/Src/GSSecurityPlugin.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:  Source file for CGSSecurityPlugin class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // Includes
       
    20 #include "GSSecurityPlugin.h"
       
    21 #include "GsLogger.h"
       
    22 
       
    23 #include <aknViewAppUi.h>
       
    24 #include <ConeResLoader.h>
       
    25 #include <barsread.h>       // For TResourceReader
       
    26 #include <StringLoader.h>
       
    27 
       
    28 // Includes from GS framework:
       
    29 #include <gsfwviewuids.h>
       
    30 #include <gsprivatepluginproviderids.h>
       
    31 
       
    32 // Plugin includes:
       
    33 #include <gssecuritypluginrsc.rsg>
       
    34 #include <gssecplugin.mbg>
       
    35 #include <csxhelp/cp.hlp.hrh>
       
    36 #include <featmgr.h>
       
    37 
       
    38 
       
    39 // CONSTANTS
       
    40 _LIT( KGSSecurityPluginResourceFileName, "z:GSSecurityPluginRsc.rsc" );
       
    41 
       
    42 #ifdef __SCALABLE_ICONS
       
    43   // svg file
       
    44   _LIT( KGSSecPluginIconFileName, "\\resource\\apps\\GSSecPlugin.mif");
       
    45 #else
       
    46   // bitmap
       
    47   _LIT( KGSSecPluginIconFileName, "\\resource\\apps\\GSSecPlugin.mbm");
       
    48 #endif // __SCALABLE_ICONS
       
    49 
       
    50 // ========================= MEMBER FUNCTIONS ================================
       
    51 
       
    52 
       
    53 // ---------------------------------------------------------------------------
       
    54 // CGSSecurityPlugin::CGSSecurityPlugin()
       
    55 //
       
    56 //
       
    57 // ---------------------------------------------------------------------------
       
    58 //
       
    59 CGSSecurityPlugin::CGSSecurityPlugin()
       
    60     : CGSParentPlugin(), iResourceLoader( *iCoeEnv )
       
    61     {
       
    62     }
       
    63 
       
    64 
       
    65 // ---------------------------------------------------------------------------
       
    66 // CGSSecurityPlugin::~CGSSecurityPlugin()
       
    67 //
       
    68 //
       
    69 // ---------------------------------------------------------------------------
       
    70 //
       
    71 CGSSecurityPlugin::~CGSSecurityPlugin()
       
    72     {
       
    73     iResourceLoader.Close();
       
    74     }
       
    75 
       
    76 
       
    77 // ---------------------------------------------------------------------------
       
    78 // CGSSecurityPlugin::ConstructL()
       
    79 //
       
    80 //
       
    81 // ---------------------------------------------------------------------------
       
    82 //
       
    83 void CGSSecurityPlugin::ConstructL()
       
    84     {
       
    85     __GSLOGSTRING( "[CGSSecurityPlugin] ConstructL()|->" );
       
    86     OpenLocalizedResourceFileL( KGSSecurityPluginResourceFileName,
       
    87                                 iResourceLoader );
       
    88     BaseConstructL( R_GS_SECURITY_VIEW, R_GS_SECURITY_VIEW_TITLE );
       
    89     __GSLOGSTRING( "[CGSSecurityPlugin] ConstructL()-|" );
       
    90     }
       
    91 
       
    92 
       
    93 // ---------------------------------------------------------------------------
       
    94 // CGSSecurityPlugin::NewL()
       
    95 //
       
    96 //
       
    97 // ---------------------------------------------------------------------------
       
    98 //
       
    99 CGSSecurityPlugin* CGSSecurityPlugin::NewL( TAny* /*aInitParams*/ )
       
   100   {
       
   101   CGSSecurityPlugin* self = new( ELeave ) CGSSecurityPlugin();
       
   102   CleanupStack::PushL( self );
       
   103   self->ConstructL();
       
   104   CleanupStack::Pop( self );
       
   105   return self;
       
   106   }
       
   107 
       
   108 
       
   109 // ---------------------------------------------------------------------------
       
   110 // CGSParentPlugin::Id()
       
   111 //
       
   112 //
       
   113 // ---------------------------------------------------------------------------
       
   114 //
       
   115 TUid CGSSecurityPlugin::Id() const
       
   116     {
       
   117     return KGSSecurityPluginUid;
       
   118     }
       
   119 
       
   120 
       
   121 // ---------------------------------------------------------------------------
       
   122 // CGSParentPlugin::DoActivateL()
       
   123 //
       
   124 //
       
   125 // ---------------------------------------------------------------------------
       
   126 //
       
   127 void CGSSecurityPlugin::DoActivateL( const TVwsViewId& aPrevViewId,
       
   128                                      TUid aCustomMessageId,
       
   129                                      const TDesC8& aCustomMessage )
       
   130     {
       
   131     CGSParentPlugin::DoActivateL( aPrevViewId, aCustomMessageId,
       
   132                                   aCustomMessage );
       
   133     }
       
   134 
       
   135 
       
   136 // ---------------------------------------------------------------------------
       
   137 // CGSParentPlugin::DoDeactivate()
       
   138 //
       
   139 //
       
   140 // ---------------------------------------------------------------------------
       
   141 //
       
   142 void CGSSecurityPlugin::DoDeactivate()
       
   143     {
       
   144     CGSParentPlugin::DoDeactivate();
       
   145     }
       
   146 
       
   147 
       
   148 // ========================= From CGSParentPlugin =====================
       
   149 
       
   150 
       
   151 // ---------------------------------------------------------------------------
       
   152 // CGSSecurityPlugin::UpperLevelViewUid()
       
   153 //
       
   154 //
       
   155 // ---------------------------------------------------------------------------
       
   156 //
       
   157 TUid CGSSecurityPlugin::UpperLevelViewUid()
       
   158     {
       
   159     #ifdef RD_CONTROL_PANEL
       
   160         return KGSDeviceManagementPluginUid;
       
   161     #else //RD_CONTROL_PANEL
       
   162         return KGSGenPluginUid;
       
   163     #endif //RD_CONTROL_PANEL
       
   164     }
       
   165 
       
   166 
       
   167 // -----------------------------------------------------------------------------
       
   168 // CGSSecurityPlugin::GetHelpContext()
       
   169 //
       
   170 //
       
   171 // -----------------------------------------------------------------------------
       
   172 //
       
   173 void CGSSecurityPlugin::GetHelpContext( TCoeHelpContext& aContext )
       
   174     {
       
   175     aContext.iMajor = KUidGS;
       
   176     aContext.iContext = KCP_HLP_SECURITY;
       
   177     }
       
   178 
       
   179 
       
   180 // ========================= From CGSPluginInterface ==================
       
   181 
       
   182 
       
   183 // ---------------------------------------------------------------------------
       
   184 // CGSSecurityPlugin::GetCaptionL()
       
   185 //
       
   186 //
       
   187 // ---------------------------------------------------------------------------
       
   188 //
       
   189 void CGSSecurityPlugin::GetCaptionL( TDes& aCaption ) const
       
   190     {
       
   191     __GSLOGSTRING( "[CGSSecurityPlugin] GetCaptionL()|->" );
       
   192     // The resource file is already opened by iResourceLoader.
       
   193     HBufC* result = StringLoader::LoadL( R_GS_SECURITY_VIEW_CAPTION );
       
   194     aCaption.Copy( *result );
       
   195     delete result;
       
   196     __GSLOGSTRING( "[CGSSecurityPlugin] GetCaptionL()-|" );
       
   197     }
       
   198 
       
   199 
       
   200 // ---------------------------------------------------------------------------
       
   201 // CGSSecurityPlugin::PluginProviderCategory()
       
   202 //
       
   203 //
       
   204 // ---------------------------------------------------------------------------
       
   205 //
       
   206 TInt CGSSecurityPlugin::PluginProviderCategory() const
       
   207     {
       
   208     return KGSPluginProviderInternal;
       
   209     }
       
   210 
       
   211 // ---------------------------------------------------------------------------
       
   212 // CGSSecurityPlugin::CreateIconL
       
   213 //
       
   214 // Return the icon, if has one.
       
   215 // ---------------------------------------------------------------------------
       
   216 //
       
   217 CGulIcon* CGSSecurityPlugin::CreateIconL( const TUid aIconType )
       
   218     {
       
   219     __GSLOGSTRING( "[CGSSecurityPlugin] CreateIconL()|->" );
       
   220     //EMbm<Mbm_file_name><Bitmap_name>
       
   221     CGulIcon* icon;
       
   222 
       
   223     if( aIconType == KGSIconTypeLbxItem )
       
   224         {
       
   225         icon = AknsUtils::CreateGulIconL(
       
   226         AknsUtils::SkinInstance(),
       
   227         KAknsIIDQgnPropSetSecSub,
       
   228         KGSSecPluginIconFileName,
       
   229         EMbmGssecpluginQgn_prop_set_sec_sub,
       
   230         EMbmGssecpluginQgn_prop_set_sec_sub_mask );
       
   231         }
       
   232      else
       
   233         {
       
   234         icon = CGSPluginInterface::CreateIconL( aIconType );
       
   235         }
       
   236 
       
   237     __GSLOGSTRING( "[CGSSecurityPlugin] CreateIconL()-|" );
       
   238     return icon;
       
   239     }
       
   240 
       
   241 
       
   242 // -----------------------------------------------------------------------------
       
   243 // CGSSecurityPlugin::ListBoxType()
       
   244 //
       
   245 //
       
   246 // -----------------------------------------------------------------------------
       
   247 //
       
   248 TGSListboxTypes CGSSecurityPlugin::ListBoxType()
       
   249     {
       
   250     return EGSListBoxTypeSettings;
       
   251     }
       
   252 
       
   253 
       
   254 // ----------------------------------------------------------------------------
       
   255 // CGSSecurityPlugin::DynInitMenuPaneL()
       
   256 // 
       
   257 // Display the dynamic menu
       
   258 // ----------------------------------------------------------------------------
       
   259 void CGSSecurityPlugin::DynInitMenuPaneL( TInt aResourceId,
       
   260                                           CEikMenuPane* aMenuPane )
       
   261     {
       
   262     FeatureManager::InitializeLibL();
       
   263 	// show or hide the 'help' menu item when supported
       
   264     if( aResourceId == R_GS_MENU_ITEM_HELP )
       
   265         {
       
   266         User::LeaveIfNull( aMenuPane );
       
   267             
       
   268         if ( FeatureManager::FeatureSupported( KFeatureIdHelp ) )
       
   269             {
       
   270             aMenuPane->SetItemDimmed( EAknCmdHelp, EFalse );
       
   271             }
       
   272         else
       
   273             {
       
   274             aMenuPane->SetItemDimmed( EAknCmdHelp, ETrue );
       
   275             }
       
   276         }
       
   277 	FeatureManager::UnInitializeLib();
       
   278     }
       
   279 
       
   280 
       
   281 // End of File