From 1492cd0eec11ec3e3a1000cc2a60700b0f690dad Mon Sep 17 00:00:00 2001
From: dt <qtc-committer@nokia.com>
Date: Wed, 25 Mar 2009 17:49:54 +0100
Subject: [PATCH] Work around problems with kde 4.2.0 by checking for that
 exact version.

Need to remove that at one point, but having someone report it one day
after we tried to remove this, means not now.
---
 src/plugins/designer/formeditorplugin.cpp | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/src/plugins/designer/formeditorplugin.cpp b/src/plugins/designer/formeditorplugin.cpp
index 41970ae5ae5..d77c4af23b9 100644
--- a/src/plugins/designer/formeditorplugin.cpp
+++ b/src/plugins/designer/formeditorplugin.cpp
@@ -46,6 +46,7 @@
 
 #include <QtCore/QtPlugin>
 #include <QtCore/QDebug>
+#include <QtCore/QProcess>
 
 #ifdef CPP_ENABLED
 #    include <QtGui/QAction>
@@ -100,7 +101,19 @@ bool FormEditorPlugin::initialize(const QStringList &arguments, QString *error)
     m_factory = new FormEditorFactory;
     addObject(m_factory);
 
-    FormEditorW::ensureInitStage(FormEditorW::RegisterPlugins);
+    if (qgetenv("KDE_SESSION_VERSION") == QByteArray("4")) {
+        // KDE 4, possibly dangerous...
+        // KDE 4.2.0 had a nasty bug, which resulted in the File/Open Dialog crashing
+        // so check for that an fully load the plugins
+        QProcess proc;
+        proc.start("kde4-config", QStringList() << "--version");
+        proc.waitForFinished();
+        QString output = proc.readAll();
+        if (output.contains("KDE: 4.2.0"))
+            FormEditorW::ensureInitStage(FormEditorW::FullyInitialized);
+    } else {
+        FormEditorW::ensureInitStage(FormEditorW::RegisterPlugins);
+    }
 
     error->clear();
     return true;
-- 
GitLab