Changeset View
Changeset View
Standalone View
Standalone View
kcms/notifications/sourcesmodel.cpp
Show All 25 Lines | |||||
26 | #include <QCollator> | 26 | #include <QCollator> | ||
27 | #include <QDir> | 27 | #include <QDir> | ||
28 | #include <QStandardPaths> | 28 | #include <QStandardPaths> | ||
29 | #include <QStringList> | 29 | #include <QStringList> | ||
30 | #include <QRegularExpression> | 30 | #include <QRegularExpression> | ||
31 | 31 | | |||
32 | #include <KConfig> | 32 | #include <KConfig> | ||
33 | #include <KConfigGroup> | 33 | #include <KConfigGroup> | ||
34 | #include <KLocalizedString> | ||||
34 | #include <KSharedConfig> | 35 | #include <KSharedConfig> | ||
35 | #include <KService> | 36 | #include <KService> | ||
36 | #include <KServiceTypeTrader> | 37 | #include <KServiceTypeTrader> | ||
37 | 38 | | |||
38 | #include <algorithm> | 39 | #include <algorithm> | ||
39 | 40 | | |||
40 | SourcesModel::SourcesModel(QObject *parent) : QAbstractItemModel(parent) | 41 | SourcesModel::SourcesModel(QObject *parent) : QAbstractItemModel(parent) | ||
41 | { | 42 | { | ||
▲ Show 20 Lines • Show All 299 Lines • ▼ Show 20 Line(s) | 323 | for (const QString &app : seenApps) { | |||
341 | desktopEntries.append(service->desktopEntryName()); | 342 | desktopEntries.append(service->desktopEntryName()); | ||
342 | } | 343 | } | ||
343 | 344 | | |||
344 | auto sortData = [&collator](const SourceData &a, const SourceData &b) { | 345 | auto sortData = [&collator](const SourceData &a, const SourceData &b) { | ||
345 | return collator.compare(a.display(), b.display()) < 0; | 346 | return collator.compare(a.display(), b.display()) < 0; | ||
346 | }; | 347 | }; | ||
347 | 348 | | |||
348 | std::sort(appsData.begin(), appsData.end(), sortData); | 349 | std::sort(appsData.begin(), appsData.end(), sortData); | ||
350 | | ||||
351 | // Fake entry for configuring non-identifyable applications | ||||
352 | appsData << SourceData{ | ||||
353 | i18n("Other Applications"), | ||||
354 | {}, | ||||
355 | QStringLiteral("applications-other"), | ||||
356 | QString(), | ||||
357 | QStringLiteral("@other"), | ||||
358 | {} | ||||
359 | }; | ||||
360 | | ||||
349 | std::sort(servicesData.begin(), servicesData.end(), sortData); | 361 | std::sort(servicesData.begin(), servicesData.end(), sortData); | ||
350 | 362 | | |||
351 | m_data << appsData << servicesData; | 363 | m_data << appsData << servicesData; | ||
352 | 364 | | |||
353 | endResetModel(); | 365 | endResetModel(); | ||
354 | } | 366 | } |