diff options
Diffstat (limited to 'src/plugins/platforminputcontexts')
13 files changed, 327 insertions, 247 deletions
diff --git a/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp b/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp index 395bb5b090..c0aaed2525 100644 --- a/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp +++ b/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, 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. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** rights. These rights are described in the Digia 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. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.h b/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.h index 6ce89cfe77..c6f7fea814 100644 --- a/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.h +++ b/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.h @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, 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. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** rights. These rights are described in the Digia 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. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforminputcontexts/compose/main.cpp b/src/plugins/platforminputcontexts/compose/main.cpp index 728c60caf5..4f9362fa5a 100644 --- a/src/plugins/platforminputcontexts/compose/main.cpp +++ b/src/plugins/platforminputcontexts/compose/main.cpp @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, 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. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** rights. These rights are described in the Digia 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. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontext.cpp b/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontext.cpp index 65b93b1a45..b0e34e3edc 100644 --- a/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontext.cpp +++ b/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontext.cpp @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, 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. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** rights. These rights are described in the Digia 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. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontext.h b/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontext.h index def63486a7..897b164b3b 100644 --- a/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontext.h +++ b/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontext.h @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, 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. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** rights. These rights are described in the Digia 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. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforminputcontexts/ibus/interfaces/org.freedesktop.IBus.InputContext.xml b/src/plugins/platforminputcontexts/ibus/interfaces/org.freedesktop.IBus.InputContext.xml index dbc79c178b..9c67a38c57 100644 --- a/src/plugins/platforminputcontexts/ibus/interfaces/org.freedesktop.IBus.InputContext.xml +++ b/src/plugins/platforminputcontexts/ibus/interfaces/org.freedesktop.IBus.InputContext.xml @@ -35,6 +35,11 @@ <method name="GetEngine"> <arg name="desc" direction="out" type="v"/> </method> + <method name="SetSurroundingText"> + <arg name="text" direction="in" type="v"/> + <arg name="cursor_pos" direction="in" type="u"/> + <arg name="anchor_pos" direction="in" type="u"/> + </method> <method name="Destroy"/> <signal name="CommitText"> <arg name="text" type="v"/> @@ -75,6 +80,11 @@ <signal name="UpdateProperty"> <arg name="prop" type="v"/> </signal> + <signal name="RequireSurroundingText"/> + <signal name="DeleteSurroundingText"> + <arg name="offset" type="i"/> + <arg name="n_chars" type="u"/> + </signal> </interface> </node> diff --git a/src/plugins/platforminputcontexts/ibus/main.cpp b/src/plugins/platforminputcontexts/ibus/main.cpp index d7c34ee9b3..a3fc05bfc3 100644 --- a/src/plugins/platforminputcontexts/ibus/main.cpp +++ b/src/plugins/platforminputcontexts/ibus/main.cpp @@ -1,47 +1,41 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, 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. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** rights. These rights are described in the Digia 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. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ #include <qpa/qplatforminputcontextplugin_p.h> #include <QtCore/QStringList> +#include <QDBusMetaType> #include "qibusplatforminputcontext.h" +#include "qibustypes.h" QT_BEGIN_NAMESPACE @@ -58,8 +52,13 @@ QIBusPlatformInputContext *QIbusPlatformInputContextPlugin::create(const QString { Q_UNUSED(paramList); - if (system.compare(system, QStringLiteral("ibus"), Qt::CaseInsensitive) == 0) + if (system.compare(system, QStringLiteral("ibus"), Qt::CaseInsensitive) == 0) { + qDBusRegisterMetaType<QIBusSerializable>(); + qDBusRegisterMetaType<QIBusAttribute>(); + qDBusRegisterMetaType<QIBusAttributeList>(); + qDBusRegisterMetaType<QIBusText>(); return new QIBusPlatformInputContext; + } return 0; } diff --git a/src/plugins/platforminputcontexts/ibus/qibusinputcontextproxy.cpp b/src/plugins/platforminputcontexts/ibus/qibusinputcontextproxy.cpp index 8df88b339b..454a1e6fda 100644 --- a/src/plugins/platforminputcontexts/ibus/qibusinputcontextproxy.cpp +++ b/src/plugins/platforminputcontexts/ibus/qibusinputcontextproxy.cpp @@ -1,5 +1,5 @@ /* - * This file was generated by qdbusxml2cpp version 0.7 + * This file was generated by qdbusxml2cpp version 0.8 * Command line was: qdbusxml2cpp -N -p qibusinputcontextproxy -c QIBusInputContextProxy interfaces/org.freedesktop.IBus.InputContext.xml * * qdbusxml2cpp is Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). diff --git a/src/plugins/platforminputcontexts/ibus/qibusinputcontextproxy.h b/src/plugins/platforminputcontexts/ibus/qibusinputcontextproxy.h index b1e33a3ecd..b75a5e0a93 100644 --- a/src/plugins/platforminputcontexts/ibus/qibusinputcontextproxy.h +++ b/src/plugins/platforminputcontexts/ibus/qibusinputcontextproxy.h @@ -1,5 +1,5 @@ /* - * This file was generated by qdbusxml2cpp version 0.7 + * This file was generated by qdbusxml2cpp version 0.8 * Command line was: qdbusxml2cpp -N -p qibusinputcontextproxy -c QIBusInputContextProxy interfaces/org.freedesktop.IBus.InputContext.xml * * qdbusxml2cpp is Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). @@ -8,8 +8,8 @@ * Do not edit! All changes made to it will be lost. */ -#ifndef QIBUSINPUTCONTEXTPROXY_H_1308831153 -#define QIBUSINPUTCONTEXTPROXY_H_1308831153 +#ifndef QIBUSINPUTCONTEXTPROXY_H_1394889529 +#define QIBUSINPUTCONTEXTPROXY_H_1394889529 #include <QtCore/QObject> #include <QtCore/QByteArray> @@ -119,10 +119,18 @@ public Q_SLOTS: // METHODS return asyncCallWithArgumentList(QLatin1String("SetEngine"), argumentList); } + inline QDBusPendingReply<> SetSurroundingText(const QDBusVariant &text, uint cursor_pos, uint anchor_pos) + { + QList<QVariant> argumentList; + argumentList << QVariant::fromValue(text) << QVariant::fromValue(cursor_pos) << QVariant::fromValue(anchor_pos); + return asyncCallWithArgumentList(QLatin1String("SetSurroundingText"), argumentList); + } + Q_SIGNALS: // SIGNALS void CommitText(const QDBusVariant &text); void CursorDownLookupTable(); void CursorUpLookupTable(); + void DeleteSurroundingText(int offset, uint n_chars); void Disabled(); void Enabled(); void ForwardKeyEvent(uint keyval, uint keycode, uint state); @@ -132,6 +140,7 @@ Q_SIGNALS: // SIGNALS void PageDownLookupTable(); void PageUpLookupTable(); void RegisterProperties(const QDBusVariant &props); + void RequireSurroundingText(); void ShowAuxiliaryText(); void ShowLookupTable(); void ShowPreeditText(); diff --git a/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp b/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp index 53e9b171d5..990fcd0d10 100644 --- a/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp +++ b/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, 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. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** rights. These rights are described in the Digia 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. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -43,6 +35,7 @@ #include <QtDebug> #include <QTextCharFormat> #include <QGuiApplication> +#include <QDBusVariant> #include <qwindow.h> #include <qevent.h> @@ -78,6 +71,7 @@ public: bool valid; QString predit; + bool needsSurroundingText; }; @@ -87,6 +81,8 @@ QIBusPlatformInputContext::QIBusPlatformInputContext () if (d->context) { connect(d->context, SIGNAL(CommitText(QDBusVariant)), SLOT(commitText(QDBusVariant))); connect(d->context, SIGNAL(UpdatePreeditText(QDBusVariant,uint,bool)), this, SLOT(updatePreeditText(QDBusVariant,uint,bool))); + connect(d->context, SIGNAL(DeleteSurroundingText(int,uint)), this, SLOT(deleteSurroundingText(int,uint))); + connect(d->context, SIGNAL(RequireSurroundingText()), this, SLOT(surroundingTextRequired())); } QInputMethod *p = qApp->inputMethod(); connect(p, SIGNAL(cursorRectangleChanged()), this, SLOT(cursorRectChanged())); @@ -135,9 +131,11 @@ void QIBusPlatformInputContext::commit() return; } - QInputMethodEvent event; - event.setCommitString(d->predit); - QCoreApplication::sendEvent(input, &event); + if (!d->predit.isEmpty()) { + QInputMethodEvent event; + event.setCommitString(d->predit); + QCoreApplication::sendEvent(input, &event); + } d->context->Reset(); d->predit = QString(); @@ -146,6 +144,33 @@ void QIBusPlatformInputContext::commit() void QIBusPlatformInputContext::update(Qt::InputMethodQueries q) { + QObject *input = qApp->focusObject(); + + if (d->needsSurroundingText && input + && (q.testFlag(Qt::ImSurroundingText) + || q.testFlag(Qt::ImCursorPosition) + || q.testFlag(Qt::ImAnchorPosition))) { + QInputMethodQueryEvent srrndTextQuery(Qt::ImSurroundingText); + QInputMethodQueryEvent cursorPosQuery(Qt::ImCursorPosition); + QInputMethodQueryEvent anchorPosQuery(Qt::ImAnchorPosition); + + QCoreApplication::sendEvent(input, &srrndTextQuery); + QCoreApplication::sendEvent(input, &cursorPosQuery); + QCoreApplication::sendEvent(input, &anchorPosQuery); + + QString surroundingText = srrndTextQuery.value(Qt::ImSurroundingText).toString(); + uint cursorPosition = cursorPosQuery.value(Qt::ImCursorPosition).toUInt(); + uint anchorPosition = anchorPosQuery.value(Qt::ImAnchorPosition).toUInt(); + + QIBusText text; + text.text = surroundingText; + + QVariant variant; + variant.setValue(text); + QDBusVariant dbusText(variant); + + d->context->SetSurroundingText(dbusText, cursorPosition, anchorPosition); + } QPlatformInputContext::update(q); } @@ -191,7 +216,7 @@ void QIBusPlatformInputContext::commitText(const QDBusVariant &text) QIBusText t; if (debug) qDebug() << arg.currentSignature(); - t.fromDBusArgument(arg); + arg >> t; if (debug) qDebug() << "commit text:" << t.text; @@ -211,7 +236,7 @@ void QIBusPlatformInputContext::updatePreeditText(const QDBusVariant &text, uint const QDBusArgument arg = text.variant().value<QDBusArgument>(); QIBusText t; - t.fromDBusArgument(arg); + arg >> t; if (debug) qDebug() << "preedit text:" << t.text; @@ -225,6 +250,27 @@ void QIBusPlatformInputContext::updatePreeditText(const QDBusVariant &text, uint d->predit = t.text; } +void QIBusPlatformInputContext::surroundingTextRequired() +{ + if (debug) + qDebug() << "surroundingTextRequired"; + d->needsSurroundingText = true; + update(Qt::ImSurroundingText); +} + +void QIBusPlatformInputContext::deleteSurroundingText(int offset, uint n_chars) +{ + QObject *input = qApp->focusObject(); + if (!input) + return; + + if (debug) + qDebug() << "deleteSurroundingText" << offset << n_chars; + + QInputMethodEvent event; + event.setCommitString("", offset, n_chars); + QCoreApplication::sendEvent(input, &event); +} bool QIBusPlatformInputContext::x11FilterEvent(uint keyval, uint keycode, uint state, bool press) @@ -250,7 +296,8 @@ QIBusPlatformInputContextPrivate::QIBusPlatformInputContextPrivate() : connection(createConnection()), bus(0), context(0), - valid(false) + valid(false), + needsSurroundingText(false) { if (!connection || !connection->isConnected()) return; @@ -284,7 +331,7 @@ QIBusPlatformInputContextPrivate::QIBusPlatformInputContextPrivate() IBUS_CAP_PROPERTY = 1 << 4, IBUS_CAP_SURROUNDING_TEXT = 1 << 5 }; - context->SetCapabilities(IBUS_CAP_PREEDIT_TEXT|IBUS_CAP_FOCUS); + context->SetCapabilities(IBUS_CAP_PREEDIT_TEXT|IBUS_CAP_FOCUS|IBUS_CAP_SURROUNDING_TEXT); if (debug) qDebug(">>>> valid!"); diff --git a/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.h b/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.h index 400ef3914a..dda24aca08 100644 --- a/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.h +++ b/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.h @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, 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. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** rights. These rights are described in the Digia 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. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -69,6 +61,8 @@ public Q_SLOTS: void commitText(const QDBusVariant &text); void updatePreeditText(const QDBusVariant &text, uint cursor_pos, bool visible); void cursorRectChanged(); + void deleteSurroundingText(int offset, uint n_chars); + void surroundingTextRequired(); private: QIBusPlatformInputContextPrivate *d; diff --git a/src/plugins/platforminputcontexts/ibus/qibustypes.cpp b/src/plugins/platforminputcontexts/ibus/qibustypes.cpp index 6ab0b1ae3e..9bc53ed5c0 100644 --- a/src/plugins/platforminputcontexts/ibus/qibustypes.cpp +++ b/src/plugins/platforminputcontexts/ibus/qibustypes.cpp @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, 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. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** rights. These rights are described in the Digia 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. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -42,6 +34,7 @@ #include "qibustypes.h" #include <qtextformat.h> #include <QtDBus> +#include <QHash> QT_BEGIN_NAMESPACE @@ -53,23 +46,45 @@ QIBusSerializable::~QIBusSerializable() { } -void QIBusSerializable::fromDBusArgument(const QDBusArgument &arg) +const QDBusArgument &operator>>(const QDBusArgument &argument, QIBusSerializable &object) { - arg >> name; - arg.beginMap(); - while (!arg.atEnd()) { - arg.beginMapEntry(); + argument >> object.name; + + argument.beginMap(); + while (!argument.atEnd()) { + argument.beginMapEntry(); QString key; QDBusVariant value; - arg >> key; - arg >> value; - arg.endMapEntry(); - attachments[key] = value.variant().value<QDBusArgument>(); + argument >> key; + argument >> value; + argument.endMapEntry(); + object.attachments[key] = value.variant().value<QDBusArgument>(); } - arg.endMap(); + argument.endMap(); + return argument; } +QDBusArgument &operator<<(QDBusArgument &argument, const QIBusSerializable &object) +{ + argument << object.name; + + argument.beginMap(qMetaTypeId<QString>(), qMetaTypeId<QDBusVariant>()); + + QHashIterator<QString, QDBusArgument> i(object.attachments); + while (i.hasNext()) { + i.next(); + + argument.beginMapEntry(); + argument << i.key(); + QDBusVariant variant(i.value().asVariant()); + + argument << variant; + argument.endMapEntry(); + } + argument.endMap(); + return argument; +} QIBusAttribute::QIBusAttribute() : type(Invalid), @@ -77,28 +92,46 @@ QIBusAttribute::QIBusAttribute() start(0), end(0) { + name = "IBusAttribute"; } QIBusAttribute::~QIBusAttribute() { +} + +QDBusArgument &operator<<(QDBusArgument &argument, const QIBusAttribute &attribute) +{ + argument.beginStructure(); + + argument << static_cast<const QIBusSerializable &>(attribute); + quint32 t = (quint32) attribute.type; + argument << t; + argument << attribute.value; + argument << attribute.start; + argument << attribute.end; + + argument.endStructure(); + + return argument; } -void QIBusAttribute::fromDBusArgument(const QDBusArgument &arg) +const QDBusArgument &operator>>(const QDBusArgument &argument, QIBusAttribute &attribute) { -// qDebug() << "QIBusAttribute::fromDBusArgument()" << arg.currentSignature(); - arg.beginStructure(); + argument.beginStructure(); - QIBusSerializable::fromDBusArgument(arg); + argument >> static_cast<QIBusSerializable &>(attribute); quint32 t; - arg >> t; - type = (Type)t; - arg >> value; - arg >> start; - arg >> end; + argument >> t; + attribute.type = (QIBusAttribute::Type) t; + argument >> attribute.value; + argument >> attribute.start; + argument >> attribute.end; - arg.endStructure(); + argument.endStructure(); + + return argument; } QTextFormat QIBusAttribute::format() const @@ -141,36 +174,53 @@ QTextFormat QIBusAttribute::format() const return fmt; } - QIBusAttributeList::QIBusAttributeList() { - + name = "IBusAttrList"; } QIBusAttributeList::~QIBusAttributeList() { +} + +QDBusArgument &operator<<(QDBusArgument &argument, const QIBusAttributeList &attrList) +{ + argument.beginStructure(); + + argument << static_cast<const QIBusSerializable &>(attrList); + + argument.beginArray(qMetaTypeId<QDBusVariant>()); + for (int i = 0; i < attrList.attributes.size(); ++i) { + QVariant variant; + variant.setValue(attrList.attributes.at(i)); + argument << QDBusVariant (variant); + } + argument.endArray(); + argument.endStructure(); + return argument; } -void QIBusAttributeList::fromDBusArgument(const QDBusArgument &arg) +const QDBusArgument &operator>>(const QDBusArgument &arg, QIBusAttributeList &attrList) { // qDebug() << "QIBusAttributeList::fromDBusArgument()" << arg.currentSignature(); arg.beginStructure(); - QIBusSerializable::fromDBusArgument(arg); + arg >> static_cast<QIBusSerializable &>(attrList); arg.beginArray(); - while(!arg.atEnd()) { + while (!arg.atEnd()) { QDBusVariant var; arg >> var; QIBusAttribute attr; - attr.fromDBusArgument(var.variant().value<QDBusArgument>()); - attributes.append(attr); + var.variant().value<QDBusArgument>() >> attr; + attrList.attributes.append(attr); } arg.endArray(); arg.endStructure(); + return arg; } QList<QInputMethodEvent::Attribute> QIBusAttributeList::imAttributes() const @@ -183,30 +233,40 @@ QList<QInputMethodEvent::Attribute> QIBusAttributeList::imAttributes() const return imAttrs; } - QIBusText::QIBusText() { - + name = "IBusText"; } QIBusText::~QIBusText() { +} +QDBusArgument &operator<<(QDBusArgument &argument, const QIBusText &text) +{ + argument.beginStructure(); + + argument << static_cast<const QIBusSerializable &>(text); + + argument << text.text << text.attributes; + argument.endStructure(); + return argument; } -void QIBusText::fromDBusArgument(const QDBusArgument &arg) +const QDBusArgument &operator>>(const QDBusArgument &argument, QIBusText &text) { // qDebug() << "QIBusText::fromDBusArgument()" << arg.currentSignature(); - arg.beginStructure(); + argument.beginStructure(); - QIBusSerializable::fromDBusArgument(arg); + argument >> static_cast<QIBusSerializable &>(text); - arg >> text; + argument >> text.text; QDBusVariant variant; - arg >> variant; - attributes.fromDBusArgument(variant.variant().value<QDBusArgument>()); + argument >> variant; + variant.variant().value<QDBusArgument>() >> text.attributes; - arg.endStructure(); + argument.endStructure(); + return argument; } QT_END_NAMESPACE diff --git a/src/plugins/platforminputcontexts/ibus/qibustypes.h b/src/plugins/platforminputcontexts/ibus/qibustypes.h index 8e6f853a52..2ec3b019ff 100644 --- a/src/plugins/platforminputcontexts/ibus/qibustypes.h +++ b/src/plugins/platforminputcontexts/ibus/qibustypes.h @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, 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. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** rights. These rights are described in the Digia 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. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -43,19 +35,16 @@ #include <qvector.h> #include <qevent.h> +#include <QDBusArgument> QT_BEGIN_NAMESPACE -class QDBusArgument; - class QIBusSerializable { public: QIBusSerializable(); virtual ~QIBusSerializable(); - virtual void fromDBusArgument(const QDBusArgument &arg); - QString name; QHash<QString, QDBusArgument> attachments; }; @@ -81,7 +70,6 @@ public: QIBusAttribute(); ~QIBusAttribute(); - void fromDBusArgument(const QDBusArgument &arg); QTextFormat format() const; Type type; @@ -96,8 +84,6 @@ public: QIBusAttributeList(); ~QIBusAttributeList(); - void fromDBusArgument(const QDBusArgument &arg); - QList<QInputMethodEvent::Attribute> imAttributes() const; QVector<QIBusAttribute> attributes; @@ -109,12 +95,27 @@ public: QIBusText(); ~QIBusText(); - void fromDBusArgument(const QDBusArgument &arg); - QString text; QIBusAttributeList attributes; }; +QDBusArgument &operator<<(QDBusArgument &argument, const QIBusSerializable &object); +const QDBusArgument &operator>>(const QDBusArgument &argument, QIBusSerializable &object); + +QDBusArgument &operator<<(QDBusArgument &argument, const QIBusAttribute &attribute); +const QDBusArgument &operator>>(const QDBusArgument &argument, QIBusAttribute &attribute); + +QDBusArgument &operator<<(QDBusArgument &argument, const QIBusAttributeList &attributeList); +const QDBusArgument &operator>>(const QDBusArgument &arg, QIBusAttributeList &attrList); + +QDBusArgument &operator<<(QDBusArgument &argument, const QIBusText &text); +const QDBusArgument &operator>>(const QDBusArgument &argument, QIBusText &text); + QT_END_NAMESPACE +Q_DECLARE_METATYPE(QIBusSerializable) +Q_DECLARE_METATYPE(QIBusAttribute) +Q_DECLARE_METATYPE(QIBusAttributeList) +Q_DECLARE_METATYPE(QIBusText) + #endif |