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