coreapplicationuis/Rfs/Plugins/GSRFSPlugin/src/GSRFSPlugin.cpp
branchRCL_3
changeset 63 c2c61fdca848
parent 0 2e3d3ce01487
equal deleted inserted replaced
62:924385140d98 63:c2c61fdca848
       
     1 /*
       
     2 * Copyright (c) 2005-2009 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: 
       
    15 *        GS RFS Plugin
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 // SYSTEM INCLUDES
       
    21 #include <aknViewAppUi.h>
       
    22 #include <bautils.h>
       
    23 #include <rfsHandler.h>
       
    24 #include <gsprivatepluginproviderids.h>
       
    25 #include <StringLoader.h>
       
    26 #include <GSRFSPluginRsc.rsg>
       
    27 #include <GSRFSPlugin.mbg>
       
    28 
       
    29 #include <hlplch.h>             
       
    30 #include <gscommon.hrh>
       
    31 #include <gsfwviewuids.h>
       
    32 #include "GSRFSPlugin.h"
       
    33 #include "GSRFSPluginTraces.h"
       
    34 #include "GSRFSPluginContainer.h"
       
    35 #include "gsrfsplugin.hrh"
       
    36 
       
    37 // Constants
       
    38 _LIT( KGSRFSPluginResourceFileName, "z:GSRFSPluginRsc.rsc" );
       
    39 
       
    40 
       
    41 // ---------------------------------------------------------------------------
       
    42 // CGSRFSPlugin::CGSRFSPlugin()
       
    43 // Constructor
       
    44 // ---------------------------------------------------------------------------
       
    45 CGSRFSPlugin::CGSRFSPlugin()
       
    46     :iResourceLoader( *iCoeEnv )
       
    47     {
       
    48     TRACES("CGSRFSPlugin::CGSRFSPlugin()");
       
    49     }
       
    50 
       
    51 // ---------------------------------------------------------------------------
       
    52 // CGSRFSPlugin::~CGSRFSPlugin()
       
    53 // Destructor
       
    54 // ---------------------------------------------------------------------------
       
    55 CGSRFSPlugin::~CGSRFSPlugin()
       
    56     {
       
    57     TRACES("CGSRFSPlugin::~CGSRFSPlugin()");
       
    58 	  iResourceLoader.Close();
       
    59     TRACES("CGSRFSPlugin::~CGSRFSPlugin(): End");
       
    60     }
       
    61 
       
    62 // ---------------------------------------------------------------------------
       
    63 // CGSRFSPlugin::ConstructL(const TRect& aRect)
       
    64 // Symbian OS two-phased constructor
       
    65 // ---------------------------------------------------------------------------
       
    66 void CGSRFSPlugin::ConstructL()
       
    67     {
       
    68     TRACES("CGSRFSPlugin::ConstructL()");
       
    69     
       
    70     // Find the resource file
       
    71     TParse parse;
       
    72     parse.Set( KGSRFSPluginResourceFileName, &KDC_RESOURCE_FILES_DIR, NULL );
       
    73     TFileName fileName( parse.FullName() );
       
    74     
       
    75     // Get language of resource file
       
    76     BaflUtils::NearestLanguageFile( iCoeEnv->FsSession(), fileName );
       
    77 
       
    78     // Open resource file
       
    79     iResourceLoader.OpenL( fileName );
       
    80 
       
    81     BaseConstructL( R_RFS_FACTORY_SETTINGS_VIEW );
       
    82 
       
    83     TRACES("CGSRFSPlugin::ConstructL(): End");
       
    84     }
       
    85 
       
    86 // ---------------------------------------------------------------------------
       
    87 // CGSRFSPlugin::NewL()
       
    88 // Static constructor
       
    89 // ---------------------------------------------------------------------------
       
    90 CGSRFSPlugin* CGSRFSPlugin::NewL( TAny* /*aInitParams*/ )
       
    91     {
       
    92     TRACES("CGSRFSPlugin::NewL()");
       
    93     CGSRFSPlugin* self = new( ELeave ) CGSRFSPlugin();
       
    94     CleanupStack::PushL( self );
       
    95     self->ConstructL();
       
    96     CleanupStack::Pop( self );
       
    97     TRACES("CGSRFSPlugin::NewL(): End");
       
    98     return self;
       
    99     }
       
   100 
       
   101 // ---------------------------------------------------------------------------
       
   102 // CGSRFSPlugin::Id()
       
   103 // ---------------------------------------------------------------------------
       
   104 TUid CGSRFSPlugin::Id() const
       
   105     {
       
   106     return KGSRFSPluginUid;
       
   107     }
       
   108 
       
   109 // ---------------------------------------------------------------------------
       
   110 // CGSRFSPlugin::DoActivateL()
       
   111 // ---------------------------------------------------------------------------
       
   112 void CGSRFSPlugin::DoActivateL( const TVwsViewId& aPrevViewId, TUid aCustomMessageId, const TDesC8& aCustomMessage )
       
   113     {
       
   114     TRACES("CGSRFSPlugin::DoActivateL()");
       
   115     CGSBaseView::DoActivateL( aPrevViewId, aCustomMessageId, aCustomMessage );
       
   116     }
       
   117     
       
   118 // ---------------------------------------------------------------------------
       
   119 // CGSRFSPlugin::DoDeactivate()
       
   120 // ---------------------------------------------------------------------------
       
   121 void CGSRFSPlugin::DoDeactivate()
       
   122     {
       
   123     TRACES("CGSRFSPlugin::DoDeactivate()");
       
   124     CGSBaseView::DoDeactivate();
       
   125     }
       
   126 
       
   127 // ---------------------------------------------------------------------------
       
   128 // CGSRFSPlugin::HandleCommandL()
       
   129 // ---------------------------------------------------------------------------
       
   130 void CGSRFSPlugin::HandleCommandL( TInt aCommand )
       
   131     {
       
   132     TRACES("CGSRFSPlugin::HandleCommandL()");
       
   133     switch ( aCommand )
       
   134         {
       
   135         case EAknSoftkeyBack:
       
   136             {
       
   137             iAppUi->ActivateLocalViewL( KGSDeviceManagementPluginUid  );
       
   138             break;
       
   139             }
       
   140         case EAknCmdHelp:
       
   141             {
       
   142             HlpLauncher::LaunchHelpApplicationL(iEikonEnv->WsSession(), iAppUi->AppHelpContextL() );
       
   143             break;
       
   144             }
       
   145         default:
       
   146             {
       
   147             iAppUi->HandleCommandL( aCommand );
       
   148             break;
       
   149             }
       
   150         }
       
   151     }
       
   152 
       
   153 // ---------------------------------------------------------------------------
       
   154 // CGSRFSPlugin::GetCaptionL()
       
   155 // ---------------------------------------------------------------------------
       
   156 void CGSRFSPlugin::GetCaptionL( TDes& aCaption ) const
       
   157     {
       
   158     // the resource file is already opened
       
   159     HBufC* result = StringLoader::LoadL( R_RFS_FACTORY_SETTINGS );    
       
   160     aCaption.Copy( *result );
       
   161     delete result;
       
   162     }
       
   163 
       
   164 // ---------------------------------------------------------------------------
       
   165 // CGSRFSPlugin::PluginProviderCategory()
       
   166 // ---------------------------------------------------------------------------
       
   167 TInt CGSRFSPlugin::PluginProviderCategory() const
       
   168     {
       
   169     return KGSPluginProviderInternal;
       
   170     }
       
   171 
       
   172 // -----------------------------------------------------------------------------
       
   173 // CGSNetworkPlugin::CreateIconL()
       
   174 // -----------------------------------------------------------------------------
       
   175 CGulIcon* CGSRFSPlugin::CreateIconL( const TUid aIconType )
       
   176     {
       
   177     CGulIcon* icon;
       
   178     TParse* fp = new( ELeave ) TParse();
       
   179     CleanupStack::PushL( fp );
       
   180     _LIT( KGSRFSPluginIconDirAndName, "z:gsrfsplugin.mbm");
       
   181     fp->Set( KGSRFSPluginIconDirAndName, &KDC_BITMAP_DIR, NULL );
       
   182 
       
   183     if( aIconType == KGSIconTypeLbxItem )
       
   184         {
       
   185         icon = AknsUtils::CreateGulIconL( AknsUtils::SkinInstance(), KAknsIIDQgnPropSetGenePhone,
       
   186                                           fp->FullName(),EMbmGsrfspluginQgn_prop_set_gene_phone,
       
   187                                           EMbmGsrfspluginQgn_prop_set_gene_phone_mask );
       
   188         }
       
   189     else
       
   190         {
       
   191         icon = CGSPluginInterface::CreateIconL( aIconType );
       
   192         }
       
   193 
       
   194     CleanupStack::PopAndDestroy( fp );
       
   195 
       
   196     return icon;
       
   197     }
       
   198 
       
   199 // -----------------------------------------------------------------------------
       
   200 // CGSRFSPlugin::DynInitMenuPaneL()
       
   201 //
       
   202 // Dynamically handle help item if not supported
       
   203 // -----------------------------------------------------------------------------
       
   204 void CGSRFSPlugin::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane )
       
   205     {
       
   206     if( aResourceId == R_GS_MENU_ITEM_HELP )
       
   207         {
       
   208         User::LeaveIfNull( aMenuPane );
       
   209         aMenuPane->SetItemDimmed( EAknCmdHelp, EFalse );
       
   210         }
       
   211     }
       
   212 
       
   213 // ---------------------------------------------------------------------------
       
   214 // CGSRFSPlugin::NewContainerL()
       
   215 //
       
   216 // Creates new iContainer.
       
   217 // ---------------------------------------------------------------------------
       
   218 void CGSRFSPlugin::NewContainerL()
       
   219     {
       
   220     iContainer = new( ELeave ) CGSRFSPluginContainer( this );
       
   221     }
       
   222 
       
   223 // ---------------------------------------------------------------------------
       
   224 // CGSRFSPlugin::HandleListBoxSelectionL()
       
   225 // ---------------------------------------------------------------------------
       
   226 void CGSRFSPlugin::HandleListBoxSelectionL()
       
   227     {    
       
   228     CGSRFSPluginContainer *pluginContainer = static_cast<CGSRFSPluginContainer*>( iContainer );
       
   229     const TInt currentFeatureId = pluginContainer->CurrentFeatureId();         
       
   230     
       
   231     CRfsHandler* iRfsHandler = new ( ELeave ) CRfsHandler;
       
   232     CleanupStack :: PushL(iRfsHandler);
       
   233     
       
   234     TRfsType rfsType = ERfsNormal;
       
   235     if ( currentFeatureId == EGSSettIdOptDeepRfs )
       
   236         {
       
   237         rfsType = ERfsDeep;
       
   238         }
       
   239     iRfsHandler->ActivateRfsL( rfsType );
       
   240     
       
   241     CleanupStack :: PopAndDestroy(iRfsHandler);
       
   242     }
       
   243 
       
   244 // End of file