From 231fce16f7beb5073531f5fdfc76a4d1e89ff37f Mon Sep 17 00:00:00 2001 From: Rodney Dawes Date: Thu, 16 Jun 2022 16:54:36 -0400 Subject: [PATCH 1/8] cmake: Bump version requirement for maliit-framework for the new API --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 36a4e8f6..83c8c651 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,7 +24,7 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_AUTOMOC ON) -find_package(MaliitPlugins 0.99.1 REQUIRED) +find_package(MaliitPlugins 2.99.0 REQUIRED) find_package(GLib2 REQUIRED) find_package(GIO REQUIRED) From d6dd063eb05ebbbd1e88e54a718172e91867411e Mon Sep 17 00:00:00 2001 From: Rodney Dawes Date: Thu, 16 Jun 2022 16:55:15 -0400 Subject: [PATCH 2/8] Fix the build against new framework API --- src/plugin/inputmethod.cpp | 1 - src/plugin/inputmethod_p.h | 2 -- tests/unittests/common/inputmethodhostprobe.h | 4 ---- 3 files changed, 7 deletions(-) diff --git a/src/plugin/inputmethod.cpp b/src/plugin/inputmethod.cpp index 23cacca6..60966d5b 100644 --- a/src/plugin/inputmethod.cpp +++ b/src/plugin/inputmethod.cpp @@ -641,7 +641,6 @@ void InputMethod::setActiveLanguage(const QString &newLanguage) d->editor.commitPreedit(); d->activeLanguage = newLanguage; - d->host->setLanguage(newLanguage); d->m_settings.setActiveLanguage(newLanguage); qDebug() << "in inputMethod.cpp setActiveLanguage() emitting activeLanguageChanged to" << d->activeLanguage; diff --git a/src/plugin/inputmethod_p.h b/src/plugin/inputmethod_p.h index 749ff3da..aeef87b6 100644 --- a/src/plugin/inputmethod_p.h +++ b/src/plugin/inputmethod_p.h @@ -30,7 +30,6 @@ #include "logic/wordengine.h" #include -#include #include #include @@ -49,7 +48,6 @@ const Qt::WindowType InputMethodWindowType = (Qt::WindowType)(0x00000080 | Qt::W using namespace MaliitKeyboard; -typedef QScopedPointer ScopedSetting; typedef QSharedPointer SharedOverride; typedef QMap::const_iterator OverridesIterator; diff --git a/tests/unittests/common/inputmethodhostprobe.h b/tests/unittests/common/inputmethodhostprobe.h index 9828f360..9fe41e8c 100644 --- a/tests/unittests/common/inputmethodhostprobe.h +++ b/tests/unittests/common/inputmethodhostprobe.h @@ -101,10 +101,6 @@ class InputMethodHostProbe void setSelection(int, int) override {} void setOrientationAngleLocked(bool) override {} QList pluginDescriptions(Maliit::HandlerState) const override {return QList();} - Maliit::Plugins::AbstractPluginSetting* registerPluginSetting(const QString &, - const QString &, - Maliit::SettingEntryType , - const QVariantMap &) override { return 0; } void invokeAction(const QString &, const QKeySequence &) override {} From f961bc4c9f4ce508cbbe480584b9b20c38474d4a Mon Sep 17 00:00:00 2001 From: Rodney Dawes Date: Wed, 22 Jun 2022 14:13:03 -0400 Subject: [PATCH 3/8] qml: Add formatted numbers keyboard panel --- qml/languages/Keyboard_formattednumbers.qml | 82 +++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 qml/languages/Keyboard_formattednumbers.qml diff --git a/qml/languages/Keyboard_formattednumbers.qml b/qml/languages/Keyboard_formattednumbers.qml new file mode 100644 index 00000000..fe401faf --- /dev/null +++ b/qml/languages/Keyboard_formattednumbers.qml @@ -0,0 +1,82 @@ +/* + * Copyright 2013 Canonical Ltd. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; version 3. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +import QtQuick 2.4 + +import MaliitKeyboard 2.0 + +import "../keys" + +KeyPad { + anchors.fill: parent + + content: c1 + symbols: "" + + Column { + id: c1 + anchors.fill: parent + anchors.leftMargin: Device.gu(1); + anchors.rightMargin: Device.gu(1); + anchors.bottomMargin: Device.gu(1); + + property double numKeyWidth: panel.keyWidth - Device.gu(0.75); + property double numKeyHeight: panel.keyHeight - Device.gu(1); + + spacing: Device.gu(1); + + Row { + anchors.horizontalCenter: parent.horizontalCenter; + spacing: Device.gu(0.5); + + CharKey { label: "1"; noMagnifier: true; width: c1.numKeyWidth; height: c1.numKeyHeight; } + CharKey { label: "2"; noMagnifier: true; width: c1.numKeyWidth; height: c1.numKeyHeight; } + CharKey { label: "3"; noMagnifier: true; width: c1.numKeyWidth; height: c1.numKeyHeight; } + CharKey { label: "-"; noMagnifier: true; width: c1.numKeyWidth; height: c1.numKeyHeight; } + } + + Row { + anchors.horizontalCenter: parent.horizontalCenter; + spacing: Device.gu(0.5); + + CharKey { label: "4"; noMagnifier: true; width: c1.numKeyWidth; height: c1.numKeyHeight; } + CharKey { label: "5"; noMagnifier: true; width: c1.numKeyWidth; height: c1.numKeyHeight; } + CharKey { label: "6"; noMagnifier: true; width: c1.numKeyWidth; height: c1.numKeyHeight; } + SmallSpaceKey { padding: 0; width: c1.numKeyWidth; height: c1.numKeyHeight; } + } + + Row { + anchors.horizontalCenter: parent.horizontalCenter; + spacing: Device.gu(0.5); + + CharKey { label: "7"; noMagnifier: true; width: c1.numKeyWidth; height: c1.numKeyHeight; } + CharKey { label: "8"; noMagnifier: true; width: c1.numKeyWidth; height: c1.numKeyHeight; } + CharKey { label: "9"; noMagnifier: true; width: c1.numKeyWidth; height: c1.numKeyHeight; } + BackspaceKey { padding: 0; width: c1.numKeyWidth; height: c1.numKeyHeight; } + } + + Row { + anchors.horizontalCenter: parent.horizontalCenter; + spacing: Device.gu(0.5); + + CharKey { label: "+"; annotation: "#*"; extended: ["#", "*"]; noMagnifier: true; width: c1.numKeyWidth; height: c1.numKeyHeight; } + CharKey { label: "0"; noMagnifier: true; width: c1.numKeyWidth; height: c1.numKeyHeight; } + CharKey { label: "."; noMagnifier: true; width: c1.numKeyWidth; height: c1.numKeyHeight; } + ReturnKey { padding: 0; width: c1.numKeyWidth; height: c1.numKeyHeight; } + } + } // column +} + From ccf278802fa9825becd2986291f69eacea6395b2 Mon Sep 17 00:00:00 2001 From: Rodney Dawes Date: Wed, 22 Jun 2022 14:17:09 -0400 Subject: [PATCH 4/8] Handle new FormattedNumberContentType --- qml/KeyboardContainer.qml | 14 ++++++++++---- src/plugin/inputmethod.h | 1 + 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/qml/KeyboardContainer.qml b/qml/KeyboardContainer.qml index be774070..d87fa409 100644 --- a/qml/KeyboardContainer.qml +++ b/qml/KeyboardContainer.qml @@ -132,25 +132,31 @@ Item { } // NumberContentType - if (contentType === 1) { + if (contentType === Keyboard.NumberContentType) { canvas.layoutId = "number"; return "languages/Keyboard_numbers.qml"; } + // FormattedNumberContentType + if (contentType === Keyboard.FormattedNumberContentType) { + canvas.layoutId = "formatted"; + return "languages/Keyboard_formattednumbers.qml"; + } + // PhoneNumberContentType - if (contentType === 2) { + if (contentType === Keyboard.PhoneNumberContentType ) { canvas.layoutId = "telephone"; return "languages/Keyboard_telephone.qml"; } // EmailContentType - if (contentType === 3) { + if (contentType === Keyboard.EmailContentType) { canvas.layoutId = "email"; return Keyboard.currentPluginPath + "/Keyboard_" + language + "_email.qml"; } // UrlContentType - if (contentType === 4) { + if (contentType === Keyboard.UrlContentType) { canvas.layoutId = "url"; return Keyboard.currentPluginPath + "/Keyboard_" + language + "_url_search.qml"; } diff --git a/src/plugin/inputmethod.h b/src/plugin/inputmethod.h index f29ae7eb..87d66056 100644 --- a/src/plugin/inputmethod.h +++ b/src/plugin/inputmethod.h @@ -70,6 +70,7 @@ class InputMethod enum TextContentType { FreeTextContentType = Maliit::FreeTextContentType, NumberContentType = Maliit::NumberContentType, + FormattedNumberContentType = Maliit::FormattedNumberContentType, PhoneNumberContentType = Maliit::PhoneNumberContentType, EmailContentType = Maliit::EmailContentType, UrlContentType = Maliit::UrlContentType, From 078c90062d10d9aad2a9d37f58db0c31c6a6a3bc Mon Sep 17 00:00:00 2001 From: Rodney Dawes Date: Wed, 22 Jun 2022 16:55:22 -0400 Subject: [PATCH 5/8] qml: Improve the FormattedNumber keyboard layout --- qml/languages/Keyboard_formattednumbers.qml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/qml/languages/Keyboard_formattednumbers.qml b/qml/languages/Keyboard_formattednumbers.qml index fe401faf..0768ef31 100644 --- a/qml/languages/Keyboard_formattednumbers.qml +++ b/qml/languages/Keyboard_formattednumbers.qml @@ -55,7 +55,7 @@ KeyPad { CharKey { label: "4"; noMagnifier: true; width: c1.numKeyWidth; height: c1.numKeyHeight; } CharKey { label: "5"; noMagnifier: true; width: c1.numKeyWidth; height: c1.numKeyHeight; } CharKey { label: "6"; noMagnifier: true; width: c1.numKeyWidth; height: c1.numKeyHeight; } - SmallSpaceKey { padding: 0; width: c1.numKeyWidth; height: c1.numKeyHeight; } + CharKey { label: ","; noMagnifier: true; width: c1.numKeyWidth; height: c1.numKeyHeight; } } Row { @@ -72,9 +72,9 @@ KeyPad { anchors.horizontalCenter: parent.horizontalCenter; spacing: Device.gu(0.5); - CharKey { label: "+"; annotation: "#*"; extended: ["#", "*"]; noMagnifier: true; width: c1.numKeyWidth; height: c1.numKeyHeight; } - CharKey { label: "0"; noMagnifier: true; width: c1.numKeyWidth; height: c1.numKeyHeight; } CharKey { label: "."; noMagnifier: true; width: c1.numKeyWidth; height: c1.numKeyHeight; } + CharKey { label: "0"; noMagnifier: true; width: c1.numKeyWidth; height: c1.numKeyHeight; } + Item { width: c1.numKeyWidth; height: c1.numKeyHeight; } ReturnKey { padding: 0; width: c1.numKeyWidth; height: c1.numKeyHeight; } } } // column From 6c81a38c5b82a229da0fbfe6ae59f0bc94864456 Mon Sep 17 00:00:00 2001 From: Rodney Dawes Date: Wed, 22 Jun 2022 16:56:40 -0400 Subject: [PATCH 6/8] qml: Make the Number keyboard layout only numbers --- qml/languages/Keyboard_numbers.qml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/qml/languages/Keyboard_numbers.qml b/qml/languages/Keyboard_numbers.qml index fe401faf..a9d60266 100644 --- a/qml/languages/Keyboard_numbers.qml +++ b/qml/languages/Keyboard_numbers.qml @@ -45,7 +45,6 @@ KeyPad { CharKey { label: "1"; noMagnifier: true; width: c1.numKeyWidth; height: c1.numKeyHeight; } CharKey { label: "2"; noMagnifier: true; width: c1.numKeyWidth; height: c1.numKeyHeight; } CharKey { label: "3"; noMagnifier: true; width: c1.numKeyWidth; height: c1.numKeyHeight; } - CharKey { label: "-"; noMagnifier: true; width: c1.numKeyWidth; height: c1.numKeyHeight; } } Row { @@ -55,7 +54,6 @@ KeyPad { CharKey { label: "4"; noMagnifier: true; width: c1.numKeyWidth; height: c1.numKeyHeight; } CharKey { label: "5"; noMagnifier: true; width: c1.numKeyWidth; height: c1.numKeyHeight; } CharKey { label: "6"; noMagnifier: true; width: c1.numKeyWidth; height: c1.numKeyHeight; } - SmallSpaceKey { padding: 0; width: c1.numKeyWidth; height: c1.numKeyHeight; } } Row { @@ -65,16 +63,14 @@ KeyPad { CharKey { label: "7"; noMagnifier: true; width: c1.numKeyWidth; height: c1.numKeyHeight; } CharKey { label: "8"; noMagnifier: true; width: c1.numKeyWidth; height: c1.numKeyHeight; } CharKey { label: "9"; noMagnifier: true; width: c1.numKeyWidth; height: c1.numKeyHeight; } - BackspaceKey { padding: 0; width: c1.numKeyWidth; height: c1.numKeyHeight; } } Row { anchors.horizontalCenter: parent.horizontalCenter; spacing: Device.gu(0.5); - CharKey { label: "+"; annotation: "#*"; extended: ["#", "*"]; noMagnifier: true; width: c1.numKeyWidth; height: c1.numKeyHeight; } + BackspaceKey { padding: 0; width: c1.numKeyWidth; height: c1.numKeyHeight; } CharKey { label: "0"; noMagnifier: true; width: c1.numKeyWidth; height: c1.numKeyHeight; } - CharKey { label: "."; noMagnifier: true; width: c1.numKeyWidth; height: c1.numKeyHeight; } ReturnKey { padding: 0; width: c1.numKeyWidth; height: c1.numKeyHeight; } } } // column From 2a886636d65b94c6cdefa83601eda4c46a181d16 Mon Sep 17 00:00:00 2001 From: Rodney Dawes Date: Thu, 30 Jun 2022 15:52:21 -0400 Subject: [PATCH 7/8] inputmethod: Drop imExtensionEvent method --- src/plugin/inputmethod.cpp | 69 +++++++++++++++++--------------------- src/plugin/inputmethod.h | 1 - 2 files changed, 30 insertions(+), 40 deletions(-) diff --git a/src/plugin/inputmethod.cpp b/src/plugin/inputmethod.cpp index 60966d5b..a8f76741 100644 --- a/src/plugin/inputmethod.cpp +++ b/src/plugin/inputmethod.cpp @@ -260,45 +260,6 @@ void InputMethod::handleClientChange() hide(); } -bool InputMethod::imExtensionEvent(MImExtensionEvent *event) -{ - Q_D(InputMethod); - - if (not event or event->type() != MImExtensionEvent::Update) { - return false; - } - - auto enterKeyType = inputMethodHost()->inputMethodQuery(Qt::ImEnterKeyType).value(); - - d->actionKeyOverrider.reset(new MKeyOverride(actionKeyName)); - switch (enterKeyType) { - case Qt::EnterKeyDefault: - case Qt::EnterKeyReturn: - d->actionKeyOverrider->setLabel(QString()); - break; - case Qt::EnterKeyDone: - d->actionKeyOverrider->setLabel(d->m_gettext->qsTr("Done")); - break; - case Qt::EnterKeyGo: - d->actionKeyOverrider->setLabel(d->m_gettext->qsTr("Go")); - break; - case Qt::EnterKeySend: - d->actionKeyOverrider->setLabel(d->m_gettext->qsTr("Send")); - break; - case Qt::EnterKeySearch: - d->actionKeyOverrider->setLabel(d->m_gettext->qsTr("Search")); - break; - case Qt::EnterKeyNext: - d->actionKeyOverrider->setLabel(d->m_gettext->qsTr("Next")); - break; - case Qt::EnterKeyPrevious: - d->actionKeyOverrider->setLabel(d->m_gettext->qsTr("Previous")); - break; - } - emit actionKeyOverrideChanged(); - return true; -} - void InputMethod::onAutoCorrectSettingChanged() { Q_D(InputMethod); @@ -459,6 +420,36 @@ void InputMethod::update() checkAutocaps(); d->previous_position = position; } + + // Check for action key overrides + auto enterKeyType = inputMethodHost()->inputMethodQuery(Qt::ImEnterKeyType).value(); + + d->actionKeyOverrider.reset(new MKeyOverride(actionKeyName)); + switch (enterKeyType) { + case Qt::EnterKeyDefault: + case Qt::EnterKeyReturn: + d->actionKeyOverrider->setLabel(QString()); + break; + case Qt::EnterKeyDone: + d->actionKeyOverrider->setLabel(d->m_gettext->qsTr("Done")); + break; + case Qt::EnterKeyGo: + d->actionKeyOverrider->setLabel(d->m_gettext->qsTr("Go")); + break; + case Qt::EnterKeySend: + d->actionKeyOverrider->setLabel(d->m_gettext->qsTr("Send")); + break; + case Qt::EnterKeySearch: + d->actionKeyOverrider->setLabel(d->m_gettext->qsTr("Search")); + break; + case Qt::EnterKeyNext: + d->actionKeyOverrider->setLabel(d->m_gettext->qsTr("Next")); + break; + case Qt::EnterKeyPrevious: + d->actionKeyOverrider->setLabel(d->m_gettext->qsTr("Previous")); + break; + } + emit actionKeyOverrideChanged(); } void InputMethod::updateWordEngine() diff --git a/src/plugin/inputmethod.h b/src/plugin/inputmethod.h index 87d66056..66ea195b 100644 --- a/src/plugin/inputmethod.h +++ b/src/plugin/inputmethod.h @@ -97,7 +97,6 @@ class InputMethod void handleAppOrientationChanged(int angle) override; void handleClientChange() override; void reset() override; - bool imExtensionEvent(MImExtensionEvent *event) override; void setKeyOverrides(const QMap > &overrides) override; //! \reimp_end From 15cb2b22a7d81a8345974bc4ed9dad0feb509c0d Mon Sep 17 00:00:00 2001 From: Rodney Dawes Date: Thu, 30 Jun 2022 16:26:17 -0400 Subject: [PATCH 8/8] Remove UpdateNotifier and related code depending on UpdateEvent API --- CMakeLists.txt | 2 - src/plugin/inputmethod.cpp | 3 - src/plugin/updatenotifier.cpp | 101 ------------------ src/plugin/updatenotifier.h | 75 ------------- .../ut_preedit-string/ut_preedit-string.cpp | 24 ----- 5 files changed, 205 deletions(-) delete mode 100644 src/plugin/updatenotifier.cpp delete mode 100644 src/plugin/updatenotifier.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 83c8c651..dc7a4c20 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -157,8 +157,6 @@ set(MALIIT_KEYBOARD_COMMON_SOURCES src/plugin/feedback.h src/plugin/gettext.cpp src/plugin/gettext.h - src/plugin/updatenotifier.cpp - src/plugin/updatenotifier.h src/plugin/inputmethod.cpp src/plugin/inputmethod.h src/plugin/inputmethod_p.h diff --git a/src/plugin/inputmethod.cpp b/src/plugin/inputmethod.cpp index a8f76741..b27da8a0 100644 --- a/src/plugin/inputmethod.cpp +++ b/src/plugin/inputmethod.cpp @@ -42,14 +42,11 @@ #include "view/setup.h" #include -#include #include #include -class MImUpdateEvent; - using namespace MaliitKeyboard; namespace { diff --git a/src/plugin/updatenotifier.cpp b/src/plugin/updatenotifier.cpp deleted file mode 100644 index 33d5420e..00000000 --- a/src/plugin/updatenotifier.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/* - * This file is part of Maliit Plugins - * - * Copyright (C) 2012 Openismus GmbH. All rights reserved. - * - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * Neither the name of Nokia Corporation nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific - * prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - * THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#include "updatenotifier.h" - -#include - -namespace MaliitKeyboard { - -namespace -{ - -const char* const g_surrounding_text_property("surroundingText"); -const char* const g_cursor_position_property("cursorPosition"); -const char* const g_anchor_position_property("anchorPosition"); -const char* const g_has_selection("hasSelection"); - -} // unnamed namespace - -class UpdateNotifierPrivate -{ -public: - UpdateNotifierPrivate(); - - bool has_selection; -}; - -UpdateNotifierPrivate::UpdateNotifierPrivate() - : has_selection(false) -{} - -UpdateNotifier::UpdateNotifier(QObject *parent) - : QObject(parent) - , d_ptr(new UpdateNotifierPrivate) -{} - -UpdateNotifier::~UpdateNotifier() = default; - -void UpdateNotifier::notify(MImUpdateEvent* event) -{ - Q_D(UpdateNotifier); - - const QStringList properties_changed(event->propertiesChanged()); - - if (properties_changed.contains(g_has_selection)) { - const bool has_selection(event->value(g_has_selection).toBool()); - - d->has_selection = has_selection; - } - - if (not d->has_selection and properties_changed.contains(g_cursor_position_property)) { - const int cursor_position(event->value(g_cursor_position_property).toInt()); - const QString surrounding_text(event->value(g_surrounding_text_property).toString()); - bool emit_a_signal(true); - - if (emit_a_signal and properties_changed.contains(g_anchor_position_property)) { - const int anchor_position(event->value(g_anchor_position_property).toInt()); - - emit_a_signal = (anchor_position == cursor_position); - } - - if (emit_a_signal) { - Q_EMIT cursorPositionChanged(cursor_position, surrounding_text); - } - } -} - -void UpdateNotifier::notifyOverride(const Logic::KeyOverrides &overridden_keys, - bool update /* = false */) -{ - Q_EMIT keysOverridden(overridden_keys, update); -} - -} // namespace MaliitKeyboard diff --git a/src/plugin/updatenotifier.h b/src/plugin/updatenotifier.h deleted file mode 100644 index aa1b4c1f..00000000 --- a/src/plugin/updatenotifier.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * This file is part of Maliit Plugins - * - * Copyright (C) 2012 Openismus GmbH. All rights reserved. - * - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * Neither the name of Nokia Corporation nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific - * prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - * THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifndef MALIIT_KEYBOARD_UPDATENOTIFIER_H -#define MALIIT_KEYBOARD_UPDATENOTIFIER_H - -#include -#include - -class MImUpdateEvent; - -namespace MaliitKeyboard { -class Key; - -namespace Logic -{ -typedef QMap KeyOverrides; -} - -class UpdateNotifierPrivate; - -class UpdateNotifier - : public QObject -{ - Q_OBJECT - Q_DISABLE_COPY(UpdateNotifier) - Q_DECLARE_PRIVATE(UpdateNotifier) - -public: - explicit UpdateNotifier(QObject *parent = nullptr); - ~UpdateNotifier() override; - - void notify(MImUpdateEvent *event); - void notifyOverride(const Logic::KeyOverrides &overridden_keys, - bool update = false); - - Q_SIGNAL void cursorPositionChanged(int cursor_position, - const QString &surrounding_text); - Q_SIGNAL void keysOverridden(const Logic::KeyOverrides &overridden_keys, - bool update); - -private: - const QScopedPointer d_ptr; -}; - -} // namespace MaliitKeyboard - -#endif // MALIIT_KEYBOARD_UPDATENOTIFIER_H diff --git a/tests/unittests/ut_preedit-string/ut_preedit-string.cpp b/tests/unittests/ut_preedit-string/ut_preedit-string.cpp index fe5b7c6e..8784372f 100644 --- a/tests/unittests/ut_preedit-string/ut_preedit-string.cpp +++ b/tests/unittests/ut_preedit-string/ut_preedit-string.cpp @@ -45,12 +45,10 @@ #include "view/setup.h" #include "plugin/editor.h" -#include "plugin/updatenotifier.h" #include "inputmethodhostprobe.h" #include "wordengineprobe.h" #include -#include #include #include @@ -147,19 +145,6 @@ bool operator==(const Maliit::PreeditTextFormat &a, const Maliit::PreeditTextFor return ((a.start == b.start) and (a.length == b.length) and (a.preeditFace == b.preeditFace)); } -MImUpdateEvent *createUpdateEvent(const QString &surrounding_text, - int cursor_position) -{ - const char *const cur_pos("cursorPosition"); - QStringList properties_changed(cur_pos); - QMap update; - - update.insert(cur_pos, cursor_position); - update.insert("surroundingText", surrounding_text); - - return new MImUpdateEvent(update, properties_changed); -} - } // unnamed namespace struct BasicSetupTest @@ -175,7 +160,6 @@ struct BasicSetupTest Editor editor; InputMethodHostProbe host; - UpdateNotifier notifier; }; class SetupTest @@ -477,10 +461,6 @@ class TestPreeditString QFETCH(bool, expected_preedit_string_sent); BasicSetupTest test_setup; - QScopedPointer update_event(createUpdateEvent(surrounding_text, - cursor_position)); - - test_setup.notifier.notify(update_event.data()); QCOMPARE(test_setup.host.preeditStringSent(), expected_preedit_string_sent); if (expected_preedit_string_sent) { @@ -602,10 +582,6 @@ class TestPreeditString QFETCH(int, expected_cursor_position); SetupTest test_setup; - QScopedPointer update_event(createUpdateEvent(surrounding_text, - cursor_position)); - - test_setup.notifier.notify(update_event.data()); Q_FOREACH (const QString &k, keys) { test_setup.event_handler.onPressed(lookup(k));