Changeset View
Changeset View
Standalone View
Standalone View
startkde/plasma-session/autostart.cpp
Show First 20 Lines • Show All 69 Lines • ▼ Show 20 Line(s) | |||||
70 | } | 70 | } | ||
71 | 71 | | |||
72 | void | 72 | void | ||
73 | AutoStart::loadAutoStartList() | 73 | AutoStart::loadAutoStartList() | ||
74 | { | 74 | { | ||
75 | // XDG autostart dirs | 75 | // XDG autostart dirs | ||
76 | 76 | | |||
77 | // Make unique list of relative paths | 77 | // Make unique list of relative paths | ||
78 | QStringList files; | 78 | QHash<QString, QString> files; | ||
79 | QStringList dirs = QStandardPaths::locateAll(QStandardPaths::GenericConfigLocation, QStringLiteral("autostart"), QStandardPaths::LocateDirectory); | 79 | QStringList dirs = QStandardPaths::locateAll(QStandardPaths::GenericConfigLocation, QStringLiteral("autostart"), QStandardPaths::LocateDirectory); | ||
80 | Q_FOREACH (const QString &dir, dirs) { | 80 | Q_FOREACH (const QString &dir, dirs) { | ||
81 | const QStringList fileNames = QDir(dir).entryList(QStringList() << QStringLiteral("*.desktop")); | 81 | const QDir d(dir); | ||
82 | const QStringList fileNames = d.entryList(QStringList() << QStringLiteral("*.desktop")); | ||||
82 | Q_FOREACH (const QString &file, fileNames) { | 83 | Q_FOREACH (const QString &file, fileNames) { | ||
83 | if (!files.contains(file)) { | 84 | if (!files.contains(file)) { | ||
84 | files.append(file); | 85 | files.insert(file, d.absoluteFilePath(file)); | ||
85 | } | 86 | } | ||
86 | } | 87 | } | ||
87 | } | 88 | } | ||
88 | 89 | | |||
89 | for (auto it = files.constBegin(); it != files.constEnd(); ++it) { | 90 | for (auto it = files.constBegin(); it != files.constEnd(); ++it) { | ||
90 | KAutostart config(*it); | 91 | KAutostart config(*it); | ||
91 | if (!config.autostarts(QStringLiteral("KDE"), KAutostart::CheckAll)) { | 92 | if (!config.autostarts(QStringLiteral("KDE"), KAutostart::CheckAll)) { | ||
92 | continue; | 93 | continue; | ||
93 | } | 94 | } | ||
94 | 95 | | |||
95 | const auto file = QStandardPaths::locate(QStandardPaths::GenericConfigLocation, QStringLiteral("autostart/") + *it); | | |||
96 | AutoStartItem item; | 96 | AutoStartItem item; | ||
97 | item.name = extractName(file); | 97 | item.service = *it; | ||
98 | item.service = file; | 98 | item.name = extractName(it.key()); | ||
99 | item.startAfter = config.startAfter(); | 99 | item.startAfter = config.startAfter(); | ||
100 | item.phase = qMax(KAutostart::BaseDesktop, config.startPhase()); | 100 | item.phase = qMax(KAutostart::BaseDesktop, config.startPhase()); | ||
101 | m_startList.append(item); | 101 | m_startList.append(item); | ||
102 | } | 102 | } | ||
103 | } | 103 | } | ||
104 | 104 | | |||
105 | QString | 105 | QString | ||
106 | AutoStart::startService() | 106 | AutoStart::startService() | ||
▲ Show 20 Lines • Show All 50 Lines • Show Last 20 Lines |