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