|
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: tsmodelitem.cpp |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "tsmodelitem.h" |
|
19 |
|
20 #include <HbIcon> |
|
21 |
|
22 #include <tstask.h> |
|
23 |
|
24 #include "tsdataroles.h" |
|
25 |
|
26 /*! |
|
27 \class TsModelItem |
|
28 \ingroup group_tsdevicedialogplugin |
|
29 \brief Item presenting running apps in the grid. |
|
30 */ |
|
31 |
|
32 /*! |
|
33 Standard C++ constructor |
|
34 /param entry - Task Monitor data |
|
35 */ |
|
36 TsModelItem::TsModelItem(QSharedPointer<TsTask> entry) |
|
37 : mEntry(entry) |
|
38 { |
|
39 //no implementation required |
|
40 } |
|
41 |
|
42 /*! |
|
43 Standard C++ destructor |
|
44 */ |
|
45 TsModelItem::~TsModelItem() |
|
46 { |
|
47 } |
|
48 |
|
49 /*! |
|
50 Returns the data stored under the given role. |
|
51 /param role - requested data role |
|
52 /return data encapulated by QVariant |
|
53 */ |
|
54 QVariant TsModelItem::data(int role) const |
|
55 { |
|
56 switch (role) { |
|
57 case Qt::DisplayRole: |
|
58 return QVariant(mEntry->name()); |
|
59 case Qt::DecorationRole: |
|
60 return QVariant::fromValue<HbIcon>(HbIcon(mEntry->screenshot())); |
|
61 case TsDataRoles::Closable: |
|
62 return QVariant(mEntry->isClosable()); |
|
63 case TsDataRoles::Active: |
|
64 return QVariant(mEntry->isActive()); |
|
65 default: |
|
66 return QVariant(QVariant::Invalid); |
|
67 } |
|
68 } |
|
69 |
|
70 /*! |
|
71 Close running application repesented by entry |
|
72 */ |
|
73 void TsModelItem::close() |
|
74 { |
|
75 mEntry->close(); |
|
76 } |
|
77 |
|
78 /*! |
|
79 Open or move to foreground application repesented by entry |
|
80 */ |
|
81 void TsModelItem::open() |
|
82 { |
|
83 mEntry->open(); |
|
84 } |