[meego-commits] 14687: Changes to devel:qt-mtf/meegotouch-inputmethodkeyboard
Luis Araujo
no_reply at build.meego.com
Fri Mar 11 03:38:30 UTC 2011
Hi,
I have made the following changes to meegotouch-inputmethodkeyboard in project devel:qt-mtf. Please review and accept ASAP.
Thank You,
Luis Araujo
[This message was auto-generated]
---
Request #14687:
submit: home:araujo:branches:devel:qt-mtf/meegotouch-inputmethodkeyboard(r3)(cleanup) -> devel:qt-mtf/meegotouch-inputmethodkeyboard
Message:
Version update to 0.5.32 depending on important API changes required for meego1.2 (BMC#14350, BMC#14351)
State: new 2011-03-10T19:38:25 araujo
Comment: None
changes files:
--------------
--- meegotouch-inputmethodkeyboard.changes
+++ meegotouch-inputmethodkeyboard.changes
@@ -0,0 +1,4 @@
+* Thu Mar 10 2011 Luis Araujo <luis.araujo at collabora.co.uk> - 0.5.32
+- Update to release tag 0.5.32-1 (BMC#14351)
+- Add version dependency on MeegoImFramework >= 0.20.0
+
old:
----
meegotouch-inputmethodkeyboard-0.5.30.tar.bz2
new:
----
meegotouch-inputmethodkeyboard-0.5.32.tar.bz2
spec files:
-----------
--- meegotouch-inputmethodkeyboard.spec
+++ meegotouch-inputmethodkeyboard.spec
@@ -1,13 +1,13 @@
#
# Do NOT Edit the Auto-generated Part!
-# Generated by: spectacle version 0.22git
+# Generated by: spectacle version 0.22
#
# >> macros
# << macros
Name: meegotouch-inputmethodkeyboard
Summary: MeeGo Virtual Keyboard
-Version: 0.5.30
+Version: 0.5.32
Release: 1
Group: System/GUI/Other
License: LGPLv2.1
@@ -17,7 +17,7 @@
Requires: contextkit-maemo
BuildRequires: pkgconfig(QtGui) >= 4.6.0
BuildRequires: pkgconfig(MeegoImEngine) >= 0.4.1
-BuildRequires: pkgconfig(MeegoImFramework) >= 0.19.41
+BuildRequires: pkgconfig(MeegoImFramework) >= 0.20.0
BuildRequires: pkgconfig(meegotouch) >= 0.20.87
BuildRequires: pkgconfig(meegotouch-feedbackreactionmaps) >= 0.14.0
BuildRequires: pkgconfig(x11)
other changes:
--------------
++++++ meegotouch-inputmethodkeyboard-0.5.30.tar.bz2 -> meegotouch-inputmethodkeyboard-0.5.32.tar.bz2
--- debian/changelog
+++ debian/changelog
@@ -1,9 +1,21 @@
-meego-keyboard (0.5.31~1) unstable; urgency=low
+meego-keyboard (0.5.33~1) unstable; urgency=low
* [UNRELEASED]
+
+ -- Rakesh Cherian <ext-rakesh.cherian at nokia.com> Tue, 08 Mar 2011 15:23:00 +0200
+
+meego-keyboard (0.5.32-1) unstable; urgency=low
+
+ * Fixes: NB#233350, [TASK] E-mail/url specific virtual keyboard layouts
+
+ -- Rakesh Cherian <ext-rakesh.cherian at nokia.com> Tue, 08 Mar 2011 15:23:00 +0200
+
+meego-keyboard (0.5.31-1) unstable; urgency=low
+
+ * Fixes: NB#231074, [FEA] Action key highlight in vkb (not for picker)
* Fixes: NB#218406, Cursor is moving to the end of the word when space bar is long pressed in a scenario.
- -- Ning Chi <ext-chi.2.ning at nokia.com> Thu, 03 Mar 2011 09:39:44 +0200
+ -- Kimmo Surakka <kimmo.surakka at nokia.com> Fri, 04 Mar 2011 14:10:00 +0200
meego-keyboard (0.5.30-1) unstable; urgency=low
--- debian/control
+++ debian/control
@@ -2,7 +2,7 @@
Section: libs
Priority: extra
Maintainer: Mohammad Anwari <Mohammad.Anwari at nokia.com>
-Build-Depends: debhelper (>= 5), libqt4-dev (>= 4.6), doxygen, libmeegoimengine-dev (>= 0.4.1), libmeegoimframework-dev (>= 0.19.41~1), libmeegotouch-dev (>= 0.20), libmeegoreactionmap-dev (>= 0.14.0-1), libxkbfile-dev (>= 1.0.6)
+Build-Depends: debhelper (>= 5), libqt4-dev (>= 4.6), doxygen, libmeegoimengine-dev (>= 0.4.1), libmeegoimframework-dev (>= 0.20.0~1), libmeegotouch-dev (>= 0.20), libmeegoreactionmap-dev (>= 0.14.0-1), libxkbfile-dev (>= 1.0.6)
Standards-Version: 3.7.2
Package: meego-keyboard
--- debian/rules
+++ debian/rules
@@ -36,6 +36,10 @@
QMAKE_OPTIONS += DEFINES+=M_TIMESTAMP
endif
+ifneq (,$(filter noreactionmap,$(TMP_BUILD_OPTS)))
+ QMAKE_OPTIONS += CONFIG+=noreactionmap
+endif
+
# shared library versions, option 1
version=0.1.0
--- m-keyboard/common/common.pri
+++ m-keyboard/common/common.pri
@@ -25,6 +25,7 @@
$$COMMON_DIR/keyboardmapping.h \
$$COMMON_DIR/simplefilelog.h \
$$COMMON_DIR/mimreactionmap.h \
+ $$COMMON_DIR/reactionmapwrapper.h \
SOURCES += \
$$COMMON_DIR/keyboarddata.cpp\
--- m-keyboard/common/keyboarddata.cpp
+++ m-keyboard/common/keyboarddata.cpp
@@ -498,7 +498,7 @@
{
const bool shift = toBoolean(element.attribute(VKBTagShift, "false"));
- if (params.currentKey->bindings[shift ? MImKeyModel::Shift : MImKeyModel::NoShift]) {
+ if (params.currentKey->binding(shift)) {
qWarning() << "Ignoring duplicate binding with same shift attribute on line"
<< element.lineNumber() << "column" << element.columnNumber()
<< "in layout file" << *params.fileName;
@@ -521,7 +521,7 @@
binding->extended_labels = element.attribute(VKBTagExtendedLabels);
- params.currentKey->bindings[shift ? MImKeyModel::Shift : MImKeyModel::NoShift] = binding;
+ params.currentKey->setBinding(*binding, shift);
}
void KeyboardData::parseTagKey(const QDomElement &element, ParseParameters ¶ms)
@@ -548,12 +548,12 @@
parseChildren(element, params, VKBTagBinding, &KeyboardData::parseTagBinding);
- if (key->bindings[1] == NULL) {
- key->bindings[1] = key->bindings[0];
+ if (key->binding(false) == NULL) {
+ key->setBinding(*(key->binding(true)), false);
}
- if (key->bindings[0] == NULL) {
- key->bindings[0] = key->bindings[1];
+ if (key->binding(true) == NULL) {
+ key->setBinding(*(key->binding(false)), true);
}
}
--- m-keyboard/common/mimkeymodel.cpp
+++ m-keyboard/common/mimkeymodel.cpp
@@ -142,6 +142,8 @@
{
bindings[NoShift] = 0;
bindings[Shift] = 0;
+ activeBindings[NoShift] = 0;
+ activeBindings[Shift] = 0;
}
MImKeyModel::~MImKeyModel()
@@ -150,6 +152,8 @@
delete bindings[NoShift];
}
delete bindings[Shift];
+
+ // No need to delete activeBindings; they're only aliases
}
void MImKeyModel::setBinding(const MImKeyBinding &binding, bool shift)
@@ -159,6 +163,7 @@
delete store;
}
store = &binding;
+ activeBindings[shift ? Shift : NoShift] = &binding;
}
KeyEvent MImKeyModel::toKeyEvent(QKeyEvent::Type eventType, bool shift) const
@@ -197,3 +202,11 @@
return keyId;
}
+void MImKeyModel::overrideBinding(const MImKeyBinding *binding, bool shift)
+{
+ if(binding == 0)
+ {
+ binding = bindings[shift ? Shift : NoShift]; // reset to default
+ }
+ activeBindings[shift ? Shift : NoShift] = binding;
+}
--- m-keyboard/common/mimkeymodel.h
+++ m-keyboard/common/mimkeymodel.h
@@ -235,6 +235,9 @@
//! Returns key's identifier
QString id() const;
+ //! Set a temporary override for the binding
+ void overrideBinding(const MImKeyBinding *binding, bool shift);
+
private:
enum {
NoShift = 0,
@@ -246,6 +249,11 @@
// the same binding
const MImKeyBinding *bindings[NumBindings];
+ // Active bindings (changeable by overrideBinding or setBinding):
+ // NOTE: this are only aliases, they are not owned. No need to
+ // delete them!
+ const MImKeyBinding *activeBindings[NumBindings];
+
StyleType mStyle;
WidthType mWidthType;
@@ -259,16 +267,12 @@
//! Contains key's identifier
QString keyId;
- friend class KeyboardData;
- friend class Ut_MImKeyModel;
- friend class Ut_MImKey;
};
inline const MImKeyBinding *MImKeyModel::binding(bool shift) const
{
- return bindings[shift ? Shift : NoShift];
+ return activeBindings[shift ? Shift : NoShift];
}
-
#endif
--- m-keyboard/common/mimreactionmap.h
+++ m-keyboard/common/mimreactionmap.h
@@ -21,8 +21,9 @@
namespace MImReactionMap
{
-const static QString Press = "vkb-press";
-const static QString Release = "vkb-release";
+const static QString Press = "priority2_static_press";
+const static QString Release = "priority2_static_release";
+const static QString Sliding = "priority2_vkb_sliding_press";
};
#endif
--- m-keyboard/common/reactionmapwrapper.h
+++ m-keyboard/common/reactionmapwrapper.h
+/* * This file is part of m-keyboard *
+ *
+ * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * Contact: Nokia Corporation (directui at nokia.com)
+ *
+ * If you have questions regarding the use of this file, please contact
+ * Nokia at directui at nokia.com.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it 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.
+ */
+
+#ifndef REACTIONMAPWRAPPER_H
+#define REACTIONMAPWRAPPER_H
+
+#ifdef HAVE_REACTIONMAP
+#include "mimreactionmap.h"
+#include <mreactionmap.h>
+#else
+// Provide an empty replacement, in case MReactionMap was forward-declared:
+class MReactionMap
+{};
+#endif
+
+#endif // REACTIONMAPWRAPPER_H
--- m-keyboard/m-keyboard.pro
+++ m-keyboard/m-keyboard.pro
@@ -4,7 +4,7 @@
# It causes problem in the integration.
QMAKE_LFLAGS_RELEASE-=-Wl,--as-needed
-TEMPLATE = lib
+TEMPLATE = lib
TARGET = $$qtLibraryTarget(meego-keyboard)
OBJECTS_DIR = .obj
@@ -15,7 +15,7 @@
QT += xml
LIBS += -lmeegoimengine
-CONFIG += plugin meegotouch meegoimengine meegoimframework meegoreactionmap
+CONFIG += plugin meegotouch meegoimengine meegoimframework
CONFIG += link_pkgconfig
PKGCONFIG += gconf-2.0 xkbfile
@@ -30,6 +30,12 @@
}
}
+contains(CONFIG, noreactionmap) {
+} else {
+ DEFINES += HAVE_REACTIONMAP
+ CONFIG += meegoreactionmap
+}
+
QMAKE_CLEAN += *.gcno *.gcda
include(common/common.pri)
--- m-keyboard/mkeyboardhost.cpp
+++ m-keyboard/mkeyboardhost.cpp
@@ -30,6 +30,7 @@
#include "reactionmappainter.h"
#include "regiontracker.h"
#include "simplefilelog.h"
+#include "reactionmapwrapper.h"
#include <mimenginefactory.h>
#include <mabstractinputmethodhost.h>
@@ -38,11 +39,14 @@
#include <mkeyoverride.h>
#include <mgconfitem.h>
+#include <QApplication>
#include <QDebug>
#include <QKeyEvent>
#include <QRegExp>
#include <QEasingCurve>
+#include <MComponentData>
+#include <MDeviceProfile>
#include <MScene>
#include <MSceneManager>
#include <MSceneWindow>
@@ -79,6 +83,7 @@
const char *const MImTouchPointsLogfile = "touchpoints.csv";
const char PlusSign('+');
const char MinusSign('-');
+ bool gOwnsComponentData = false;
}
MKeyboardHost::SlideUpAnimation::SlideUpAnimation(QObject *parent)
@@ -185,8 +190,9 @@
}
}
-MKeyboardHost::MKeyboardHost(MAbstractInputMethodHost *imHost, QObject *parent)
- : MAbstractInputMethod(imHost, parent),
+MKeyboardHost::MKeyboardHost(MAbstractInputMethodHost *host,
+ QWidget *mainWindow)
+ : MAbstractInputMethod(host, mainWindow),
vkbStyleContainer(0),
correctionHost(0),
vkbWidget(0),
@@ -221,13 +227,42 @@
fastTypingEnabled(false),
vkbFadeInAnimation(*new QPropertyAnimation(this)),
toolbarFadeInAnimation(*new QPropertyAnimation(this)),
- touchPointLogHandle(0)
+ touchPointLogHandle(0),
+ view(0)
{
+ Q_ASSERT(host != 0);
+ Q_ASSERT(mainWindow != 0);
+
+ if (!MComponentData::instance()) {
+ static int argc = qApp->argc();
+ static char **argv = qApp->argv();
+ MComponentData::createInstance(argc, argv, qApp->applicationName());
+ gOwnsComponentData = true;
+ }
+
+ // Assumes that we start up in landscape mode:
+ const QSize sceneSize(MDeviceProfile::instance()->resolution());
+ mainWindow->resize(sceneSize);
+
+#ifdef HAVE_REACTIONMAP
+ if (not MReactionMap::instance(mainWindow)) {
+ new MReactionMap(mainWindow, qAppName(), this);
+ }
+#endif
+
+ view = new MPlainWindow(host, mainWindow);
+ int w = sceneSize.width();
+ int h = sceneSize.height();
+ view->setSceneRect(0, 0, w, h);
+ view->resize(sceneSize);
+ view->setMinimumSize(1, 1);
+ view->setMaximumSize(w, h);
+
RegionTracker::createInstance();
connect(&RegionTracker::instance(), SIGNAL(regionChanged(const QRegion &)),
- imHost, SLOT(setScreenRegion(const QRegion &)));
+ host, SLOT(setScreenRegion(const QRegion &)));
connect(&RegionTracker::instance(), SIGNAL(inputMethodAreaChanged(const QRegion &)),
- imHost, SLOT(setInputMethodArea(const QRegion &)));
+ host, SLOT(setInputMethodArea(const QRegion &)));
// Create the reaction map painter
ReactionMapPainter::createInstance();
@@ -284,7 +319,7 @@
this, SLOT(switchPlugin(MInputMethod::SwitchDirection)));
// construct hardware keyboard object
- hardwareKeyboard = new MHardwareKeyboard(*imHost, this);
+ hardwareKeyboard = new MHardwareKeyboard(*host, this);
connect(hardwareKeyboard, SIGNAL(symbolKeyClicked()),
this, SLOT(handleSymbolKeyClick()));
// Trigger a reaction map when the hardware keyboard is opened
@@ -445,6 +480,11 @@
ReactionMapPainter::destroyInstance();
RegionTracker::destroyInstance();
currentInstance = 0;
+
+ if (gOwnsComponentData) {
+ delete MComponentData::instance();
+ gOwnsComponentData = false;
+ }
}
MKeyboardHost* MKeyboardHost::instance()
@@ -1189,7 +1229,8 @@
}
if (event.specialKey() == KeyEvent::LayoutMenu) {
- showLayoutMenu();
+ qWarning() << __PRETTY_FUNCTION__
+ << "KeyEvent::LayoutMenu is unsupported";
} else if (event.specialKey() == KeyEvent::Sym) {
handleSymbolKeyClick();
} else if (event.specialKey() == KeyEvent::Switch) {
@@ -1505,11 +1546,6 @@
}
}
-void MKeyboardHost::showLayoutMenu()
-{
- inputMethodHost()->showSettings();
-}
-
void MKeyboardHost::switchPlugin(MInputMethod::SwitchDirection direction)
{
inputMethodHost()->switchPlugin(direction);
--- m-keyboard/mkeyboardhost.h
+++ m-keyboard/mkeyboardhost.h
@@ -22,6 +22,8 @@
#include "mkeyboardcommon.h"
#include "mabstractinputmethod.h"
#include "keyevent.h"
+#include "mplainwindow.h"
+
#include <QStringList>
#include <QTimer>
#include <QPointer>
@@ -29,6 +31,7 @@
#include <QSequentialAnimationGroup>
#include <QParallelAnimationGroup>
#include <QTextStream>
+#include <QPixmap>
class MGConfItem;
class MImCorrectionHost;
@@ -51,7 +54,8 @@
Q_OBJECT
public:
- MKeyboardHost(MAbstractInputMethodHost *imHost, QObject *parent = 0);
+ MKeyboardHost(MAbstractInputMethodHost *host,
+ QWidget *mainWindow);
virtual ~MKeyboardHost();
//! \brief Return the current instance, or 0 if none.
@@ -233,9 +237,6 @@
//! Actual backspace operation
void doBackspace();
- // shows the layout menu
- void showLayoutMenu();
-
/*! \brief Handle key click event that changes the state of the keyboard.
*
* This method should contain functionality that is common to
@@ -419,6 +420,7 @@
QParallelAnimationGroup toolbarAndVkbFadeInAnimation;
SimpleFileLog *touchPointLogHandle;
+ MPlainWindow *view;
#ifdef UNIT_TEST
friend class Ut_MKeyboardHost;
--- m-keyboard/mkeyboardplugin.cpp
+++ m-keyboard/mkeyboardplugin.cpp
@@ -43,11 +43,12 @@
MAbstractInputMethod *
-MKeyboardPlugin::createInputMethod(MAbstractInputMethodHost *host)
+MKeyboardPlugin::createInputMethod(MAbstractInputMethodHost *host,
+ QWidget *mainWindow)
{
loadTranslation();
mTimestamp("MKeyboardPlugin", "start");
- MAbstractInputMethod *inputMethod = new MKeyboardHost(host);
+ MAbstractInputMethod *inputMethod = new MKeyboardHost(host, mainWindow);
mTimestamp("MKeyboardPlugin", "end");
return inputMethod;
}
--- m-keyboard/mkeyboardplugin.h
+++ m-keyboard/mkeyboardplugin.h
@@ -20,6 +20,7 @@
#define MKEYBOARDPLUGIN_H
#include <QObject>
+#include <QWidget>
#include "minputmethodplugin.h"
@@ -40,7 +41,8 @@
//! \reimp
virtual QString name() const;
virtual QStringList languages() const;
- virtual MAbstractInputMethod *createInputMethod(MAbstractInputMethodHost *host);
+ virtual MAbstractInputMethod *createInputMethod(MAbstractInputMethodHost *host,
+ QWidget *mainWindow);
virtual MAbstractInputMethodSettings *createInputMethodSettings();
virtual QSet<MInputMethod::HandlerState> supportedStates() const;
//! \reimp_end
--- m-keyboard/theme/haptic-press
+++ m-keyboard/theme/haptic-press
-(directory)
--- m-keyboard/theme/haptic-press/haptic-press.pri
+++ m-keyboard/theme/haptic-press/haptic-press.pri
-
-haptic_press_data.path = /usr/share/themes/base/meegotouch/meego-im-uiserver/feedbacks/vkb-press
-haptic_press_data.files = theme/haptic-press/vibra.ivt
-
-INSTALLS += \
- haptic_press_data \
--- m-keyboard/theme/haptic-release
+++ m-keyboard/theme/haptic-release
-(directory)
--- m-keyboard/theme/haptic-release/haptic-release.pri
+++ m-keyboard/theme/haptic-release/haptic-release.pri
-
-haptic_release_data.path = /usr/share/themes/base/meegotouch/meego-im-uiserver/feedbacks/vkb-release
-haptic_release_data.files = theme/haptic-release/vibra.ivt
-
-INSTALLS += \
- haptic_release_data \
--- m-keyboard/theme/haptic-release/vibra.ivt
+++ m-keyboard/theme/haptic-release/vibra.ivt
(renamed to m-keyboard/theme/priority2_vkb_sliding_press/vibra.ivt)
--- m-keyboard/theme/priority2_vkb_sliding_press
+++ m-keyboard/theme/priority2_vkb_sliding_press
+(directory)
--- m-keyboard/theme/priority2_vkb_sliding_press/priority2_vkb_sliding_press.pri
+++ m-keyboard/theme/priority2_vkb_sliding_press/priority2_vkb_sliding_press.pri
+
+priority2_vkb_sliding_press_data.path = /usr/share/themes/base/meegotouch/meego-im-uiserver/feedbacks/priority2_vkb_sliding_press
+priority2_vkb_sliding_press_data.files = theme/priority2_vkb_sliding_press/vibra.ivt \
+ theme/priority2_vkb_sliding_press/audio.wav \
+
+INSTALLS += \
+ priority2_vkb_sliding_press_data \
--- m-keyboard/theme/priority2_vkb_sliding_press/vibra.ivt
+++ m-keyboard/theme/priority2_vkb_sliding_press/vibra.ivt
(renamed from m-keyboard/theme/haptic-release/vibra.ivt)
--- m-keyboard/theme/theme.pri
+++ m-keyboard/theme/theme.pri
@@ -1,6 +1,5 @@
-include(haptic-press/haptic-press.pri)
-include(haptic-release/haptic-release.pri)
+include(priority2_vkb_sliding_press/priority2_vkb_sliding_press.pri)
IMAGES_DATA = theme/meegotouch-keyboard.svg
images_data.path = /usr/share/themes/base/meegotouch/svg
--- m-keyboard/widgets/horizontalswitcher.cpp
+++ m-keyboard/widgets/horizontalswitcher.cpp
@@ -330,3 +330,12 @@
}
}
+void HorizontalSwitcher::setContentType(M::TextContentType type)
+{
+ foreach(QGraphicsWidget *slide, slides) {
+ MImAbstractKeyArea *mainKba = qobject_cast<MImAbstractKeyArea *>(slide);
+ if (mainKba) {
+ mainKba->setContentType(type);
+ }
+ }
+}
--- m-keyboard/widgets/horizontalswitcher.h
+++ m-keyboard/widgets/horizontalswitcher.h
@@ -23,6 +23,7 @@
#include <QGraphicsItemAnimation>
#include <QTimeLine>
#include <QMap>
+#include <MNamespace>
class MKeyOverride;
@@ -115,6 +116,11 @@
*/
void setKeyOverrides(const QMap<QString, QSharedPointer<MKeyOverride> > &overrides);
+ /*!
+ * \brief Sets the current content type (handles email/url overrides).
+ */
+ void setContentType(M::TextContentType type);
+
signals:
/*! \brief Signals the beginning of a switch.
* This is emitted even if there is no animation.
--- m-keyboard/widgets/mimabstractkeyarea.cpp
+++ m-keyboard/widgets/mimabstractkeyarea.cpp
@@ -131,7 +131,7 @@
mPopup(usePopup ? PopupFactory::instance()->createPopup(this) : 0),
wasGestureTriggered(false),
enableMultiTouch(MGConfItem(MultitouchSettings).value().toBool()),
- feedbackSliding(MImReactionMap::Release),
+ feedbackSliding(MImReactionMap::Sliding),
section(newSection)
{
// By default multi-touch is disabled
--- m-keyboard/widgets/mimabstractkeyarea.h
+++ m-keyboard/widgets/mimabstractkeyarea.h
@@ -119,6 +119,11 @@
*/
virtual void setKeyOverrides(const QMap<QString, QSharedPointer<MKeyOverride> > &overrides) = 0;
+ /*!
+ * \brief Sets the current content type (handles email/url overrides).
+ */
+ virtual void setContentType(M::TextContentType type) = 0;
+
signals:
//! \brief Emitted when key is pressed
//!
--- m-keyboard/widgets/mimkey.cpp
+++ m-keyboard/widgets/mimkey.cpp
@@ -208,6 +208,14 @@
invalidateLabelPos();
}
+void MImKey::overrideBinding(const MImKeyBinding *binding)
+{
+ const_cast<MImKeyModel&>(mModel).overrideBinding(binding, false);
+ const_cast<MImKeyModel&>(mModel).overrideBinding(binding, true);
+ currentLabel = this->binding().accented(accent);
+ invalidateLabelPos();
+}
+
void MImKey::invalidateLabelPos()
{
labelArea = QRectF();
--- m-keyboard/widgets/mimkey.h
+++ m-keyboard/widgets/mimkey.h
@@ -172,6 +172,9 @@
//! \param ignore Set this parameter to true if you want to get original key's attributes.
void setIgnoreOverriding(bool ignore);
+ //! \brief Override key's binding.
+ void overrideBinding(const MImKeyBinding* binding);
+
//! The width for this button. Not managed by this class.
//! It is used by MImKeyArea to store the correct button size.
qreal width;
@@ -244,6 +247,7 @@
QPixmap *overrideIcon;
bool ignoreOverride;
+
};
#endif // MIMKEY_H
--- m-keyboard/widgets/mimkeyarea.cpp
+++ m-keyboard/widgets/mimkeyarea.cpp
@@ -16,6 +16,8 @@
#include "mimkeyarea.h"
#include "mimkeyvisitor.h"
+#include "mplainwindow.h"
+#include "reactionmapwrapper.h"
#include <QDebug>
#include <QEvent>
@@ -27,12 +29,8 @@
#include <mkeyoverride.h>
#include <MScalableImage>
-#include <mplainwindow.h>
-#include <mreactionmap.h>
#include <MTimestamp>
-#include "mimreactionmap.h"
-
namespace {
template<class T>
int binaryRangeFind(T value,
@@ -337,7 +335,8 @@
shiftKey(0),
equalWidthKeys(true),
WidthCorrection(0),
- stylingCache(new MImKey::StylingCache)
+ stylingCache(new MImKey::StylingCache),
+ commaKey(0)
{
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
@@ -370,6 +369,11 @@
void MImKeyArea::drawReactiveAreas(MReactionMap *reactionMap,
QGraphicsView *view)
{
+#ifndef HAVE_REACTIONMAP
+ Q_UNUSED(reactionMap);
+ Q_UNUSED(view);
+ return;
+#else
reactionMap->setTransform(this, view);
reactionMap->setDrawingValue(MImReactionMap::Press, MImReactionMap::Release);
@@ -394,6 +398,7 @@
reactionMap->fillRectangle(area);
}
+#endif
}
void MImKeyArea::loadKeys()
@@ -434,6 +439,9 @@
if (dataKey->binding()->action() == MImKeyBinding::ActionShift) {
shiftKey = key;
}
+ else if (dataKey->binding()->label() == ",") {
+ commaKey = key;
+ }
rowIter->keys.append(key);
}
@@ -882,3 +890,25 @@
hasActiveShiftKeys || level() % 2);
}
+void MImKeyArea::setContentType(M::TextContentType type)
+{
+ static const MImKeyBinding bindAt("@");
+ static const MImKeyBinding bindSlash("/");
+
+ if (!commaKey) {
+ return;
+ }
+
+ switch(type) {
+ case M::UrlContentType:
+ commaKey->overrideBinding(&bindSlash);
+ break;
+ case M::EmailContentType:
+ commaKey->overrideBinding(&bindAt);
+ break;
+ default:
+ commaKey->overrideBinding(0);
+ break;
+ }
+ update();
+}
--- m-keyboard/widgets/mimkeyarea.h
+++ m-keyboard/widgets/mimkeyarea.h
@@ -51,6 +51,7 @@
virtual QList<const MImAbstractKey *> keys() const;
virtual MImAbstractKey * findKey(const QString &id);
virtual void setKeyOverrides(const QMap<QString, QSharedPointer<MKeyOverride> > &overrides);
+ virtual void setContentType(M::TextContentType type);
//! \reimp_end
private slots:
@@ -129,6 +130,7 @@
int WidthCorrection; //!< width correction for Arabic layouts
QSharedPointer<MImKey::StylingCache> stylingCache; //!< Cached information about current styling
QList<MImKey *> idToKey; //!< Contains information about keys which have identifiers
+ MImKey *commaKey; //!< store comma key in order to override it later
#ifdef UNIT_TEST
friend class Ut_MImAbstractKeyArea;
--- m-keyboard/widgets/mimtoolbar.cpp
+++ m-keyboard/widgets/mimtoolbar.cpp
@@ -19,19 +19,19 @@
#include "mimtoolbar.h"
#include "mtoolbarbutton.h"
#include "mtoolbarlabel.h"
-#include "mimreactionmap.h"
+#include "reactionmapwrapper.h"
+#include "mplainwindow.h"
#include <mtoolbardata.h>
#include <mtoolbaritem.h>
#include <mtoolbarlayout.h>
+#include <minputmethodnamespace.h>
#include <MNamespace>
#include <QKeySequence>
#include <QGraphicsLinearLayout>
#include <QDebug>
#include <MSceneManager>
-#include <mplainwindow.h>
-#include <mreactionmap.h>
namespace
{
@@ -197,7 +197,7 @@
}
const M::Orientation orientation = MPlainWindow::instance()->sceneManager()->orientation();
- QSharedPointer<const MToolbarLayout> layout = currentToolbar->layout(orientation);
+ QSharedPointer<const MToolbarLayout> layout = currentToolbar->layout(static_cast<MInputMethod::Orientation>(orientation));
if (layout.isNull()) {
qWarning() << __PRETTY_FUNCTION__
@@ -387,6 +387,11 @@
void MImToolbar::paintReactionMap(MReactionMap *reactionMap, QGraphicsView *view)
{
+#ifndef HAVE_REACTIONMAP
+ Q_UNUSED(reactionMap);
+ Q_UNUSED(view);
+ return;
+#else
if (!layout()) {
qCritical() << __PRETTY_FUNCTION__ << "Layout does not exist";
}
@@ -431,6 +436,7 @@
// Otherwise leave as inactive.
}
}
+#endif // HAVE_REACTIONMAP
}
void MImToolbar::finalizeOrientationChange()
--- m-keyboard/widgets/mimwordlist.cpp
+++ m-keyboard/widgets/mimwordlist.cpp
@@ -18,13 +18,12 @@
#include "regiontracker.h"
#include "mimwordlist.h"
#include "mimwordlistitem.h"
+#include "reactionmapwrapper.h"
#include <QGraphicsLinearLayout>
#include <QDebug>
#include <QString>
-#include <mreactionmap.h>
-
#include <mwidgetcreator.h>
M_REGISTER_WIDGET_NO_CREATE(MImWordList)
@@ -110,6 +109,10 @@
void MImWordList::paintReactionMap(MReactionMap *reactionMap, QGraphicsView *)
{
+#ifndef HAVE_REACTIONMAP
+ Q_UNUSED(reactionMap);
+ return;
+#else
if (!isVisible())
return;
// word list take whole screen. And inner contentitem will play their
@@ -117,4 +120,5 @@
reactionMap->setInactiveDrawingValue();
reactionMap->setTransform(QTransform());
reactionMap->fillRectangle(0, 0, reactionMap->width(), reactionMap->height());
+#endif // HAVE_REACTIONMAP
}
--- m-keyboard/widgets/mimwordtracker.cpp
+++ m-keyboard/widgets/mimwordtracker.cpp
@@ -19,13 +19,12 @@
#include "regiontracker.h"
#include "mimwordtracker.h"
#include "mimcorrectioncandidateitem.h"
-#include "mimreactionmap.h"
+#include "reactionmapwrapper.h"
+#include "mplainwindow.h"
#include <QGraphicsLinearLayout>
#include <QDebug>
-#include <mplainwindow.h>
-#include <mreactionmap.h>
#include <MScalableImage>
#include <MSceneManager>
#include <MSceneWindow>
@@ -272,6 +271,10 @@
void MImWordTracker::paintReactionMap(MReactionMap *reactionMap, QGraphicsView *view)
{
+#ifndef HAVE_REACTIONMAP
+ Q_UNUSED(reactionMap);
+ Q_UNUSED(view);
+#else
if (!isVisible())
return;
@@ -283,4 +286,5 @@
// Draw the actual word tracker area.
reactionMap->setDrawingValue(MImReactionMap::Press, MImReactionMap::Release);
reactionMap->fillRectangle(geometry());
+#endif // HAVE_REACTIONMAP
}
--- m-keyboard/widgets/mkeyboardsettingswidget.cpp
+++ m-keyboard/widgets/mkeyboardsettingswidget.cpp
@@ -27,6 +27,7 @@
#include <MList>
#include <MDialog>
#include <MBanner>
+#include <MBasicListItem>
#include <QObject>
#include <QGraphicsLinearLayout>
@@ -125,10 +126,12 @@
void MKeyboardSettingsWidget::buildUi()
{
- selectedKeyboardsItem = new MContentItem(MContentItem::TwoTextLabels, this);
+ // We are using MBasicListItem instead of MContentItem because
+ // the latter is not supported by theme
+ selectedKeyboardsItem = new MBasicListItem(MBasicListItem::TitleWithSubtitle, this);
selectedKeyboardsItem->setObjectName(ObjectNameSelectedKeyboardsItem);
connect(selectedKeyboardsItem, SIGNAL(clicked()), this, SLOT(showKeyboardList()));
- selectedKeyboardsItem->setStyleName("CommonContentItemInverted");
+ selectedKeyboardsItem->setStyleName("CommonBasicListItemInverted");
// Put to first row, first column on the grid
addItem(selectedKeyboardsItem, 0, 0);
@@ -138,8 +141,8 @@
errorCorrectionSwitch->setObjectName(ObjectNameErrorCorrectionButton);
errorCorrectionSwitch->setViewType(MButton::switchType);
errorCorrectionSwitch->setCheckable(true);
- errorCorrectionContentItem = new MContentItem(MContentItem::TwoTextLabels, this);
- errorCorrectionContentItem->setStyleName("CommonContentItemInverted");
+ errorCorrectionContentItem = new MBasicListItem(MBasicListItem::TitleWithSubtitle, this);
+ errorCorrectionContentItem->setStyleName("CommonBasicListItemInverted");
//% "Error correction"
errorCorrectionContentItem->setTitle(qtTrId("qtn_txts_error_correction"));
//% "Error correction description"
@@ -156,8 +159,8 @@
correctionSpaceSwitch->setObjectName(ObjectNameCorrectionSpaceButton);
correctionSpaceSwitch->setViewType(MButton::switchType);
correctionSpaceSwitch->setCheckable(true);
- correctionSpaceContentItem = new MContentItem(MContentItem::TwoTextLabels, this);
- correctionSpaceContentItem->setStyleName("CommonContentItemInverted");
+ correctionSpaceContentItem = new MBasicListItem(MBasicListItem::TitleWithSubtitle, this);
+ correctionSpaceContentItem->setStyleName("CommonBasicListItemInverted");
//% "Insert with space"
correctionSpaceContentItem->setTitle(qtTrId("qtn_txts_insert_with_space"));
//% "Insert with space description"
--- m-keyboard/widgets/mkeyboardsettingswidget.h
+++ m-keyboard/widgets/mkeyboardsettingswidget.h
@@ -23,7 +23,7 @@
class QGraphicsItem;
class QGraphicsLayoutItem;
-class MContentItem;
+class MBasicListItem;
class MButton;
class MDialog;
class MList;
@@ -66,12 +66,12 @@
MGridLayoutPolicy *landscapePolicy;
MLinearLayoutPolicy *portraitPolicy;
MButton *errorCorrectionSwitch;
- MContentItem *errorCorrectionContentItem;
+ MBasicListItem *errorCorrectionContentItem;
MButton *correctionSpaceSwitch;
- MContentItem *correctionSpaceContentItem;
+ MBasicListItem *correctionSpaceContentItem;
MDialog *keyboardDialog;
MList *keyboardList;
- MContentItem *selectedKeyboardsItem;
+ MBasicListItem *selectedKeyboardsItem;
friend class Ut_MKeyboardSettingsWidget;
};
--- m-keyboard/widgets/mplainwindow.cpp
+++ m-keyboard/widgets/mplainwindow.cpp
+/* * This file is part of meego-im-framework *
+ *
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * Contact: Nokia Corporation (directui at nokia.com)
+ *
+ * If you have questions regarding the use of this file, please contact
+ * Nokia at directui at nokia.com.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation
+ l* and appearing in the file LICENSE.LGPL included in the packaging
+ * of this file.
+ */
+
+#include "mplainwindow.h"
+
+#include <mabstractinputmethodhost.h>
+#include <MSceneManager>
+#include <MTimestamp>
+#include <MGConfItem>
+#include <MComponentData>
+
+#include <QDebug>
+
+namespace
+{
+ // This GConf item defines whether multitouch is enabled or disabled
+ const char * const MultitouchSettings = "/meegotouch/inputmethods/multitouch/enabled";
+}
+
+MPlainWindow *MPlainWindow::m_instance = 0;
+
+MPlainWindow *MPlainWindow::instance()
+{
+ return m_instance;
+}
+
+MPlainWindow::MPlainWindow(const MAbstractInputMethodHost *newHost,
+ QWidget *parent)
+ : MWindow(parent)
+ , host(newHost)
+{
+ if (m_instance)
+ qFatal("There can be only one instance of MPlainWindow");
+
+ m_instance = this;
+
+ // This *does not* prevent plugins from activating multitouch through
+ // QGraphicsItem::setAcceptTouchEvents, as the first (enabling) call to
+ // that method *will* set the WA_AcceptTouchEvents attribute on all
+ // attached viewports (this was probably done in Qt to add some
+ // convenience for sloppy programmers).
+ //
+ // Setting this attribute explicitely here is supposed to guard against
+ // changes in above mentioned (undocumented!) "convenience", as this is
+ // what the documentation suggests [1].
+ //
+ // [1] http://doc.trolltech.com/4.6/qtouchevent.html#enabling-touch-events
+ if (MGConfItem(MultitouchSettings).value().toBool()) {
+ setAttribute(Qt::WA_AcceptTouchEvents);
+ }
+
+ ungrabGesture(Qt::TapAndHoldGesture);
+ ungrabGesture(Qt::PinchGesture);
+ ungrabGesture(Qt::PanGesture);
+ ungrabGesture(Qt::SwipeGesture);
+ ungrabGesture(Qt::TapGesture);
+}
+
+MPlainWindow::~MPlainWindow()
+{
+ m_instance = 0;
+ delete sceneManager();
+}
+
+bool MPlainWindow::viewportEvent(QEvent *event)
+{
+#ifdef M_TIMESTAMP
+ QString start;
+ QString end;
+ start = QString("%1_start").arg(event->type());
+ end = QString("%1_end").arg(event->type());
+
+ mTimestamp("MPlainWindow", start);
+#endif
+
+ bool result = MWindow::viewportEvent(event);
+
+#ifdef M_TIMESTAMP
+ mTimestamp("MPlainWindow", end);
+#endif
+
+ return result;
+}
+
+void MPlainWindow::drawBackground(QPainter *painter, const QRectF &rect)
+{
+ if (not host || rect.isEmpty()) {
+ return;
+ }
+
+ const QPixmap bg(host->background());
+ if (not bg.isNull()) {
+ painter->drawPixmap(rect, bg, rect);
+ }
+}
--- m-keyboard/widgets/mplainwindow.h
+++ m-keyboard/widgets/mplainwindow.h
+/* * This file is part of meego-im-framework *
+ *
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * Contact: Nokia Corporation (directui at nokia.com)
+ *
+ * If you have questions regarding the use of this file, please contact
+ * Nokia at directui at nokia.com.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it 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.
+ */
+#ifndef MPLAINWINDOW_H
+#define MPLAINWINDOW_H
+
+#include <MWindow>
+#include <QPixmap>
+
+class QRegion;
+class MAbstractInputMethodHost;
+
+class MPlainWindow
+ : public MWindow
+{
+ Q_OBJECT
+
+public:
+ explicit MPlainWindow(const MAbstractInputMethodHost *host = 0,
+ QWidget *parent = 0);
+ virtual ~MPlainWindow();
+ static MPlainWindow *instance();
+
+protected:
+ //! \reimp
+ virtual bool viewportEvent(QEvent *event);
+ virtual void drawBackground(QPainter *painter,
+ const QRectF &rect);
+ //! \reimp_end
+
+private:
+ Q_DISABLE_COPY(MPlainWindow);
+
+ static MPlainWindow *m_instance;
+ const MAbstractInputMethodHost *const host;
+};
+
+#endif // MPLAINWINDOW_H
--- m-keyboard/widgets/mvirtualkeyboard.cpp
+++ m-keyboard/widgets/mvirtualkeyboard.cpp
@@ -30,6 +30,7 @@
#include "grip.h"
#include "reactionmappainter.h"
#include "regiontracker.h"
+#include "reactionmapwrapper.h"
#include <mtoolbardata.h>
#include <mkeyoverride.h>
@@ -43,7 +44,6 @@
#include <MButton>
#include <MScalableImage>
#include <MSceneManager>
-#include <mreactionmap.h>
#include <mtimestamp.h>
#include <mplainwindow.h>
#include <MApplication>
@@ -78,7 +78,8 @@
phoneNumberKeyboard(0),
eventHandler(this),
pendingNotificationRequest(false),
- transitioning(false)
+ transitioning(false),
+ generalContentType(M::FreeTextContentType)
{
setFlag(QGraphicsItem::ItemHasNoContents);
setObjectName("MVirtualKeyboard");
@@ -343,6 +344,11 @@
void MVirtualKeyboard::paintReactionMap(MReactionMap *reactionMap, QGraphicsView *view)
{
+#ifndef HAVE_REACTIONMAP
+ Q_UNUSED(reactionMap);
+ Q_UNUSED(view);
+ return;
+#else
if (!isVisible()) {
return;
}
@@ -354,6 +360,7 @@
reactionMap->fillRectangle(layout()->itemAt(KeyboardHandleIndex)->geometry());
drawButtonsReactionMaps(reactionMap, view);
+#endif // HAVE_REACTIONMAP
}
@@ -378,15 +385,15 @@
break;
}
- if (newLayoutType == currentLayoutType) {
- return;
+ if (newLayoutType != currentLayoutType) {
+ currentLayoutType = newLayoutType;
+ updateMainLayoutAtKeyboardIndex();
+ if (mainKeyboardSwitcher->count() > 1 && (currentLayoutType == LayoutData::General)) {
+ requestLanguageNotification();
+ }
}
- currentLayoutType = newLayoutType;
- updateMainLayoutAtKeyboardIndex();
- if (mainKeyboardSwitcher->count() > 1 && (currentLayoutType == LayoutData::General)) {
- requestLanguageNotification();
- }
+ setContentType(static_cast<M::TextContentType>(type));
}
ModifierState MVirtualKeyboard::shiftStatus() const
@@ -808,3 +815,13 @@
this->overrides = overrides;
}
+void MVirtualKeyboard::setContentType(M::TextContentType type)
+{
+ if( currentLayoutType != LayoutData::General
+ || generalContentType == type )
+ {
+ return;
+ }
+ mainKeyboardSwitcher->setContentType(type);
+ generalContentType = type;
+}
--- m-keyboard/widgets/mvirtualkeyboard.h
+++ m-keyboard/widgets/mvirtualkeyboard.h
@@ -347,6 +347,9 @@
//! Show notification informing about current language
void showLanguageNotification();
+ //! Sets the current content type (handles email/url overrides):
+ void setContentType(M::TextContentType type);
+
private:
//! Main layout indices
enum LayoutIndex {
@@ -403,6 +406,9 @@
//! Contains current keyboard overrides
QMap<QString, QSharedPointer<MKeyOverride> > overrides;
+
+ //! Currently active content type for general layout:
+ M::TextContentType generalContentType;
};
#endif
--- m-keyboard/widgets/symbolview.cpp
+++ m-keyboard/widgets/symbolview.cpp
@@ -23,15 +23,14 @@
#include "grip.h"
#include "mimkeyarea.h"
#include "reactionmappainter.h"
-#include "mimreactionmap.h"
#include "regiontracker.h"
+#include "reactionmapwrapper.h"
+#include "mplainwindow.h"
#include <mkeyoverride.h>
#include <MSceneManager>
#include <MScalableImage>
-#include <mreactionmap.h>
-#include <mplainwindow.h>
#include <QDebug>
#include <QGraphicsSceneResizeEvent>
@@ -491,6 +490,11 @@
void SymbolView::paintReactionMap(MReactionMap *reactionMap, QGraphicsView *view)
{
+#ifndef HAVE_REACTIONMAP
+ Q_UNUSED(reactionMap);
+ Q_UNUSED(view);
+ return;
+#else
// Draw region area with inactive color to prevent any holes in reaction map.
reactionMap->setInactiveDrawingValue();
reactionMap->setTransform(this, view);
@@ -504,6 +508,7 @@
if (pageSwitcher->currentWidget()) {
static_cast<MImAbstractKeyArea *>(pageSwitcher->currentWidget())->drawReactiveAreas(reactionMap, view);
}
+#endif // HAVE_REACTIONMAP
}
const MVirtualKeyboardStyleContainer &SymbolView::style() const
--- m-keyboard/widgets/widgets.pri
+++ m-keyboard/widgets/widgets.pri
@@ -51,6 +51,7 @@
$$WIDGETS_DIR/mkeyboardsettingswidget.h \
$$WIDGETS_DIR/getcssproperty.h \
$$WIDGETS_DIR/mtoolbarlabelview.h \
+ $$WIDGETS_DIR/mplainwindow.h \
INSTALL_HEADERS += $$PUBLIC_HEADERS + $$PUBLIC_STYLE_HEADERS
@@ -71,6 +72,7 @@
$$WIDGETS_DIR/mimkeyvisitor.cpp \
$$WIDGETS_DIR/mimkey.cpp \
$$WIDGETS_DIR/mimkeyarea.cpp \
+ $$WIDGETS_DIR/mplainwindow.cpp \
$$WIDGETS_DIR/popupbase.cpp \
$$WIDGETS_DIR/popupfactory.cpp \
$$WIDGETS_DIR/mtoolbarbutton.cpp \
--- tests/common_check.pri
+++ tests/common_check.pri
@@ -37,8 +37,8 @@
# coverage flags are off per default, but can be turned on via qmake COV_OPTION=on
for(OPTION,$$list($$lower($$COV_OPTION))){
isEqual(OPTION, on){
- QMAKE_CXXFLAGS += -ftest-coverage -fprofile-arcs
- LIBS += -lgcov
+ QMAKE_CXXFLAGS += -ftest-coverage -fprofile-arcs
+ LIBS += -lgcov
}
}
@@ -51,6 +51,6 @@
MOC_DIR = .moc
meegotouch {
- DEFINES += MEEGOTOUCH
+ DEFINES += HAVE_MEEGOTOUCH
}
--- tests/stubs/mreactionmap_stub.h
+++ tests/stubs/mreactionmap_stub.h
@@ -18,7 +18,69 @@
#ifndef MREACTIONMAP_STUB_H
#define MREACTIONMAP_STUB_H
+#include <QtCore>
+#include <QtGui>
+
+#ifdef HAVE_REACTIONMAP
#include <mreactionmap.h>
+#else
+class MReactionMapPrivate
+{};
+
+class MReactionMap
+ : public QObject
+{
+ Q_OBJECT
+
+private:
+ MReactionMapPrivate *d;
+
+public:
+ static const QString Press;
+ static const QString Release;
+ static const QString Cancel;
+ static const QString Transparent;
+ static const QString Inactive;
+
+ explicit MReactionMap(QWidget *topLevelWidget,
+ const QString &appIdentifier = QString(),
+ QObject *parent = 0);
+
+ ~MReactionMap();
+
+ static MReactionMap *instance(QWidget *anyWidget);
+ void setInactiveDrawingValue();
+ void setReactiveDrawingValue();
+ void setTransparentDrawingValue();
+ void setDrawingValue(const QString &pressFeedback,
+ const QString &releaseFeedback);
+ QTransform transform() const;
+ void setTransform(QTransform transform);
+ void setTransform(QGraphicsItem *item,
+ QGraphicsView *view);
+ void fillRectangle(int x,
+ int y,
+ int width,
+ int height);
+ void fillRectangle(const QRect &rectangle);
+ void fillRectangle(const QRectF &rectangle);
+ void fillRectangle(const QRect &rectangle,
+ const QString &pressFeedback,
+ const QString &releaseFeedback);
+ void fillRectangle(const QRectF &rectangle,
+ const QString &pressFeedback,
+ const QString &releaseFeedback);
+ int width() const;
+ int height() const;
+ void clear();
+};
+
+const QString MReactionMap::Press = "press";
+const QString MReactionMap::Release = "release";
+const QString MReactionMap::Cancel = "cancel";
+const QString MReactionMap::Transparent = "transparent";
+const QString MReactionMap::Inactive = "";
+#endif
/*!
* \brief MReactionMap stub class.
--- tests/tests.pro
+++ tests/tests.pro
@@ -28,6 +28,12 @@
ut_sharedhandlearea \
bm_painting \
+contains(CONFIG, nomeegotouch) {
+} else {
+ DEFINES += HAVE_MEEGOTOUCH
+ CONFIG += meegotouch
+}
+
target.commands += $$system(touch tests.xml)
target.path = /usr/share/meego-keyboard-tests
target.files += qtestlib2junitxml.xsl runtests.sh tests.xml
--- tests/ut_horizontalswitcher/mimtestkeyarea.cpp
+++ tests/ut_horizontalswitcher/mimtestkeyarea.cpp
@@ -48,6 +48,10 @@
{
}
+void MImTestKeyArea::setContentType(M::TextContentType)
+{
+}
+
void MImTestKeyArea::setKeyOverrides(const QMap<QString, QSharedPointer<MKeyOverride> > &overrides)
{
++setKeyOverridesCalls;
--- tests/ut_horizontalswitcher/mimtestkeyarea.h
+++ tests/ut_horizontalswitcher/mimtestkeyarea.h
@@ -47,6 +47,7 @@
virtual MImAbstractKey * findKey(const QString &);
virtual MImAbstractKey *keyAt(const QPoint &) const;
virtual void updateKeyGeometries(int);
+ virtual void setContentType(M::TextContentType);
//! \reimp_end
public slots:
--- tests/ut_mhardwarekeyboard/testinputmethodhost.h
+++ tests/ut_mhardwarekeyboard/testinputmethodhost.h
@@ -157,7 +157,7 @@
virtual void switchPlugin(const QString & /*pluginName*/)
{
}
-
+
virtual void setScreenRegion(const QRegion & /*region*/)
{
}
--- tests/ut_mimkey/ut_mimkey.cpp
+++ tests/ut_mimkey/ut_mimkey.cpp
@@ -164,7 +164,7 @@
{
MImKeyModel *key = new MImKeyModel;
MImKeyBinding *binding = new MImKeyBinding;
- key->bindings[MImKeyModel::NoShift] = binding;
+ key->setBinding(*binding, false);
MImAbstractKey *subject = new MImKey(*key, *style, *parent, stylingCache);
@@ -348,7 +348,7 @@
MImKeyBinding *b = new MImKeyBinding;
b->keyAction = MImKeyBinding::ActionShift;
MImKeyModel *model = new MImKeyModel;
- model->bindings[MImKeyModel::NoShift] = b;
+ model->setBinding(*b, false);
MImKey *shift = new MImKey(*model, *style, *parent, stylingCache);
shift->setDownState(true);
keys << shift;
@@ -484,6 +484,38 @@
QCOMPARE(subject->state(), MImAbstractKey::Normal);
}
+void Ut_MImKey::testOverrideBinding()
+{
+ // Make sure default bindings are there.
+ bool shift = false;
+ subject->setModifiers(shift);
+ QCOMPARE(&subject->binding(), dataKey->binding(shift));
+
+ shift = true;
+ subject->setModifiers(shift);
+ QCOMPARE(&subject->binding(), dataKey->binding(shift));
+
+ // Override bindigs and verify the result:
+ MImKeyBinding override("override");
+ subject->overrideBinding(&override);
+
+ shift = false;
+ subject->setModifiers(shift);
+ QCOMPARE(&subject->binding(), &override);
+ shift = true;
+ subject->setModifiers(shift);
+ QCOMPARE(&subject->binding(), &override);
+
+ // Clear the override:
+ subject->overrideBinding(0);
+ shift = false;
+ subject->setModifiers(shift);
+ QCOMPARE(&subject->binding(), dataKey->binding(shift));
+ shift = true;
+ subject->setModifiers(shift);
+ QCOMPARE(&subject->binding(), dataKey->binding(shift));
+}
+
MImKey *Ut_MImKey::createKey(bool state)
{
MImKey *key = new MImKey(*dataKey, *style, *parent, stylingCache);
@@ -509,8 +541,8 @@
binding2->accented_labels = QString(L'À') + L'Á' + L'Â' + L'Ä';
binding2->keyAction = MImKeyBinding::ActionInsert;
- key->bindings[MImKeyModel::NoShift] = binding1;
- key->bindings[MImKeyModel::Shift] = binding2;
+ key->setBinding(*binding1, false);
+ key->setBinding(*binding2, true);
return key;
}
--- tests/ut_mimkey/ut_mimkey.h
+++ tests/ut_mimkey/ut_mimkey.h
@@ -102,6 +102,8 @@
void testLabelOverride();
void testKeyDisabling();
+ void testOverrideBinding();
+
private:
MImKey *createKey(bool state = false);
MImKeyModel *createKeyModel();
--- tests/ut_mimkey/ut_mimkey.pro
+++ tests/ut_mimkey/ut_mimkey.pro
@@ -13,6 +13,7 @@
HEADERS += ut_mimkey.h \
$$WIDGETS_DIR/mimabstractkey.h \
$$WIDGETS_DIR/mimkey.h \
+ $$WIDGETS_DIR/mplainwindow.h \
$$COMMON_DIR/mimkeymodel.h \
$$COMMON_DIR/keyevent.h \
$$STYLE_HEADERS
@@ -20,6 +21,7 @@
SOURCES += ut_mimkey.cpp \
$$WIDGETS_DIR/mimabstractkey.cpp \
$$WIDGETS_DIR/mimkey.cpp \
+ $$WIDGETS_DIR/mplainwindow.cpp \
$$COMMON_DIR/mimkeymodel.cpp \
$$COMMON_DIR/keyevent.cpp
--- tests/ut_mimkeymodel/ut_mimkeymodel.cpp
+++ tests/ut_mimkeymodel/ut_mimkeymodel.cpp
@@ -83,7 +83,7 @@
<< label[0];
MImKeyBinding *noShiftBinding = new MImKeyBinding;
- subject->bindings[MImKeyModel::NoShift] = noShiftBinding;
+ subject->setBinding(*noShiftBinding, false);
noShiftBinding->keyLabel = label;
noShiftBinding->accented_labels = QString(accentedChars,
sizeof(accentedChars) / sizeof(accentedChars[0]));
@@ -116,12 +116,32 @@
QFETCH(Qt::Key, keyCode);
MImKeyBinding *noShiftBinding = new MImKeyBinding;
- subject->bindings[MImKeyModel::NoShift] = noShiftBinding;
+ subject->setBinding(*noShiftBinding, false);
noShiftBinding->keyLabel = label;
QCOMPARE(static_cast<Qt::Key>(subject->toKeyEvent(QEvent::KeyPress, false).toQKeyEvent().key()),
keyCode);
}
+void Ut_MImKeyModel::testOverrideBinding()
+{
+ MImKeyBinding *defaultBinding = new MImKeyBinding("default");
+ subject->setBinding(*defaultBinding, false);
+ subject->setBinding(*defaultBinding, true);
+ QVERIFY(subject->binding(false)->keyLabel == "default");
+ QVERIFY(subject->binding(true)->keyLabel == "default");
+
+ // Set override and check
+ MImKeyBinding override("override");
+ subject->overrideBinding(&override, false);
+ QVERIFY(subject->binding(false)->keyLabel == "override");
+ QVERIFY(subject->binding(true)->keyLabel == "default");
+
+ // remove override and check
+ subject->overrideBinding(0, false);
+ QVERIFY(subject->binding(false)->keyLabel == "default");
+ QVERIFY(subject->binding(true)->keyLabel == "default");
+}
+
QTEST_APPLESS_MAIN(Ut_MImKeyModel);
--- tests/ut_mimkeymodel/ut_mimkeymodel.h
+++ tests/ut_mimkeymodel/ut_mimkeymodel.h
@@ -42,6 +42,7 @@
void testAccent();
void testKeyCode_data();
void testKeyCode();
+ void testOverrideBinding();
};
#endif
--- tests/ut_mimtoolbar/ut_mimtoolbar.pro
+++ tests/ut_mimtoolbar/ut_mimtoolbar.pro
@@ -1,11 +1,16 @@
include(../common_top.pri)
TEMPLATE = app
-CONFIG += meegotouch meegoreactionmap
+
+contains(CONFIG, nomeegotouch) {
+} else {
+ DEFINES += HAVE_MEEGOTOUCH
+ CONFIG += meegotouch
+}
DEPENDPATH += .
-INCLUDEPATH += . \
- ../stubs/
+INCLUDEPATH += . \
+ ../stubs/
LIBS += -Wl,-rpath=/usr/lib/meego-im-plugins/ -lmeego-keyboard
--- tests/ut_mkeyboardhost/ut_mkeyboardhost.cpp
+++ tests/ut_mkeyboardhost/ut_mkeyboardhost.cpp
@@ -155,7 +155,8 @@
app = new MApplication(argc, app_name);
inputMethodHost = new MInputMethodHostStub;
- window = new MPlainWindow;
+ window = 0;
+ mainWindow = new QWidget;
MGConfItem(MultitouchSettings).set(true);
@@ -165,8 +166,8 @@
void Ut_MKeyboardHost::cleanupTestCase()
{
- delete window;
- window = 0;
+ delete mainWindow;
+ mainWindow = 0;
delete inputMethodHost;
inputMethodHost = 0;
delete app;
@@ -181,10 +182,11 @@
MGConfItem config(CorrectionSetting);
config.set(QVariant(false));
- subject = new MKeyboardHost(inputMethodHost, 0);
+ subject = new MKeyboardHost(inputMethodHost, mainWindow);
inputMethodHost->clear();
gAutoCapsEnabled = true;
+ window = MPlainWindow::instance();
window->hide();
if (window->orientationAngle() != M::Angle0) {
window->setOrientationAngle(M::Angle0);
@@ -197,6 +199,8 @@
{
delete subject;
subject = 0;
+ delete window;
+ window = 0;
}
void Ut_MKeyboardHost::testCreate()
--- tests/ut_mkeyboardhost/ut_mkeyboardhost.h
+++ tests/ut_mkeyboardhost/ut_mkeyboardhost.h
@@ -22,6 +22,7 @@
#include <QList>
#include <QtTest/QtTest>
#include <QObject>
+#include <QWidget>
#include <mnamespace.h>
@@ -39,6 +40,7 @@
MKeyboardHost *subject;
MInputMethodHostStub *inputMethodHost;
MWindow *window;
+ QWidget *mainWindow;
private slots:
void init();
--- tests/ut_mkeyboardsettingswidget/ut_mkeyboardsettingswidget.cpp
+++ tests/ut_mkeyboardsettingswidget/ut_mkeyboardsettingswidget.cpp
@@ -23,7 +23,7 @@
#include <MSceneManager>
#include <MList>
#include <MButton>
-#include <MContentItem>
+#include <MBasicListItem>
#include <MDialog>
#include <MLabel>
--- tests/ut_mvirtualkeyboard/ut_mvirtualkeyboard.pro
+++ tests/ut_mvirtualkeyboard/ut_mvirtualkeyboard.pro
@@ -1,10 +1,10 @@
include(../common_top.pri)
TEMPLATE = app
-CONFIG += QtTest meegotouch MImServer meegoimframework meegoreactionmap
+CONFIG += QtTest meegotouch MImServer meegoimframework
DEPENDPATH += .
INCLUDEPATH += . \
- ../stubs/
+ ../stubs/
include(../common_check.pri)
--- tests/ut_sharedhandlearea/ut_sharedhandlearea.pro
+++ tests/ut_sharedhandlearea/ut_sharedhandlearea.pro
@@ -1,11 +1,11 @@
include(../common_top.pri)
TEMPLATE = app
-CONFIG += meegotouch meegoreactionmap
+CONFIG += meegotouch
DEPENDPATH += .
-INCLUDEPATH += . \
- ../stubs/
+INCLUDEPATH += . \
+ ../stubs/
LIBS += -Wl,-rpath=/usr/lib/meego-im-plugins/ -lmeego-keyboard
--- tests/ut_symbolview/ut_symbolview.pro
+++ tests/ut_symbolview/ut_symbolview.pro
@@ -1,9 +1,16 @@
include(../common_top.pri)
TEMPLATE = app
-CONFIG += QtTest meegotouch MImServer meegoimframework meegoreactionmap
+CONFIG += QtTest meegotouch MImServer meegoimframework
+
+contains(CONFIG, noreactionmap) {
+} else {
+ DEFINES += HAVE_REACTIONMAP
+ CONFIG += meegoreactionmap
+}
+
DEPENDPATH += .
INCLUDEPATH += . \
- ../stubs/ \
+ ../stubs/ \
LIBS += -L/usr/lib -Wl,-rpath=/usr/lib/meego-im-plugins/ -lmeego-keyboard
# Input
--- tests/utils/utils.cpp
+++ tests/utils/utils.cpp
@@ -17,7 +17,7 @@
#include "utils.h"
#include <stdlib.h>
-#ifdef MEEGOTOUCH
+#ifdef HAVE_MEEGOTOUCH
#include <MApplication>
#include <mplainwindow.h>
#include <MSceneWindow>
@@ -44,7 +44,7 @@
qWarning("meego-im-uiserver: unable to unset QT_IM_MODULE.");
}
-#ifdef MEEGOTOUCH
+#ifdef HAVE_MEEGOTOUCH
MApplication::setLoadMInputContext(false);
#endif
@@ -62,7 +62,7 @@
}
// Create a scene window, set it to manual managed, and appear it.
-#ifdef MEEGOTOUCH
+#ifdef HAVE_MEEGOTOUCH
MSceneWindow * createMSceneWindow(MWindow *w)
{
MSceneWindow *sceneWindow = new MSceneWindow;
--- tests/utils/utils.h
+++ tests/utils/utils.h
@@ -29,7 +29,7 @@
// Wait for signal or timeout; use SIGNAL macro for signal
void waitForSignal(const QObject* object, const char* signal, int timeout = 500);
-#ifdef MEEGOTOUCH
+#ifdef HAVE_MEEGOTOUCH
// Create a scene window, set it to manual managed, and appear it.
MSceneWindow *createMSceneWindow(MWindow *w);
#endif
++++++ meegotouch-inputmethodkeyboard.yaml
--- meegotouch-inputmethodkeyboard.yaml
+++ meegotouch-inputmethodkeyboard.yaml
@@ -1,6 +1,6 @@
Name: meegotouch-inputmethodkeyboard
Summary: MeeGo Virtual Keyboard
-Version: 0.5.30
+Version: 0.5.32
Release: 1
Group: System/GUI/Other
License: LGPLv2.1
@@ -14,7 +14,7 @@
PkgConfigBR:
- QtGui >= 4.6.0
- MeegoImEngine >= 0.4.1
- - MeegoImFramework >= 0.19.41
+ - MeegoImFramework >= 0.20.0
- meegotouch >= 0.20.87
- meegotouch-feedbackreactionmaps >= 0.14.0
- x11
More information about the MeeGo-commits
mailing list