1 | /****************************************************************************
|
---|
2 | **
|
---|
3 | ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
---|
4 | ** All rights reserved.
|
---|
5 | ** Contact: Nokia Corporation ([email protected])
|
---|
6 | **
|
---|
7 | ** This file is part of the QtGui module of the Qt Toolkit.
|
---|
8 | **
|
---|
9 | ** $QT_BEGIN_LICENSE:LGPL$
|
---|
10 | ** Commercial Usage
|
---|
11 | ** Licensees holding valid Qt Commercial licenses may use this file in
|
---|
12 | ** accordance with the Qt Commercial License Agreement provided with the
|
---|
13 | ** Software or, alternatively, in accordance with the terms contained in
|
---|
14 | ** a written agreement between you and Nokia.
|
---|
15 | **
|
---|
16 | ** GNU Lesser General Public License Usage
|
---|
17 | ** Alternatively, this file may be used under the terms of the GNU Lesser
|
---|
18 | ** General Public License version 2.1 as published by the Free Software
|
---|
19 | ** Foundation and appearing in the file LICENSE.LGPL included in the
|
---|
20 | ** packaging of this file. Please review the following information to
|
---|
21 | ** ensure the GNU Lesser General Public License version 2.1 requirements
|
---|
22 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
---|
23 | **
|
---|
24 | ** In addition, as a special exception, Nokia gives you certain additional
|
---|
25 | ** rights. These rights are described in the Nokia Qt LGPL Exception
|
---|
26 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
---|
27 | **
|
---|
28 | ** GNU General Public License Usage
|
---|
29 | ** Alternatively, this file may be used under the terms of the GNU
|
---|
30 | ** General Public License version 3.0 as published by the Free Software
|
---|
31 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
---|
32 | ** packaging of this file. Please review the following information to
|
---|
33 | ** ensure the GNU General Public License version 3.0 requirements will be
|
---|
34 | ** met: http://www.gnu.org/copyleft/gpl.html.
|
---|
35 | **
|
---|
36 | ** If you have questions regarding the use of this file, please contact
|
---|
37 | ** Nokia at [email protected].
|
---|
38 | ** $QT_END_LICENSE$
|
---|
39 | **
|
---|
40 | ****************************************************************************/
|
---|
41 |
|
---|
42 | /****************************************************************************
|
---|
43 | **
|
---|
44 | ** Implementation of QInputContextFactory class
|
---|
45 | **
|
---|
46 | ** Copyright (C) 2003-2004 immodule for Qt Project. All rights reserved.
|
---|
47 | **
|
---|
48 | ** This file is written to contribute to Nokia Corporation and/or its subsidiary(-ies) under their own
|
---|
49 | ** license. You may use this file under your Qt license. Following
|
---|
50 | ** description is copied from their original file headers. Contact
|
---|
51 | ** [email protected] if any conditions of this licensing are
|
---|
52 | ** not clear to you.
|
---|
53 | **
|
---|
54 | ****************************************************************************/
|
---|
55 |
|
---|
56 | #include "qinputcontextfactory.h"
|
---|
57 |
|
---|
58 | #ifndef QT_NO_IM
|
---|
59 |
|
---|
60 | #include "qcoreapplication.h"
|
---|
61 | #include "qinputcontext.h"
|
---|
62 | #include "qinputcontextplugin.h"
|
---|
63 |
|
---|
64 | #ifdef Q_WS_X11
|
---|
65 | #include "private/qt_x11_p.h"
|
---|
66 | #include "qximinputcontext_p.h"
|
---|
67 | #endif
|
---|
68 | #ifdef Q_WS_WIN
|
---|
69 | #include "qwininputcontext_p.h"
|
---|
70 | #endif
|
---|
71 | #ifdef Q_WS_MAC
|
---|
72 | #include "qmacinputcontext_p.h"
|
---|
73 | #endif
|
---|
74 | #ifdef Q_WS_S60
|
---|
75 | #include "qcoefepinputcontext_p.h"
|
---|
76 | #include "AknInputLanguageInfo.h"
|
---|
77 | #endif
|
---|
78 |
|
---|
79 | #include "private/qfactoryloader_p.h"
|
---|
80 | #include "qmutex.h"
|
---|
81 |
|
---|
82 | QT_BEGIN_NAMESPACE
|
---|
83 |
|
---|
84 | #ifndef QT_NO_LIBRARY
|
---|
85 | Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
|
---|
86 | (QInputContextFactoryInterface_iid, QLatin1String("/inputmethods")))
|
---|
87 | #endif
|
---|
88 |
|
---|
89 | /*!
|
---|
90 | \class QInputContextFactory
|
---|
91 | \brief The QInputContextFactory class creates QInputContext objects.
|
---|
92 |
|
---|
93 |
|
---|
94 | The input context factory creates a QInputContext object for a
|
---|
95 | given key with QInputContextFactory::create().
|
---|
96 |
|
---|
97 | The input contexts are either built-in or dynamically loaded from
|
---|
98 | an input context plugin (see QInputContextPlugin).
|
---|
99 |
|
---|
100 | keys() returns a list of valid keys. The
|
---|
101 | keys are the names used, for example, to identify and specify
|
---|
102 | input methods for the input method switching mechanism. The names
|
---|
103 | have to be consistent with QInputContext::identifierName(), and
|
---|
104 | may only contain ASCII characters.
|
---|
105 |
|
---|
106 | A key can be used to retrieve the associated input context's
|
---|
107 | supported languages using languages(). You
|
---|
108 | can retrieve the input context's description using
|
---|
109 | description() and finally you can get a user
|
---|
110 | friendly internationalized name of the QInputContext object
|
---|
111 | specified by the key using displayName().
|
---|
112 |
|
---|
113 | \legalese
|
---|
114 | Copyright (C) 2003-2004 immodule for Qt Project. All rights reserved.
|
---|
115 |
|
---|
116 | This file is written to contribute to Nokia Corporation and/or its subsidiary(-ies) under their own
|
---|
117 | license. You may use this file under your Qt license. Following
|
---|
118 | description is copied from their original file headers. Contact
|
---|
119 | [email protected] if any conditions of this licensing are
|
---|
120 | not clear to you.
|
---|
121 | \endlegalese
|
---|
122 |
|
---|
123 | \sa QInputContext, QInputContextPlugin
|
---|
124 | */
|
---|
125 |
|
---|
126 | /*!
|
---|
127 | Creates and returns a QInputContext object for the input context
|
---|
128 | specified by \a key with the given \a parent. Keys are case
|
---|
129 | sensitive.
|
---|
130 |
|
---|
131 | \sa keys()
|
---|
132 | */
|
---|
133 | QInputContext *QInputContextFactory::create( const QString& key, QObject *parent )
|
---|
134 | {
|
---|
135 | QInputContext *result = 0;
|
---|
136 | #if defined(Q_WS_X11) && !defined(QT_NO_XIM)
|
---|
137 | if (key == QLatin1String("xim")) {
|
---|
138 | result = new QXIMInputContext;
|
---|
139 | }
|
---|
140 | #endif
|
---|
141 | #if defined(Q_WS_WIN)
|
---|
142 | if (key == QLatin1String("win")) {
|
---|
143 | result = new QWinInputContext;
|
---|
144 | }
|
---|
145 | #endif
|
---|
146 | #if defined(Q_WS_MAC)
|
---|
147 | if (key == QLatin1String("mac")) {
|
---|
148 | result = new QMacInputContext;
|
---|
149 | }
|
---|
150 | #endif
|
---|
151 | #if defined(Q_WS_S60)
|
---|
152 | if (key == QLatin1String("coefep")) {
|
---|
153 | result = new QCoeFepInputContext;
|
---|
154 | }
|
---|
155 | #endif
|
---|
|
---|