equal
deleted
inserted
replaced
27 |
27 |
28 #include <canotifier.h> |
28 #include <canotifier.h> |
29 #include <canotifierfilter.h> |
29 #include <canotifierfilter.h> |
30 #include <hsactivitydbclientinterface.h> |
30 #include <hsactivitydbclientinterface.h> |
31 |
31 |
|
32 #ifdef Q_OS_SYMBIAN |
|
33 #include <XQSettingsManager> |
|
34 |
|
35 const int TSDeviceDialogUid = 0x2002677F; |
|
36 const int ItemsLimit = 0x00000001; |
|
37 #endif |
|
38 |
32 const char entryTypeKeyword[] = "application"; |
39 const char entryTypeKeyword[] = "application"; |
33 const char applicationUidKeyword [] = "application:uid"; |
40 const char applicationUidKeyword [] = "application:uid"; |
34 const int maxItems(10); |
41 const int maxItems(10); |
35 /*! |
42 /*! |
36 \class TsModel |
43 \class TsModel |
47 QAbstractListModel(parent), |
54 QAbstractListModel(parent), |
48 mEntries(), |
55 mEntries(), |
49 mApplicationService(applicationSrv), |
56 mApplicationService(applicationSrv), |
50 mActivityService(activitySrv), |
57 mActivityService(activitySrv), |
51 mNotifier(NULL), |
58 mNotifier(NULL), |
52 mSize(240, 240) |
59 mSize(240, 240), |
|
60 mMaxItems(maxItems) |
53 { |
61 { |
54 // creating query |
62 // creating query |
55 mQuery.setEntryRoles(ItemEntryRole); |
63 mQuery.setEntryRoles(ItemEntryRole); |
56 mQuery.addEntryTypeName(entryTypeKeyword); |
64 mQuery.addEntryTypeName(entryTypeKeyword); |
57 mQuery.setFlagsOn(VisibleEntryFlag); |
65 mQuery.setFlagsOn(VisibleEntryFlag); |
66 connect(mNotifier, SIGNAL(entryChanged(CaEntry,ChangeType)), this, SLOT(entryChanged(CaEntry, ChangeType))); |
74 connect(mNotifier, SIGNAL(entryChanged(CaEntry,ChangeType)), this, SLOT(entryChanged(CaEntry, ChangeType))); |
67 connect(mNotifier, SIGNAL(entryTouched(int)), this, SLOT(updateModel())); |
75 connect(mNotifier, SIGNAL(entryTouched(int)), this, SLOT(updateModel())); |
68 if (mQuery.parentId() > 0) { |
76 if (mQuery.parentId() > 0) { |
69 connect(mNotifier, SIGNAL(groupContentChanged(int)), this, SLOT(updateModel())); |
77 connect(mNotifier, SIGNAL(groupContentChanged(int)), this, SLOT(updateModel())); |
70 } |
78 } |
|
79 |
|
80 #ifdef Q_OS_SYMBIAN |
|
81 XQSettingsManager *crManager = new XQSettingsManager; |
|
82 XQCentralRepositorySettingsKey itemsNumberKey(TSDeviceDialogUid, ItemsLimit); |
|
83 QVariant itemsNumberVariant = crManager->readItemValue(itemsNumberKey, XQSettingsManager::TypeInt); |
|
84 if (!itemsNumberVariant.isNull()) { |
|
85 int number = itemsNumberVariant.toInt(); |
|
86 if (number > 0) { |
|
87 mMaxItems = number; |
|
88 } |
|
89 } |
|
90 #endif |
71 } |
91 } |
72 |
92 |
73 /*! |
93 /*! |
74 Destructor |
94 Destructor |
75 */ |
95 */ |
107 \retval maximum data count |
127 \retval maximum data count |
108 */ |
128 */ |
109 |
129 |
110 int TsModel::maxRowCount()const |
130 int TsModel::maxRowCount()const |
111 { |
131 { |
112 return maxItems; |
132 return mMaxItems; |
113 } |
133 } |
114 |
134 |
115 /*! |
135 /*! |
116 Activate one of model entries |
136 Activate one of model entries |
117 */ |
137 */ |
162 //CA entry ownership is transfered to model item |
182 //CA entry ownership is transfered to model item |
163 entry = new TsEntryModelItem(mApplicationService, application, mSize); |
183 entry = new TsEntryModelItem(mApplicationService, application, mSize); |
164 if (entry) { |
184 if (entry) { |
165 //add running application filtering |
185 //add running application filtering |
166 if (entry->data(TsDataRoles::Closable).toBool() && //running application filtering |
186 if (entry->data(TsDataRoles::Closable).toBool() && //running application filtering |
167 entry->data(TsDataRoles::Visible).toBool() && //visible applications filtering |
187 entry->data(TsDataRoles::Visible).toBool()) { //visible applications filtering |
168 maxRowCount() > mEntries.count()) { //maximum model size check |
|
169 mEntries.append(entry); |
188 mEntries.append(entry); |
170 } else { |
189 } else { |
171 delete entry; |
190 delete entry; |
172 } |
191 } |
173 |
|
174 } |
192 } |
175 } |
193 } |
176 } |
194 } |
177 |
195 |
178 /*! |
196 /*! |
186 QMetaObject::invokeMethod(&mActivityService, "activitiesList", Q_RETURN_ARG(QList<QVariantHash>, activities)); |
204 QMetaObject::invokeMethod(&mActivityService, "activitiesList", Q_RETURN_ARG(QList<QVariantHash>, activities)); |
187 foreach(QVariantHash activity, activities) { |
205 foreach(QVariantHash activity, activities) { |
188 prepareActivityEntry(activity); |
206 prepareActivityEntry(activity); |
189 entry = new TsActivityModelItem(*this, mActivityService, activity); |
207 entry = new TsActivityModelItem(*this, mActivityService, activity); |
190 if (entry) { |
208 if (entry) { |
191 if (entry->data(TsDataRoles::Visible).toBool() && //visible activity filtering |
209 if (maxRowCount() <= mEntries.count()) { |
192 maxRowCount() > mEntries.count()) { //maximum model size check |
210 break; |
|
211 } |
|
212 if (entry->data(TsDataRoles::Visible).toBool()) { //visible activity filtering |
193 mEntries.append(entry); |
213 mEntries.append(entry); |
194 } else { |
214 } else { |
195 delete entry; |
215 delete entry; |
196 } |
216 } |
197 } |
217 } |