diff -r 3ab5c078b490 -r c63ee96dbe5f taskswitcher/client/src/tstask.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/taskswitcher/client/src/tstask.cpp Thu Sep 16 12:11:40 2010 +0100 @@ -0,0 +1,93 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#include "tstask.h" + +#include "tstaskcontent.h" +#include "tstasklauncher.h" + +/*! + @class TsTask + @ingroup publicApi + @brief TsTask object represents a single task. + + This class represents one running task. It can be queried for task content + like screenshot or task name, or used to start or close task. +*/ + +/*! + @internal + Constructor. +*/ +TsTask::TsTask(TsTaskContent *content, TsTaskLauncher &launcher) : mContent(content), mLauncher(launcher) +{ +} + +/*! + Destructor. +*/ +TsTask::~TsTask() +{ + delete mContent; +} + +/*! + @return True if it's possible to close the task, false otherwise. +*/ +bool TsTask::isClosable() const +{ + return mContent->mClosable; +} + +/*! + @return True if the task is running, false otherwise. +*/ +bool TsTask::isActive() const +{ + return mContent->mActive; +} + +/*! + @return Screenshot of the task. +*/ +QPixmap TsTask::screenshot() const +{ + return mContent->mScreenshot; +} + +/*! + @return Name of the task. +*/ +QString TsTask::name() const +{ + return mContent->mName; +} + +/*! + Start or bring the task to foreground. +*/ +void TsTask::open() +{ + mLauncher.openTask(mContent->mKey); +} + +/*! + Close the task. +*/ +void TsTask::close() +{ + mLauncher.closeTask(mContent->mKey); +}