1
/***************************************************************************
2
* Copyright (C) 2011~2012 by CSSlayer *
4
* This program is free software; you can redistribute it and/or modify *
5
* it under the terms of the GNU General Public License as published by *
6
* the Free Software Foundation; either version 2 of the License, or *
7
* (at your option) any later version. *
9
* This program is distributed in the hope that it will be useful, *
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12
* GNU General Public License for more details. *
14
* You should have received a copy of the GNU General Public License *
15
* along with this program; if not, write to the *
16
* Free Software Foundation, Inc., *
17
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
18
***************************************************************************/
20
#include <QInputContextPlugin>
21
#include <QDBusConnection>
22
#include "qfcitxinputcontext.h"
24
/* The class Definition */
25
class QFcitxInputContextPlugin: public QInputContextPlugin
30
* The language list for Fcitx.
32
static QStringList fcitx_languages;
36
QFcitxInputContextPlugin(QObject *parent = 0);
38
~QFcitxInputContextPlugin();
40
QStringList keys() const;
42
QStringList languages(const QString &key);
44
QString description(const QString &key);
46
QInputContext *create(const QString &key);
48
QString displayName(const QString &key);
55
QStringList QFcitxInputContextPlugin::fcitx_languages;
58
QFcitxInputContextPlugin::QFcitxInputContextPlugin(QObject *parent)
59
: QInputContextPlugin(parent)
64
QFcitxInputContextPlugin::~QFcitxInputContextPlugin()
69
QFcitxInputContextPlugin::keys() const
71
QStringList identifiers;
72
identifiers.push_back(FCITX_IDENTIFIER_NAME);
78
QFcitxInputContextPlugin::languages(const QString & key)
80
if (key.toLower() != FCITX_IDENTIFIER_NAME) {
84
if (fcitx_languages.empty()) {
85
fcitx_languages.push_back("zh");
86
fcitx_languages.push_back("ja");
87
fcitx_languages.push_back("ko");
89
return fcitx_languages;
94
QFcitxInputContextPlugin::description(const QString &key)
96
if (key.toLower() != FCITX_IDENTIFIER_NAME) {
100
return QString::fromUtf8("Qt immodule plugin for Fcitx");
105
QFcitxInputContextPlugin::create(const QString &key)
107
if (key.toLower() != FCITX_IDENTIFIER_NAME) {
111
return static_cast<QInputContext *>(new QFcitxInputContext());
115
QString QFcitxInputContextPlugin::displayName(const QString &key)
120
Q_EXPORT_PLUGIN2(QFcitxInputContextPlugin, QFcitxInputContextPlugin)
122
// kate: indent-mode cstyle; space-indent on; indent-width 0;