Changeset View
Changeset View
Standalone View
Standalone View
ksmserver/startup.cpp
Show First 20 Lines • Show All 294 Lines • ▼ Show 20 Line(s) | 293 | if (!dir.exists()) { | |||
---|---|---|---|---|---|
295 | dir.mkpath(QStringLiteral(".")); | 295 | dir.mkpath(QStringLiteral(".")); | ||
296 | 296 | | |||
297 | if (!migrateKDE4Autostart(autostartFolder)) { | 297 | if (!migrateKDE4Autostart(autostartFolder)) { | ||
298 | return; | 298 | return; | ||
299 | } | 299 | } | ||
300 | } | 300 | } | ||
301 | 301 | | |||
302 | const QStringList entries = dir.entryList(QDir::Files); | 302 | const QStringList entries = dir.entryList(QDir::Files); | ||
303 | foreach (const QString &file, entries) { | 303 | for (const QString &file : entries) { | ||
304 | // Don't execute backup files | 304 | // Don't execute backup files | ||
305 | if (!file.endsWith(QLatin1Char('~')) && !file.endsWith(QStringLiteral(".bak")) && | 305 | if (!file.endsWith(QLatin1Char('~')) && !file.endsWith(QStringLiteral(".bak")) && | ||
306 | (file[0] != QLatin1Char('%') || !file.endsWith(QLatin1Char('%'))) && | 306 | (file[0] != QLatin1Char('%') || !file.endsWith(QLatin1Char('%'))) && | ||
307 | (file[0] != QLatin1Char('#') || !file.endsWith(QLatin1Char('#')))) | 307 | (file[0] != QLatin1Char('#') || !file.endsWith(QLatin1Char('#')))) | ||
308 | { | 308 | { | ||
309 | const QString fullPath = dir.absolutePath() + QLatin1Char('/') + file; | 309 | const QString fullPath = dir.absolutePath() + QLatin1Char('/') + file; | ||
310 | 310 | | |||
311 | qCInfo(KSMSERVER) << "Starting autostart script " << fullPath; | 311 | qCInfo(KSMSERVER) << "Starting autostart script " << fullPath; | ||
Show All 21 Lines | 324 | { | |||
333 | const QString oldKdeGlobals = migration.locateLocal("config", QStringLiteral("kdeglobals")); | 333 | const QString oldKdeGlobals = migration.locateLocal("config", QStringLiteral("kdeglobals")); | ||
334 | if (!oldKdeGlobals.isEmpty()) { | 334 | if (!oldKdeGlobals.isEmpty()) { | ||
335 | oldAutostart = KConfig(oldKdeGlobals).group("Paths").readEntry("Autostart", oldAutostart); | 335 | oldAutostart = KConfig(oldKdeGlobals).group("Paths").readEntry("Autostart", oldAutostart); | ||
336 | } | 336 | } | ||
337 | 337 | | |||
338 | const QDir oldFolder(oldAutostart); | 338 | const QDir oldFolder(oldAutostart); | ||
339 | qCDebug(KSMSERVER) << "Copying autostart files from" << oldFolder.path(); | 339 | qCDebug(KSMSERVER) << "Copying autostart files from" << oldFolder.path(); | ||
340 | const QStringList entries = oldFolder.entryList(QDir::Files); | 340 | const QStringList entries = oldFolder.entryList(QDir::Files); | ||
341 | foreach (const QString &file, entries) { | 341 | for (const QString &file : entries) { | ||
342 | const QString src = oldFolder.absolutePath() + QLatin1Char('/') + file; | 342 | const QString src = oldFolder.absolutePath() + QLatin1Char('/') + file; | ||
343 | const QString dest = autostartFolder + QLatin1Char('/') + file; | 343 | const QString dest = autostartFolder + QLatin1Char('/') + file; | ||
344 | QFileInfo info(src); | 344 | QFileInfo info(src); | ||
345 | bool success; | 345 | bool success; | ||
346 | if (info.isSymLink()) { | 346 | if (info.isSymLink()) { | ||
347 | // This will only work with absolute symlink targets | 347 | // This will only work with absolute symlink targets | ||
348 | success = QFile::link(info.symLinkTarget(), dest); | 348 | success = QFile::link(info.symLinkTarget(), dest); | ||
349 | } else { | 349 | } else { | ||
▲ Show 20 Lines • Show All 44 Lines • Show Last 20 Lines |