pnpmobileservices/pnpms/ServiceHelpPlugin/src/ServiceHelpPlugin.cpp
changeset 0 3ce708148e4d
child 55 c4687ff85147
equal deleted inserted replaced
-1:000000000000 0:3ce708148e4d
       
     1 /*
       
     2 * Copyright (c) 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:  ServiceHelpPlugin implementation.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // User includes
       
    20 #include    "ServiceHelpPlugin.h"
       
    21 
       
    22 #include    <gsparentplugin.h>
       
    23 #include    <gscommon.hrh>
       
    24 #include    <PnpProvisioning.rsg>
       
    25 #include    <ServiceHelpPlugin.mbg>
       
    26 #include    <gsprivatepluginproviderids.h>
       
    27 #include    <gsfwviewuids.h>
       
    28 #include    <gsbaseview.h>
       
    29 
       
    30 // System includes
       
    31 #include    <AknWaitDialog.h>
       
    32 #include    <aknViewAppUi.h>
       
    33 #include    <bautils.h>
       
    34 #include    <StringLoader.h>
       
    35 #include    <badesca.h>
       
    36 #include    <PnpProvUtil.h>
       
    37 #include    <featmgr.h>
       
    38 #include    "ServicePluginLogger.h"
       
    39 
       
    40 
       
    41 
       
    42 // ========================= MEMBER FUNCTIONS ================================
       
    43 
       
    44 // ---------------------------------------------------------------------------
       
    45 // CServiceHelpPlugin::CServiceHelpPlugin()
       
    46 // Constructor
       
    47 // ---------------------------------------------------------------------------
       
    48 //
       
    49 CServiceHelpPlugin::CServiceHelpPlugin()
       
    50     : iResources( *iCoeEnv )
       
    51     {
       
    52     }
       
    53 
       
    54 
       
    55 // ---------------------------------------------------------------------------
       
    56 // CServiceHelpPlugin::~CServiceHelpPlugin()
       
    57 // Destructor
       
    58 // ---------------------------------------------------------------------------
       
    59 //
       
    60 CServiceHelpPlugin::~CServiceHelpPlugin()
       
    61     {
       
    62     iResources.Close();
       
    63 
       
    64     
       
    65     }
       
    66 
       
    67 
       
    68 // ---------------------------------------------------------------------------
       
    69 // CServiceHelpPlugin::ConstructL(const TRect& aRect)
       
    70 // Symbian OS two-phased constructor
       
    71 // ---------------------------------------------------------------------------
       
    72 //
       
    73 void CServiceHelpPlugin::ConstructL()
       
    74     {	
       
    75        LOGSTRING("ContructL");
       
    76      
       
    77 	OpenLocalizedResourceFileL( KOperatorLogoResourceFileName, iResources );
       
    78     
       
    79      
       
    80     }
       
    81 
       
    82 
       
    83 // ---------------------------------------------------------------------------
       
    84 // CServiceHelpPlugin::NewL()
       
    85 // Static constructor
       
    86 // ---------------------------------------------------------------------------
       
    87 //
       
    88 CServiceHelpPlugin* CServiceHelpPlugin::NewL( TAny* /*aInitParams*/ )
       
    89     {
       
    90  
       
    91     
       
    92     LOGSTRING("NewL - CServiceHelpPlugin ");
       
    93     CServiceHelpPlugin* self = new( ELeave ) CServiceHelpPlugin();
       
    94     CleanupStack::PushL(self);
       
    95     self->ConstructL();
       
    96     CleanupStack::Pop(self);
       
    97     return self;
       
    98 
       
    99     
       
   100     }
       
   101 
       
   102 
       
   103 // -----------------------------------------------------------------------------
       
   104 // CServiceHelpPlugin::Id
       
   105 // -----------------------------------------------------------------------------
       
   106 //
       
   107 TUid CServiceHelpPlugin::Id() const
       
   108     {
       
   109     return KServiceHelpPluginUID;
       
   110     }
       
   111 
       
   112 
       
   113 // -----------------------------------------------------------------------------
       
   114 // CServiceHelpPlugin::DoActivateL
       
   115 // -----------------------------------------------------------------------------
       
   116 //
       
   117 void CServiceHelpPlugin::DoActivateL( const TVwsViewId& /*aPrevViewId*/,
       
   118                                   TUid /*aCustomMessageId*/,
       
   119                                   const TDesC8& /*aCustomMessage*/ )
       
   120     {
       
   121 
       
   122     }
       
   123 
       
   124 
       
   125 // -----------------------------------------------------------------------------
       
   126 // CServiceHelpPlugin::DoDeactivate
       
   127 // -----------------------------------------------------------------------------
       
   128 //
       
   129 void CServiceHelpPlugin::DoDeactivate()
       
   130     {
       
   131 
       
   132 
       
   133     }
       
   134 
       
   135 
       
   136 // ========================= From CGSPluginInterface ==================
       
   137 
       
   138 
       
   139 // -----------------------------------------------------------------------------
       
   140 // CServiceHelpPlugin::GetCaptionL
       
   141 // -----------------------------------------------------------------------------
       
   142 //
       
   143 void CServiceHelpPlugin::GetCaptionL( TDes& aCaption ) const
       
   144     {    
       
   145 
       
   146     LOGSTRING("NewL - GetCaptionL ");
       
   147     HBufC* result = StringLoader::LoadL( R_TEXT_PLUGIN_CAPTION );
       
   148     aCaption.Copy( *result );
       
   149     delete result;
       
   150 
       
   151     LOGSTRING("NewL - GetCaptionL - Done");
       
   152     
       
   153     }
       
   154 
       
   155 
       
   156 // -----------------------------------------------------------------------------
       
   157 // CServiceHelpPlugin::PluginProviderCategory
       
   158 // -----------------------------------------------------------------------------
       
   159 //
       
   160 TInt CServiceHelpPlugin::PluginProviderCategory() const
       
   161     {
       
   162     return KGSPluginProviderInternal;
       
   163     }
       
   164 
       
   165 
       
   166 // -----------------------------------------------------------------------------
       
   167 // CServiceHelpPlugin::ItemType()
       
   168 // -----------------------------------------------------------------------------
       
   169 //
       
   170 TGSListboxItemTypes CServiceHelpPlugin::ItemType()
       
   171     {
       
   172     return EGSItemTypeSettingDialog;
       
   173     }
       
   174 
       
   175 
       
   176 // -----------------------------------------------------------------------------
       
   177 // CServiceHelpPlugin::GetValue()
       
   178 // -----------------------------------------------------------------------------
       
   179 //
       
   180 void CServiceHelpPlugin::GetValue( const TGSPluginValueKeys /*aKey*/,
       
   181                                       TDes& /*aValue*/ )
       
   182     {
       
   183     }
       
   184 
       
   185 
       
   186 // -----------------------------------------------------------------------------
       
   187 // CServiceHelpPlugin::HandleSelection()
       
   188 // -----------------------------------------------------------------------------
       
   189 //
       
   190 void CServiceHelpPlugin::HandleSelection(
       
   191     const TGSSelectionTypes /*aSelectionType*/ )
       
   192     {
       
   193     
       
   194     TRAP_IGNORE(  LaunchOnlineSupportL() );
       
   195    
       
   196     }
       
   197 
       
   198 
       
   199 
       
   200 // ---------------------------------------------------------------------------
       
   201 // CServiceHelpPlugin::CreateIconL
       
   202 // ---------------------------------------------------------------------------
       
   203 //
       
   204 CGulIcon* CServiceHelpPlugin::CreateIconL( const TUid aIconType )
       
   205     {
       
   206    
       
   207     LOGSTRING("NewL - CreateIconL ");
       
   208    //EMbm<Mbm_file_name><Bitmap_name>
       
   209     CGulIcon* icon;
       
   210     TParse* fp = new( ELeave ) TParse();
       
   211     CleanupStack::PushL( fp );
       
   212     fp->Set( KServiceHelpPluginIconDirAndName, &KDC_BITMAP_DIR, NULL );
       
   213 
       
   214     if ( aIconType == KGSIconTypeLbxItem )
       
   215         {
       
   216         icon = AknsUtils::CreateGulIconL(
       
   217         AknsUtils::SkinInstance(),
       
   218         KAknsIIDQgnPropSetAppsWml,
       
   219         fp->FullName(),//qgn_prop_set_apps_wml.svg
       
   220         EMbmServicehelppluginQgn_prop_set_apps_wml,
       
   221         EMbmServicehelppluginQgn_prop_set_apps_wml_mask );
       
   222         }    
       
   223     else
       
   224         {
       
   225         icon = CGSPluginInterface::CreateIconL( aIconType );
       
   226         }
       
   227         
       
   228     CleanupStack::PopAndDestroy( fp );
       
   229 
       
   230     LOGSTRING("NewL - CreateIconL - Done ");
       
   231     return icon;
       
   232 	
       
   233    }
       
   234 
       
   235 
       
   236 // -----------------------------------------------------------------------------
       
   237 // CServiceHelpPlugin::OpenLocalizedResourceFileL()
       
   238 // -----------------------------------------------------------------------------
       
   239 //
       
   240 void CServiceHelpPlugin::OpenLocalizedResourceFileL(
       
   241     const TDesC& aResourceFileName,
       
   242     RConeResourceLoader& aResourceLoader )
       
   243     {
       
   244     
       
   245     LOGSTRING("NewL - OpenLocalizedResourceFileL ");
       
   246 
       
   247     RFs fsSession;
       
   248     User::LeaveIfError( fsSession.Connect() );
       
   249 
       
   250     CleanupClosePushL(fsSession);
       
   251 
       
   252     // Find the resource file:
       
   253     TParse parse;
       
   254     parse.Set( aResourceFileName, &KDC_APP_RESOURCE_DIR, NULL );
       
   255     TFileName fileName( parse.FullName() );
       
   256 
       
   257     // Get language of resource file:
       
   258     BaflUtils::NearestLanguageFile( fsSession, fileName );
       
   259 
       
   260     // Open resource file:
       
   261     aResourceLoader.OpenL( fileName );
       
   262 
       
   263     
       
   264     CleanupStack::PopAndDestroy(); //fssession
       
   265 
       
   266     LOGSTRING("NewL - OpenLocalizedResourceFileL End ");
       
   267 
       
   268     }
       
   269     
       
   270 // -----------------------------------------------------------------------------
       
   271 // CServiceHelpPlugin::LaunchonlinesupportL()
       
   272 // -----------------------------------------------------------------------------
       
   273 //
       
   274 
       
   275 void CServiceHelpPlugin::LaunchOnlineSupportL()
       
   276     {
       
   277 
       
   278       LOGSTRING("NewL - LaunchOnlineSupportL ");
       
   279 
       
   280       // To Launch online suppport Use PNPMS Provisioning utilities for PNPMS services
       
   281       TBufC<1> Nullval(_L(""));
       
   282       
       
   283       CPnpProvUtil *prov = CPnpProvUtil::NewLC();
       
   284       TRAP_IGNORE(prov->LaunchOnlineSupportL(Nullval, EUserTriggered, EStartInteractive,  EFalse, Nullval)); 
       
   285       CleanupStack::PopAndDestroy();
       
   286 
       
   287        LOGSTRING("NewL - LaunchOnlineSupportL END ");
       
   288 
       
   289     }
       
   290 
       
   291 
       
   292 
       
   293 // End of file