1
/* * This file is part of Maliit framework *
3
* Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
6
* Contact: maliit-discuss@lists.maliit.org
8
* This library is free software; you can redistribute it and/or
9
* modify it under the terms of the GNU Lesser General Public
10
* License version 2.1 as published by the Free Software Foundation
11
* and appearing in the file LICENSE.LGPL included in the packaging
17
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
18
#include "mimdummyinputcontext.h"
21
#include "connectionfactory.h"
22
#include "mimserver.h"
23
#include "mimstandaloneserverlogic.h"
25
#include <QApplication>
28
#include <QCommonStyle>
30
#if QT_VERSION <= QT_VERSION_CHECK(5, 0, 0)
35
void disableMInputContextPlugin()
37
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
38
// none is a special value for QT_IM_MODULE, which disables loading of any
39
// input method module in Qt 5.
40
setenv("QT_IM_MODULE", "none", true);
42
// prevent loading of minputcontext because we don't need it and starting
43
// it might trigger starting of this service by the d-bus. not nice if that is
44
// already happening :)
45
if (-1 == unsetenv("QT_IM_MODULE")) {
46
qWarning("meego-im-uiserver: unable to unset QT_IM_MODULE.");
52
int main(int argc, char **argv)
54
// QT_IM_MODULE, MApplication and QtMaemo5Style all try to load
55
// MInputContext, which is fine for the application. For the maliit
56
// server, we absolutely need to prevent that.
57
disableMInputContextPlugin();
59
QApplication app(argc, argv);
60
QSharedPointer<MImAbstractServerLogic> serverLogic(new MImStandaloneServerLogic);
62
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
63
// Set a dummy input context so that Qt does not create a default input
64
// context (qimsw-multi) which is expensive and not required by
66
app.setInputContext(new MIMDummyInputContext);
69
QSharedPointer<MInputContextConnection> icConnection(Maliit::DBus::createInputContextConnectionWithDynamicAddress());
72
MImServer::configureSettings(MImServer::PersistentSettings);
73
MImServer imServer(serverLogic, icConnection);