Changeset View
Changeset View
Standalone View
Standalone View
ksmserver/shutdown.cpp
Show First 20 Lines • Show All 55 Lines • ▼ Show 20 Line(s) | |||||
56 | void Shutdown::logoutComplete() { | 56 | void Shutdown::logoutComplete() { | ||
57 | runShutdownScripts(); | 57 | runShutdownScripts(); | ||
58 | KDisplayManager().shutdown( m_shutdownType, KWorkSpace::ShutdownModeDefault); | 58 | KDisplayManager().shutdown( m_shutdownType, KWorkSpace::ShutdownModeDefault); | ||
59 | } | 59 | } | ||
60 | 60 | | |||
61 | void Shutdown::runShutdownScripts() | 61 | void Shutdown::runShutdownScripts() | ||
62 | { | 62 | { | ||
63 | const QStringList shutdownFolders = QStandardPaths::locateAll(QStandardPaths::GenericConfigLocation, QStringLiteral("plasma-workspace/shutdown"), QStandardPaths::LocateDirectory); | 63 | const QStringList shutdownFolders = QStandardPaths::locateAll(QStandardPaths::GenericConfigLocation, QStringLiteral("plasma-workspace/shutdown"), QStandardPaths::LocateDirectory); | ||
64 | foreach (const QString &shutDownFolder, shutdownFolders) { | 64 | for (const QString &shutDownFolder : shutdownFolders) { | ||
65 | QDir dir(shutDownFolder); | 65 | QDir dir(shutDownFolder); | ||
66 | 66 | | |||
67 | const QStringList entries = dir.entryList(QDir::Files); | 67 | const QStringList entries = dir.entryList(QDir::Files); | ||
68 | foreach (const QString &file, entries) { | 68 | for (const QString &file : entries) { | ||
69 | // Don't execute backup files | 69 | // Don't execute backup files | ||
70 | if (!file.endsWith(QLatin1Char('~')) && !file.endsWith(QStringLiteral(".bak")) && | 70 | if (!file.endsWith(QLatin1Char('~')) && !file.endsWith(QStringLiteral(".bak")) && | ||
71 | (file[0] != QLatin1Char('%') || !file.endsWith(QLatin1Char('%'))) && | 71 | (file[0] != QLatin1Char('%') || !file.endsWith(QLatin1Char('%'))) && | ||
72 | (file[0] != QLatin1Char('#') || !file.endsWith(QLatin1Char('#')))) | 72 | (file[0] != QLatin1Char('#') || !file.endsWith(QLatin1Char('#')))) | ||
73 | { | 73 | { | ||
74 | const QString fullPath = dir.absolutePath() + QLatin1Char('/') + file; | 74 | const QString fullPath = dir.absolutePath() + QLatin1Char('/') + file; | ||
75 | 75 | | |||
76 | qCDebug(KSMSERVER) << "running shutdown script" << fullPath; | 76 | qCDebug(KSMSERVER) << "running shutdown script" << fullPath; | ||
77 | QProcess::execute(fullPath, QStringList()); | 77 | QProcess::execute(fullPath, QStringList()); | ||
78 | } | 78 | } | ||
79 | } | 79 | } | ||
80 | } | 80 | } | ||
81 | } | 81 | } | ||
82 | 82 | |