clock2/clockui/plugins/datetimeviewplugin/src/clkdatetimeviewplugininterface.cpp
changeset 0 f979ecb2b13e
equal deleted inserted replaced
-1:000000000000 0:f979ecb2b13e
       
     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:   This is the source file for the CClkDateTimeViewPluginInterface class.
       
    15 *
       
    16 */
       
    17 
       
    18 // System Includes
       
    19 #include <e32std.h>
       
    20 #include <implementationproxy.h>
       
    21 #include <clock.rsg>
       
    22 #include <StringLoader.h>
       
    23 #include <bautils.h>
       
    24 #include <AknsUtils.h>
       
    25 #include <gulicon.h>
       
    26 #include <akntitle.h>
       
    27 #include <clockapp.mbg>
       
    28 
       
    29 // User includes
       
    30 #include "clkdatetimeviewinher.h"
       
    31 #include "clkdatetimeviewplugininterface.h"
       
    32 #include "clkdatetimeview.h"
       
    33 // Constants
       
    34 const TImplementationProxy KDateTimeViewImplementationTable[] = 
       
    35 	{
       
    36     IMPLEMENTATION_PROXY_ENTRY( 0x102818EA,	CClkDateTimeViewPluginInterface::NewL ) // Used by GS plugin.
       
    37 	};
       
    38 
       
    39 // Literals
       
    40 _LIT( KClockIconFileName, "Z:\\resource\\apps\\clockapp.mbm" );
       
    41 
       
    42 // ---------------------------------------------------------
       
    43 // ImplementationGroupProxy
       
    44 // Gate/factory function.
       
    45 // ---------------------------------------------------------
       
    46 //
       
    47 EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount )
       
    48 	{
       
    49 	aTableCount = sizeof( KDateTimeViewImplementationTable ) 
       
    50                 / sizeof( TImplementationProxy );
       
    51 	return KDateTimeViewImplementationTable;
       
    52 	}
       
    53 
       
    54 // ---------------------------------------------------------
       
    55 // CClkDateTimeViewPluginInterface::NewL
       
    56 // rest of the details are commented in the header
       
    57 // ---------------------------------------------------------
       
    58 //
       
    59 CGSPluginInterface* CClkDateTimeViewPluginInterface::NewL()
       
    60     {
       
    61 	// UID of the plugin.
       
    62 	TUid pluginId = { 0x102818E9 };
       
    63 	
       
    64 	CClkDateTimeViewPluginInterface* self = new( ELeave ) CClkDateTimeViewPluginInterface();
       
    65     CleanupStack::PushL( self );
       
    66 
       
    67     self->ConstructL( pluginId, ETrue );
       
    68 	
       
    69 	CleanupStack::Pop( self );
       
    70 	return ( CGSPluginInterface* ) self;
       
    71 	}
       
    72 
       
    73 // ---------------------------------------------------------
       
    74 // CClkDateTimeViewPluginInterface::Id
       
    75 // rest of the details are commented in the header
       
    76 // ---------------------------------------------------------
       
    77 //
       
    78 TUid CClkDateTimeViewPluginInterface::Id() const
       
    79 	{
       
    80 	// Return the id of the view.
       
    81 	return iView->Id();
       
    82 	}
       
    83 
       
    84 // ---------------------------------------------------------
       
    85 // CClkDateTimeViewPluginInterface::ConstructL
       
    86 // rest of the details are commented in the header
       
    87 // ---------------------------------------------------------
       
    88 //	
       
    89 void CClkDateTimeViewPluginInterface::ConstructL( TUid aId, TBool aClockInUse )
       
    90 	{
       
    91 	// The resource file used to find the clkdatetimeview resources.
       
    92 	TFileName fileName( KRESOURCE );
       
    93     BaflUtils::NearestLanguageFile( iCoeEnv->FsSession(), fileName );
       
    94     iOffset = iCoeEnv->AddResourceFileL( fileName );
       
    95     
       
    96 	// Construct the datetimeview.
       
    97 	BaseConstructL( R_CLK_DATE_TIME_SETT_VIEW );
       
    98 	
       
    99 	// We access the datetimeview through this object.
       
   100 	iView = CClkDateTimeViewInher::NewLC( aId, aClockInUse );	
       
   101 	CleanupStack::Pop( iView );
       
   102 	}
       
   103 
       
   104 // ---------------------------------------------------------
       
   105 // CClkDateTimeViewPluginInterface::HandleCommandL
       
   106 // rest of the details are commented in the header
       
   107 // ---------------------------------------------------------
       
   108 //
       
   109 void CClkDateTimeViewPluginInterface::HandleCommandL( TInt aCommandId )
       
   110     {
       
   111 	// Allow the view to handle the command.
       
   112     iView->HandleCommandL( aCommandId );
       
   113     }
       
   114 
       
   115 // ---------------------------------------------------------
       
   116 // CClkDateTimeViewPluginInterface::DynInitMenuPaneL
       
   117 // rest of the details are commented in the header
       
   118 // ---------------------------------------------------------
       
   119 //
       
   120 void CClkDateTimeViewPluginInterface::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane )
       
   121     {
       
   122 	iView->DynInitMenuPaneL( aResourceId, aMenuPane );
       
   123 	}
       
   124 
       
   125 // ---------------------------------------------------------
       
   126 // CClkDateTimeViewPluginInterface::CClkDateTimeViewPluginInterface
       
   127 // rest of the details are commented in the header
       
   128 // ---------------------------------------------------------
       
   129 //   
       
   130 CClkDateTimeViewPluginInterface::CClkDateTimeViewPluginInterface()
       
   131 	{
       
   132 	// No implementation yet.
       
   133 	}
       
   134 
       
   135 // ---------------------------------------------------------
       
   136 // CClkDateTimeViewPluginInterface::~CClkDateTimeViewPluginInterface
       
   137 // rest of the details are commented in the header
       
   138 // ---------------------------------------------------------
       
   139 //
       
   140 CClkDateTimeViewPluginInterface::~CClkDateTimeViewPluginInterface()
       
   141 	{
       
   142 	// First delete the view.
       
   143 	if( iView )
       
   144 		{
       
   145 		delete iView;
       
   146 		iView = NULL;
       
   147 		}
       
   148 	// Delete the resource file from the control environment.
       
   149 	iCoeEnv->DeleteResourceFile( iOffset );
       
   150 	}
       
   151 
       
   152 // ---------------------------------------------------------
       
   153 // CClkDateTimeViewPluginInterface::GetCaptionL
       
   154 // rest of the details are commented in the header
       
   155 // ---------------------------------------------------------
       
   156 //
       
   157 void CClkDateTimeViewPluginInterface::GetCaptionL( TDes& aCaption ) const
       
   158     {
       
   159 	// This is the string displayed in General Settings for datetimeview.
       
   160     StringLoader::Load( aCaption, R_QTN_SET_FOLDER_DATIM );
       
   161     }
       
   162 
       
   163 // ---------------------------------------------------------
       
   164 // CClkDateTimeViewPluginInterface::CreateIconL
       
   165 // rest of the details are commented in the header
       
   166 // ---------------------------------------------------------
       
   167 //
       
   168 CGulIcon* CClkDateTimeViewPluginInterface::CreateIconL( const TUid /*aIconType*/ )
       
   169 	{
       
   170 	CFbsBitmap* iconBitmap( NULL );
       
   171     CFbsBitmap* iconMask( NULL ); 
       
   172  
       
   173     MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance();    
       
   174     AknsUtils::CreateIconL( skinInstance,
       
   175 							KAknsIIDQgnPropSetDatimSub,
       
   176 							iconBitmap,
       
   177 							iconMask,
       
   178     						KClockIconFileName,
       
   179     						EMbmClockappQgn_prop_set_datim_sub,
       
   180     						EMbmClockappQgn_prop_set_datim_sub_mask );
       
   181 
       
   182     CGulIcon* finalIcon = CGulIcon::NewL( iconBitmap, iconMask );
       
   183     finalIcon->SetBitmapsOwnedExternally( EFalse );
       
   184 
       
   185 	// Cleanup.
       
   186     iconMask = NULL;
       
   187     iconMask = NULL;      
       
   188     return finalIcon;    
       
   189 	}
       
   190 	
       
   191 // ---------------------------------------------------------
       
   192 // CClkDateTimeViewPluginInterface::DoActivateL
       
   193 // rest of the details are commented in the header
       
   194 // ---------------------------------------------------------
       
   195 //
       
   196 void CClkDateTimeViewPluginInterface::DoActivateL( const TVwsViewId& aPrevViewId,
       
   197 												   TUid aCustomMessageId,
       
   198 												   const TDesC8& aCustomMessage )
       
   199 	{
       
   200 	iView->DoActivateL( aPrevViewId, aCustomMessageId, aCustomMessage );
       
   201 	
       
   202 	// Update the title of the settings view when launched from GS.
       
   203 	// Text to be displayed on the title pane.
       
   204 	HBufC* titleText = StringLoader::LoadLC( R_CLOCK_TITLE_SETTINGS );
       
   205     CEikStatusPane* statusPane = StatusPane();
       
   206     // Get the titlepane.
       
   207 	CAknTitlePane* titlePane = ( CAknTitlePane* )statusPane->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) );
       
   208     // Set the text.
       
   209 	titlePane->SetTextL( titleText->Des() );
       
   210     
       
   211 	// Cleanup.
       
   212 	CleanupStack::PopAndDestroy( titleText );
       
   213 	}
       
   214 	
       
   215 // ---------------------------------------------------------
       
   216 // CClkDateTimeViewPluginInterface::DoDeactivate
       
   217 // rest of the details are commented in the header
       
   218 // ---------------------------------------------------------
       
   219 //
       
   220 void CClkDateTimeViewPluginInterface::DoDeactivate()
       
   221 	{
       
   222 	iView->DoDeactivate();
       
   223 	}
       
   224 
       
   225 // ---------------------------------------------------------
       
   226 // CClkDateTimeViewPluginInterface::HandleForegroundEventL
       
   227 // rest of the details are commented in the header
       
   228 // ---------------------------------------------------------
       
   229 //	
       
   230 void CClkDateTimeViewPluginInterface::HandleForegroundEventL( TBool aForeground )
       
   231 	{
       
   232 	iView->HandleForegroundEventL( aForeground );
       
   233 	}
       
   234 
       
   235 // End of File