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: tsmodel.h
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#ifndef TSMODEL_H
|
|
19 |
#define TSMODEL_H
|
|
20 |
|
|
21 |
#include <QAbstractItemModel>
|
|
22 |
#include <QList>
|
|
23 |
#include <QSize>
|
|
24 |
#include <QSharedPointer>
|
|
25 |
#include <tstaskmonitor.h>
|
|
26 |
#ifdef Q_OS_SYMBIAN
|
|
27 |
#include <apgcli.h>
|
|
28 |
#endif
|
|
29 |
|
|
30 |
class TsTaskMonitor;
|
|
31 |
class CaNotifier;
|
|
32 |
class TsModelItem;
|
|
33 |
|
|
34 |
class TsModel : public QAbstractListModel
|
|
35 |
{
|
|
36 |
Q_OBJECT
|
|
37 |
|
|
38 |
public:
|
|
39 |
explicit TsModel(TsTaskMonitor &applicationSrv,
|
|
40 |
QObject &activitySrv,
|
|
41 |
QObject *parent = 0);
|
|
42 |
~TsModel();
|
|
43 |
|
|
44 |
int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
|
45 |
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
|
|
46 |
int maxRowCount()const;
|
|
47 |
|
|
48 |
public slots:
|
|
49 |
void openApplication(const QModelIndex &index);
|
|
50 |
void closeApplication(const QModelIndex &index);
|
|
51 |
void updateModel();
|
|
52 |
void entryChanged(TsModelItem *);
|
|
53 |
private:
|
|
54 |
TsModelItem *entry(const QModelIndex &index) const;
|
|
55 |
void getApplications();
|
|
56 |
void getActivities();
|
|
57 |
void prepareActivityEntry(QVariantHash &activity);
|
|
58 |
QString getApplicationName(int id);
|
|
59 |
|
|
60 |
private:
|
|
61 |
/*
|
|
62 |
* List containing result
|
|
63 |
*/
|
|
64 |
QList<TsModelItem *> mEntries;
|
|
65 |
|
|
66 |
TsTaskMonitor &mApplicationService;
|
|
67 |
|
|
68 |
/*
|
|
69 |
* Activity Service
|
|
70 |
*/
|
|
71 |
QObject &mActivityService;
|
|
72 |
|
|
73 |
#ifdef Q_OS_SYMBIAN
|
|
74 |
RApaLsSession iAppArcSession;
|
|
75 |
#endif
|
|
76 |
|
|
77 |
/*
|
|
78 |
* Icon size in model
|
|
79 |
*/
|
|
80 |
QSize mSize;
|
|
81 |
|
|
82 |
/*
|
|
83 |
* Maximum number of items (only for running apps + activities)
|
|
84 |
*/
|
|
85 |
int mMaxItems;
|
|
86 |
};
|
|
87 |
|
|
88 |
#endif // TSMODEL_H
|