gssettingsuis/Gs/GSConPlugin/src/GSConPlugin.cpp
changeset 0 8c5d936e5675
child 17 3b47783fdf16
equal deleted inserted replaced
-1:000000000000 0:8c5d936e5675
       
     1 /*
       
     2 * Copyright (c) 2005-2008 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:  GSConPlugin implementation.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // Includes
       
    20 #include "GSConPlugin.h"
       
    21 #include "GsLogger.h"
       
    22 
       
    23 #include <gsconplugin.mbg> // Icons
       
    24 #include <GSConPluginRsc.rsg>
       
    25 #include <gsfwviewuids.h>
       
    26 #include <gsmainview.h>
       
    27 #include <gsplugininterface.h>
       
    28 #include <gsprivatepluginproviderids.h>
       
    29 #include <data_caging_path_literals.hrh>
       
    30 #include <aknViewAppUi.h>
       
    31 #include <barsread.h> // For TResourceReader
       
    32 #include <ConeResLoader.h>
       
    33 #include <StringLoader.h>
       
    34 #include <csxhelp/cp.hlp.hrh>
       
    35 #include <featmgr.h>
       
    36 #include <eikbtgpc.h>
       
    37 
       
    38 #ifndef RD_CONTROL_PANEL
       
    39     #include <GSTabHelper.h>
       
    40 #endif //RD_CONTROL_PANEL
       
    41 
       
    42 // Constants
       
    43 
       
    44 // ========================= MEMBER FUNCTIONS ================================
       
    45 
       
    46 
       
    47 // ---------------------------------------------------------------------------
       
    48 // CGSConPlugin::CGSConPlugin()
       
    49 //
       
    50 //
       
    51 // ---------------------------------------------------------------------------
       
    52 //
       
    53 CGSConPlugin::CGSConPlugin()
       
    54     : CGSParentPlugin(), iResources( *iCoeEnv )
       
    55     {
       
    56     __GSLOGSTRING( "[CGSConPlugin] CGSConPlugin()" );
       
    57 
       
    58     }
       
    59 
       
    60 
       
    61 // ---------------------------------------------------------------------------
       
    62 // CGSConPlugin::~CGSConPlugin()
       
    63 //
       
    64 //
       
    65 // ---------------------------------------------------------------------------
       
    66 //
       
    67 CGSConPlugin::~CGSConPlugin()
       
    68     {
       
    69     FeatureManager::UnInitializeLib();
       
    70     iResources.Close();
       
    71 
       
    72     #ifndef RD_CONTROL_PANEL
       
    73         delete iTabHelper;
       
    74     #endif //RD_CONTROL_PANEL
       
    75     __GSLOGSTRING( "[CGSConPlugin] ~CGSConPlugin()" );
       
    76     }
       
    77 
       
    78 
       
    79 // ---------------------------------------------------------------------------
       
    80 // CGSConPlugin::ConstructL()
       
    81 //
       
    82 //
       
    83 // ---------------------------------------------------------------------------
       
    84 //
       
    85 void CGSConPlugin::ConstructL()
       
    86     {
       
    87     __GSLOGSTRING( "[CGSConPlugin] ConstructL()" );
       
    88     FeatureManager::InitializeLibL();
       
    89     OpenLocalizedResourceFileL( KGSConPluginResourceFileName, iResources );
       
    90     BaseConstructL( R_GS_CON_VIEW, R_GS_CON_VIEW_TITLE );
       
    91 
       
    92     #ifndef RD_CONTROL_PANEL
       
    93         iTabHelper = CGSTabHelper::NewL();
       
    94     #endif //RD_CONTROL_PANEL
       
    95     }
       
    96 
       
    97 
       
    98 // ---------------------------------------------------------------------------
       
    99 // CGSConPlugin::NewL()
       
   100 //
       
   101 //
       
   102 // ---------------------------------------------------------------------------
       
   103 //
       
   104 CGSConPlugin* CGSConPlugin::NewL( TAny* /*aInitParams*/ )
       
   105     {
       
   106     __GSLOGSTRING( "[CGSConPlugin] NewL()" );
       
   107 
       
   108     CGSConPlugin* self = new(ELeave) CGSConPlugin();
       
   109     CleanupStack::PushL( self );
       
   110     self->ConstructL();
       
   111     CleanupStack::Pop( self );
       
   112     return self;
       
   113     }
       
   114 
       
   115 
       
   116 // ---------------------------------------------------------------------------
       
   117 // CGSConPlugin::Id()
       
   118 //
       
   119 //
       
   120 // ---------------------------------------------------------------------------
       
   121 //
       
   122 TUid CGSConPlugin::Id() const
       
   123     {
       
   124     __GSLOGSTRING1( "[CGSConPlugin] Id():0x%X", KGSConPluginUid.iUid );
       
   125     return KGSConPluginUid;
       
   126     }
       
   127 
       
   128 
       
   129 // ---------------------------------------------------------------------------
       
   130 // CGSConPlugin::DoActivateL()
       
   131 //
       
   132 //
       
   133 // ---------------------------------------------------------------------------
       
   134 //
       
   135 void CGSConPlugin::DoActivateL( const TVwsViewId& aPrevViewId,
       
   136                                 TUid aCustomMessageId,
       
   137                                 const TDesC8& aCustomMessage )
       
   138     {
       
   139     CGSParentPlugin::DoActivateL( aPrevViewId,
       
   140                                   aCustomMessageId,
       
   141                                   aCustomMessage );
       
   142     CGSMainView* parent =
       
   143         static_cast<CGSMainView*> ( AppUi()->View( KGSMainViewUid ) );
       
   144 
       
   145     #ifndef RD_CONTROL_PANEL
       
   146         // Create tab group for this view (do only if casting parent succeeds):
       
   147         if( parent )
       
   148             {
       
   149             iTabHelper->CreateTabGroupL( Id(), parent );
       
   150             }
       
   151     #endif //RD_CONTROL_PANEL
       
   152     
       
   153 		// If AppUid is different or placeholderview is used, this view has been launched from outside GS
       
   154 		if ( iPrevViewId.iAppUid != KUidGS || iPrevViewId.iViewUid == TUid::Uid(0x0DEADBED ) )
       
   155 			{
       
   156 			CEikButtonGroupContainer* cbaGroup = Cba();
       
   157 			if(cbaGroup)
       
   158 				{
       
   159 				HBufC* rightSKText = StringLoader::LoadLC (R_GS_CBA_EXIT);
       
   160 				TPtr rskPtr = rightSKText->Des();
       
   161 				cbaGroup->SetCommandL(2,EAknSoftkeyExit,*rightSKText);
       
   162 				CleanupStack::PopAndDestroy(rightSKText);
       
   163 				}
       
   164 		}
       
   165     
       
   166     }
       
   167 
       
   168 
       
   169 // ---------------------------------------------------------------------------
       
   170 // CGSParentPlugin::DoDeactivate()
       
   171 //
       
   172 //
       
   173 // ---------------------------------------------------------------------------
       
   174 void CGSConPlugin::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 // CGSConPlugin::UpperLevelViewUid()
       
   189 //
       
   190 //
       
   191 // ---------------------------------------------------------------------------
       
   192 //
       
   193 TUid CGSConPlugin::UpperLevelViewUid()
       
   194     {
       
   195     return KGSMainViewUid;
       
   196     }
       
   197 
       
   198 
       
   199 // ========================= From CGSPluginInterface ==================
       
   200 
       
   201 
       
   202 // ---------------------------------------------------------------------------
       
   203 // CGSConPlugin::GetCaptionL()
       
   204 //
       
   205 //
       
   206 // ---------------------------------------------------------------------------
       
   207 //
       
   208 void CGSConPlugin::GetCaptionL( TDes& aCaption ) const
       
   209     {
       
   210     // The resource file is already opened.
       
   211     HBufC* result = StringLoader::LoadL( R_GS_CON_VIEW_CAPTION );
       
   212     aCaption.Copy( *result );
       
   213     delete result;
       
   214     }
       
   215 
       
   216 
       
   217 // ---------------------------------------------------------------------------
       
   218 // CGSConPlugin::PluginProviderCategory()
       
   219 //
       
   220 //
       
   221 // ---------------------------------------------------------------------------
       
   222 //
       
   223 TInt CGSConPlugin::PluginProviderCategory() const
       
   224     {
       
   225     return KGSPluginProviderInternal;
       
   226     }
       
   227 
       
   228 
       
   229 // -----------------------------------------------------------------------------
       
   230 // CGSConPlugin::GetHelpContext()
       
   231 //
       
   232 //
       
   233 // -----------------------------------------------------------------------------
       
   234 //
       
   235 void CGSConPlugin::GetHelpContext( TCoeHelpContext& aContext )
       
   236     {
       
   237     aContext.iMajor = KUidGS;
       
   238     aContext.iContext = KCP_HLP_CONNECTIVITY;
       
   239     }
       
   240 
       
   241 
       
   242 // ---------------------------------------------------------------------------
       
   243 // CGSConPlugin::CreateIconL
       
   244 //
       
   245 //
       
   246 // ---------------------------------------------------------------------------
       
   247 //
       
   248 CGulIcon* CGSConPlugin::CreateIconL( const TUid aIconType )
       
   249     {
       
   250     //EMbm<Mbm_file_name><Bitmap_name>
       
   251     CGulIcon* icon;
       
   252     TParse* fp = new( ELeave ) TParse();
       
   253     CleanupStack::PushL( fp );
       
   254     fp->Set( KGSConPluginIconDirAndName, &KDC_BITMAP_DIR, NULL );
       
   255 
       
   256     if( aIconType == KGSIconTypeLbxItem )
       
   257         {
       
   258         icon = AknsUtils::CreateGulIconL(
       
   259         AknsUtils::SkinInstance(),
       
   260         KAknsIIDQgnPropCpConn,
       
   261         fp->FullName(),
       
   262         EMbmGsconpluginQgn_prop_cp_conn,
       
   263         EMbmGsconpluginQgn_prop_cp_conn_mask );
       
   264         }
       
   265     else
       
   266         {
       
   267         icon = CGSPluginInterface::CreateIconL( aIconType );
       
   268         }
       
   269 
       
   270     CleanupStack::PopAndDestroy( fp );
       
   271 
       
   272     return icon;
       
   273     }
       
   274 
       
   275 // ---------------------------------------------------------------------------
       
   276 // CGSConPlugin::ListBoxType()
       
   277 //
       
   278 // ---------------------------------------------------------------------------
       
   279 //
       
   280 TGSListboxTypes CGSConPlugin::ListBoxType()
       
   281     {
       
   282     return EGSListBoxTypeDoubleLarge;
       
   283     }
       
   284 
       
   285 
       
   286 // End of file