~ubuntu-branches/ubuntu/trusty/fcitx/trusty-proposed

« back to all changes in this revision

Viewing changes to src/lib/fcitx-qt/fcitxqtinputmethoditem.cpp

  • Committer: Package Import Robot
  • Author(s): Aron Xu
  • Date: 2013-02-10 17:03:56 UTC
  • mfrom: (1.3.18) (33.1.3 experimental)
  • Revision ID: package-import@ubuntu.com-20130210170356-2yuv6xy3ed378kn0
Tags: 1:4.2.7-1
* New upstream release.
* New binary packages:
  - fcitx-libs-gclient: D-Bus client library for Glib
  - fcitx-libs-qt: D-Bus client library for Qt
  - fcitx-module-quickphrase-editor: Quick Phrase editor module

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
 *   Copyright (C) 2011~2012 by CSSlayer                                   *
 
3
 *                                                                         *
 
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.                                   *
 
8
 *                                                                         *
 
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.                          *
 
13
 *                                                                         *
 
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
 ***************************************************************************/
 
19
 
 
20
// Qt
 
21
#include <QDBusArgument>
 
22
#include <QDBusMetaType>
 
23
 
 
24
// self
 
25
#include "fcitxqtinputmethoditem.h"
 
26
 
 
27
bool FcitxQtInputMethodItem::enabled() const
 
28
{
 
29
    return m_enabled;
 
30
}
 
31
const QString& FcitxQtInputMethodItem::langCode() const
 
32
{
 
33
    return m_langCode;
 
34
}
 
35
const QString& FcitxQtInputMethodItem::name() const
 
36
{
 
37
    return m_name;
 
38
}
 
39
const QString& FcitxQtInputMethodItem::uniqueName() const
 
40
{
 
41
    return m_uniqueName;
 
42
}
 
43
void FcitxQtInputMethodItem::setEnabled(bool enable)
 
44
{
 
45
    m_enabled = enable;
 
46
}
 
47
void FcitxQtInputMethodItem::setLangCode(const QString& lang)
 
48
{
 
49
    m_langCode = lang;
 
50
}
 
51
void FcitxQtInputMethodItem::setName(const QString& name)
 
52
{
 
53
    m_name = name;
 
54
}
 
55
void FcitxQtInputMethodItem::setUniqueName(const QString& name)
 
56
{
 
57
    m_uniqueName = name;
 
58
}
 
59
 
 
60
void FcitxQtInputMethodItem::registerMetaType()
 
61
{
 
62
    qRegisterMetaType<FcitxQtInputMethodItem>("FcitxQtInputMethodItem");
 
63
    qDBusRegisterMetaType<FcitxQtInputMethodItem>();
 
64
    qRegisterMetaType<FcitxQtInputMethodItemList>("FcitxQtInputMethodItemList");
 
65
    qDBusRegisterMetaType<FcitxQtInputMethodItemList>();
 
66
}
 
67
 
 
68
FCITX_QT_EXPORT_API
 
69
QDBusArgument& operator<<(QDBusArgument& argument, const FcitxQtInputMethodItem& im)
 
70
{
 
71
    argument.beginStructure();
 
72
    argument << im.name();
 
73
    argument << im.uniqueName();
 
74
    argument << im.langCode();
 
75
    argument << im.enabled();
 
76
    argument.endStructure();
 
77
    return argument;
 
78
}
 
79
 
 
80
FCITX_QT_EXPORT_API
 
81
const QDBusArgument& operator>>(const QDBusArgument& argument, FcitxQtInputMethodItem& im)
 
82
{
 
83
    QString name;
 
84
    QString uniqueName;
 
85
    QString langCode;
 
86
    bool enabled;
 
87
    argument.beginStructure();
 
88
    argument >> name >> uniqueName >> langCode >> enabled;
 
89
    argument.endStructure();
 
90
    im.setName(name);
 
91
    im.setUniqueName(uniqueName);
 
92
    im.setLangCode(langCode);
 
93
    im.setEnabled(enabled);
 
94
    return argument;
 
95
}