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 <QAbstractListModel> |
|
22 #include <QList> |
|
23 #include <QSize> |
|
24 #include <QSharedPointer> |
|
25 |
|
26 #include <tstaskmonitor.h> |
|
27 |
|
28 class CaNotifier; |
|
29 class TsModelItem; |
|
30 |
|
31 class TsModel : public QAbstractListModel |
|
32 { |
|
33 Q_OBJECT |
|
34 |
|
35 public: |
|
36 TsModel(TsTaskMonitor &applicationSrv, |
|
37 QObject *parent = 0); |
|
38 ~TsModel(); |
|
39 |
|
40 int rowCount(const QModelIndex &parent = QModelIndex()) const; |
|
41 QVariant data(const QModelIndex &index, |
|
42 int role = Qt::DisplayRole) const; |
|
43 // from QAbstractModel |
|
44 virtual bool insertRows(int row, int count, TsModelItem *item, |
|
45 const QModelIndex &parent = QModelIndex()); |
|
46 virtual bool removeRows(int row, int count, |
|
47 const QModelIndex &parent = QModelIndex()); |
|
48 |
|
49 |
|
50 bool moveRows(int oldPosition, int newPosition, |
|
51 const QModelIndex &parent = QModelIndex()); |
|
52 bool updateRows(int row, TsModelItem *item); |
|
53 void fullUpdate(); |
|
54 |
|
55 public slots: |
|
56 void openApplication(const QModelIndex &index); |
|
57 void closeApplication(const QModelIndex &index); |
|
58 void updateApplications(); |
|
59 |
|
60 private: |
|
61 TsModelItem *entry(const QModelIndex &index) const; |
|
62 void getApplications(); |
|
63 |
|
64 private: |
|
65 /* |
|
66 * List containing result |
|
67 */ |
|
68 QList<TsModelItem *> mEntries; |
|
69 |
|
70 TsTaskMonitor &mApplicationService; |
|
71 |
|
72 Q_DISABLE_COPY(TsModel) |
|
73 }; |
|
74 |
|
75 #endif // TSMODEL_H |
|