clock/clockui/clockappcontroller/src/clockappcontrollerifimpl.cpp
branchRCL_3
changeset 65 12af337248b1
equal deleted inserted replaced
60:96907930389d 65:12af337248b1
       
     1 /*
       
     2 * Copyright (c) 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 * This file contains the ClockAppControllerIfImpl class definition.
       
    16 *
       
    17 */
       
    18 
       
    19 // User includes
       
    20 #include "clockappcontrollerifimpl.h"
       
    21 #include "clockappcontroller.h"
       
    22 #include "clockviewmanager.h"
       
    23 #include "timezoneclient.h"
       
    24 #include "settingsutility.h"
       
    25 #include "alarmclient.h"
       
    26 #include "OstTraceDefinitions.h"
       
    27 #ifdef OST_TRACE_COMPILER_IN_USE
       
    28 #include "clockappcontrollerifimplTraces.h"
       
    29 #endif
       
    30 
       
    31 
       
    32 /*!
       
    33 	\class ClockAppControllerIfImpl
       
    34 
       
    35 	This class implements the ClockAppControllerIf interface which is used
       
    36 	by the views and other componets to access the services of
       
    37 	clockviewmanager.
       
    38  */
       
    39 
       
    40 /*!
       
    41 	Constructor.
       
    42 
       
    43 	\param controller Pointer to an object of ClockAppController.
       
    44 	\param parent QObject pointer.
       
    45  */
       
    46 ClockAppControllerIfImpl::ClockAppControllerIfImpl(
       
    47 		ClockAppController *controller, QObject *parent)
       
    48 :QObject(parent),
       
    49  mAppController(controller)
       
    50 {
       
    51 	OstTraceFunctionEntry0( CLOCKAPPCONTROLLERIFIMPL_CLOCKAPPCONTROLLERIFIMPL_ENTRY );
       
    52 	// Construct the timezone client.
       
    53 	mTimeZoneClient = TimezoneClient::getInstance();
       
    54 	// Construct the settings utility object.
       
    55 	mSettingsUtility = new SettingsUtility(this);
       
    56 	// Construct the alarm client object.
       
    57 	mAlarmClient = new AlarmClient(this);
       
    58 	OstTraceFunctionExit0( CLOCKAPPCONTROLLERIFIMPL_CLOCKAPPCONTROLLERIFIMPL_EXIT );
       
    59 }
       
    60 
       
    61 /*!
       
    62 	Destructor.
       
    63  */
       
    64 ClockAppControllerIfImpl::~ClockAppControllerIfImpl()
       
    65 {
       
    66 	OstTraceFunctionEntry0( DUP1_CLOCKAPPCONTROLLERIFIMPL_CLOCKAPPCONTROLLERIFIMPL_ENTRY );
       
    67 	if (!mTimeZoneClient->isNull()) {
       
    68 		mTimeZoneClient->deleteInstance();
       
    69 	}
       
    70 	if (mSettingsUtility) {
       
    71 		delete mSettingsUtility;
       
    72 		mSettingsUtility = 0;
       
    73 	}
       
    74 	if(mAlarmClient) {
       
    75 		delete mAlarmClient;
       
    76 		mAlarmClient = 0;
       
    77 	}
       
    78 	OstTraceFunctionExit0( DUP1_CLOCKAPPCONTROLLERIFIMPL_CLOCKAPPCONTROLLERIFIMPL_EXIT );
       
    79 }
       
    80 
       
    81 
       
    82 /*!
       
    83 	From ClockAppControllerIf.
       
    84 	Returns a pointer to timezoneClient.
       
    85 
       
    86 	\return TimezoneClient* Pointer to TimezoneClient object.
       
    87 	\sa ClockAppControllerIf
       
    88  */
       
    89 TimezoneClient* ClockAppControllerIfImpl::timezoneClient()
       
    90 {
       
    91 	OstTraceFunctionEntry0( CLOCKAPPCONTROLLERIFIMPL_TIMEZONECLIENT_ENTRY );
       
    92 	OstTraceFunctionExit0( CLOCKAPPCONTROLLERIFIMPL_TIMEZONECLIENT_EXIT );
       
    93 	return mTimeZoneClient;
       
    94 }
       
    95 
       
    96 /*!
       
    97 	From ClockAppControllerIf.
       
    98 	Returns a pointer to SettingsUtility.
       
    99 
       
   100 	\return SettingsUtility* Pointer to SettingsUtility object.
       
   101 	\sa ClockAppControllerIf
       
   102  */
       
   103 SettingsUtility* ClockAppControllerIfImpl::settingsUtility()
       
   104 {
       
   105 	OstTraceFunctionEntry0( CLOCKAPPCONTROLLERIFIMPL_SETTINGSUTILITY_ENTRY );
       
   106 	OstTraceFunctionExit0( CLOCKAPPCONTROLLERIFIMPL_SETTINGSUTILITY_EXIT );
       
   107 	return mSettingsUtility;
       
   108 }
       
   109 
       
   110 /*!
       
   111 	From ClockAppControllerIf.
       
   112 	Returns a pointer to AlarmClient.
       
   113 
       
   114 	\return AlarmClient* Pointer to AlarmClient object.
       
   115 	\sa ClockAppControllerIf
       
   116  */
       
   117 AlarmClient* ClockAppControllerIfImpl::alarmClient()
       
   118 {
       
   119 	OstTraceFunctionEntry0( CLOCKAPPCONTROLLERIFIMPL_ALARMCLIENT_ENTRY );
       
   120 	OstTraceFunctionExit0( CLOCKAPPCONTROLLERIFIMPL_ALARMCLIENT_EXIT );
       
   121 	return mAlarmClient;
       
   122 }
       
   123 
       
   124 /*!
       
   125 	From ClockAppControllerIf.
       
   126 	Issues a request to ClockViewManager to switch to a given view.
       
   127 
       
   128 	\param viewId The id of the view to be switched to.
       
   129 	\sa ClockAppControllerIf
       
   130  */
       
   131 void ClockAppControllerIfImpl::switchToView(ClockViews viewId)
       
   132 {
       
   133 	OstTraceFunctionEntry0( CLOCKAPPCONTROLLERIFIMPL_SWITCHTOVIEW_ENTRY );
       
   134 	mAppController->mViewManager->showView(viewId);
       
   135 	OstTraceFunctionExit0( CLOCKAPPCONTROLLERIFIMPL_SWITCHTOVIEW_EXIT );
       
   136 }
       
   137 
       
   138 // End of file	--Don't remove this.