summaryrefslogtreecommitdiffstats
path: root/src/platformsupport/inputcontext/qplatforminputcontextfactory_qpa.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@nokia.com>2011-09-08 22:09:33 +0200
committerLars Knoll <lars.knoll@nokia.com>2011-09-08 22:12:46 +0200
commit970df646691f1fd1f710156af7ddf10abd72df07 (patch)
tree660758c46ab3346c17d0e9f5c27175b3056d0397 /src/platformsupport/inputcontext/qplatforminputcontextfactory_qpa.cpp
parent2cdd7886bf424a4986cfa1e08462cf9689c4c3d3 (diff)
Make inputcontext plugin loading a bit more generic
Add a create() method to the inputcontext factory that takes no arguments. Add a virtual isValid() to QPlatformInputContext to determine whether it actually works. Remove IBUS dependencies in the xcb code so that it can also load other plugins. Change-Id: I6345a845f48fd4b3cacf6d8652711b16835a235c Reviewed-on: http://codereview.qt-project.org/4487 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Diffstat (limited to 'src/platformsupport/inputcontext/qplatforminputcontextfactory_qpa.cpp')
-rw-r--r--src/platformsupport/inputcontext/qplatforminputcontextfactory_qpa.cpp31
1 files changed, 29 insertions, 2 deletions
diff --git a/src/platformsupport/inputcontext/qplatforminputcontextfactory_qpa.cpp b/src/platformsupport/inputcontext/qplatforminputcontextfactory_qpa.cpp
index 255ed71fe2..494431e624 100644
--- a/src/platformsupport/inputcontext/qplatforminputcontextfactory_qpa.cpp
+++ b/src/platformsupport/inputcontext/qplatforminputcontextfactory_qpa.cpp
@@ -46,14 +46,13 @@
#include "qguiapplication.h"
#include "qdebug.h"
+#include <stdlib.h>
QT_BEGIN_NAMESPACE
#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS)
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
(QPlatformInputContextFactoryInterface_iid, QLatin1String("/platforminputcontexts"), Qt::CaseInsensitive))
-Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader,
- (QPlatformInputContextFactoryInterface_iid, QLatin1String(""), Qt::CaseInsensitive))
#endif
QStringList QPlatformInputContextFactory::keys()
@@ -79,5 +78,33 @@ QPlatformInputContext *QPlatformInputContextFactory::create(const QString& key)
return ret;
}
+QPlatformInputContext *QPlatformInputContextFactory::create()
+{
+ QPlatformInputContext *ic = 0;
+
+ QString icString = QString::fromLatin1(getenv("QT_IM_MODULE"));
+ ic = create(icString);
+ qDebug() << ic << ic->isValid();
+ if (ic && ic->isValid())
+ return ic;
+
+ delete ic;
+ ic = 0;
+
+ QStringList k = keys();
+ for (int i = 0; i < k.size(); ++i) {
+ if (k.at(i) == icString)
+ continue;
+ ic = create(k.at(i));
+ if (ic && ic->isValid())
+ return ic;
+ delete ic;
+ ic = 0;
+ }
+
+ return 0;
+}
+
+
QT_END_NAMESPACE