Changeset View
Changeset View
Standalone View
Standalone View
applets/kicker/plugin/recentusagemodel.cpp
Show First 20 Lines • Show All 166 Lines • ▼ Show 20 Line(s) | 156 | { | |||
---|---|---|---|---|---|
167 | } | 167 | } | ||
168 | } | 168 | } | ||
169 | 169 | | |||
170 | QVariant RecentUsageModel::appData(const QString &resource, int role) const | 170 | QVariant RecentUsageModel::appData(const QString &resource, int role) const | ||
171 | { | 171 | { | ||
172 | const QString storageId = resource.section(':', 1); | 172 | const QString storageId = resource.section(':', 1); | ||
173 | KService::Ptr service = KService::serviceByStorageId(storageId); | 173 | KService::Ptr service = KService::serviceByStorageId(storageId); | ||
174 | 174 | | |||
175 | if (!service || !service->isApplication()) { | 175 | QStringList allowedTypes({ QLatin1String("Service"), QLatin1String("Application") }); | ||
176 | | ||||
177 | if (!service || !allowedTypes.contains(service->property(QLatin1String("Type")).toString()) | ||||
178 | || service->exec().isEmpty()) { | ||||
hein: Please check both the type and exec(). | |||||
176 | return QVariant(); | 179 | return QVariant(); | ||
177 | } | 180 | } | ||
178 | 181 | | |||
179 | if (role == Qt::DisplayRole) { | 182 | if (role == Qt::DisplayRole) { | ||
180 | AppsModel *parentModel = qobject_cast<AppsModel *>(QObject::parent()); | 183 | AppsModel *parentModel = qobject_cast<AppsModel *>(QObject::parent()); | ||
181 | 184 | | |||
182 | if (parentModel) { | 185 | if (parentModel) { | ||
183 | return AppEntry::nameFromService(service, | 186 | return AppEntry::nameFromService(service, | ||
▲ Show 20 Lines • Show All 243 Lines • Show Last 20 Lines |
Please check both the type and exec().