| 1 | /**************************************************************************** | 
|---|
| 2 | ** | 
|---|
| 3 | ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). | 
|---|
| 4 | ** Contact: Qt Software Information (qt-info@nokia.com) | 
|---|
| 5 | ** | 
|---|
| 6 | ** This file is part of the QtGui module of the Qt Toolkit. | 
|---|
| 7 | ** | 
|---|
| 8 | ** $QT_BEGIN_LICENSE:LGPL$ | 
|---|
| 9 | ** Commercial Usage | 
|---|
| 10 | ** Licensees holding valid Qt Commercial licenses may use this file in | 
|---|
| 11 | ** accordance with the Qt Commercial License Agreement provided with the | 
|---|
| 12 | ** Software or, alternatively, in accordance with the terms contained in | 
|---|
| 13 | ** a written agreement between you and Nokia. | 
|---|
| 14 | ** | 
|---|
| 15 | ** GNU Lesser General Public License Usage | 
|---|
| 16 | ** Alternatively, this file may be used under the terms of the GNU Lesser | 
|---|
| 17 | ** General Public License version 2.1 as published by the Free Software | 
|---|
| 18 | ** Foundation and appearing in the file LICENSE.LGPL included in the | 
|---|
| 19 | ** packaging of this file.  Please review the following information to | 
|---|
| 20 | ** ensure the GNU Lesser General Public License version 2.1 requirements | 
|---|
| 21 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | 
|---|
| 22 | ** | 
|---|
| 23 | ** In addition, as a special exception, Nokia gives you certain | 
|---|
| 24 | ** additional rights. These rights are described in the Nokia Qt LGPL | 
|---|
| 25 | ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this | 
|---|
| 26 | ** 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 are unsure which license is appropriate for your use, please | 
|---|
| 37 | ** contact the sales department at qt-sales@nokia.com. | 
|---|
| 38 | ** $QT_END_LICENSE$ | 
|---|
| 39 | ** | 
|---|
| 40 | ****************************************************************************/ | 
|---|
| 41 |  | 
|---|
| 42 | /**************************************************************************** | 
|---|
| 43 | ** | 
|---|
| 44 | ** Implementation of QInputContext 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 | ** immodule-qt@freedesktop.org if any conditions of this licensing are | 
|---|
| 52 | ** not clear to you. | 
|---|
| 53 | ** | 
|---|
| 54 | ****************************************************************************/ | 
|---|
| 55 |  | 
|---|
| 56 | #include "qinputcontextplugin.h" | 
|---|
| 57 |  | 
|---|
| 58 | #ifndef QT_NO_IM | 
|---|
| 59 | #ifndef QT_NO_LIBRARY | 
|---|
| 60 |  | 
|---|
| 61 | QT_BEGIN_NAMESPACE | 
|---|
| 62 |  | 
|---|
| 63 | /*! | 
|---|
| 64 | \class QInputContextPlugin | 
|---|
| 65 | \brief The QInputContextPlugin class provides an abstract base for custom QInputContext plugins. | 
|---|
| 66 |  | 
|---|
| 67 | \reentrant | 
|---|
| 68 | \ingroup plugins | 
|---|
| 69 |  | 
|---|
| 70 | The input context plugin is a simple plugin interface that makes it | 
|---|
| 71 | easy to create custom input contexts that can be loaded dynamically | 
|---|
| 72 | into applications. | 
|---|
| 73 |  | 
|---|
| 74 | To create an input context plugin you subclass this base class, | 
|---|
| 75 | reimplement the pure virtual functions keys(), create(), | 
|---|
| 76 | languages(), displayName(), and description(), and export the | 
|---|
| 77 | class with the Q_EXPORT_PLUGIN2() macro. | 
|---|
| 78 |  | 
|---|
| 79 | \legalese | 
|---|
| 80 | Copyright (C) 2003-2004 immodule for Qt Project.  All rights reserved. | 
|---|
| 81 |  | 
|---|
| 82 | This file is written to contribute to Nokia Corporation and/or its subsidiary(-ies) under their own | 
|---|
| 83 | license. You may use this file under your Qt license. Following | 
|---|
| 84 | description is copied from their original file headers. Contact | 
|---|
| 85 | immodule-qt@freedesktop.org if any conditions of this licensing are | 
|---|
| 86 | not clear to you. | 
|---|
| 87 | \endlegalese | 
|---|
| 88 |  | 
|---|
| 89 | \sa QInputContext, {How to Create Qt Plugins} | 
|---|
| 90 | */ | 
|---|
| 91 |  | 
|---|
| 92 | /*! | 
|---|
| 93 | \fn QStringList QInputContextPlugin::keys() const | 
|---|
| 94 |  | 
|---|
| 95 | Returns the list of QInputContext keys this plugin provides. | 
|---|
| 96 |  | 
|---|
| 97 | These keys are usually the class names of the custom input context | 
|---|
| 98 | that are implemented in the plugin. The names are used, for | 
|---|
| 99 | example, to identify and specify input methods for the input | 
|---|
| 100 | method switching mechanism.  They have to be consistent with | 
|---|
| 101 | QInputContext::identifierName(), and may only contain ASCII | 
|---|
| 102 | characters. | 
|---|
| 103 |  | 
|---|
| 104 | \sa create(), displayName(), QInputContext::identifierName() | 
|---|
| 105 | */ | 
|---|
| 106 |  | 
|---|
| 107 | /*! | 
|---|
| 108 | \fn QInputContext* QInputContextPlugin::create( const QString& key ) | 
|---|
| 109 |  | 
|---|
| 110 | Creates and returns a QInputContext object for the input context | 
|---|
| 111 | key \a key.  The input context key is usually the class name of | 
|---|
| 112 | the required input method. | 
|---|
| 113 |  | 
|---|
| 114 | \sa keys() | 
|---|
| 115 | */ | 
|---|
| 116 |  | 
|---|
| 117 | /*! | 
|---|
| 118 | \fn QStringList QInputContextPlugin::languages(const QString &key) | 
|---|
| 119 |  | 
|---|
| 120 | Returns the languages supported by the QInputContext object | 
|---|
| 121 | specified by \a key. | 
|---|
| 122 |  | 
|---|
| 123 | The languages are expressed as language code (e.g. "zh_CN", | 
|---|
| 124 | "zh_TW", "zh_HK", "ja", "ko", ...). An input context that supports | 
|---|
| 125 | multiple languages can return all supported languages as | 
|---|
| 126 | QStringList. The name has to be consistent with | 
|---|
| 127 | QInputContext::language(). | 
|---|
| 128 |  | 
|---|
| 129 | This information may be used to optimize user interface. | 
|---|
| 130 |  | 
|---|
| 131 | \sa keys(), QInputContext::language(), QLocale | 
|---|
| 132 | */ | 
|---|
| 133 |  | 
|---|
| 134 | /*! | 
|---|
| 135 | \fn QString QInputContextPlugin::displayName(const QString &key) | 
|---|
| 136 |  | 
|---|
| 137 | Returns a user friendly internationalized name of the | 
|---|
| 138 | QInputContext object specified by \a key. You can, for example, | 
|---|
| 139 | use this name in a menu. | 
|---|
| 140 |  | 
|---|
| 141 | \sa keys(), QInputContext::identifierName() | 
|---|
| 142 | */ | 
|---|
| 143 |  | 
|---|
| 144 | /*! | 
|---|
| 145 | \fn QString QInputContextPlugin::description(const QString &key) | 
|---|
| 146 |  | 
|---|
| 147 | Returns an internationalized brief description of the QInputContext | 
|---|
| 148 | object specified by \a key. You can, for example, use this | 
|---|
| 149 | description in a user interface. | 
|---|
| 150 |  | 
|---|
| 151 | \sa keys(), displayName() | 
|---|
| 152 | */ | 
|---|
| 153 |  | 
|---|
| 154 |  | 
|---|
| 155 | /*! | 
|---|
| 156 | Constructs a input context plugin with the given \a parent. This | 
|---|
| 157 | is invoked automatically by the Q_EXPORT_PLUGIN2() macro. | 
|---|
| 158 | */ | 
|---|
| 159 | QInputContextPlugin::QInputContextPlugin(QObject *parent) | 
|---|
| 160 | :QObject(parent) | 
|---|
| 161 | { | 
|---|
| 162 | } | 
|---|
| 163 |  | 
|---|
| 164 | /*! | 
|---|
| 165 | Destroys the input context plugin. | 
|---|
| 166 |  | 
|---|
| 167 | You never have to call this explicitly. Qt destroys a plugin | 
|---|
| 168 | automatically when it's no longer used. | 
|---|
| 169 | */ | 
|---|
| 170 | QInputContextPlugin::~QInputContextPlugin() | 
|---|
| 171 | { | 
|---|
| 172 | } | 
|---|
| 173 |  | 
|---|
| 174 | QT_END_NAMESPACE | 
|---|
| 175 |  | 
|---|
| 176 | #endif // QT_NO_LIBRARY | 
|---|
| 177 |  | 
|---|
| 178 | #endif // QT_NO_IM | 
|---|