remove the plugin support for QInputContext

This will be handled through the lighthouse plugin
instead.
bb10
Lars Knoll 2011-06-21 16:00:36 +02:00
parent e1293b49e3
commit 4363d836f6
25 changed files with 3 additions and 1328 deletions

View File

@ -1,14 +0,0 @@
TARGET = qimsw-multi
load(qt_plugin)
CONFIG += warn_on
QT += widgets
DESTDIR = $$QT.gui.plugins/inputmethods
HEADERS += qmultiinputcontext.h \
qmultiinputcontextplugin.h
SOURCES += qmultiinputcontext.cpp \
qmultiinputcontextplugin.cpp
target.path += $$[QT_INSTALL_PLUGINS]/inputmethods
INSTALLS += target

View File

@ -1,212 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the plugins of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this
** file. Please review the following information to ensure the GNU Lesser
** General Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU General
** Public License version 3.0 as published by the Free Software Foundation
** and appearing in the file LICENSE.GPL included in the packaging of this
** file. Please review the following information to ensure the GNU General
** Public License version 3.0 requirements will be met:
** http://www.gnu.org/copyleft/gpl.html.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
/****************************************************************************
**
** Implementation of QMultiInputContext class
**
** Copyright (C) 2004 immodule for Qt Project. All rights reserved.
**
** This file is written to contribute to Nokia Corporation and/or its subsidiary(-ies) under their own
** licence. You may use this file under your Qt license. Following
** description is copied from their original file headers. Contact
** immodule-qt@freedesktop.org if any conditions of this licensing are
** not clear to you.
**
****************************************************************************/
#ifndef QT_NO_IM
#include "qmultiinputcontext.h"
#include <qinputcontextfactory.h>
#include <qstringlist.h>
#include <qaction.h>
#include <qsettings.h>
#include <qmenu.h>
#include <stdlib.h>
QT_BEGIN_NAMESPACE
QMultiInputContext::QMultiInputContext()
: QInputContext(), current(-1)
{
keys = QInputContextFactory::keys();
for (int i = keys.size()-1; i >= 0; --i)
if (keys.at(i).contains(QLatin1String("imsw")))
keys.removeAt(i);
QString def = QLatin1String(getenv("QT4_IM_MODULE"));
if (def.isEmpty())
def = QLatin1String(getenv("QT_IM_MODULE"));
if (def.isEmpty()) {
QSettings settings(QSettings::UserScope, QLatin1String("Trolltech"));
settings.beginGroup(QLatin1String("Qt"));
def = settings.value(QLatin1String("DefaultInputMethod"), QLatin1String("xim")).toString();
}
current = keys.indexOf(def);
if (current < 0)
current = 0;
menu = new QMenu(tr("Select IM"));
separator = new QAction(this);
separator->setSeparator(true);
QActionGroup *group = new QActionGroup(this);
for (int i = 0; i < keys.size(); ++i) {
slaves.append(0);
const QString key = keys.at(i);
QAction *a = menu->addAction(QInputContextFactory::displayName(key));
a->setData(key);
a->setCheckable(true);
group->addAction(a);
if (i == current) {
slaves.replace(current, QInputContextFactory::create(key, this));
a->setChecked(true);
}
}
connect(group, SIGNAL(triggered(QAction*)), this, SLOT(changeSlave(QAction*)));
}
QMultiInputContext::~QMultiInputContext()
{
delete menu;
}
QString QMultiInputContext::identifierName()
{
return (slave()) ? slave()->identifierName() : QLatin1String("");
}
QString QMultiInputContext::language()
{
return (slave()) ? slave()->language() : QLatin1String("");
}
#if defined(Q_WS_X11)
bool QMultiInputContext::x11FilterEvent(QWidget *keywidget, XEvent *event)
{
return (slave()) ? slave()->x11FilterEvent(keywidget, event) : false;
}
#endif // Q_WS_X11
bool QMultiInputContext::filterEvent(const QEvent *event)
{
return (slave()) ? slave()->filterEvent(event) : false;
}
void QMultiInputContext::reset()
{
if (slave())
slave()->reset();
}
void QMultiInputContext::update()
{
if (slave())
slave()->update();
}
void QMultiInputContext::mouseHandler(int x, QMouseEvent *event)
{
if (slave())
slave()->mouseHandler(x, event);
}
QFont QMultiInputContext::font() const
{
return (slave()) ? slave()->font() : QInputContext::font();
}
void QMultiInputContext::setFocusWidget(QWidget *w)
{
QInputContext::setFocusWidget(w);
if (slave())
slave()->setFocusWidget(w);
}
QWidget *QMultiInputContext::focusWidget() const
{
return QInputContext::focusWidget();
}
void QMultiInputContext::widgetDestroyed(QWidget *w)
{
if (slave())
slave()->widgetDestroyed(w);
}
bool QMultiInputContext::isComposing() const
{
return (slave()) ? slave()->isComposing() : false;
}
QList<QAction *> QMultiInputContext::actions()
{
QList<QAction *> a = slave()->actions();
a.append(separator);
a.append(menu->menuAction());
return a;
}
void QMultiInputContext::changeSlave(QAction *a)
{
for (int i = 0; i < slaves.size(); ++i) {
if (keys.at(i) == a->data().toString()) {
if (slaves.at(i) == 0)
slaves.replace(i, QInputContextFactory::create(keys.at(i), this));
QInputContext *qic = slaves.at(current);
QWidget *oldWidget = qic->focusWidget();
qic->reset();
qic->setFocusWidget(0);
current = i;
qic = slaves.at(current);
qic->setFocusWidget(oldWidget);
return;
}
}
}
QT_END_NAMESPACE
#endif // QT_NO_IM

View File

@ -1,117 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the plugins of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this
** file. Please review the following information to ensure the GNU Lesser
** General Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU General
** Public License version 3.0 as published by the Free Software Foundation
** and appearing in the file LICENSE.GPL included in the packaging of this
** file. Please review the following information to ensure the GNU General
** Public License version 3.0 requirements will be met:
** http://www.gnu.org/copyleft/gpl.html.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
/****************************************************************************
**
** Definition of QMultiInputContext class
**
** Copyright (C) 2004 immodule for Qt Project. All rights reserved.
**
** This file is written to contribute to Nokia Corporation and/or its subsidiary(-ies) under their own
** licence. You may use this file under your Qt license. Following
** description is copied from their original file headers. Contact
** immodule-qt@freedesktop.org if any conditions of this licensing are
** not clear to you.
**
****************************************************************************/
#ifndef QMULTIINPUTCONTEXT_H
#define QMULTIINPUTCONTEXT_H
#ifndef QT_NO_IM
#include <QtWidgets/qwidget.h>
#include <QtWidgets/qinputcontext.h>
#include <QtCore/qstring.h>
#include <QtCore/qnamespace.h>
#include <QtCore/qmap.h>
#include <QtCore/qpointer.h>
#include <QtCore/qlist.h>
QT_BEGIN_NAMESPACE
class QMultiInputContext : public QInputContext
{
Q_OBJECT
public:
QMultiInputContext();
~QMultiInputContext();
QString identifierName();
QString language();
#if defined(Q_WS_X11)
bool x11FilterEvent( QWidget *keywidget, XEvent *event );
#endif // Q_WS_X11
bool filterEvent( const QEvent *event );
void reset();
void update();
void mouseHandler( int x, QMouseEvent *event );
QFont font() const;
bool isComposing() const;
QList<QAction *> actions();
QWidget *focusWidget() const;
void setFocusWidget(QWidget *w);
void widgetDestroyed( QWidget *w );
QInputContext *slave() { return slaves.at(current); }
const QInputContext *slave() const { return slaves.at(current); }
protected Q_SLOTS:
void changeSlave(QAction *);
private:
void *unused;
int current;
QList<QInputContext *> slaves;
QMenu *menu;
QAction *separator;
QStringList keys;
};
#endif // Q_NO_IM
QT_END_NAMESPACE
#endif // QMULTIINPUTCONTEXT_H

View File

@ -1,111 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the plugins of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this
** file. Please review the following information to ensure the GNU Lesser
** General Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU General
** Public License version 3.0 as published by the Free Software Foundation
** and appearing in the file LICENSE.GPL included in the packaging of this
** file. Please review the following information to ensure the GNU General
** Public License version 3.0 requirements will be met:
** http://www.gnu.org/copyleft/gpl.html.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
/****************************************************************************
**
** Implementation of QMultiInputContextPlugin class
**
** Copyright (C) 2004 immodule for Qt Project. All rights reserved.
**
** This file is written to contribute to Nokia Corporation and/or its subsidiary(-ies) under their own
** license. You may use this file under your Qt license. Following
** description is copied from their original file headers. Contact
** immodule-qt@freedesktop.org if any conditions of this licensing are
** not clear to you.
**
****************************************************************************/
#ifndef QT_NO_IM
#include "qmultiinputcontext.h"
#include "qmultiinputcontextplugin.h"
#include <qinputcontextplugin.h>
#include <qstringlist.h>
QT_BEGIN_NAMESPACE
QMultiInputContextPlugin::QMultiInputContextPlugin()
{
}
QMultiInputContextPlugin::~QMultiInputContextPlugin()
{
}
QStringList QMultiInputContextPlugin::keys() const
{
// input method switcher should named with "imsw-" prefix to
// prevent to be listed in ordinary input method list.
return QStringList( QLatin1String("imsw-multi") );
}
QInputContext *QMultiInputContextPlugin::create( const QString &key )
{
if (key != QLatin1String("imsw-multi"))
return 0;
return new QMultiInputContext;
}
QStringList QMultiInputContextPlugin::languages( const QString & )
{
return QStringList();
}
QString QMultiInputContextPlugin::displayName( const QString &key )
{
if (key != QLatin1String("imsw-multi"))
return QString();
return tr( "Multiple input method switcher" );
}
QString QMultiInputContextPlugin::description( const QString &key )
{
if (key != QLatin1String("imsw-multi"))
return QString();
return tr( "Multiple input method switcher that uses the context menu of the text widgets" );
}
Q_EXPORT_STATIC_PLUGIN(QMultiInputContextPlugin)
Q_EXPORT_PLUGIN2(qimsw_multi, QMultiInputContextPlugin)
QT_END_NAMESPACE
#endif

View File

@ -1,85 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the plugins of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this
** file. Please review the following information to ensure the GNU Lesser
** General Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU General
** Public License version 3.0 as published by the Free Software Foundation
** and appearing in the file LICENSE.GPL included in the packaging of this
** file. Please review the following information to ensure the GNU General
** Public License version 3.0 requirements will be met:
** http://www.gnu.org/copyleft/gpl.html.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
/****************************************************************************
**
** Definition of QMultiInputContextPlugin class
**
** Copyright (C) 2004 immodule for Qt Project. All rights reserved.
**
** This file is written to contribute to Nokia Corporation and/or its subsidiary(-ies) under their own
** license. You may use this file under your Qt license. Following
** description is copied from their original file headers. Contact
** immodule-qt@freedesktop.org if any conditions of this licensing are
** not clear to you.
**
****************************************************************************/
#ifndef QMULTIINPUTCONTEXTPLUGIN_H
#define QMULTIINPUTCONTEXTPLUGIN_H
#ifndef QT_NO_IM
#include "qmultiinputcontext.h"
#include <QtWidgets/qinputcontextplugin.h>
#include <QtCore/qstringlist.h>
QT_BEGIN_NAMESPACE
class QMultiInputContextPlugin : public QInputContextPlugin
{
Q_OBJECT
public:
QMultiInputContextPlugin();
~QMultiInputContextPlugin();
QStringList keys() const;
QInputContext *create( const QString &key );
QStringList languages( const QString &key );
QString displayName( const QString &key );
QString description( const QString &key );
};
#endif // QT_NO_IM
QT_END_NAMESPACE
#endif // QMULTIINPUTCONTEXTPLUGIN_H

View File

@ -1,3 +0,0 @@
TEMPLATE = subdirs
SUBDIRS = imsw-multi

View File

@ -7,7 +7,6 @@ unix:!symbian {
SUBDIRS *= codecs
}
!contains(QT_CONFIG, no-gui): SUBDIRS *= imageformats
!win32:!embedded:!mac:!symbian:SUBDIRS *= inputmethods
!symbian:!contains(QT_CONFIG, no-gui):SUBDIRS += accessible
symbian:SUBDIRS += s60
qpa:SUBDIRS += platforms

View File

@ -1,26 +0,0 @@
# Qt inputmethod module
HEADERS +=inputmethod/qinputcontextfactory.h \
inputmethod/qinputcontextplugin.h \
inputmethod/qinputcontext.h
SOURCES +=inputmethod/qinputcontextfactory.cpp \
inputmethod/qinputcontextplugin.cpp \
inputmethod/qinputcontext.cpp
x11 {
HEADERS += inputmethod/qximinputcontext_p.h
SOURCES += inputmethod/qximinputcontext_x11.cpp
}
win32:!qpa {
HEADERS += inputmethod/qwininputcontext_p.h
SOURCES += inputmethod/qwininputcontext_win.cpp
}
mac:!qpa {
HEADERS += inputmethod/qmacinputcontext_p.h
SOURCES += inputmethod/qmacinputcontext_mac.cpp
}
symbian:contains(QT_CONFIG, s60) {
HEADERS += inputmethod/qcoefepinputcontext_p.h
SOURCES += inputmethod/qcoefepinputcontext_s60.cpp
LIBS += -lfepbase -lakninputlanguage
}

View File

@ -1,354 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this
** file. Please review the following information to ensure the GNU Lesser
** General Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU General
** Public License version 3.0 as published by the Free Software Foundation
** and appearing in the file LICENSE.GPL included in the packaging of this
** file. Please review the following information to ensure the GNU General
** Public License version 3.0 requirements will be met:
** http://www.gnu.org/copyleft/gpl.html.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
/****************************************************************************
**
** Implementation of QInputContextFactory class
**
** Copyright (C) 2003-2004 immodule for Qt Project. All rights reserved.
**
** This file is written to contribute to Nokia Corporation and/or its subsidiary(-ies) under their own
** license. You may use this file under your Qt license. Following
** description is copied from their original file headers. Contact
** immodule-qt@freedesktop.org if any conditions of this licensing are
** not clear to you.
**
****************************************************************************/
#include "qinputcontextfactory.h"
#ifndef QT_NO_IM
#include "qcoreapplication.h"
#include "qinputcontext.h"
#include "qinputcontextplugin.h"
#ifdef Q_WS_X11
#include "private/qt_x11_p.h"
#include "qximinputcontext_p.h"
#endif
#ifdef Q_WS_WIN
#include "qwininputcontext_p.h"
#endif
#ifdef Q_WS_MAC
#include "qmacinputcontext_p.h"
#endif
#ifdef Q_WS_S60
#include "qcoefepinputcontext_p.h"
#include "AknInputLanguageInfo.h"
#endif
#include "private/qfactoryloader_p.h"
#include "qmutex.h"
QT_BEGIN_NAMESPACE
#ifndef QT_NO_LIBRARY
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
(QInputContextFactoryInterface_iid, QLatin1String("/inputmethods")))
#endif
/*!
\class QInputContextFactory
\brief The QInputContextFactory class creates QInputContext objects.
The input context factory creates a QInputContext object for a
given key with QInputContextFactory::create().
The input contexts are either built-in or dynamically loaded from
an input context plugin (see QInputContextPlugin).
keys() returns a list of valid keys. The
keys are the names used, for example, to identify and specify
input methods for the input method switching mechanism. The names
have to be consistent with QInputContext::identifierName(), and
may only contain ASCII characters.
A key can be used to retrieve the associated input context's
supported languages using languages(). You
can retrieve the input context's description using
description() and finally you can get a user
friendly internationalized name of the QInputContext object
specified by the key using displayName().
\legalese
Copyright (C) 2003-2004 immodule for Qt Project. All rights reserved.
This file is written to contribute to Nokia Corporation and/or its subsidiary(-ies) under their own
license. You may use this file under your Qt license. Following
description is copied from their original file headers. Contact
immodule-qt@freedesktop.org if any conditions of this licensing are
not clear to you.
\endlegalese
\sa QInputContext, QInputContextPlugin
*/
/*!
Creates and returns a QInputContext object for the input context
specified by \a key with the given \a parent. Keys are case
sensitive.
\sa keys()
*/
QInputContext *QInputContextFactory::create( const QString& key, QObject *parent )
{
QInputContext *result = 0;
#if defined(Q_WS_X11) && !defined(QT_NO_XIM)
if (key == QLatin1String("xim")) {
result = new QXIMInputContext;
}
#endif
#if defined(Q_WS_WIN)
if (key == QLatin1String("win")) {
result = new QWinInputContext;
}
#endif
#if defined(Q_WS_MAC)
if (key == QLatin1String("mac")) {
result = new QMacInputContext;
}
#endif
#if defined(Q_WS_S60)
if (key == QLatin1String("coefep")) {
result = new QCoeFepInputContext;
}
#endif
#ifdef QT_NO_LIBRARY
Q_UNUSED(key);
#else
if (QInputContextFactoryInterface *factory =
qobject_cast<QInputContextFactoryInterface*>(loader()->instance(key))) {
result = factory->create(key);
}
#endif
if (result)
result->setParent(parent);
return result;
}
/*!
Returns the list of keys this factory can create input contexts
for.
The keys are the names used, for example, to identify and specify
input methods for the input method switching mechanism. The names
have to be consistent with QInputContext::identifierName(), and
may only contain ASCII characters.
\sa create(), displayName(), QInputContext::identifierName()
*/
QStringList QInputContextFactory::keys()
{
QStringList result;
#if defined(Q_WS_X11) && !defined(QT_NO_XIM)
result << QLatin1String("xim");
#endif
#if defined(Q_WS_WIN) && !defined(QT_NO_XIM)
result << QLatin1String("win");
#endif
#if defined(Q_WS_MAC)
result << QLatin1String("mac");
#endif
#if defined(Q_WS_S60)
result << QLatin1String("coefep");
#endif
#ifndef QT_NO_LIBRARY
result += loader()->keys();
#endif // QT_NO_LIBRARY
return result;
}
#if defined(Q_WS_S60)
/*!
\internal
This function contains pure Symbian exception handling code for
getting S60 language list.
Returned object ownership is transferred to caller.
*/
static CAknInputLanguageList* s60LangListL()
{
CAknInputLanguageInfo *langInfo = AknInputLanguageInfoFactory::CreateInputLanguageInfoL();
CleanupStack::PushL(langInfo);
// In rare phone there is more than 7 languages installed -> use 7 as an array granularity
CAknInputLanguageList *langList = new (ELeave) CAknInputLanguageList(7);
CleanupStack::PushL(langList);
langInfo->AppendAvailableLanguagesL(langList);
CleanupStack::Pop(langList);
CleanupStack::PopAndDestroy(langInfo);
return langList;
}
/*!
\internal
This function utility function return S60 language list.
Returned object ownership is transferred to caller.
*/
static CAknInputLanguageList* s60LangList()
{
CAknInputLanguageList *langList = NULL;
TRAP_IGNORE(langList = s60LangListL());
q_check_ptr(langList);
return langList;
}
#endif
/*!
Returns the languages supported by the QInputContext object
specified by \a key.
The languages are expressed as language code (e.g. "zh_CN",
"zh_TW", "zh_HK", "ja", "ko", ...). An input context that supports
multiple languages can return all supported languages as a
QStringList. The name has to be consistent with
QInputContext::language().
This information may be used to optimize a user interface.
\sa keys(), QInputContext::language(), QLocale
*/
QStringList QInputContextFactory::languages( const QString &key )
{
QStringList result;
#if defined(Q_WS_X11) && !defined(QT_NO_XIM)
if (key == QLatin1String("xim"))
return QStringList(QString());
#endif
#if defined(Q_WS_WIN)
if (key == QLatin1String("win"))
return QStringList(QString());
#endif
#if defined(Q_WS_MAC)
if (key == QLatin1String("mac"))
return QStringList(QString());
#endif
#if defined(Q_WS_S60)
if (key == QLatin1String("coefep"))
{
CAknInputLanguageList *langList = s60LangList();
int count = langList->Count();
for (int i = 0; i < count; ++i)
{
result.append(QString(qt_symbianLocaleName(langList->At(i)->LanguageCode())));
}
delete langList;
}
#endif
#if defined(QT_NO_LIBRARY) || defined(QT_NO_SETTINGS)
Q_UNUSED(key);
#else
if (QInputContextFactoryInterface *factory =
qobject_cast<QInputContextFactoryInterface*>(loader()->instance(key)))
result = factory->languages(key);
#endif // QT_NO_LIBRARY
return result;
}
/*!
Returns a user friendly internationalized name of the
QInputContext object specified by \a key. You can, for example,
use this name in a menu.
\sa keys(), QInputContext::identifierName()
*/
QString QInputContextFactory::displayName( const QString &key )
{
QString result;
#if defined(Q_WS_X11) && !defined(QT_NO_XIM)
if (key == QLatin1String("xim"))
return QInputContext::tr( "XIM" );
#endif
#ifdef Q_WS_S60
if (key == QLatin1String("coefep"))
return QInputContext::tr( "FEP" );
#endif
#if defined(QT_NO_LIBRARY) || defined(QT_NO_SETTINGS)
Q_UNUSED(key);
#else
if (QInputContextFactoryInterface *factory =
qobject_cast<QInputContextFactoryInterface*>(loader()->instance(key)))
return factory->displayName(key);
#endif // QT_NO_LIBRARY
return QString();
}
/*!
Returns an internationalized brief description of the QInputContext
object specified by \a key. You can, for example, use this
description in a user interface.
\sa keys(), displayName()
*/
QString QInputContextFactory::description( const QString &key )
{
#if defined(Q_WS_X11) && !defined(QT_NO_XIM)
if (key == QLatin1String("xim"))
return QInputContext::tr( "XIM input method" );
#endif
#if defined(Q_WS_WIN) && !defined(QT_NO_XIM)
if (key == QLatin1String("win"))
return QInputContext::tr( "Windows input method" );
#endif
#if defined(Q_WS_MAC)
if (key == QLatin1String("mac"))
return QInputContext::tr( "Mac OS X input method" );
#endif
#if defined(Q_WS_S60)
if (key == QLatin1String("coefep"))
return QInputContext::tr( "S60 FEP input method" );
#endif
#if defined(QT_NO_LIBRARY) || defined(QT_NO_SETTINGS)
Q_UNUSED(key);
#else
if (QInputContextFactoryInterface *factory =
qobject_cast<QInputContextFactoryInterface*>(loader()->instance(key)))
return factory->description(key);
#endif // QT_NO_LIBRARY
return QString();
}
QT_END_NAMESPACE
#endif // QT_NO_IM

View File

@ -1,88 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this
** file. Please review the following information to ensure the GNU Lesser
** General Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU General
** Public License version 3.0 as published by the Free Software Foundation
** and appearing in the file LICENSE.GPL included in the packaging of this
** file. Please review the following information to ensure the GNU General
** Public License version 3.0 requirements will be met:
** http://www.gnu.org/copyleft/gpl.html.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
/****************************************************************************
**
** Definition of QInputContextFactory class
**
** Copyright (C) 2003-2004 immodule for Qt Project. All rights reserved.
**
** This file is written to contribute to Nokia Corporation and/or its subsidiary(-ies) under their own
** license. You may use this file under your Qt license. Following
** description is copied from their original file headers. Contact
** immodule-qt@freedesktop.org if any conditions of this licensing are
** not clear to you.
**
****************************************************************************/
#ifndef QINPUTCONTEXTFACTORY_H
#define QINPUTCONTEXTFACTORY_H
#include <QtCore/qstringlist.h>
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
QT_MODULE(Gui)
#ifndef QT_NO_IM
class QInputContext;
class QWidget;
class Q_WIDGETS_EXPORT QInputContextFactory
{
public:
static QStringList keys();
static QInputContext *create( const QString &key, QObject *parent ); // should be a toplevel widget
static QStringList languages( const QString &key );
static QString displayName( const QString &key );
static QString description( const QString &key );
};
#endif // QT_NO_IM
QT_END_NAMESPACE
QT_END_HEADER
#endif // QINPUTCONTEXTFACTORY_H

View File

@ -1,178 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this
** file. Please review the following information to ensure the GNU Lesser
** General Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU General
** Public License version 3.0 as published by the Free Software Foundation
** and appearing in the file LICENSE.GPL included in the packaging of this
** file. Please review the following information to ensure the GNU General
** Public License version 3.0 requirements will be met:
** http://www.gnu.org/copyleft/gpl.html.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
/****************************************************************************
**
** Implementation of QInputContext class
**
** Copyright (C) 2003-2004 immodule for Qt Project. All rights reserved.
**
** This file is written to contribute to Nokia Corporation and/or its subsidiary(-ies) under their own
** license. You may use this file under your Qt license. Following
** description is copied from their original file headers. Contact
** immodule-qt@freedesktop.org if any conditions of this licensing are
** not clear to you.
**
****************************************************************************/
#include "qinputcontextplugin.h"
#ifndef QT_NO_IM
#ifndef QT_NO_LIBRARY
QT_BEGIN_NAMESPACE
/*!
\class QInputContextPlugin
\brief The QInputContextPlugin class provides an abstract base for custom QInputContext plugins.
\reentrant
\ingroup plugins
The input context plugin is a simple plugin interface that makes it
easy to create custom input contexts that can be loaded dynamically
into applications.
To create an input context plugin you subclass this base class,
reimplement the pure virtual functions keys(), create(),
languages(), displayName(), and description(), and export the
class with the Q_EXPORT_PLUGIN2() macro.
\legalese
Copyright (C) 2003-2004 immodule for Qt Project. All rights reserved.
This file is written to contribute to Nokia Corporation and/or its subsidiary(-ies) under their own
license. You may use this file under your Qt license. Following
description is copied from their original file headers. Contact
immodule-qt@freedesktop.org if any conditions of this licensing are
not clear to you.
\endlegalese
\sa QInputContext, {How to Create Qt Plugins}
*/
/*!
\fn QStringList QInputContextPlugin::keys() const
Returns the list of QInputContext keys this plugin provides.
These keys are usually the class names of the custom input context
that are implemented in the plugin. The names are used, for
example, to identify and specify input methods for the input
method switching mechanism. They have to be consistent with
QInputContext::identifierName(), and may only contain ASCII
characters.
\sa create(), displayName(), QInputContext::identifierName()
*/
/*!
\fn QInputContext* QInputContextPlugin::create( const QString& key )
Creates and returns a QInputContext object for the input context
key \a key. The input context key is usually the class name of
the required input method.
\sa keys()
*/
/*!
\fn QStringList QInputContextPlugin::languages(const QString &key)
Returns the languages supported by the QInputContext object
specified by \a key.
The languages are expressed as language code (e.g. "zh_CN",
"zh_TW", "zh_HK", "ja", "ko", ...). An input context that supports
multiple languages can return all supported languages as
QStringList. The name has to be consistent with
QInputContext::language().
This information may be used to optimize user interface.
\sa keys(), QInputContext::language(), QLocale
*/
/*!
\fn QString QInputContextPlugin::displayName(const QString &key)
Returns a user friendly internationalized name of the
QInputContext object specified by \a key. You can, for example,
use this name in a menu.
\sa keys(), QInputContext::identifierName()
*/
/*!
\fn QString QInputContextPlugin::description(const QString &key)
Returns an internationalized brief description of the QInputContext
object specified by \a key. You can, for example, use this
description in a user interface.
\sa keys(), displayName()
*/
/*!
Constructs a input context plugin with the given \a parent. This
is invoked automatically by the Q_EXPORT_PLUGIN2() macro.
*/
QInputContextPlugin::QInputContextPlugin(QObject *parent)
:QObject(parent)
{
}
/*!
Destroys the input context plugin.
You never have to call this explicitly. Qt destroys a plugin
automatically when it's no longer used.
*/
QInputContextPlugin::~QInputContextPlugin()
{
}
QT_END_NAMESPACE
#endif // QT_NO_LIBRARY
#endif // QT_NO_IM

View File

@ -1,106 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this
** file. Please review the following information to ensure the GNU Lesser
** General Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU General
** Public License version 3.0 as published by the Free Software Foundation
** and appearing in the file LICENSE.GPL included in the packaging of this
** file. Please review the following information to ensure the GNU General
** Public License version 3.0 requirements will be met:
** http://www.gnu.org/copyleft/gpl.html.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
/****************************************************************************
**
** Definition of QInputContextPlugin class
**
** Copyright (C) 2003-2004 immodule for Qt Project. All rights reserved.
**
** This file is written to contribute to Nokia Corporation and/or its subsidiary(-ies) under their own
** license. You may use this file under your Qt license. Following
** description is copied from their original file headers. Contact
** immodule-qt@freedesktop.org if any conditions of this licensing are
** not clear to you.
**
****************************************************************************/
#ifndef QINPUTCONTEXTPLUGIN_H
#define QINPUTCONTEXTPLUGIN_H
#include <QtCore/qplugin.h>
#include <QtCore/qfactoryinterface.h>
#include <QtCore/qstringlist.h>
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
QT_MODULE(Gui)
#if !defined(QT_NO_IM)
class QInputContext;
class QInputContextPluginPrivate;
struct Q_WIDGETS_EXPORT QInputContextFactoryInterface : public QFactoryInterface
{
virtual QInputContext *create( const QString &key ) = 0;
virtual QStringList languages( const QString &key ) = 0;
virtual QString displayName( const QString &key ) = 0;
virtual QString description( const QString &key ) = 0;
};
#define QInputContextFactoryInterface_iid "com.trolltech.Qt.QInputContextFactoryInterface"
Q_DECLARE_INTERFACE(QInputContextFactoryInterface, QInputContextFactoryInterface_iid)
class Q_WIDGETS_EXPORT QInputContextPlugin : public QObject, public QInputContextFactoryInterface
{
Q_OBJECT
Q_INTERFACES(QInputContextFactoryInterface:QFactoryInterface)
public:
explicit QInputContextPlugin(QObject *parent = 0);
~QInputContextPlugin();
virtual QStringList keys() const = 0;
virtual QInputContext *create( const QString &key ) = 0;
virtual QStringList languages( const QString &key ) = 0;
virtual QString displayName( const QString &key ) = 0;
virtual QString description( const QString &key ) = 0;
};
#endif // QT_NO_IM
QT_END_NAMESPACE
QT_END_HEADER
#endif // QINPUTCONTEXTPLUGIN_H

View File

@ -21,6 +21,7 @@ HEADERS += \
kernel/qiconloader_p.h \
kernel/qiconengine.h \
kernel/qiconengineplugin.h \
kernel/qinputcontext.h \
kernel/qlayout.h \
kernel/qlayout_p.h \
kernel/qlayoutengine_p.h \
@ -54,6 +55,7 @@ SOURCES += \
kernel/qiconloader.cpp \
kernel/qiconengine.cpp \
kernel/qiconengineplugin.cpp \
kernel/qinputcontext.cpp \
kernel/qlayout.cpp \
kernel/qlayoutengine.cpp \
kernel/qlayoutitem.cpp \

View File

@ -5222,38 +5222,7 @@ void QApplication::setInputContext(QInputContext *inputContext)
*/
QInputContext *QApplication::inputContext() const
{
Q_D(const QApplication);
Q_UNUSED(d);// only static members being used.
if (QApplicationPrivate::is_app_closing)
return d->inputContext;
#ifdef Q_WS_X11
if (!X11)
return 0;
if (!d->inputContext) {
QApplication *that = const_cast<QApplication *>(this);
QInputContext *qic = QInputContextFactory::create(X11->default_im, that);
// fallback to default X Input Method.
if (!qic)
qic = QInputContextFactory::create(QLatin1String("xim"), that);
that->d_func()->inputContext = qic;
}
#elif defined(Q_OS_SYMBIAN)
if (!d->inputContext) {
QApplication *that = const_cast<QApplication *>(this);
const QStringList keys = QInputContextFactory::keys();
// Try hbim and coefep first, then try others.
if (keys.contains(QLatin1String("hbim"))) {
that->d_func()->inputContext = QInputContextFactory::create(QLatin1String("hbim"), that);
} else if (keys.contains(QLatin1String("coefep"))) {
that->d_func()->inputContext = QInputContextFactory::create(QLatin1String("coefep"), that);
} else {
for (int c = 0; c < keys.size() && !d->inputContext; ++c) {
that->d_func()->inputContext = QInputContextFactory::create(keys[c], that);
}
}
}
#endif
return d->inputContext;
return QApplicationPrivate::inputContext;
}
#endif // QT_NO_IM

View File

@ -41,7 +41,6 @@ include(widgets/widgets.pri)
include(dialogs/dialogs.pri)
include(accessible/accessible.pri)
include(itemviews/itemviews.pri)
include(inputmethod/inputmethod.pri)
include(graphicsview/graphicsview.pri)
include(util/util.pri)
include(statemachine/statemachine.pri)