|
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: caitemmodel_p.h |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef CAITEMMODEL_P_H |
|
19 #define CAITEMMODEL_P_H |
|
20 |
|
21 // System includes |
|
22 #include <QObject> |
|
23 #include <QModelIndex> |
|
24 |
|
25 // User includes |
|
26 #include "caservice.h" |
|
27 #include "caquery.h" |
|
28 #include "caitemmodel.h" |
|
29 #include "caitemmodellist.h" |
|
30 #include "caclient_global.h" |
|
31 |
|
32 // Forward declarations |
|
33 class CaItemModel; |
|
34 CA_CLIENT_TEST_CLASS(TestCaClient) |
|
35 |
|
36 // Class declaration |
|
37 class CaItemModelPrivate: public QObject |
|
38 { |
|
39 |
|
40 Q_OBJECT |
|
41 CA_CLIENT_TEST_FRIEND_CLASS(TestCaClient) |
|
42 |
|
43 public: |
|
44 |
|
45 // Function declarations |
|
46 explicit CaItemModelPrivate(const CaQuery &query, |
|
47 CaItemModel *itemModelPublic); |
|
48 ~CaItemModelPrivate(); |
|
49 int rowCount() const; |
|
50 QModelIndex index(int row); |
|
51 QVariant data(const QModelIndex &modelIndex, int role) const; |
|
52 void setAutoUpdate(bool autoUpdate); |
|
53 void setSort(SortAttribute sortAttribute, Qt::SortOrder sortOrder = |
|
54 Qt::AscendingOrder); |
|
55 void setIconSize(const QSizeF &size); |
|
56 QSizeF getIconSize() const; |
|
57 QModelIndex root(); |
|
58 QSharedPointer<CaEntry> entry(const QModelIndex &modelIndex) const; |
|
59 void setSecondLineVisibility(bool secondLineVisibility); |
|
60 bool secondLineVisibility() const; |
|
61 QVariant displayRole(const CaEntry* entry) const; |
|
62 void setParentId(int parentId); |
|
63 void setFlagsOn(const EntryFlags &onFlags); |
|
64 void setFlagsOff(const EntryFlags &offFlags); |
|
65 bool notifierExists() const; |
|
66 |
|
67 QList<int> getUninstallingEntriesIds(int componentId); |
|
68 void updateProgress(int id, int valueOfProgress); |
|
69 |
|
70 |
|
71 public slots: |
|
72 |
|
73 // Function declarations |
|
74 void updateModel(); |
|
75 |
|
76 private: |
|
77 |
|
78 // Function declarations |
|
79 void updateParentEntry(); |
|
80 void updateItemData(const QSharedPointer<CaEntry> &entry); |
|
81 void addItem(int id); |
|
82 void addItemBlock(const QList<int> &itemsList); |
|
83 void handleAddItems(const QList<int> &itemsList); |
|
84 int itemRow(int id); |
|
85 void removeItem(int id); |
|
86 void removeItems(const QList<int> &itemsList); |
|
87 void updateLayout(); |
|
88 void connectSlots(); |
|
89 void disconnectSlots(); |
|
90 void reconnectSlots(); |
|
91 void emitEmpty(int previousCount); |
|
92 void emitCountChange(int previousCount); |
|
93 |
|
94 private slots: |
|
95 |
|
96 // Function declarations |
|
97 void updateModelItem(const CaEntry &entry, ChangeType changeType); |
|
98 void updateModelContent(int id); |
|
99 |
|
100 private: |
|
101 // data |
|
102 |
|
103 CaItemModel *const m_q; |
|
104 QSharedPointer<CaEntry> mParentEntry; |
|
105 CaQuery mQuery; |
|
106 QSharedPointer<CaService> mService; |
|
107 CaItemModelList mEntries; |
|
108 CaNotifier *mNotifier;//own |
|
109 QSizeF mSize; |
|
110 bool mSecondLineVisibility; |
|
111 |
|
112 }; |
|
113 |
|
114 #endif // CAITEMMODEL_P_H |