Changeset View
Changeset View
Standalone View
Standalone View
src/services/kservicetypetrader.h
Show First 20 Lines • Show All 181 Lines • ▼ Show 20 Line(s) | 76 | public: | |||
---|---|---|---|---|---|
182 | static T *createInstanceFromQuery(const QString &serviceType, | 182 | static T *createInstanceFromQuery(const QString &serviceType, | ||
183 | QWidget *parentWidget, QObject *parent, const QString &constraint = QString(), | 183 | QWidget *parentWidget, QObject *parent, const QString &constraint = QString(), | ||
184 | const QVariantList &args = QVariantList(), QString *error = nullptr) | 184 | const QVariantList &args = QVariantList(), QString *error = nullptr) | ||
185 | { | 185 | { | ||
186 | const KService::List offers = self()->query(serviceType, constraint); | 186 | const KService::List offers = self()->query(serviceType, constraint); | ||
187 | if (error) { | 187 | if (error) { | ||
188 | error->clear(); | 188 | error->clear(); | ||
189 | } | 189 | } | ||
190 | Q_FOREACH (const KService::Ptr &ptr, offers) { | 190 | for (const KService::Ptr &ptr : offers) { | ||
191 | T *component = ptr->template createInstance<T>(parentWidget, parent, args, error); | 191 | T *component = ptr->template createInstance<T>(parentWidget, parent, args, error); | ||
192 | if (component) { | 192 | if (component) { | ||
193 | return component; | 193 | return component; | ||
194 | } | 194 | } | ||
195 | } | 195 | } | ||
196 | if (error && error->isEmpty()) { | 196 | if (error && error->isEmpty()) { | ||
197 | *error = QCoreApplication::translate("", "No service matching the requirements was found"); | 197 | *error = QCoreApplication::translate("", "No service matching the requirements was found"); | ||
198 | } | 198 | } | ||
Show All 27 Lines |