gssettingsuis/Gs/GSDeviceManagementPlugin/src/GSDeviceManagementPlugin.cpp
branchRCL_3
changeset 24 8ee96d21d9bf
parent 23 8bda91a87a00
child 25 7e0eff37aedb
equal deleted inserted replaced
23:8bda91a87a00 24:8ee96d21d9bf
     1 /*
       
     2 * Copyright (c) 2007 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:  GSDeviceManagementPlugin source code.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // Includes
       
    20 #include "GSDeviceManagementPlugin.h"
       
    21 #include "GsLogger.h"
       
    22 #include <gsfwviewuids.h>
       
    23 #include <gsdevicemanagementplugin.mbg> // Icons
       
    24 #include <gsdevicemanagementpluginrsc.rsg>
       
    25 #include <gsmainview.h>
       
    26 #include <gsprivatepluginproviderids.h>
       
    27 #include <csxhelp/cp.hlp.hrh>
       
    28 
       
    29 
       
    30 #include <aknViewAppUi.h>
       
    31 #include <ConeResLoader.h>
       
    32 #include <StringLoader.h>
       
    33 #include <barsread.h> // For TResourceReader
       
    34 
       
    35 
       
    36 // Constants
       
    37 
       
    38 
       
    39 // ========================= MEMBER FUNCTIONS ================================
       
    40 
       
    41 
       
    42 // ---------------------------------------------------------------------------
       
    43 // CGSDeviceManagementPlugin::CGSDeviceManagementPlugin()
       
    44 //
       
    45 //
       
    46 // ---------------------------------------------------------------------------
       
    47 //
       
    48 CGSDeviceManagementPlugin::CGSDeviceManagementPlugin()
       
    49     : CGSParentPlugin(), iResourceLoader( *iCoeEnv )
       
    50     {
       
    51     __GSLOGSTRING( "[CGSDeviceManagementPlugin] CGSDeviceManagementPlugin()" );
       
    52 
       
    53     }
       
    54 
       
    55 
       
    56 // ---------------------------------------------------------------------------
       
    57 // CGSDeviceManagementPlugin::~CGSDeviceManagementPlugin()
       
    58 //
       
    59 //
       
    60 // ---------------------------------------------------------------------------
       
    61 //
       
    62 CGSDeviceManagementPlugin::~CGSDeviceManagementPlugin()
       
    63     {
       
    64     __GSLOGSTRING( "[CGSDeviceManagementPlugin] ~CGSDeviceManagementPlugin()|->" );
       
    65     iResourceLoader.Close();
       
    66     __GSLOGSTRING( "[CGSDeviceManagementPlugin] ~CGSDeviceManagementPlugin()-|" );
       
    67     }
       
    68 
       
    69 
       
    70 // ---------------------------------------------------------------------------
       
    71 // CGSDeviceManagementPlugin::ConstructL()
       
    72 //
       
    73 //
       
    74 // ---------------------------------------------------------------------------
       
    75 //
       
    76 void CGSDeviceManagementPlugin::ConstructL()
       
    77     {
       
    78     __GSLOGSTRING( "[CGSDeviceManagementPlugin] ConstructL()|->" );
       
    79     OpenLocalizedResourceFileL( KGSDeviceManagementPluginResourceFileName,
       
    80                                 iResourceLoader );
       
    81     BaseConstructL( R_GS_DEVICEMANAGEMENT_VIEW, R_GS_DEVICEMANAGEMENT_VIEW_TITLE );
       
    82     __GSLOGSTRING( "[CGSDeviceManagementPlugin] ConstructL()-|" );
       
    83     }
       
    84 
       
    85 
       
    86 // ---------------------------------------------------------------------------
       
    87 // CGSDeviceManagementPlugin::NewL()
       
    88 //
       
    89 //
       
    90 // ---------------------------------------------------------------------------
       
    91 //
       
    92 CGSDeviceManagementPlugin* CGSDeviceManagementPlugin::NewL( TAny* /*aInitParams*/ )
       
    93     {
       
    94     __GSLOGSTRING( "[CGSDeviceManagementPlugin] NewL()" );
       
    95 
       
    96     CGSDeviceManagementPlugin* self = new(ELeave) CGSDeviceManagementPlugin();
       
    97     CleanupStack::PushL(self);
       
    98     self->ConstructL();
       
    99     CleanupStack::Pop(self);
       
   100     return self;
       
   101     }
       
   102 
       
   103 
       
   104 // ---------------------------------------------------------------------------
       
   105 // CGSParentPlugin::Id()
       
   106 //
       
   107 //
       
   108 // ---------------------------------------------------------------------------
       
   109 //
       
   110 TUid CGSDeviceManagementPlugin::Id() const
       
   111     {
       
   112     __GSLOGSTRING1( "[CGSDeviceManagementPlugin] Id():0x%X", KGSDeviceManagementPluginUid.iUid );
       
   113     return KGSDeviceManagementPluginUid;
       
   114     }
       
   115 
       
   116 
       
   117 // ---------------------------------------------------------------------------
       
   118 // CGSParentPlugin::DoActivateL()
       
   119 //
       
   120 //
       
   121 // ---------------------------------------------------------------------------
       
   122 //
       
   123 void CGSDeviceManagementPlugin::DoActivateL
       
   124     ( const TVwsViewId& aPrevViewId,
       
   125       TUid aCustomMessageId,
       
   126       const TDesC8& aCustomMessage )
       
   127     {
       
   128     __GSLOGSTRING( "[CGSDeviceManagementPlugin] DoActivateL()|->" );
       
   129     CGSParentPlugin::DoActivateL( aPrevViewId,
       
   130                                   aCustomMessageId,
       
   131                                   aCustomMessage );
       
   132     CGSMainView* parent =
       
   133         static_cast<CGSMainView*> ( AppUi()->View( KGSMainViewUid ) );
       
   134 
       
   135     // Create tab group for this view (do only if casting parent succeeds):
       
   136     __GSLOGSTRING( "[CGSDeviceManagementPlugin] DoActivateL()-|" );
       
   137     }
       
   138 
       
   139 
       
   140 // ---------------------------------------------------------------------------
       
   141 // CGSParentPlugin::DoDeactivate()
       
   142 //
       
   143 //
       
   144 // ---------------------------------------------------------------------------
       
   145 //
       
   146 void CGSDeviceManagementPlugin::DoDeactivate()
       
   147     {
       
   148     __GSLOGSTRING( "[CGSDeviceManagementPlugin] DoDeactivate()|->" );
       
   149     CGSParentPlugin::DoDeactivate();
       
   150     __GSLOGSTRING( "[CGSDeviceManagementPlugin] DoDeactivate()-|" );
       
   151     }
       
   152 
       
   153 
       
   154 // ========================= From CGSParentPlugin =====================
       
   155 
       
   156 
       
   157 // ---------------------------------------------------------------------------
       
   158 // CGSDeviceManagementPlugin::UpperLevelViewUid()
       
   159 //
       
   160 //
       
   161 // ---------------------------------------------------------------------------
       
   162 //
       
   163 TUid CGSDeviceManagementPlugin::UpperLevelViewUid()
       
   164     {
       
   165     return KGSGenPluginUid;
       
   166     }
       
   167 
       
   168 
       
   169 // ========================= From CGSPluginInterface ==================
       
   170 
       
   171 
       
   172 // ---------------------------------------------------------------------------
       
   173 // CGSDeviceManagementPlugin::GetCaptionL()
       
   174 //
       
   175 //
       
   176 // ---------------------------------------------------------------------------
       
   177 //
       
   178 void CGSDeviceManagementPlugin::GetCaptionL( TDes& aCaption ) const
       
   179     {
       
   180     __GSLOGSTRING( "[CGSDeviceManagementPlugin] GetCaptionL()|->" );
       
   181     // The resource file is already opened by iResourceLoader.
       
   182     HBufC* result = StringLoader::LoadL( R_GS_DEVICEMANAGEMENT_VIEW_CAPTION );
       
   183     aCaption.Copy( *result );
       
   184     delete result;
       
   185     __GSLOGSTRING( "[CGSDeviceManagementPlugin] GetCaptionL()-|" );
       
   186     }
       
   187 
       
   188 
       
   189 // ---------------------------------------------------------------------------
       
   190 // CGSDeviceManagementPlugin::PluginProviderCategory()
       
   191 //
       
   192 //
       
   193 // ---------------------------------------------------------------------------
       
   194 //
       
   195 TInt CGSDeviceManagementPlugin::PluginProviderCategory() const
       
   196     {
       
   197     return KGSPluginProviderInternal;
       
   198     }
       
   199 
       
   200 
       
   201 // -----------------------------------------------------------------------------
       
   202 // CGSDeviceManagementPlugin::GetHelpContext()
       
   203 //
       
   204 //
       
   205 // -----------------------------------------------------------------------------
       
   206 //
       
   207 void CGSDeviceManagementPlugin::GetHelpContext( TCoeHelpContext& aContext )
       
   208     {
       
   209     aContext.iMajor = KUidGS;
       
   210     aContext.iContext = KCP_HLP_DEVICE_MANAGEMENT;
       
   211     }
       
   212 
       
   213 
       
   214 // -----------------------------------------------------------------------------
       
   215 // CGSDeviceManagementPlugin::CreateIconL()
       
   216 //
       
   217 //
       
   218 // -----------------------------------------------------------------------------
       
   219 //
       
   220 CGulIcon* CGSDeviceManagementPlugin::CreateIconL( const TUid aIconType )
       
   221     {
       
   222     //EMbm<Mbm_file_name><Bitmap_name>
       
   223     CGulIcon* icon;
       
   224     TParse* fp = new( ELeave ) TParse();
       
   225     CleanupStack::PushL( fp );
       
   226     fp->Set( KGSDeviceManagementPluginIconDirAndName, &KDC_BITMAP_DIR, NULL );
       
   227 
       
   228     if( aIconType == KGSIconTypeLbxItem )
       
   229         {
       
   230         icon = AknsUtils::CreateGulIconL(
       
   231         AknsUtils::SkinInstance(),
       
   232         KAknsIIDQgnPropCpDevMan,
       
   233         fp->FullName(),
       
   234         EMbmGsdevicemanagementpluginQgn_prop_cp_dev_man,
       
   235         EMbmGsdevicemanagementpluginQgn_prop_cp_dev_man_mask );
       
   236         }
       
   237        else
       
   238         {
       
   239         icon = CGSPluginInterface::CreateIconL( aIconType );
       
   240         }
       
   241 
       
   242     CleanupStack::PopAndDestroy( fp );
       
   243 
       
   244     return icon;
       
   245     }
       
   246 
       
   247 // End of File