sl@0: // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // sl@0: sl@0: /** sl@0: @file sl@0: @test sl@0: @internalComponent sl@0: */ sl@0: sl@0: #include sl@0: #include sl@0: #include sl@0: #include "t_dsaappui.h" sl@0: #include "t_dsaappview.h" sl@0: #include "t_inidata.h" sl@0: #include "t_wservconsts.h" sl@0: sl@0: /** sl@0: * constructL method that creates the AppView object sl@0: * sl@0: */ sl@0: void CDsaAppUi::ConstructL() sl@0: { sl@0: BaseConstructL(); sl@0: CWsScreenDevice * screen = CCoeEnv::Static()->ScreenDevice(); sl@0: TSize screenSize=screen->SizeInPixels(); sl@0: TInt posX = 0; sl@0: READ_INT(KDsaPositionX, KWServDsaAppConfigFile, posX); sl@0: CalculateAbsL(posX, screenSize.iWidth); sl@0: sl@0: TInt posY = 0; sl@0: READ_INT(KDsaPositionY, KWServDsaAppConfigFile, posY); sl@0: CalculateAbsL(posY, screenSize.iHeight); sl@0: sl@0: TInt width = 0; sl@0: READ_INT(KDsaWidth, KWServDsaAppConfigFile, width); sl@0: CalculateAbsL(width, screenSize.iWidth); sl@0: sl@0: TInt height = 0; sl@0: READ_INT(KDsaHeight, KWServDsaAppConfigFile, height); sl@0: CalculateAbsL(height, screenSize.iHeight); sl@0: sl@0: TRect myRect(TPoint(posX,posY), TPoint(width+posX,height+posY)); sl@0: iAppView = CDsaAppView::NewL(myRect); sl@0: } sl@0: sl@0: sl@0: void CDsaAppUi::CalculateAbsL(TInt& aValue, const TInt& aFactor) sl@0: { sl@0: TReal tempVar = static_cast(aValue)*static_cast(aFactor); sl@0: tempVar = tempVar/100; // as percentage sl@0: TInt32 tempVal = 0; sl@0: User::LeaveIfError(Math::Int(tempVal, tempVar)); sl@0: aValue = tempVal; sl@0: } sl@0: sl@0: /** sl@0: * Destructor sl@0: * sl@0: */ sl@0: CDsaAppUi::~CDsaAppUi() sl@0: { sl@0: delete iAppView; sl@0: } sl@0: sl@0: /** sl@0: * Handles the Menu events sl@0: * @param aCommand - command to be passed based on the menu item sl@0: * selected by the user sl@0: * sl@0: */ sl@0: void CDsaAppUi::HandleCommandL(TInt aCommand) sl@0: { sl@0: switch (aCommand) sl@0: { sl@0: case EEikCmdExit: sl@0: { sl@0: Exit(); sl@0: break; sl@0: } sl@0: default: sl@0: { sl@0: User::Leave(KErrAbort); sl@0: break; sl@0: } sl@0: } sl@0: } sl@0: sl@0: /** sl@0: * Handles system events sl@0: * @param aEvent - event that has to be handled by the function sl@0: * sl@0: */ sl@0: void CDsaAppUi::HandleSystemEventL(const TWsEvent& aEvent) sl@0: { sl@0: switch (*(TApaSystemEvent*)(aEvent.EventData())) sl@0: { sl@0: case EApaSystemEventBroughtToForeground: sl@0: { sl@0: RProcess::Rendezvous(KErrNone); sl@0: break; sl@0: } sl@0: default: sl@0: { sl@0: User::Leave(KErrAbort); sl@0: break; sl@0: } sl@0: } sl@0: }