From fd78c4c9e4d905e31618d0f50dfe167e636cdfbf Mon Sep 17 00:00:00 2001
From: Leandro Melo <leandro.melo@nokia.com>
Date: Wed, 15 Sep 2010 16:09:39 +0200
Subject: [PATCH] Generic highlighter: Also look for Kate files using
 kde4-config.

Only kde-config (and the defined paths) was being considered previously.
---
 .../highlightersettings.cpp                   | 24 ++++++++++++-------
 1 file changed, 15 insertions(+), 9 deletions(-)

diff --git a/src/plugins/texteditor/generichighlighter/highlightersettings.cpp b/src/plugins/texteditor/generichighlighter/highlightersettings.cpp
index 1b41888a25d..cf7f99d47c8 100644
--- a/src/plugins/texteditor/generichighlighter/highlightersettings.cpp
+++ b/src/plugins/texteditor/generichighlighter/highlightersettings.cpp
@@ -66,15 +66,21 @@ QString findDefinitionsLocation()
 
     if (definitionsLocation.isEmpty()) {
         // Try kde-config.
-        QProcess process;
-        process.start(QLatin1String("kde-config"), QStringList(QLatin1String("--prefix")));
-        if (process.waitForStarted(5000)) {
-            process.waitForFinished(5000);
-            QString output = QString::fromLocal8Bit(process.readAllStandardOutput());
-            output.remove(QLatin1Char('\n'));
-            dir.setPath(output + kateSyntax);
-            if (dir.exists())
-                definitionsLocation = dir.path();
+        QStringList programs;
+        programs << QLatin1String("kde-config") << QLatin1String("kde4-config");
+        foreach (const QString &program, programs) {
+            QProcess process;
+            process.start(program, QStringList(QLatin1String("--prefix")));
+            if (process.waitForStarted(5000)) {
+                process.waitForFinished(5000);
+                QString output = QString::fromLocal8Bit(process.readAllStandardOutput());
+                output.remove(QLatin1Char('\n'));
+                dir.setPath(output + kateSyntax);
+                if (dir.exists()) {
+                    definitionsLocation = dir.path();
+                    break;
+                }
+            }
         }
     }
 #endif
-- 
GitLab