tsdevicedialog/tsdevicedialogplugin/src/tsentrymodelitem.cpp
changeset 124 e36b2f4799c0
parent 121 0b3699f6c654
equal deleted inserted replaced
121:0b3699f6c654 124:e36b2f4799c0
     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 
       
    18 #include "tsentrymodelitem.h"
       
    19 
       
    20 #include <HbIcon>
       
    21 
       
    22 #include <tstask.h>
       
    23 
       
    24 #include "tsdataroles.h"
       
    25 
       
    26 /*!
       
    27     \class TsEntryModelItem
       
    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 TsEntryModelItem::TsEntryModelItem(QSharedPointer<TsTask> entry)
       
    37     :
       
    38     mEntry(entry)
       
    39 {
       
    40     //no implementation required
       
    41 }
       
    42 
       
    43 /*!
       
    44     Standard C++ destructor
       
    45 */
       
    46 TsEntryModelItem::~TsEntryModelItem()
       
    47 {
       
    48 }
       
    49 
       
    50 /*!
       
    51     Returns the data stored under the given role.
       
    52     /param role - requested data role
       
    53     /return data encapulated by QVariant
       
    54 */
       
    55 QVariant TsEntryModelItem::data(int role) const
       
    56 {
       
    57     switch (role) {
       
    58         case Qt::DisplayRole:
       
    59             return QVariant(mEntry->name());
       
    60         case Qt::DecorationRole:
       
    61             return QVariant::fromValue<HbIcon>(HbIcon(mEntry->screenshot()));
       
    62         case TsDataRoles::Closable:
       
    63             return QVariant(mEntry->isClosable());
       
    64         case TsDataRoles::Active:
       
    65             return QVariant(mEntry->isActive());
       
    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