|
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(const QSharedPointer<TsTaskContent> &content, TsTaskLauncher &launcher) : mContent(content), mLauncher(launcher) |
|
36 { |
|
37 } |
|
38 |
|
39 /*! |
|
40 Destructor. |
|
41 */ |
|
42 TsTask::~TsTask() |
|
43 { |
|
44 } |
|
45 |
|
46 /*! |
|
47 @return True if it's possible to close the task, false otherwise. |
|
48 */ |
|
49 bool TsTask::isClosable() const |
|
50 { |
|
51 return mContent->mClosable; |
|
52 } |
|
53 |
|
54 /*! |
|
55 @return True if the task is running, false otherwise. |
|
56 */ |
|
57 bool TsTask::isActive() const |
|
58 { |
|
59 return mContent->mActive; |
|
60 } |
|
61 |
|
62 /*! |
|
63 @return Screenshot of the task. |
|
64 */ |
|
65 QPixmap TsTask::screenshot() const |
|
66 { |
|
67 return mContent->mScreenshot; |
|
68 } |
|
69 |
|
70 /*! |
|
71 @return Name of the task. |
|
72 */ |
|
73 QString TsTask::name() const |
|
74 { |
|
75 return mContent->mName; |
|
76 } |
|
77 |
|
78 /*! |
|
79 Start or bring the task to foreground. |
|
80 */ |
|
81 void TsTask::open() |
|
82 { |
|
83 mLauncher.openTask(mContent->mKey); |
|
84 } |
|
85 |
|
86 /*! |
|
87 Close the task. |
|
88 */ |
|
89 void TsTask::close() |
|
90 { |
|
91 mLauncher.closeTask(mContent->mKey); |
|
92 } |