internetradio2.0/generalsettingssrc/irgeneralsettingsview.cpp
changeset 0 09774dfdd46b
equal deleted inserted replaced
-1:000000000000 0:09774dfdd46b
       
     1 /*
       
     2 * Copyright (c) 2006-2006 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:  Implementation of CIRGeneralSettingsView
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <akntitle.h>
       
    20 #include "irgeneralsettingsview.h"
       
    21 #include "irgeneralsettings.hrh"
       
    22 #include "ircommonsettingscontainer.h"
       
    23 #include "irdebug.h"
       
    24 #include <irgeneralsettings.rsg>
       
    25 #include <internetradio.mbg>
       
    26 #include <stringloader.h>
       
    27 #include <internetradio.rsg>
       
    28 #include "ir.hrh"
       
    29 
       
    30 
       
    31 // General settings plugin bitmap file.
       
    32 
       
    33 _LIT(KIRMifFileName,"InternetRadio.mif");
       
    34 
       
    35 // General settings plugin resource file.
       
    36 _LIT( KIRGeneralSettingsResourceFile, "irgeneralsettings.rsc" );
       
    37 
       
    38 // ======== LOCAL FUNCTIONS ========
       
    39 
       
    40 // ======== MEMBER FUNCTIONS ========
       
    41 
       
    42 // ---------------------------------------------------------------------------
       
    43 // Two-phased constructor.
       
    44 // ---------------------------------------------------------------------------
       
    45 //
       
    46 CIRGeneralSettingsView* CIRGeneralSettingsView::NewL( TAny* /*aInitParams*/ )
       
    47     {
       
    48     IRLOG_DEBUG( "CIRGeneralSettingsView::NewL - entering");
       
    49     CIRGeneralSettingsView* self = CIRGeneralSettingsView::NewLC();
       
    50     CleanupStack::Pop( self );
       
    51     IRLOG_DEBUG( " CIRGeneralSettingsView::NewL - exiting");
       
    52     return self;
       
    53     }
       
    54  
       
    55 // ---------------------------------------------------------------------------
       
    56 // CIRGeneralSettingsView::NewLC()
       
    57 // Two-phased constructor.
       
    58 // ---------------------------------------------------------------------------
       
    59 //
       
    60 CIRGeneralSettingsView* CIRGeneralSettingsView::NewLC()
       
    61     {
       
    62     IRLOG_DEBUG( "CIRGeneralSettingsView::NewLC - Entering" );
       
    63     CIRGeneralSettingsView* self = new( ELeave ) CIRGeneralSettingsView();
       
    64     CleanupStack::PushL( self );
       
    65     self->ConstructL();
       
    66     IRLOG_DEBUG( "CIRGeneralSettingsView::NewLC - Exiting" );
       
    67     return self;
       
    68     }
       
    69 // ---------------------------------------------------------------------------
       
    70 // Default constructor
       
    71 // ---------------------------------------------------------------------------
       
    72 //
       
    73 CIRGeneralSettingsView::CIRGeneralSettingsView()
       
    74     : iGeneralSettingsResourceLoader( *iCoeEnv )
       
    75     {
       
    76     IRLOG_DEBUG( "CIRGeneralSettingsView ::CIRGeneralSettingsView");
       
    77     }
       
    78     
       
    79 // ---------------------------------------------------------------------------
       
    80 // Second phase constructor
       
    81 // ---------------------------------------------------------------------------
       
    82 //
       
    83 void CIRGeneralSettingsView::ConstructL()
       
    84     {
       
    85 	IRLOG_DEBUG( "CIRGeneralSettingsView::ConstructL - entering");
       
    86     BaseConstructL();
       
    87     LoadResourcesL( iGeneralSettingsResourceLoader, KIRGeneralSettingsResourceFile );
       
    88     IRLOG_DEBUG( "CIRGeneralSettingsView::ConstructL - Exiting");
       
    89     }
       
    90 
       
    91 // ---------------------------------------------------------------------------
       
    92 // Destructor
       
    93 // ---------------------------------------------------------------------------
       
    94 //
       
    95 CIRGeneralSettingsView::~CIRGeneralSettingsView()
       
    96     {
       
    97     IRLOG_DEBUG( "CIRGeneralSettingsView::~CIRGeneralSettingsView - entering");
       
    98     iGeneralSettingsResourceLoader.Close();
       
    99     if(iContainer)
       
   100     	{
       
   101     	delete iContainer;
       
   102     	iContainer = NULL;
       
   103     	}
       
   104     IRLOG_DEBUG( "CIRGeneralSettingsView::~CIRGeneralSettingsView - Exiting");
       
   105     }
       
   106 
       
   107 // ---------------------------------------------------------------------------
       
   108 // Getter for the view id
       
   109 // ---------------------------------------------------------------------------
       
   110 //
       
   111 TUid CIRGeneralSettingsView::Id() const
       
   112     {
       
   113     IRLOG_DEBUG( "CIRGeneralSettingsView :: Id");
       
   114     return TUid::Uid( IRGENERAL_SETTINGS_PLUGIN_DLL_UID );
       
   115     }
       
   116 
       
   117 // ---------------------------------------------------------------------------
       
   118 // View activation
       
   119 // ---------------------------------------------------------------------------
       
   120 //
       
   121 void CIRGeneralSettingsView::DoActivateL( const TVwsViewId& aPrevViewId, 
       
   122                                           TUid aCustomMessageId, 
       
   123                                           const TDesC8& aCustomMessage )
       
   124     {
       
   125 	
       
   126     IRLOG_DEBUG( " CIRGeneralSettingsView::DoActivateL - Entering" );
       
   127     
       
   128     CIRSettingsViewBase::DoActivateL( aPrevViewId, aCustomMessageId, aCustomMessage );
       
   129 
       
   130     HBufC* title = NULL;
       
   131     title = iCoeEnv->AllocReadResourceLC( R_IRAPP_GENERAL_SETTINGS_PLUGIN_TITLE );
       
   132     static_cast<CAknTitlePane*>( AppUi()->StatusPane()->ControlL(
       
   133     			 TUid::Uid( EEikStatusPaneUidTitle ) ) )->SetTextL( *title );
       
   134     CleanupStack::PopAndDestroy( title );
       
   135     IRLOG_DEBUG( " CIRGeneralSettingsView::DoActivateL - Exiting" );
       
   136     }
       
   137 
       
   138 // ---------------------------------------------------------------------------
       
   139 // Getter for the caption of general settings
       
   140 // ---------------------------------------------------------------------------
       
   141 //
       
   142 void CIRGeneralSettingsView::GetCaptionL( TDes& aCaption ) const
       
   143     {
       
   144     IRLOG_DEBUG( "CIRGeneralSettingsView::GetCaptionL - Entering");
       
   145     StringLoader::Load(aCaption,R_IRAPP_GENERAL_SETTINGS_PLUGIN_LISTBOX_CAPTION);
       
   146     IRLOG_DEBUG( "CIRGeneralSettingsView::GetCaptionL - Exiting");
       
   147 	
       
   148 	return;
       
   149     }
       
   150 
       
   151 // ---------------------------------------------------------------------------
       
   152 // Getter for provider category
       
   153 // ---------------------------------------------------------------------------
       
   154 //
       
   155 TInt CIRGeneralSettingsView::PluginProviderCategory() const
       
   156     {
       
   157     IRLOG_DEBUG( "CIRGeneralSettingsView::PluginProviderCategory");
       
   158     return EGSPluginProviderOEM;
       
   159     }
       
   160 
       
   161 // ---------------------------------------------------------------------------
       
   162 // Creates icon for the general settings
       
   163 // ---------------------------------------------------------------------------
       
   164 //
       
   165 CGulIcon* CIRGeneralSettingsView::CreateIconL( const TUid aIconType )
       
   166     {
       
   167 	IRLOG_DEBUG( "CIRGeneralSettingsView::CreateIconL - Entering");
       
   168     if ( aIconType == KGSIconTypeLbxItem )
       
   169 	    {
       
   170 	    TParse parse;
       
   171 		parse.Set( KIRMifFileName, &KDC_APP_RESOURCE_DIR, NULL );
       
   172 		TFileName bitmapFile = parse.FullName();
       
   173 		CompleteWithAppPath( bitmapFile );
       
   174 
       
   175 	    CIRSettingsViewBase::ResolveDriveL( iCoeEnv->FsSession(), bitmapFile );
       
   176 
       
   177 		IRLOG_DEBUG( "CIRGeneralSettingsView::CreateIconL - exiting");
       
   178 	    return AknsUtils::CreateGulIconL( AknsUtils::SkinInstance(), 
       
   179 	                                      KAknsIIDDefault, 
       
   180 	                                      bitmapFile, 
       
   181 	                                      EMbmInternetradioQgn_prop_set_apps_ir, 
       
   182 	                                      EMbmInternetradioQgn_prop_set_apps_ir_mask );
       
   183 	    }
       
   184     else
       
   185 	    {
       
   186 	    IRLOG_DEBUG( "CIRGeneralSettingsView::CreateIconL - exiting");
       
   187 	    return CGSPluginInterface::CreateIconL( aIconType );
       
   188 	    }
       
   189     }
       
   190 
       
   191 // ---------------------------------------------------------------------------
       
   192 // Getter for general settings view visibility status
       
   193 // ---------------------------------------------------------------------------
       
   194 //
       
   195 TBool CIRGeneralSettingsView::Visible() const
       
   196     {
       
   197     IRLOG_DEBUG( "CIRGeneralSettingsView::Visible");
       
   198 	return ETrue;
       
   199     }
       
   200 
       
   201 // ---------------------------------------------------------------------------
       
   202 // Constructs new container
       
   203 // ---------------------------------------------------------------------------
       
   204 //
       
   205 void CIRGeneralSettingsView::CreateContainerL()
       
   206     {
       
   207 	IRLOG_DEBUG( "CIRGeneralSettingsView::CreateContainer - entering");
       
   208     if( !iContainer )
       
   209         {
       
   210         iContainer = CIRCommonSettingsContainer::NewL();
       
   211         }
       
   212     IRLOG_DEBUG( "CIRGeneralSettingsView::CreateContainer - Exiting");
       
   213     }
       
   214 
       
   215 // ---------------------------------------------------------------------------
       
   216 // HandleCommandL()
       
   217 // Command handler
       
   218 // ---------------------------------------------------------------------------
       
   219 //
       
   220 void CIRGeneralSettingsView::HandleCommandL( TInt aCommand )
       
   221 	{
       
   222 	IRLOG_DEBUG( "CIRGeneralSettingsView::HandleCommandL - entering");
       
   223 	
       
   224 	switch ( aCommand )
       
   225 		{
       
   226 		case EEikCmdExit:
       
   227 		case EExitCmd:  //lint -fallthrough
       
   228 	    case EIRExit:
       
   229 		case EAknSoftkeyExit:
       
   230 			{
       
   231 			AppUi()->Exit();
       
   232 			}
       
   233 		break;
       
   234 				
       
   235 		default:
       
   236 			{
       
   237 			CIRSettingsViewBase::HandleCommandL( aCommand );
       
   238 			}
       
   239 		break;
       
   240 		}
       
   241 
       
   242 	IRLOG_DEBUG( "CIRGeneralSettingsView::HandleCommandL - Exiting");
       
   243 	}
       
   244 
       
   245 
       
   246 
       
   247 // ---------------------------------------------------------------------------
       
   248 // void CIRGeneralSettingsView::DynInitMenuPaneL()
       
   249 // Dynamically initialises a menu pane
       
   250 // ---------------------------------------------------------------------------
       
   251 //
       
   252 void CIRGeneralSettingsView::DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane)
       
   253 	{
       
   254 	IRLOG_DEBUG( "CIRGeneralSettingsView::DynInitMenuPaneL - Entering" );
       
   255 
       
   256 	if(!aMenuPane) User::Leave(KErrNotFound);
       
   257 		{
       
   258 		if(aResourceId == R_IR_MENU_SETTINGS)
       
   259 			{				
       
   260 			// Now Playing option
       
   261 			 aMenuPane->SetItemDimmed(EGotoNowPlayingViewCmd,ETrue);
       
   262 			}
       
   263 		}
       
   264 	IRLOG_DEBUG( "CIRGeneralSettingsView::DynInitMenuPaneL - Exiting" );
       
   265 	}
       
   266 
       
   267 // ======== GLOBAL FUNCTIONS ========