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