~ubuntu-branches/ubuntu/wily/scim/wily-proposed

« back to all changes in this revision

Viewing changes to extras/immodules/client-qt/im-scim-bridge-qt.cpp

  • Committer: Package Import Robot
  • Author(s): Rolf Leggewie, Rolf Leggewie, Tz-Huan Huang
  • Date: 2012-06-30 11:21:42 UTC
  • mfrom: (1.1.7)
  • Revision ID: package-import@ubuntu.com-20120630112142-a4cwzsr16dty8dk7
Tags: 1.4.14-1
[ Rolf Leggewie ]
* new upstream release 1.4.14
  - drop 32_scim-1.4.8-fix-dlopen.patch which has landed upstream
* bump compat level to 9
* debian/control: add Toni Mueller as co-maintainer
  Welcome aboard!

[ Tz-Huan Huang ]
* start shipping a couple of newly introduced im-module packages
* debian/rules:
  - simplify dh_auto_install override where upstream changes allow this
  - drop -fpermissive from CXXFLAGS, fixed upstream
* debian/README.*: update the documentation

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * SCIM Bridge
 
3
 *
 
4
 * Copyright (c) 2006 Ryo Dairiki <ryo-dairiki@users.sourceforge.net>
 
5
 *
 
6
 *
 
7
 * This library is free software; you can redistribute it and/or
 
8
 * modify it under the terms of the GNU Lesser General Public
 
9
 * License as published by the Free Software Foundation and 
 
10
 * appearing in the file LICENSE.LGPL included in the package of this file.
 
11
 * You can also redistribute it and/or modify it under the terms of 
 
12
 * the GNU General Public License as published by the Free Software Foundation and 
 
13
 * appearing in the file LICENSE.GPL included in the package of this file.
 
14
 *
 
15
 * This library is distributed in the hope that it will be useful,
 
16
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
17
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
18
 */
 
19
 
 
20
#include <cassert>
 
21
 
 
22
#ifdef QT4
 
23
#include <Qt>
 
24
#include <QInputContextPlugin>
 
25
 
 
26
using namespace Qt;
 
27
#else
 
28
#include <qinputcontextplugin.h>
 
29
#endif
 
30
 
 
31
#include "scim-bridge.h"
 
32
#include "scim-bridge-client-common-qt.h"
 
33
#include "scim-bridge-client-imcontext-qt.h"
 
34
#include "scim-bridge-client-qt.h"
 
35
 
 
36
/* Static Variables */
 
37
static ScimBridgeClientQt *client = NULL;
 
38
 
 
39
/* The class Definition */
 
40
class ScimBridgeInputContextPlugin: public QInputContextPlugin
 
41
{
 
42
 
 
43
    private:
 
44
 
 
45
        /**
 
46
         * The language list for SCIM.
 
47
         */
 
48
        static QStringList scim_languages;
 
49
 
 
50
    public:
 
51
 
 
52
        ScimBridgeInputContextPlugin ();
 
53
 
 
54
        ~ScimBridgeInputContextPlugin ();
 
55
 
 
56
        QStringList keys () const;
 
57
 
 
58
        QStringList languages (const QString &key);
 
59
 
 
60
        QString description (const QString &key);
 
61
        
 
62
        QInputContext *create (const QString &key);
 
63
 
 
64
        QString displayName (const QString &key);
 
65
 
 
66
};
 
67
 
 
68
 
 
69
/* Implementations */
 
70
QStringList ScimBridgeInputContextPlugin::scim_languages;
 
71
 
 
72
 
 
73
ScimBridgeInputContextPlugin::ScimBridgeInputContextPlugin ()
 
74
{
 
75
}
 
76
 
 
77
 
 
78
ScimBridgeInputContextPlugin::~ScimBridgeInputContextPlugin ()
 
79
{
 
80
    delete client;
 
81
    client = NULL;
 
82
}
 
83
 
 
84
QStringList ScimBridgeInputContextPlugin::keys () const {
 
85
    QStringList identifiers;
 
86
    identifiers.push_back (SCIM_BRIDGE_IDENTIFIER_NAME);
 
87
    return identifiers;
 
88
}
 
89
 
 
90
 
 
91
QStringList ScimBridgeInputContextPlugin::languages (const QString &key)
 
92
{
 
93
    if (scim_languages.empty ()) {
 
94
        scim_languages.push_back ("zh_CN");
 
95
        scim_languages.push_back ("zh_TW");
 
96
        scim_languages.push_back ("zh_HK");
 
97
        scim_languages.push_back ("ja");
 
98
        scim_languages.push_back ("ko");
 
99
    }
 
100
    return scim_languages;
 
101
}
 
102
 
 
103
 
 
104
QString ScimBridgeInputContextPlugin::description (const QString &key)
 
105
{
 
106
    return QString::fromUtf8 ("Qt immodule plugin for SCIM Bridge");
 
107
}
 
108
 
 
109
 
 
110
QInputContext *ScimBridgeInputContextPlugin::create (const QString &key)
 
111
{
 
112
#ifdef QT4
 
113
    if (key.toLower () != SCIM_BRIDGE_IDENTIFIER_NAME) {
 
114
#else
 
115
    if (key.lower () != SCIM_BRIDGE_IDENTIFIER_NAME) {
 
116
#endif
 
117
        return NULL;
 
118
    } else {
 
119
        if (client == NULL) client = new ScimBridgeClientQt ();
 
120
        return ScimBridgeClientIMContext::alloc ();
 
121
    }
 
122
}
 
123
 
 
124
 
 
125
QString ScimBridgeInputContextPlugin::displayName (const QString &key)
 
126
{
 
127
    return key;
 
128
}
 
129
 
 
130
#ifdef QT4
 
131
Q_EXPORT_PLUGIN2 (ScimBridgeInputContextPlugin, ScimBridgeInputContextPlugin)
 
132
#else
 
133
Q_EXPORT_PLUGIN (ScimBridgeInputContextPlugin)
 
134
#endif