tsdevicedialog/tsdevicedialogplugin/inc/tsmodel.h
author hgs
Fri, 23 Jul 2010 14:03:00 +0300
changeset 106 e78d6e055a5b
parent 99 7aaf39b772ac
child 107 b34d53f6acdf
permissions -rw-r--r--
201029
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
99
hgs
parents:
diff changeset
     1
/*
hgs
parents:
diff changeset
     2
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
hgs
parents:
diff changeset
     3
* All rights reserved.
hgs
parents:
diff changeset
     4
* This component and the accompanying materials are made available
hgs
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
hgs
parents:
diff changeset
     6
* which accompanies this distribution, and is available
hgs
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
hgs
parents:
diff changeset
     8
*
hgs
parents:
diff changeset
     9
* Initial Contributors:
hgs
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
hgs
parents:
diff changeset
    11
*
hgs
parents:
diff changeset
    12
* Contributors:
hgs
parents:
diff changeset
    13
*
hgs
parents:
diff changeset
    14
* Description: tsmodel.h
hgs
parents:
diff changeset
    15
*
hgs
parents:
diff changeset
    16
*/
hgs
parents:
diff changeset
    17
hgs
parents:
diff changeset
    18
#ifndef TSMODEL_H
hgs
parents:
diff changeset
    19
#define TSMODEL_H
hgs
parents:
diff changeset
    20
hgs
parents:
diff changeset
    21
#include <QAbstractItemModel>
hgs
parents:
diff changeset
    22
#include <QList>
hgs
parents:
diff changeset
    23
#include <QSize>
hgs
parents:
diff changeset
    24
#include <QSharedPointer>
hgs
parents:
diff changeset
    25
#include <tstaskmonitor.h>
hgs
parents:
diff changeset
    26
#ifdef Q_OS_SYMBIAN
hgs
parents:
diff changeset
    27
#include <apgcli.h>
hgs
parents:
diff changeset
    28
#endif
hgs
parents:
diff changeset
    29
hgs
parents:
diff changeset
    30
class TsTaskMonitor;
hgs
parents:
diff changeset
    31
class CaNotifier;
hgs
parents:
diff changeset
    32
class TsModelItem;
hgs
parents:
diff changeset
    33
hgs
parents:
diff changeset
    34
class TsModel : public QAbstractListModel
hgs
parents:
diff changeset
    35
{
hgs
parents:
diff changeset
    36
    Q_OBJECT
hgs
parents:
diff changeset
    37
hgs
parents:
diff changeset
    38
public:
hgs
parents:
diff changeset
    39
    explicit TsModel(TsTaskMonitor &applicationSrv,
hgs
parents:
diff changeset
    40
                     QObject &activitySrv,
hgs
parents:
diff changeset
    41
                     QObject *parent = 0);
hgs
parents:
diff changeset
    42
    ~TsModel();
hgs
parents:
diff changeset
    43
hgs
parents:
diff changeset
    44
    int rowCount(const QModelIndex &parent = QModelIndex()) const;
hgs
parents:
diff changeset
    45
    QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
hgs
parents:
diff changeset
    46
    int maxRowCount()const;
hgs
parents:
diff changeset
    47
hgs
parents:
diff changeset
    48
public slots:
hgs
parents:
diff changeset
    49
    void openApplication(const QModelIndex &index);
hgs
parents:
diff changeset
    50
    void closeApplication(const QModelIndex &index);
hgs
parents:
diff changeset
    51
    void updateModel();
hgs
parents:
diff changeset
    52
    void entryChanged(TsModelItem *);
hgs
parents:
diff changeset
    53
private:
hgs
parents:
diff changeset
    54
    TsModelItem *entry(const QModelIndex &index) const;
hgs
parents:
diff changeset
    55
    void getApplications();
hgs
parents:
diff changeset
    56
    void getActivities();
hgs
parents:
diff changeset
    57
    void prepareActivityEntry(QVariantHash &activity);
hgs
parents:
diff changeset
    58
    QString getApplicationName(int id);
hgs
parents:
diff changeset
    59
hgs
parents:
diff changeset
    60
private:
hgs
parents:
diff changeset
    61
    /*
hgs
parents:
diff changeset
    62
     * List containing result
hgs
parents:
diff changeset
    63
     */
hgs
parents:
diff changeset
    64
    QList<TsModelItem *> mEntries;
hgs
parents:
diff changeset
    65
hgs
parents:
diff changeset
    66
    TsTaskMonitor &mApplicationService;
hgs
parents:
diff changeset
    67
hgs
parents:
diff changeset
    68
    /*
hgs
parents:
diff changeset
    69
     * Activity Service
hgs
parents:
diff changeset
    70
     */
hgs
parents:
diff changeset
    71
    QObject &mActivityService;
hgs
parents:
diff changeset
    72
    
hgs
parents:
diff changeset
    73
#ifdef Q_OS_SYMBIAN
hgs
parents:
diff changeset
    74
    RApaLsSession iAppArcSession;
hgs
parents:
diff changeset
    75
#endif
hgs
parents:
diff changeset
    76
hgs
parents:
diff changeset
    77
    /*
hgs
parents:
diff changeset
    78
     * Icon size in model
hgs
parents:
diff changeset
    79
     */
hgs
parents:
diff changeset
    80
    QSize mSize;
hgs
parents:
diff changeset
    81
    
hgs
parents:
diff changeset
    82
    /*
hgs
parents:
diff changeset
    83
     * Maximum number of items (only for running apps + activities)
hgs
parents:
diff changeset
    84
     */ 
hgs
parents:
diff changeset
    85
    int mMaxItems;
hgs
parents:
diff changeset
    86
};
hgs
parents:
diff changeset
    87
hgs
parents:
diff changeset
    88
#endif // TSMODEL_H