aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRohan Garg <rohangarg@kubuntu.org>2012-08-31 09:51:11 (GMT)
committerRohan Garg <rohangarg@kubuntu.org>2012-08-31 09:59:42 (GMT)
commita651fff01cfcef8874c5ddcf7a080467edc49d16 (patch)
treec8e0dfcbb538170071ccba9bf4a9551cf819fe80
parente44b48c6fa1f9875f1189f495b9981ac92a1eb36 (diff)
Make sure the plasma desktop scripts are sorted in the correct order
Instead of sorting the scripts according to their absolute paths, which would cause scripts installed by packages to always end at the top, scripts should be sorted by their relative path i.e. plasma scripts from each directory that occurs in the path should be sorted and then merged together to form a super list REVIEWED BY: Marco Martin
-rw-r--r--libs/plasmagenericshell/scripting/scriptengine.cpp20
1 files changed, 18 insertions, 2 deletions
diff --git a/libs/plasmagenericshell/scripting/scriptengine.cpp b/libs/plasmagenericshell/scripting/scriptengine.cpp
index 777a56d..7810ab4 100644
--- a/libs/plasmagenericshell/scripting/scriptengine.cpp
+++ b/libs/plasmagenericshell/scripting/scriptengine.cpp
@@ -676,8 +676,24 @@ QStringList ScriptEngine::pendingUpdateScripts()
QStringList ScriptEngine::defaultLayoutScripts()
{
const QString appName = KGlobal::activeComponent().aboutData()->appName();
- QStringList scripts = KGlobal::dirs()->findAllResources("data", appName + "/init/*.js");
- scripts.sort();
+ QStringList appNameDirs = KGlobal::dirs()->findDirs("data", appName);
+ QStringList scripts;
+ QDir appDir;
+ QFileInfoList scriptList;
+
+ foreach (const QString &appNameDir, appNameDirs) {
+ appDir.setPath(appNameDir + QLatin1String("init/"));
+ if (appDir.exists()) {
+ scriptList = appDir.entryInfoList(QStringList("*.js"),
+ QDir::NoFilter,
+ QDir::Name);
+ foreach (const QFileInfo &script, scriptList) {
+ if (script.exists()) {
+ scripts.append(script.absoluteFilePath());
+ }
+ }
+ }
+ }
QStringList scriptPaths;