Changeset View
Changeset View
Standalone View
Standalone View
startkde/plasma-session/shutdown.cpp
Show First 20 Lines • Show All 70 Lines • ▼ Show 20 Line(s) | 65 | void Shutdown::logoutComplete() { | |||
---|---|---|---|---|---|
71 | } else { //logout | 71 | } else { //logout | ||
72 | qApp->quit(); | 72 | qApp->quit(); | ||
73 | } | 73 | } | ||
74 | } | 74 | } | ||
75 | 75 | | |||
76 | void Shutdown::runShutdownScripts() | 76 | void Shutdown::runShutdownScripts() | ||
77 | { | 77 | { | ||
78 | const QStringList shutdownFolders = QStandardPaths::locateAll(QStandardPaths::GenericConfigLocation, QStringLiteral("plasma-workspace/shutdown"), QStandardPaths::LocateDirectory); | 78 | const QStringList shutdownFolders = QStandardPaths::locateAll(QStandardPaths::GenericConfigLocation, QStringLiteral("plasma-workspace/shutdown"), QStandardPaths::LocateDirectory); | ||
79 | foreach (const QString &shutDownFolder, shutdownFolders) { | 79 | for (const QString &shutDownFolder : shutdownFolders) { | ||
80 | QDir dir(shutDownFolder); | 80 | QDir dir(shutDownFolder); | ||
81 | 81 | | |||
82 | const QStringList entries = dir.entryList(QDir::Files); | 82 | const QStringList entries = dir.entryList(QDir::Files); | ||
83 | foreach (const QString &file, entries) { | 83 | for (const QString &file : entries) { | ||
84 | // Don't execute backup files | 84 | // Don't execute backup files | ||
85 | if (!file.endsWith(QLatin1Char('~')) && !file.endsWith(QLatin1String(".bak")) && | 85 | if (!file.endsWith(QLatin1Char('~')) && !file.endsWith(QLatin1String(".bak")) && | ||
86 | (file[0] != QLatin1Char('%') || !file.endsWith(QLatin1Char('%'))) && | 86 | (file[0] != QLatin1Char('%') || !file.endsWith(QLatin1Char('%'))) && | ||
87 | (file[0] != QLatin1Char('#') || !file.endsWith(QLatin1Char('#')))) | 87 | (file[0] != QLatin1Char('#') || !file.endsWith(QLatin1Char('#')))) | ||
88 | { | 88 | { | ||
89 | const QString fullPath = dir.absolutePath() + QLatin1Char('/') + file; | 89 | const QString fullPath = dir.absolutePath() + QLatin1Char('/') + file; | ||
90 | 90 | | |||
91 | qCDebug(PLASMA_SESSION) << "running shutdown script" << fullPath; | 91 | qCDebug(PLASMA_SESSION) << "running shutdown script" << fullPath; | ||
92 | QProcess::execute(fullPath, QStringList()); | 92 | QProcess::execute(fullPath, QStringList()); | ||
93 | } | 93 | } | ||
94 | } | 94 | } | ||
95 | } | 95 | } | ||
96 | } | 96 | } | ||
97 | 97 | |