taskswitcher/client/src/tstask.cpp
changeset 117 c63ee96dbe5f
equal deleted inserted replaced
115:3ab5c078b490 117:c63ee96dbe5f
       
     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 *
       
    16 */
       
    17 #include "tstask.h"
       
    18 
       
    19 #include "tstaskcontent.h"
       
    20 #include "tstasklauncher.h"
       
    21 
       
    22 /*!
       
    23     @class TsTask
       
    24     @ingroup publicApi
       
    25     @brief TsTask object represents a single task.
       
    26     
       
    27     This class represents one running task. It can be queried for task content
       
    28     like screenshot or task name, or used to start or close task.
       
    29 */
       
    30 
       
    31 /*!
       
    32     @internal
       
    33     Constructor. 
       
    34 */
       
    35 TsTask::TsTask(TsTaskContent *content, TsTaskLauncher &launcher) : mContent(content), mLauncher(launcher)
       
    36 {
       
    37 }
       
    38 
       
    39 /*!
       
    40     Destructor.
       
    41 */
       
    42 TsTask::~TsTask()
       
    43 {
       
    44     delete mContent;
       
    45 }
       
    46 
       
    47 /*!
       
    48     @return True if it's possible to close the task, false otherwise.
       
    49 */
       
    50 bool TsTask::isClosable() const
       
    51 {
       
    52     return mContent->mClosable;
       
    53 }
       
    54 
       
    55 /*!
       
    56     @return True if the task is running, false otherwise.
       
    57 */
       
    58 bool TsTask::isActive() const
       
    59 {
       
    60     return mContent->mActive;
       
    61 }
       
    62 
       
    63 /*!
       
    64     @return Screenshot of the task.
       
    65 */
       
    66 QPixmap TsTask::screenshot() const
       
    67 {
       
    68     return mContent->mScreenshot;
       
    69 }
       
    70 
       
    71 /*!
       
    72     @return Name of the task.
       
    73 */
       
    74 QString TsTask::name() const
       
    75 {
       
    76     return mContent->mName;
       
    77 }
       
    78 
       
    79 /*!
       
    80     Start or bring the task to foreground.
       
    81 */
       
    82 void TsTask::open()
       
    83 {
       
    84     mLauncher.openTask(mContent->mKey);
       
    85 }
       
    86 
       
    87 /*!
       
    88     Close the task.
       
    89 */
       
    90 void TsTask::close()
       
    91 {
       
    92     mLauncher.closeTask(mContent->mKey);
       
    93 }