[meego-commits] 14686: Changes to devel:qt-mtf/meegotouch-inputmethodframework
Luis Araujo
no_reply at build.meego.com
Fri Mar 11 03:36:54 UTC 2011
Hi,
I have made the following changes to meegotouch-inputmethodframework in project devel:qt-mtf. Please review and accept ASAP.
Thank You,
Luis Araujo
[This message was auto-generated]
---
Request #14686:
submit: home:araujo:branches:devel:qt-mtf/meegotouch-inputmethodframework(r3)(cleanup) -> devel:qt-mtf/meegotouch-inputmethodframework
Message:
Version update to 0.20.0 introducing important API changes required for meego1.2 (BMC#14350)
State: new 2011-03-10T19:36:33 araujo
Comment: None
changes files:
--------------
--- meegotouch-inputmethodframework.changes
+++ meegotouch-inputmethodframework.changes
@@ -0,0 +1,3 @@
+* Thu Mar 10 2011 Luis Araujo <luis.araujo at collabora.co.uk> - 0.20.0
+- Update to release tag 0.20.0-1 (BMC#14350)
+
old:
----
meegotouch-inputmethodframework-0.19.46.tar.bz2
new:
----
meegotouch-inputmethodframework-0.20.0.tar.bz2
spec files:
-----------
--- meegotouch-inputmethodframework.spec
+++ meegotouch-inputmethodframework.spec
@@ -7,7 +7,7 @@
Name: meegotouch-inputmethodframework
Summary: MeeGo UI Input Method Framework
-Version: 0.19.46
+Version: 0.20.0
Release: 1
Group: System/Libraries
License: LGPLv2.1
other changes:
--------------
++++++ meegotouch-inputmethodframework-0.19.46.tar.bz2 -> meegotouch-inputmethodframework-0.20.0.tar.bz2
--- NEWS
+++ NEWS
@@ -1,3 +1,48 @@
+0.20.0
+=======
+* Removed MeeGo Touch from public API.
+* Allow to build framework without MeeGo Touch (optional)
+ - Use "$ qmake CONFIG=+nomeegotouch -r ." or
+ "DEB_BUILD_OPTIONS=nomeegotouch".
+* New helper classes:
+ - MImGraphicsView: Use this widget if your input method plugin uses
+ QGraphicsView (or QDeclarative*).
+ - MImWidget: Use this widget if your input method offers a tradtional
+ QWidget-based UI.
+ - Both widgets boost render performance of input method plugins by using the
+ framework's latest self-compositing feature. Check their documentation for
+ subclassing advice. Also, in case you cannot reuse these classes, you need
+ to use MAbstractInputMethodHost::background - if null, it can be ignored.
+ Otherwise, it needs to be drawn into the background of your central widget
+ (assuming full-screen widgets). For QWidgets, this can be done in
+ QWidget::paintEvent. For QGraphicsView, it is required to override
+ QGraphicsView::drawBackground instead.
+ - MImHwKeyboardTracker: Tracks state (open/closed) of HW keyboard (does not
+ provide any functionality yet when framework is build without MeeGo Touch
+ support).
+ - MImSettings: Currently a wrapper for GConf, but supposed to be extended for
+ GConf-less platforms.
+* API changes:
+ - Removed MIMSettingsDialog (use settings applet instead).
+ - Removed MAbstractInputMethodHost::showSettings, too. This means that IM
+ plugins can no longer request the settings dialog.
+ - Removed MPlainWindow.
+ - MAbstractInputMethod:
+ - c'tor now takes an additional QWidget parameter, the
+ main window (top level widget) supplied by the framework. This frees
+ plugins from using MPlainWindow. Plugins can now choose between
+ traditonal QWidget UI's or QGraphicsView UI's (including MeeGo Touch and
+ QML). Make sure to reparent your central widget to the main window.
+ - centralWidget: Returns central widget of your plugin.
+ - setCentralWidget: Sets central widget of your plugin. Important if you
+ want to take advantage of self-composting by using MImGraphicsView or
+ MImWidget.
+ - MInputMethodPlugin:
+ - createInputMethod: Takes an additional QWidget parameter, the main
+ window. Parameter is supplied by framework.
+ - MInputMethod namespace:
+ - added OrientationAngle, Orientation, TextContentType (copied from MeeGo Touch)
+
0.19.41
=======
* API changes
--- debian/changelog
+++ debian/changelog
@@ -1,8 +1,22 @@
-meego-im-framework (0.19.47~1) unstable; urgency=low
+meego-im-framework (0.20.1~1) unstable; urgency=low
* [UNRELEASED]
- -- Ning Chi <ext-chi.2.ning at nokia.com> Thu, 03 Mar 2011 09:41:02 +0200
+ -- Rakesh Cherian <ext-rakesh.cherian at nokia.com> Tue, 08 Mar 2011 15:24:00 +0200
+
+meego-im-framework (0.20.0-1) unstable; urgency=low
+
+ * New: Remove LMT dependencies from public API
+
+ -- Rakesh Cherian <ext-rakesh.cherian at nokia.com> Tue, 08 Mar 2011 15:24:00 +0200
+
+meego-im-framework (0.19.47-1) unstable; urgency=low
+
+ * Implemented attribute extension machinery.
+ * New API: MAbstractInputMethod::setKeyOverrides
+ * Fixes: NB#223052 - Unreadable fonts in Text input settings (superseeds old fix)
+
+ -- Kimmo Surakka <kimmo.surakka at nokia.com> Fri, 04 Mar 2011 14:01:00 +0200
meego-im-framework (0.19.46-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, libqt4-opengl-dev, libgles2-sgx-img-dev [arm armel] | libgles2-dev [arm armel], opengles-sgx-img-common-dev [arm armel], libgl-dev [i386], libgl1 [i386], libxcomposite-dev, libxfixes-dev, libxdamage-dev, libxext-dev, libmeegoreactionmap-dev (>= 0.14.0-1), dbus-1-utils, pkg-config, dpkg-dev, libmeegotouch-dev (>= 0.20.77), libduicontrolpanel-dev (>= 0.7.20), graphviz
+Build-Depends: debhelper (>= 5), libqt4-dev (>= 4.6), libmeegotouch-dev, libduicontrolpanel-dev (>= 0.7.20), libqt4-opengl-dev, libgles2-sgx-img-dev [arm armel] | libgles2-dev [arm armel], opengles-sgx-img-common-dev [arm armel], libgl-dev [i386], libgl1 [i386] | libgl1-mesa-dev [i386], libxcomposite-dev, libxfixes-dev, libxdamage-dev, libxext-dev, libdbus-glib-1-dev, libgconf2-dev, pkg-config, dpkg-dev, graphviz, doxygen
Standards-Version: 3.7.2
Package: meego-im-uiserver
@@ -29,14 +29,14 @@
Architecture: all
Depends: libmeegoimframework0 (>= ${source:Version}), libqt4-dev (>= 4.6)
Description: libmimmuiframework development files
- Development files for MeegoTouch Input Method UI Framework.
+ Development files for MeegoTouch Input Method Framework.
Package: libmeegoimframework0-dbg
Section: devel
Architecture: any
Depends: libmeegoimframework0 (= ${binary:Version})
-Description: libmimmuiframework debug files
- Debug files for MeegoTouch Input Method UI Framework.
+Description: libmeegoimframework debug files
+ Debug files for MeegoTouch Input Method Framework.
Package: libmeegoimframework-doc
Section: doc
@@ -56,7 +56,7 @@
Package: meego-im-context
Section: libs
Architecture: any
-Depends: ${shlibs:Depends}
+Depends: ${misc:Depends}, ${shlibs:Depends}
Description: Qt input method context for MeegoTouch Framework
Package: meego-im-context-dbg
@@ -67,5 +67,6 @@
Package: meego-im-settings-applet
Architecture: any
-Depends: duicontrolpanel (>= 0.7.20), libduicontrolpanel (>= 0.7.20), libmeegoimframework0 (= ${binary:Version})
+Depends: ${misc:Depends}, ${shlibs:Depends}, duicontrolpanel (>= 0.7.20), libduicontrolpanel (>= 0.7.20)
Description: MeegoTouch Text Input Settings Applet
+
--- debian/rules
+++ debian/rules
@@ -16,6 +16,15 @@
QMAKE_OPTIONS+=CONFIG+=release
endif
+# Whether to use MeeGo Touch (eg, for MInputContext)
+ifneq (,$(findstring nomeegotouch,$(DEB_BUILD_OPTIONS)))
+ QMAKE_OPTIONS+=CONFIG-=meegotouch
+ QMAKE_OPTIONS+=CONFIG+=nomeegotouch
+else
+ QMAKE_OPTIONS+=CONFIG+=meegotouch
+ QMAKE_OPTIONS+=CONFIG-=nomeegotouch
+endif
+
# Don't build documentation by setting DEB_BUILD_OPTION=nodocs
ifeq (,$(findstring nodocs,$(DEB_BUILD_OPTIONS)))
QMAKE_OPTIONS+=CONFIG+=docs
--- input-context/glibdbusimserverproxy.cpp
+++ input-context/glibdbusimserverproxy.cpp
@@ -24,8 +24,7 @@
#include <QVariant>
#include <QTimer>
#include <QDateTime>
-
-#include <MDebug>
+#include <QDebug>
#include <unistd.h>
#include <sys/types.h>
@@ -65,13 +64,13 @@
void GlibDBusIMServerProxy::onDisconnectionTrampoline(DBusGProxy */*proxy*/, gpointer userData)
{
- mDebug("MInputContext") << __PRETTY_FUNCTION__;
+ qDebug() << "MInputContext" << __PRETTY_FUNCTION__;
static_cast<GlibDBusIMServerProxy *>(userData)->onDisconnection();
}
void GlibDBusIMServerProxy::connectToDBus()
{
- mDebug("MInputContext") << __PRETTY_FUNCTION__;
+ qDebug() << "MInputContext" << __PRETTY_FUNCTION__;
GError *error = NULL;
connection = dbus_g_connection_open(SocketPath, &error);
@@ -102,7 +101,7 @@
void GlibDBusIMServerProxy::onDisconnection()
{
- mDebug("MInputContext") << __PRETTY_FUNCTION__;
+ qDebug() << "MInputContext" << __PRETTY_FUNCTION__;
glibObjectProxy = 0;
dbus_g_connection_unref(connection);
connection = 0;
--- input-context/input-context.pro
+++ input-context/input-context.pro
@@ -8,8 +8,15 @@
OBJECTS_DIR = .obj
MOC_DIR = .moc
-STYLE_HEADERS += \
- mpreeditstyle.h \
+contains(CONFIG, nomeegotouch) {
+} else {
+ CONFIG += meegotouch
+ DEFINES += HAVE_MEEGOTOUCH
+
+ STYLE_HEADERS += \
+ mpreeditstyle.h \
+
+}
# Input
HEADERS += minputcontext.h \
@@ -24,7 +31,7 @@
glibdbusimserverproxy.cpp \
QT = core gui
-CONFIG += plugin meegotouch link_pkgconfig
+CONFIG += plugin link_pkgconfig
PKGCONFIG += dbus-glib-1
--- input-context/minputcontext.cpp
+++ input-context/minputcontext.cpp
@@ -16,6 +16,19 @@
#include "minputcontext.h"
+#include "mdbusglibinputcontextadaptor.h"
+#include "glibdbusimserverproxy.h"
+
+#ifdef HAVE_MEEGOTOUCH
+#include "mpreeditstyle.h"
+#else
+class MPreeditStyle
+{};
+
+class MPreeditStyleContainer
+{};
+#endif
+
#include <QX11Info>
#include <QInputContext>
#include <QCoreApplication>
@@ -25,24 +38,30 @@
#include <QTextFormat>
#include <QApplication>
#include <QClipboard>
+#include <QDebug>
+#ifdef HAVE_MEEGOTOUCH
#include <MApplication>
-#include <MPreeditInjectionEvent>
#include <MTheme>
#include <MComponentData>
-#include <MDebug>
#include <MLibrary>
#include <MInputMethodState>
#include <MWindow>
+#include <mtimestamp.h>
+#else
+#include <QApplication>
+#include <QGraphicsView>
+#endif
-#include "mdbusglibinputcontextadaptor.h"
-#include "glibdbusimserverproxy.h"
-#include "mpreeditstyle.h"
-#include "mtimestamp.h"
+#ifdef HAVE_MEEGOTOUCH
+#include <MPreeditInjectionEvent>
+#endif
#include <X11/XKBlib.h>
+#ifdef HAVE_MEEGOTOUCH
M_LIBRARY
+#endif
namespace
{
@@ -104,15 +123,18 @@
// CloseSoftwareInputPanel event, so hideOnFocusOut is misleading.
connect(&sipHideTimer, SIGNAL(timeout()), SLOT(hideOnFocusOut()));
- // using theming only when there is MComponentData instance, should be
+#ifdef HAVE_MEEGOTOUCH
+ // using theming only when there is MComponentData instance, should be
// there for meegotouch apps (naturally) and for plain qt with meego style plugin
if (MComponentData::instance() != 0) {
styleContainer = new MPreeditStyleContainer;
styleContainer->initialize("DefaultStyle", "MPreeditStyle", 0);
}
+#endif
connectToDBus();
+#ifdef HAVE_MEEGOTOUCH
connect(MInputMethodState::instance(),
SIGNAL(activeWindowOrientationAngleAboutToChange(M::OrientationAngle)),
this, SLOT(notifyOrientationAboutToChange(M::OrientationAngle)));
@@ -136,6 +158,7 @@
connect(MInputMethodState::instance(),
SIGNAL(extendedAttributeChanged(int, QString, QString, QString, QVariant)),
this, SLOT(notifyExtendedAttributeChanged(int, QString, QString, QString, QVariant)));
+#endif
}
@@ -164,6 +187,7 @@
bool MInputContext::event(QEvent *event)
{
+#ifdef HAVE_MEEGOTOUCH
if (event->type() == MPreeditInjectionEvent::eventNumber()) {
if (correctionEnabled) {
MPreeditInjectionEvent *injectionEvent
@@ -173,9 +197,10 @@
return false;
}
- mDebug("MInputContext") << "MInputContext got preedit injection:"
- << injectionEvent->preedit()
- << ", event cursor pos:" << injectionEvent->eventCursorPosition();
+ qDebug() << "MInputContext" << __PRETTY_FUNCTION__
+ << "MInputContext got preedit injection:"
+ << injectionEvent->preedit()
+ << ", event cursor pos:" << injectionEvent->eventCursorPosition();
// send the injected preedit to input method server and back to the widget with proper
// styling
// Note: plugin could change the preedit style in imServer->setPreedit().
@@ -190,13 +215,13 @@
event->accept();
return true;
-
} else {
- mDebug("MInputContext")
- << "MInputContext ignored preedit injection because correction is disabled";
+ qDebug() << "MInputContext" << __PRETTY_FUNCTION__
+ << "MInputContext ignored preedit injection because correction is disabled";
return false;
}
}
+#endif
return QInputContext::event(event);
}
@@ -204,21 +229,21 @@
QString MInputContext::identifierName()
{
- mDebug("MInputContext") << "in" << __PRETTY_FUNCTION__;
+ qDebug() << "MInputContext" << "in" << __PRETTY_FUNCTION__;
return "MInputContext";
}
bool MInputContext::isComposing() const
{
- mDebug("MInputContext") << "in" << __PRETTY_FUNCTION__;
+ qDebug() << "MInputContext" << "in" << __PRETTY_FUNCTION__;
return true; // FIXME
}
QString MInputContext::language()
{
- mDebug("MInputContext") << "in" << __PRETTY_FUNCTION__;
+ qDebug() << "MInputContext" << "in" << __PRETTY_FUNCTION__;
return "EN"; // FIXME
}
@@ -229,7 +254,7 @@
void MInputContext::reset()
{
- mDebug("MInputContext") << "in" << __PRETTY_FUNCTION__;
+ qDebug() << "MInputContext" << "in" << __PRETTY_FUNCTION__;
// send existing preedit to widget, documentation unclear whether this is
// allowed, but trolls gave permission to use it. Most of qt's internal
@@ -248,7 +273,7 @@
void MInputContext::update()
{
- mDebug("MInputContext") << "in" << __PRETTY_FUNCTION__;
+ qDebug() << "MInputContext" << "in" << __PRETTY_FUNCTION__;
const QWidget *const focused = focusWidget();
@@ -267,8 +292,8 @@
{
Q_UNUSED(x);
- mDebug("MInputContext") << "in" << __PRETTY_FUNCTION__;
- mDebug("MInputContext") << " event pos: " << event->globalPos() << " cursor pos:" << x;
+ qDebug() << "MInputContext" << "in" << __PRETTY_FUNCTION__;
+ qDebug() << "MInputContext" << " event pos: " << event->globalPos() << " cursor pos:" << x;
if (event->type() == QEvent::MouseButtonPress && (x < 0 || x > preedit.length())) {
reset();
@@ -283,11 +308,16 @@
QWidget *focused = focusWidget();
QRect preeditRect;
+#ifdef HAVE_MEEGOTOUCH
if (focused) {
+ // TODO: Move M::PreeditRectangleQuery to MInputMethod
Qt::InputMethodQuery query
= static_cast<Qt::InputMethodQuery>(M::PreeditRectangleQuery);
preeditRect = focused->inputMethodQuery(query).toRect();
}
+#else
+ Q_UNUSED(focused);
+#endif
imServer->mouseClickedOnPreedit(event->globalPos(), preeditRect);
}
@@ -298,7 +328,7 @@
{
QObject *focusedObject = focused;
QGraphicsItem *focusItem = 0;
- mDebug("MInputContext") << "in" << __PRETTY_FUNCTION__ << focused;
+ qDebug() << "MInputContext" << "in" << __PRETTY_FUNCTION__ << focused;
QInputContext::setFocusWidget(focused);
// get detailed focus information from inside qgraphicsview
@@ -319,10 +349,12 @@
imServer->activateContext();
active = true;
+#ifdef HAVE_MEEGOTOUCH
// Notify whatever application's orientation is currently.
M::OrientationAngle angle
= MInputMethodState::instance()->activeWindowOrientationAngle();
notifyOrientationChanged(angle);
+#endif
}
imServer->updateWidgetInformation(stateInformation, true);
@@ -399,7 +431,7 @@
switch (event->type()) {
case QEvent::RequestSoftwareInputPanel:
- mDebug("MInputContext") << "got event" << event->type();
+ qDebug() << "MInputContext" << "got event" << event->type();
sipHideTimer.stop();
if (!active || focusWidget() == 0) {
@@ -418,7 +450,7 @@
break;
case QEvent::CloseSoftwareInputPanel:
- mDebug("MInputContext") << "got event" << event->type();
+ qDebug() << "MInputContext" << "got event" << event->type();
sipHideTimer.start();
eaten = true;
break;
@@ -429,11 +461,14 @@
break; // Don't emit signals without focused widget
}
+#ifdef HAVE_MEEGOTOUCH
+ // TODO: Move MInputMethodState to IM FW and let LMT include an IM-specific LMT extension?
if (event->type() == QEvent::KeyPress) {
MInputMethodState::instance()->emitKeyPress(*(static_cast<const QKeyEvent*>(event)));
} else {
MInputMethodState::instance()->emitKeyRelease(*(static_cast<const QKeyEvent*>(event)));
}
+#endif
if (redirectKeys) {
const QKeyEvent *key = static_cast<const QKeyEvent *>(event);
@@ -446,6 +481,7 @@
break;
default:
+#ifdef HAVE_MEEGOTOUCH
if (event->type() == MPreeditInjectionEvent::eventNumber()) {
if (correctionEnabled) {
const MPreeditInjectionEvent *injectionEvent
@@ -455,9 +491,9 @@
break;
}
- mDebug("MInputContext") << "MInputContext got preedit injection:"
- << injectionEvent->preedit()
- << ", event cursor pos:" << injectionEvent->eventCursorPosition();
+ qDebug() << "MInputContext" << "MInputContext got preedit injection:"
+ << injectionEvent->preedit()
+ << ", event cursor pos:" << injectionEvent->eventCursorPosition();
// send the injected preedit to input method server and back to the widget with proper
// styling
// Note: plugin could change the preedit style in imServer->setPreedit().
@@ -483,10 +519,11 @@
eaten = true;
} else {
- mDebug("MInputContext")
- << "MInputContext ignored preedit injection because correction is disabled";
+ qDebug() << "MInputContext"
+ << "MInputContext ignored preedit injection because correction is disabled";
}
}
+#endif
break;
}
@@ -513,7 +550,7 @@
void MInputContext::imInitiatedHide()
{
- mDebug("MInputContext") << "in" << __PRETTY_FUNCTION__;
+ qDebug() << "MInputContext" << "in" << __PRETTY_FUNCTION__;
inputPanelState = InputPanelHidden;
// need to remove focus from the current text entry
@@ -538,8 +575,11 @@
void MInputContext::commitString(const QString &string, int replacementStart,
int replacementLength, int cursorPos)
{
- mDebug("MInputContext") << "in" << __PRETTY_FUNCTION__;
+ qDebug() << "MInputContext" << "in" << __PRETTY_FUNCTION__;
+
+#ifdef HAVE_MEEGOTOUCH
mTimestamp("MInputContext", string);
+#endif
preedit.clear();
@@ -571,11 +611,14 @@
const QList<MInputMethod::PreeditTextFormat> &preeditFormats,
int replacementStart, int replacementLength, int cursorPos)
{
+#ifdef HAVE_MEEGOTOUCH
mTimestamp("MInputContext", "start text=" + string);
- mDebug("MInputContext") << "in" << __PRETTY_FUNCTION__ << "preedit:" << string
- << ", replacementStart:" << replacementStart
- << ", replacementLength:" << replacementLength
- << ", cursorPos:" << cursorPos;
+#endif
+
+ qDebug() << "MInputContext" << "in" << __PRETTY_FUNCTION__ << "preedit:" << string
+ << ", replacementStart:" << replacementStart
+ << ", replacementLength:" << replacementLength
+ << ", cursorPos:" << cursorPos;
preedit = string;
@@ -588,6 +631,7 @@
// update style mode
if (styleContainer) {
+#ifdef HAVE_MEEGOTOUCH
switch (preeditFormat.preeditFace) {
case MInputMethod::PreeditNoCandidates:
styleContainer->setModeNoCandidates();
@@ -615,6 +659,7 @@
if (color.isValid()) {
format.setForeground(color);
}
+#endif // HAVE_MEEGOTOUCH
} else {
// hard coded styling:
format.setUnderlineStyle(QTextCharFormat::SingleUnderline);
@@ -644,7 +689,10 @@
}
sendEvent(event);
+
+#ifdef HAVE_MEEGOTOUCH
mTimestamp("MInputContext", "end");
+#endif
}
@@ -652,7 +700,7 @@
bool autoRepeat, int count,
MInputMethod::EventRequestType requestType)
{
- mDebug("MInputContext") << "in" << __PRETTY_FUNCTION__;
+ qDebug() << "MInputContext" << "in" << __PRETTY_FUNCTION__;
// Construct an event instance out of the parameters.
QEvent::Type eventType = static_cast<QEvent::Type>(type);
@@ -660,6 +708,7 @@
static_cast<Qt::KeyboardModifiers>(modifiers),
text, autoRepeat, count);
+#ifdef HAVE_MEEGOTOUCH
if (requestType != MInputMethod::EventRequestEventOnly) {
if (eventType == QEvent::KeyPress) {
MInputMethodState::instance()->emitKeyPress(event);
@@ -667,6 +716,7 @@
MInputMethodState::instance()->emitKeyRelease(event);
}
}
+#endif
if (focusWidget() != 0 && requestType != MInputMethod::EventRequestSignalOnly) {
QCoreApplication::sendEvent(focusWidget(), &event);
@@ -676,11 +726,15 @@
void MInputContext::updateInputMethodArea(const QList<QVariant> &data)
{
+#ifdef HAVE_MEEGOTOUCH
QRect rect;
if (!data.isEmpty())
rect = data.at(0).toRect();
MInputMethodState::instance()->setInputMethodArea(rect);
+#else
+ Q_UNUSED(data);
+#endif
}
@@ -692,17 +746,19 @@
QRect MInputContext::preeditRectangle(bool &valid) const
{
- Qt::InputMethodQuery query = static_cast<Qt::InputMethodQuery>(M::PreeditRectangleQuery);
QRect rect;
+ valid = false;
+
+#ifdef HAVE_MEEGOTOUCH
+ Qt::InputMethodQuery query = static_cast<Qt::InputMethodQuery>(M::PreeditRectangleQuery);
if (focusWidget()) {
QVariant queryResult = focusWidget()->inputMethodQuery(query);
valid = queryResult.isValid();
rect = queryResult.toRect();
- } else {
- valid = false;
}
+#endif
return rect;
}
@@ -726,7 +782,7 @@
ok = QMetaObject::invokeMethod(connectedObject, "copy", Qt::DirectConnection);
}
- mDebug("MInputContext") << __PRETTY_FUNCTION__ << "result=" << ok;
+ qDebug() << "MInputContext" << __PRETTY_FUNCTION__ << "result=" << ok;
if (!ok) {
// send Ctrl-Ckey event because suitable slot was not found
@@ -744,7 +800,7 @@
ok = QMetaObject::invokeMethod(connectedObject, "paste", Qt::DirectConnection);
}
- mDebug("MInputContext") << __PRETTY_FUNCTION__ << "result=" << ok;
+ qDebug() << "MInputContext" << __PRETTY_FUNCTION__ << "result=" << ok;
if (!ok) {
// send Ctrl-V key event because suitable slot was not found
@@ -759,7 +815,10 @@
qDebug() << __PRETTY_FUNCTION__;
active = false;
redirectKeys = false;
+
+#ifdef HAVE_MEEGOTOUCH
MInputMethodState::instance()->setInputMethodArea(QRect());
+#endif
// Make sure disconnected IM server doesn't leave this
// application's orientation angle locked.
@@ -821,6 +880,7 @@
imServer->setCopyPasteState(copyAvailable && copyAllowed, pasteAvailable);
}
+#ifdef HAVE_MEEGOTOUCH
void MInputContext::notifyOrientationAboutToChange(M::OrientationAngle orientation)
{
// can get called from signal so cannot be sure we are really currently active
@@ -836,7 +896,7 @@
imServer->appOrientationChanged(static_cast<int>(orientation));
}
}
-
+#endif
void MInputContext::notifyAttributeExtensionRegistered(int id, const QString &fileName)
{
@@ -864,19 +924,19 @@
attribute, value);
}
-M::TextContentType MInputContext::contentType(Qt::InputMethodHints hints) const
+MInputMethod::TextContentType MInputContext::contentType(Qt::InputMethodHints hints) const
{
- M::TextContentType type = M::FreeTextContentType;
+ MInputMethod::TextContentType type = MInputMethod::FreeTextContentType;
hints &= Qt::ImhExclusiveInputMask;
if (hints == Qt::ImhFormattedNumbersOnly || hints == Qt::ImhDigitsOnly) {
- type = M::NumberContentType;
+ type = MInputMethod::NumberContentType;
} else if (hints == Qt::ImhDialableCharactersOnly) {
- type = M::PhoneNumberContentType;
+ type = MInputMethod::PhoneNumberContentType;
} else if (hints == Qt::ImhEmailCharactersOnly) {
- type = M::EmailContentType;
+ type = MInputMethod::EmailContentType;
} else if (hints == Qt::ImhUrlCharactersOnly) {
- type = M::UrlContentType;
+ type = MInputMethod::UrlContentType;
}
return type;
@@ -908,14 +968,18 @@
return stateInformation;
}
+ QVariant queryResult;
+#ifdef HAVE_MEEGOTOUCH
+ // TODO: Move M::VisualizationPriorityQuery to dedicated IM/LMT extension package.
// visualization priority
- QVariant queryResult = focused->inputMethodQuery(
+ queryResult = focused->inputMethodQuery(
static_cast<Qt::InputMethodQuery>(M::VisualizationPriorityQuery));
if (queryResult.isValid()) {
stateInformation["visualizationPriority"] = queryResult.toBool();
}
+ // TODO: Move M::InputMethodToolbar*Query to dedicated IM/LMT extension package.
// toolbar id
queryResult = focused->inputMethodQuery(
static_cast<Qt::InputMethodQuery>(M::InputMethodToolbarIdQuery));
@@ -931,6 +995,7 @@
if (queryResult.isValid()) {
stateInformation["toolbar"] = queryResult.toString();
}
+#endif
// surrounding text
queryResult = focused->inputMethodQuery(Qt::ImSurroundingText);
@@ -969,6 +1034,8 @@
// content type value
stateInformation["contentType"] = contentType(hints);
+#ifdef HAVE_MEEGOTOUCH
+ // TODO: Move M::ImCorrectionEnabledQuery to dedicated IM/LMT extension package.
// error correction support
queryResult = focused->inputMethodQuery(
static_cast<Qt::InputMethodQuery>(M::ImCorrectionEnabledQuery));
@@ -976,11 +1043,15 @@
if (queryResult.isValid()) {
stateInformation["correctionEnabled"] = queryResult.toBool();
}
+#endif
stateInformation["predictionEnabled"] = !(hints & Qt::ImhNoPredictiveText);
stateInformation["autocapitalizationEnabled"] = !(hints & Qt::ImhNoAutoUppercase);
stateInformation["hiddenText"] = static_cast<bool>(hints & Qt::ImhHiddenText);
+
+#ifdef HAVE_MEEGOTOUCH
+ // TODO: Move M::InputMethodMode* to dedicated IM/LMT extension package.
// input method mode
queryResult = focused->inputMethodQuery(
static_cast<Qt::InputMethodQuery>(M::ImModeQuery));
@@ -990,6 +1061,7 @@
inputMethodMode = static_cast<M::InputMethodMode>(queryResult.toInt());
}
stateInformation["inputMethodMode"] = inputMethodMode;
+#endif
// is text selected
queryResult = focused->inputMethodQuery(Qt::ImCurrentSelection);
@@ -1015,6 +1087,7 @@
void MInputContext::registerExistingAttributeExtensions()
{
+#ifdef HAVE_MEEGOTOUCH
QList<int> ids = MInputMethodState::instance()->attributeExtensionIds();
foreach (int id, ids) {
@@ -1035,6 +1108,7 @@
}
}
}
+#endif
}
void MInputContext::setSelection(int start, int length)
@@ -1048,6 +1122,7 @@
void MInputContext::setOrientationAngleLocked(bool lock)
{
+#ifdef HAVE_MEEGOTOUCH
MApplication *mApp = qobject_cast<MApplication *>(qApp);
MWindow *mWindow = mApp ? mApp->activeWindow() : 0;
if (!mWindow) {
@@ -1067,6 +1142,9 @@
}
}
orientationAngleLockedByServer = lock;
+#else
+ Q_UNUSED(lock);
+#endif
}
QString MInputContext::selection(bool &valid) const
--- input-context/minputcontext.h
+++ input-context/minputcontext.h
@@ -17,14 +17,17 @@
#ifndef MINPUTCONTEXT_H
#define MINPUTCONTEXT_H
+#include "minputmethodnamespace.h"
+
+#ifdef HAVE_MEEGOTOUCH
+#include <MNamespace>
+#endif
+
#include <QObject>
#include <QInputContext>
#include <QTimer>
#include <QPointer>
-#include <mnamespace.h>
-#include <minputmethodnamespace.h>
-
class MPreeditStyleContainer;
class GlibDBusIMServerProxy;
typedef GlibDBusIMServerProxy DBusIMServerProxy;
@@ -199,12 +202,14 @@
*/
void handleSelectionChanged();
+#ifdef HAVE_MEEGOTOUCH
//! Notify input method plugin about the application's active window prepare to change to a new \a orientation angle.
void notifyOrientationAboutToChange(M::OrientationAngle orientation);
//! Notify input method plugin about new \a orientation angle of application's active window.
//! \note this method is called when the orientation change is finished
void notifyOrientationChanged(M::OrientationAngle orientation);
+#endif
//! Notify input method plugin about a new attribute extension which is defined in \a fileName and with the unique \a id to be registered.
//! \note empty string for \a fileName is acceptable, it means don't load any content, just register a new id.
@@ -236,7 +241,7 @@
void notifyCopyPasteState();
//! returns content type corresponding to specified hints
- M::TextContentType contentType(Qt::InputMethodHints hints) const;
+ MInputMethod::TextContentType contentType(Qt::InputMethodHints hints) const;
//! returns the D-Bus object path for this instance
QString dbusObjectPath() const;
--- input-context/mpreeditstyle.h
+++ input-context/mpreeditstyle.h
@@ -18,6 +18,7 @@
#define MPREEDITSTYLE_H
#include <MStyle>
+
#include <QColor>
#include <QString>
#include <QTextCharFormat>
@@ -25,7 +26,8 @@
/*!
* \brief This class provides access to style attributes for MInputContext
*/
-class MPreeditStyle : public MStyle
+class MPreeditStyle
+ : public MStyle
{
Q_OBJECT
@@ -38,7 +40,8 @@
M_STYLE_ATTRIBUTE(QColor, backgroundColor, BackgroundColor)
};
-class MPreeditStyleContainer : public MStyleContainer
+class MPreeditStyleContainer
+ : public MStyleContainer
{
M_STYLE_CONTAINER(MPreeditStyle)
M_STYLE_MODE(NoCandidates)
--- meego-im-framework.pro
+++ meego-im-framework.pro
@@ -2,7 +2,7 @@
CONFIG += ordered
TARGET = meego-im-uiserver
TEMPLATE = subdirs
-SUBDIRS = src passthroughserver input-context tests translations settings-applet
+SUBDIRS = src passthroughserver input-context tests
isEqual( IN_PWD, $${OUT_PWD} ) {
IS_OUT_OF_SOURCE = 0
@@ -14,6 +14,12 @@
include (doc/doc.pri)
}
+contains(CONFIG, nomeegotouch) {
+} else {
+ CONFIG += meegotouch
+ SUBDIRS += translations settings-applet
+}
+
QMAKE_EXTRA_TARGETS += check-xml
check-xml.target = check-xml
check-xml.CONFIG = recursive
--- passthroughserver/main.cpp
+++ passthroughserver/main.cpp
@@ -17,24 +17,18 @@
// Input method overlay window
-#include <stdlib.h>
+#include "mimpluginmanager.h"
+#include "mimapplication.h"
+#include "mimdummyinputcontext.h"
+#include "mimremotewindow.h"
+#include <QApplication>
#include <QtDebug>
#include <QWidget>
+#include <QGraphicsView>
#include <QPalette>
-
-#include <mreactionmap.h>
-
-#include <MApplication>
-#include <MScene>
-#include <mplainwindow.h>
#include <QCommonStyle>
-
-#include "mimpluginmanager.h"
-#include "mpassthruwindow.h"
-#include "mimapplication.h"
-#include "mimdummyinputcontext.h"
-#include "mimremotewindow.h"
+#include <stdlib.h>
namespace {
void disableMInputContextPlugin()
@@ -46,8 +40,6 @@
qWarning("meego-im-uiserver: unable to unset QT_IM_MODULE.");
}
- MApplication::setLoadMInputContext(false);
-
// TODO: Check if hardwiring the QStyle can be removed at a later stage.
QApplication::setStyle(new QCommonStyle);
}
@@ -66,51 +58,12 @@
// meego-im-uiserver.
app.setInputContext(new MIMDummyInputContext);
- bool selfComposited = app.selfComposited();
-
- qDebug() << (selfComposited ? "Use self composition" : "Use system compositor");
-
- MPassThruWindow widget(app.bypassWMHint(), selfComposited);
- widget.setFocusPolicy(Qt::NoFocus);
- app.setPassThruWindow(&widget);
-
- // Must be declared after creation of top level window.
- MReactionMap reactionMap(&widget);
- MPlainWindow *view = new MPlainWindow(&widget);
-
-#ifndef M_IM_DISABLE_TRANSLUCENCY
- if (!selfComposited)
- // enable translucent in hardware rendering
- view->setTranslucentBackground(!MApplication::softwareRendering());
-#endif
-
- // No auto fill in software rendering
- if (MApplication::softwareRendering())
- view->viewport()->setAutoFillBackground(false);
-
- if (selfComposited) {
- widget.setAttribute(Qt::WA_NoSystemBackground);
- widget.setAttribute(Qt::WA_OpaquePaintEvent);
- view->setAttribute(Qt::WA_NoSystemBackground);
- view->setAttribute(Qt::WA_OpaquePaintEvent);
- view->viewport()->setAttribute(Qt::WA_NoSystemBackground);
- view->viewport()->setAttribute(Qt::WA_OpaquePaintEvent);
- }
-
- QSize sceneSize = view->visibleSceneSize(M::Landscape);
- int w = sceneSize.width();
- int h = sceneSize.height();
- view->setSceneRect(0, 0, w, h);
-
- widget.resize(sceneSize);
-
- view->setMinimumSize(1, 1);
- view->setMaximumSize(w, h);
+ qDebug() << (app.selfComposited() ? "Use self composition" : "Use system compositor");
- MIMPluginManager *pluginManager = new MIMPluginManager();
+ MIMPluginManager *pluginManager = new MIMPluginManager;
QObject::connect(pluginManager, SIGNAL(regionUpdated(const QRegion &)),
- &widget, SLOT(inputPassthrough(const QRegion &)));
+ app.passThruWindow(), SLOT(inputPassthrough(const QRegion &)));
#if defined(M_IM_DISABLE_TRANSLUCENCY) && !defined(M_IM_USE_SHAPE_WINDOW)
QObject::connect(pluginManager, SIGNAL(regionUpdated(const QRegion &)),
view, SLOT(updatePosition(const QRegion &)));
--- passthroughserver/mpassthruwindow.cpp
+++ passthroughserver/mpassthruwindow.cpp
@@ -14,11 +14,11 @@
* of this file.
*/
#include "mpassthruwindow.h"
-#include "mplainwindow.h"
#include "mimapplication.h"
#include "mimremotewindow.h"
#include <QDebug>
+#include <QGraphicsView>
#include <QX11Info>
#include <X11/Xlib.h>
@@ -30,21 +30,23 @@
#include <X11/extensions/shape.h>
#endif
-MPassThruWindow::MPassThruWindow(bool bypassWMHint, bool selfComposited, QWidget *p)
+MPassThruWindow::MPassThruWindow(QWidget *p)
: QWidget(p),
- raiseOnShow(bypassWMHint), // if bypassing window hint, also do raise to ensure visibility
- selfComposited(selfComposited),
remoteWindow(0)
{
setWindowTitle("MInputMethod");
+ setFocusPolicy(Qt::NoFocus);
- if (!selfComposited) {
+ if (mApp && mApp->selfComposited()) {
+ setAttribute(Qt::WA_OpaquePaintEvent);
+ setAttribute(Qt::WA_NoSystemBackground);
+ } else {
setAttribute(Qt::WA_TranslucentBackground);
}
Qt::WindowFlags windowFlags = Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint;
- if (bypassWMHint) {
+ if (mApp && mApp->bypassWMHint()) {
windowFlags |= Qt::X11BypassWindowManagerHint;
}
@@ -82,35 +84,6 @@
const int size = regionRects.size();
if (size) {
-#ifdef M_IM_DISABLE_TRANSLUCENCY
-#ifdef M_IM_USE_SHAPE_WINDOW
- setMask(region);
-#else
- QPoint newPos(0, 0);
-
- switch (MPlainWindow::instance()->orientationAngle())
- {
- case M::Angle0:
- newPos.setY(region.boundingRect().top());
- break;
- case M::Angle90:
- newPos.setX(region.boundingRect().width() - width());
- break;
- case M::Angle180:
- newPos.setY(region.boundingRect().height() - height());
- break;
- case M::Angle270:
- newPos.setX(width() - region.boundingRect().width());
- break;
- default:
- Q_ASSERT(0);
- }
- move(newPos);
- newPos.setX(-newPos.x());
- newPos.setY(-newPos.y());
-#endif
-#else
-
XRectangle * const rects = (XRectangle*)malloc(sizeof(XRectangle)*(size));
if (!rects) {
return;
@@ -140,24 +113,25 @@
free(rects);
XSync(dpy, False);
-#endif
}
// selective compositing
if (isVisible() && region.isEmpty()) {
- if (selfComposited && remoteWindow) {
+ if (mApp && mApp->selfComposited() && remoteWindow) {
remoteWindow->unredirect();
}
hide();
- } else if (!isVisible() && !region.isEmpty()) {
- if (selfComposited && remoteWindow) {
+ } else
+ if (!isVisible() && !region.isEmpty()) {
+ if (mApp && mApp->selfComposited() && remoteWindow) {
remoteWindow->redirect();
}
showFullScreen();
- if (raiseOnShow) {
+ // If bypassing window hint, also do raise to ensure visibility:
+ if (mApp && mApp->bypassWMHint()) {
raise();
}
}
@@ -170,3 +144,21 @@
if (!newWindow)
inputPassthrough();
}
+
+void MPassThruWindow::updateFromRemoteWindow(const QRegion ®ion)
+{
+ const QRectF br(region.boundingRect());
+ QList<QRectF> rects;
+ rects.append(br);
+
+ foreach (QObject *obj, children()) {
+ if (QGraphicsView *v = qobject_cast<QGraphicsView *>(obj)) {
+ v->invalidateScene(br, QGraphicsScene::BackgroundLayer);
+ v->updateScene(rects);
+ v->update(region);
+ } else
+ if (QWidget *w = qobject_cast<QWidget *>(obj)) {
+ w->update(region);
+ }
+ }
+}
--- passthroughserver/mpassthruwindow.h
+++ passthroughserver/mpassthruwindow.h
@@ -33,7 +33,7 @@
* \brief Constructor
* \param p QWidget* parent widget
*/
- explicit MPassThruWindow(bool bypassWMHint = false, bool selfComposited = true, QWidget *p = 0);
+ explicit MPassThruWindow(QWidget *p = 0);
//! Destructor
~MPassThruWindow();
@@ -45,14 +45,17 @@
//! Set the new remote window (application window)
void setRemoteWindow(MImRemoteWindow *remoteWindow = 0);
+ //! Schedules repainting for widget's background from remote window
+ void updateFromRemoteWindow(const QRegion ®ion);
+
private:
Q_DISABLE_COPY(MPassThruWindow);
- bool raiseOnShow;
- bool selfComposited;
MImRemoteWindow *remoteWindow;
+#ifdef UNIT_TEST
friend class Ut_PassthroughServer;
+#endif
};
#endif
--- passthroughserver/passthroughserver.pro
+++ passthroughserver/passthroughserver.pro
@@ -19,7 +19,6 @@
mimdummyinputcontext.h
QT += core gui
-CONFIG += meegotouchcore
# coverage flags are off per default, but can be turned on via qmake COV_OPTION=on
for(OPTION,$$list($$lower($$COV_OPTION))){
@@ -43,7 +42,7 @@
check-xml.target = check-xml
check-xml.depends += $$TARGET
-QMAKE_EXTRA_TARGETS += check
+QMAKE_EXTRA_TARGETS += check
check.target = check
check.depends += $$TARGET
--- settings-applet/mimsettingsconf.cpp
+++ settings-applet/mimsettingsconf.cpp
@@ -14,16 +14,16 @@
* of this file.
*/
-#include <MGConfItem>
+#include "minputmethodplugin.h"
+#include "mimsettingsconf.h"
+#include "mimsettings.h"
+
#include <QDir>
#include <QPluginLoader>
#include <QDBusInterface>
#include <QDBusReply>
#include <QDebug>
-#include "minputmethodplugin.h"
-#include "mimsettingsconf.h"
-
namespace
{
const QString DefaultPluginLocation("/usr/lib/meego-im-plugins/");
@@ -40,8 +40,8 @@
MImSettingsConf *MImSettingsConf::imSettingsConfInstance = 0;
MImSettingsConf::MImSettingsConf()
- : paths(MGConfItem(MImPluginPaths).value(QStringList(DefaultPluginLocation)).toStringList()),
- blacklist(MGConfItem(MImPluginDisabled).value().toStringList())
+ : paths(MImSettings(MImPluginPaths).value(QStringList(DefaultPluginLocation)).toStringList()),
+ blacklist(MImSettings(MImPluginDisabled).value().toStringList())
{
connectToIMPluginManagerDBus();
--- settings-applet/mimsettingswidget.cpp
+++ settings-applet/mimsettingswidget.cpp
@@ -17,7 +17,7 @@
#include "mimsettingswidget.h"
#include <MContainer>
-#include <MContentItem>
+#include <MBasicListItem>
#include <MLocale>
#include <MPopupList>
#include <MLabel>
@@ -72,9 +72,11 @@
mainLayout->setStretchFactor(headerLabel, 0);
// Active input method selector
- activeSubViewItem = new MContentItem(MContentItem::TwoTextLabels, this);
+ // We are using MBasicListItem instead of MContentItem because
+ // the latter is not supported by theme
+ activeSubViewItem = new MBasicListItem(MBasicListItem::TitleWithSubtitle, this);
activeSubViewItem->setObjectName(ObjectNameActiveInputMethodWidget);
- activeSubViewItem->setStyleName("CommonContentItemInverted");
+ activeSubViewItem->setStyleName("CommonBasicListItemInverted");
mainLayout->addItem(activeSubViewItem);
mainLayout->setStretchFactor(activeSubViewItem, 0);
connect(activeSubViewItem, SIGNAL(clicked()), this, SLOT(showAvailableSubViewList()));
--- settings-applet/mimsettingswidget.h
+++ settings-applet/mimsettingswidget.h
@@ -20,10 +20,10 @@
#include <DcpWidget>
#include <QModelIndex>
-class MContentItem;
class MPopupList;
class MAbstractInputMethodSettings;
class MLabel;
+class MBasicListItem;
class MImSettingsWidget : public DcpWidget
{
@@ -56,7 +56,7 @@
void updateActiveSubViewTitle();
MLabel *headerLabel;
- MContentItem *activeSubViewItem;
+ MBasicListItem *activeSubViewItem;
MPopupList *availableSubViewList;
QMap<MAbstractInputMethodSettings *, MLabel *> settingsLabelMap;
};
--- settings-applet/settings-applet.pro
+++ settings-applet/settings-applet.pro
@@ -11,9 +11,15 @@
LIBS += ../src/libmeegoimframework.so
CONFIG += ordered
-CONFIG += plugin qdbus meegotouch duicontrolpanel
+CONFIG += plugin qdbus
QT = core gui
+contains(CONFIG, nomeegotouch) {
+} else {
+ CONFIG += meegotouch duicontrolpanel
+ DEFINES += HAVE_MEEGOTOUCH
+}
+
CONFIG += link_pkgconfig
PKGCONFIG += gconf-2.0
--- src/mabstractinputmethod.cpp
+++ src/mabstractinputmethod.cpp
@@ -16,13 +16,17 @@
#include "mabstractinputmethod.h"
#include "mabstractinputmethodhost.h"
+#include "mimgraphicsview.h"
+#include "mimwidget.h"
#include <QKeyEvent>
+#include <QWidget>
class MAbstractInputMethodPrivate
{
public:
- MAbstractInputMethodPrivate(MAbstractInputMethodHost *imHost, MAbstractInputMethod *parent);
+ MAbstractInputMethodPrivate(MAbstractInputMethodHost *imHost,
+ MAbstractInputMethod *parent);
~MAbstractInputMethodPrivate();
MAbstractInputMethodHost *imHost;
@@ -44,11 +48,11 @@
///////////////
-MAbstractInputMethod::MAbstractInputMethod(MAbstractInputMethodHost *imHost, QObject *parent)
- : QObject(parent),
- d_ptr(new MAbstractInputMethodPrivate(imHost, this))
+MAbstractInputMethod::MAbstractInputMethod(MAbstractInputMethodHost *host,
+ QWidget *mainWindow)
+ : QObject(mainWindow),
+ d_ptr(new MAbstractInputMethodPrivate(host, this))
{
- // nothing
}
--- src/mabstractinputmethod.h
+++ src/mabstractinputmethod.h
@@ -21,10 +21,10 @@
#include <QEvent>
#include <QVariant>
#include <QMap>
-#include <MNamespace>
#include "minputmethodnamespace.h"
+class QWidget;
class QRegion;
class QPoint;
class QRect;
@@ -38,7 +38,7 @@
/*!
* \brief MAbstractInputMethod is a base class for input method servers.
- *
+ *
* It defines the interface which input method framework can use for
* passing commands received from the applications
*/
@@ -60,12 +60,13 @@
QString subViewTitle;
};
- /*! Constructor for input method base
- * \param imHost input method host instace, not owned by input method base
+ /*! Constructor
+ * \param host serves as communication link to framework and application. Managed by framework.
+ * \param mainWindow should be used to install plugin's UI into it. Managed by framework.
*/
- MAbstractInputMethod(MAbstractInputMethodHost *imHost, QObject *parent = 0);
-
- ~MAbstractInputMethod();
+ MAbstractInputMethod(MAbstractInputMethodHost *host,
+ QWidget *mainWindow);
+ virtual ~MAbstractInputMethod();
/*! \brief Returns input method host
*/
--- src/mabstractinputmethodhost.cpp
+++ src/mabstractinputmethodhost.cpp
@@ -15,7 +15,7 @@
*/
#include "mabstractinputmethodhost.h"
-
+#include "mimapplication.h"
class MAbstractInputMethodHostPrivate
{
@@ -51,3 +51,9 @@
valid = false;
return false;
}
+
+QPixmap MAbstractInputMethodHost::background() const
+{
+ return MIMApplication::remoteWindowPixmap();
+}
+
--- src/mabstractinputmethodhost.h
+++ src/mabstractinputmethodhost.h
@@ -21,10 +21,12 @@
#include <QRect>
#include <QObject>
+#include <QPixmap>
class QString;
class QRegion;
class QKeyEvent;
+class QWidget;
class MToolbarId;
@@ -37,7 +39,7 @@
* for interacting with the application that is using input method services and
* the input method framework state itself.
* Note: this is not meant to be derived by the input method framework users.
- *
+ *
*/
class MAbstractInputMethodHost: public QObject
{
@@ -111,6 +113,12 @@
*/
virtual QString selection(bool &valid) = 0;
+ /*!
+ * \brief returns a pixmap that needs to be drawn as the background of the
+ * input method. Pixmap contains the application's window contents.
+ */
+ QPixmap background() const;
+
public slots:
/*!
* \brief Updates pre-edit string in the application widget
@@ -230,11 +238,6 @@
virtual void setInputMethodArea(const QRegion ®ion) = 0;
/*!
- * Asks environment to show settings.
- */
- virtual void showSettings() = 0;
-
- /*!
*\brief Sets selection text from \a start with \a length in the application widget.
*/
virtual void setSelection(int start, int length) = 0;
--- src/mattributeextension.h
+++ src/mattributeextension.h
@@ -23,7 +23,6 @@
#include <QList>
#include "minputmethodnamespace.h"
-#include <MNamespace>
class MAttributeExtensionId;
--- src/mattributeextensionmanager.cpp
+++ src/mattributeextensionmanager.cpp
@@ -23,7 +23,6 @@
#include "mkeyoverridedata.h"
#include "mkeyoverride.h"
-#include <MLocale>
#include <QVariant>
#include <QFileInfo>
#include <QFile>
@@ -170,8 +169,8 @@
return;
}
- QSharedPointer<MToolbarLayout> landscape = toolbarData->layout(M::Landscape).constCast<MToolbarLayout>();
- QSharedPointer<MToolbarLayout> portrait = toolbarData->layout(M::Portrait).constCast<MToolbarLayout>();
+ QSharedPointer<MToolbarLayout> landscape = toolbarData->layout(MInputMethod::Landscape).constCast<MToolbarLayout>();
+ QSharedPointer<MToolbarLayout> portrait = toolbarData->layout(MInputMethod::Portrait).constCast<MToolbarLayout>();
if (landscape) {
addStandardButtons(landscape, toolbarData);
--- src/mattributeextensionmanager.h
+++ src/mattributeextensionmanager.h
@@ -22,12 +22,11 @@
#include <QHash>
#include <QPointer>
-#include <MGConfItem>
-
#include "mkeyoverridedata.h"
#include "mtoolbardata.h"
#include "mattributeextension.h"
#include "minputmethodnamespace.h"
+#include "mimsettings.h"
class MAttributeExtensionId;
@@ -150,7 +149,7 @@
typedef QHash<MAttributeExtensionId, QSharedPointer<MAttributeExtension> > AttributeExtensionContainer;
//! all registered attribute extensions
AttributeExtensionContainer attributeExtensions;
-
+
//! Standard close button
QSharedPointer<MToolbarItem> close;
@@ -164,7 +163,7 @@
MInputMethod::CopyPasteState copyPasteStatus;
//! Preferred domain for URL and Email toolbar domain buttons.
- MGConfItem preferredDomainSetting;
+ MImSettings preferredDomainSetting;
//! Singleton instance
static MAttributeExtensionManager *attributeExtensionMgrInstance;
--- src/mimapplication.cpp
+++ src/mimapplication.cpp
@@ -15,18 +15,13 @@
*/
#include "mimapplication.h"
-
-#include <MWindow>
-#include <MDebug>
-
#include "mimremotewindow.h"
-#include <X11/Xlib.h>
+#include <QDebug>
+#include <X11/Xlib.h> // must be last include
MIMApplication::MIMApplication(int &argc, char **argv)
- : MApplication(argc, argv),
- mPassThruWindow(0),
- mRemoteWindow(0),
+ : QApplication(argc, argv),
mCompositeExtension(),
mDamageExtension(),
mSelfComposited(false),
@@ -34,6 +29,19 @@
mBypassWMHint(false)
{
parseArguments(argc, argv);
+ mPassThruWindow.reset(new MPassThruWindow),
+
+ connect(this, SIGNAL(aboutToQuit()),
+ this, SLOT(finalize()),
+ Qt::UniqueConnection);
+}
+
+void MIMApplication::finalize()
+{
+ // Cannot destroy QWidgets or QPixmaps during MIMApplication destruction.
+ // Hence the finalize handler that runs before the d'tor.
+ mPassThruWindow.reset();
+ mRemoteWindow.reset();
}
MIMApplication::~MIMApplication()
@@ -60,58 +68,69 @@
handleMapNotifyEvents(ev);
handleTransientEvents(ev);
handleDamageEvents(ev);
- return MApplication::x11EventFilter(ev);
+ return QApplication::x11EventFilter(ev);
+}
+
+void MIMApplication::updatePassThruWindow(const QRegion ®ion)
+{
+ if (region.isEmpty() || MIMApplication::remoteWindowPixmap().isNull()) {
+ qDebug() << "Skipping update request for passthru window.";
+ return;
+ }
+
+ mPassThruWindow->updateFromRemoteWindow(region);
}
void MIMApplication::handleMapNotifyEvents(XEvent *ev)
{
if (wasPassThruWindowMapped(ev)) {
- mDebug("MIMApplication") << "PassThru window was mapped.";
+ qDebug() << "MIMApplication" << __PRETTY_FUNCTION__
+ << "PassThru window was mapped.";
emit passThruWindowMapped();
} else if (wasPassThruWindowUnmapped(ev)) {
- mDebug("MIMApplication") << "PassThru window was unmapped.";
+ qDebug() << "MIMApplication" << __PRETTY_FUNCTION__
+ << "PassThru window was unmapped.";
emit passThruWindowUnmapped();
}
}
void MIMApplication::handleTransientEvents(XEvent *ev)
{
- if (0 == mRemoteWindow || not mPassThruWindow) {
+ if (not mRemoteWindow.get()) {
return;
}
if (mRemoteWindow->wasIconified(ev) || mRemoteWindow->wasUnmapped(ev)) {
- mDebug("MIMApplication") << "Remote window was destroyed or iconified - hiding.";
+ qDebug() << "MIMApplication" << __PRETTY_FUNCTION__
+ << "Remote window was destroyed or iconified - hiding.";
+
emit remoteWindowGone();
- delete mRemoteWindow;
- mRemoteWindow = 0;
+ mRemoteWindow.reset();
}
}
void MIMApplication::setTransientHint(WId newRemoteWinId)
{
- if (0 == newRemoteWinId || not activeWindow()) {
+ if (0 == newRemoteWinId) {
return;
}
- if (mRemoteWindow && mRemoteWindow->id() == newRemoteWinId) {
+ if (mRemoteWindow.get() && mRemoteWindow->id() == newRemoteWinId) {
return;
}
- MImRemoteWindow *oldWindow = mRemoteWindow;
-
- mRemoteWindow = new MImRemoteWindow(newRemoteWinId, this);
+ mRemoteWindow.reset(new MImRemoteWindow(newRemoteWinId));
mRemoteWindow->setIMWidget(mPassThruWindow->window());
- emit remoteWindowChanged(mRemoteWindow);
- delete oldWindow;
+ connect(mRemoteWindow.get(), SIGNAL(contentUpdated(QRegion)),
+ this, SLOT(updatePassThruWindow(QRegion)));
+
+ emit remoteWindowChanged(mRemoteWindow.get());
}
-void MIMApplication::setPassThruWindow(QWidget *newPassThruWindow)
+QWidget *MIMApplication::passThruWindow() const
{
- if (newPassThruWindow != mPassThruWindow) {
- mPassThruWindow = newPassThruWindow;
- }
+ return mPassThruWindow.get();
}
MIMApplication *MIMApplication::instance()
@@ -121,22 +140,21 @@
bool MIMApplication::wasPassThruWindowMapped(XEvent *ev) const
{
- return (mPassThruWindow &&
- MapNotify == ev->type &&
+ return (MapNotify == ev->type &&
static_cast<WId>(ev->xmap.event) == mPassThruWindow->effectiveWinId());
}
bool MIMApplication::wasPassThruWindowUnmapped(XEvent *ev) const
{
- return (mPassThruWindow &&
- UnmapNotify == ev->type &&
+ return (UnmapNotify == ev->type &&
static_cast<WId>(ev->xunmap.event) == mPassThruWindow->effectiveWinId());
}
void MIMApplication::handleDamageEvents(XEvent *event)
{
- if (mRemoteWindow == 0)
+ if (not mRemoteWindow.get()) {
return;
+ }
mRemoteWindow->handleDamageEvent(event);
}
@@ -155,3 +173,20 @@
{
return mBypassWMHint;
}
+
+#ifdef UNIT_TEST
+MImRemoteWindow *MIMApplication::remoteWindow() const
+{
+ return mRemoteWindow.get();
+}
+#endif
+
+const QPixmap &MIMApplication::remoteWindowPixmap()
+{
+ if (not mApp || not mApp->mRemoteWindow.get()) {
+ static const QPixmap empty;
+ return empty;
+ }
+
+ return mApp->mRemoteWindow->windowPixmap();
+}
--- src/mimapplication.h
+++ src/mimapplication.h
@@ -17,10 +17,15 @@
#ifndef MIM_APPLICATION_H
#define MIM_APPLICATION_H
-#include <MApplication>
-
+#include <QApplication>
+#include <QWidget>
+#include <QPixmap>
+#include <QRect>
#include <QPointer>
+#include <memory>
+#include "mpassthruwindow.h"
+#include "mimremotewindow.h"
#include "mimxextension.h"
class MIMApplication;
@@ -29,8 +34,6 @@
#endif
#define mApp (static_cast<MIMApplication *>(QCoreApplication::instance()))
-class MImRemoteWindow;
-
//! \internal
/*! \brief A helper class to filter X11 events
*
@@ -38,7 +41,7 @@
* remote application window.
*/
class MIMApplication
- : public MApplication
+ : public QApplication
{
Q_OBJECT
@@ -53,6 +56,7 @@
*/
explicit MIMApplication(int &argc, char** argv);
virtual ~MIMApplication();
+ static MIMApplication *instance();
//! Requires a valid remoteWinId and a valid passThruWindow before it'll
//! start to work.
@@ -60,14 +64,18 @@
bool x11EventFilter(XEvent *ev);
void setTransientHint(WId remoteWinId);
- void setPassThruWindow(QWidget *mPassThruWindow);
-
- static MIMApplication *instance();
+ QWidget *passThruWindow() const;
bool selfComposited() const;
bool manualRedirection() const;
bool bypassWMHint() const;
+#ifdef UNIT_TEST
+ MImRemoteWindow *remoteWindow() const;
+#endif
+
+ static const QPixmap &remoteWindowPixmap();
+
const MImXCompositeExtension& compositeExtension() { return mCompositeExtension; }
const MImXDamageExtension& damageExtension() { return mDamageExtension; }
signals:
@@ -84,6 +92,11 @@
//! This signal is emitted when remote window is gone
void remoteWindowGone();
+
+private slots:
+ void updatePassThruWindow(const QRegion ®ion);
+ void finalize();
+
private:
void parseArguments(int &argc, char** argv);
@@ -96,8 +109,8 @@
bool wasPassThruWindowMapped(XEvent *ev) const;
bool wasPassThruWindowUnmapped(XEvent *ev) const;
- QPointer<QWidget> mPassThruWindow;
- MImRemoteWindow *mRemoteWindow;
+ std::auto_ptr<MPassThruWindow> mPassThruWindow;
+ std::auto_ptr<MImRemoteWindow> mRemoteWindow;
MImXCompositeExtension mCompositeExtension;
MImXDamageExtension mDamageExtension;
bool mSelfComposited;
--- src/mimgraphicsview.cpp
+++ src/mimgraphicsview.cpp
+/* * This file is part of meego-im-framework *
+ *
+ * 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.
+ */
+
+#include "mimgraphicsview_p.h"
+#include "mimgraphicsview.h"
+#include "mimapplication.h"
+
+#include <QDebug>
+
+MImGraphicsViewPrivate::MImGraphicsViewPrivate()
+ : q_ptr(0)
+{}
+
+MImGraphicsViewPrivate::~MImGraphicsViewPrivate()
+{}
+
+MImGraphicsView::MImGraphicsView(QWidget *parent)
+ : QGraphicsView(parent)
+ , d_ptr(new MImGraphicsViewPrivate)
+{
+ init();
+}
+
+MImGraphicsView::MImGraphicsView(QGraphicsScene *scene,
+ QWidget *parent)
+ : QGraphicsView(scene, parent)
+ , d_ptr(new MImGraphicsViewPrivate)
+{
+ init();
+}
+
+MImGraphicsView::MImGraphicsView(MImGraphicsViewPrivate *dd,
+ QGraphicsScene *scene,
+ QWidget *parent)
+ : QGraphicsView(scene, parent)
+ , d_ptr(dd)
+{
+ init();
+}
+
+MImGraphicsView::~MImGraphicsView()
+{
+ delete d_ptr;
+}
+
+void MImGraphicsView::init()
+{
+ Q_D(MImGraphicsView);
+ d->q_ptr = this;
+ setAttribute(Qt::WA_OpaquePaintEvent);
+ setAttribute(Qt::WA_NoSystemBackground);
+
+ if (viewport()) {
+ viewport()->setAttribute(Qt::WA_OpaquePaintEvent);
+ viewport()->setAttribute(Qt::WA_NoSystemBackground);
+ } else {
+ qWarning() << __PRETTY_FUNCTION__
+ << "Could not find viewport - unable to set window attributes!";
+ }
+}
+
+void MImGraphicsView::drawBackground(QPainter *painter,
+ const QRectF &rect)
+{
+ if (rect.isEmpty()) {
+ return;
+ }
+
+ const QPixmap &bg(MIMApplication::remoteWindowPixmap());
+ if (not bg.isNull()) {
+ painter->drawPixmap(rect.toRect(), bg, rect.toRect());
+ }
+}
--- src/mimgraphicsview.h
+++ src/mimgraphicsview.h
+/* * This file is part of meego-im-framework *
+ *
+ * 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 MIMGRAPHICSVIEW_H
+#define MIMGRAPHICSVIEW_H
+
+#include <QGraphicsView>
+#include <QGraphicsScene>
+#include <QWidget>
+#include <QPixmap>
+#include <QRegion>
+#include <QPainter>
+#include <QRectF>
+
+//! A QGraphicsView implementation that can be used for input methods
+//! using MAbstractInputMethod.
+class MImGraphicsViewPrivate;
+
+class MImGraphicsView
+ : public QGraphicsView
+{
+ Q_OBJECT
+public:
+ //! C'tor
+ //! \param parent the parent widget
+ explicit MImGraphicsView(QWidget *parent = 0);
+
+ //! C'tor
+ //! \param scene the scene for this view
+ //! \param parent the parent widget
+ explicit MImGraphicsView(QGraphicsScene * scene,
+ QWidget *parent = 0);
+
+ //! D'tor
+ virtual ~MImGraphicsView();
+
+protected:
+ //! \reimp
+ virtual void drawBackground(QPainter *painter,
+ const QRectF &rect);
+ //! \reimp_end
+
+ //! Protected c'tor that allows to re-use private class
+ //! \param dd the PIMPL instance
+ //! \param scene the scene for this view
+ //! \param widget the parent widget
+ MImGraphicsView(MImGraphicsViewPrivate *dd,
+ QGraphicsScene *scene,
+ QWidget *parent);
+
+ MImGraphicsViewPrivate *const d_ptr; //!< PIMPL
+
+private:
+ void init();
+
+ Q_DISABLE_COPY(MImGraphicsView);
+ Q_DECLARE_PRIVATE(MImGraphicsView);
+};
+
+#endif // MIMGRAPHICSVIEW_H
--- src/mimgraphicsview_p.h
+++ src/mimgraphicsview_p.h
+/* * This file is part of meego-im-framework *
+ *
+ * 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 MIMGRAPHICSVIEW_P_H
+#define MIMGRAPHICSVIEW_P_H
+
+#include "mimgraphicsview.h"
+#include <QPixmap>
+
+class MImGraphicsViewPrivate
+{
+ Q_DECLARE_PUBLIC(MImGraphicsView);
+
+protected:
+ MImGraphicsView *q_ptr;
+
+public:
+ MImGraphicsViewPrivate();
+ virtual ~MImGraphicsViewPrivate();
+
+ QPixmap background;
+};
+
+#endif // MIMGRAPHICSVIEW_P_H
--- src/mimhwkeyboardtracker.cpp
+++ src/mimhwkeyboardtracker.cpp
+#include "mimhwkeyboardtracker.h"
+
+#ifdef HAVE_MEEGOTOUCH
+#include <MKeyboardStateTracker>
+#endif
+
+MImHwKeyboardTracker::MImHwKeyboardTracker()
+ : QObject()
+{
+#ifdef HAVE_MEEGOTOUCH
+ connect(MKeyboardStateTracker::instance(), SIGNAL(stateChanged()),
+ this, SIGNAL(stateChanged()),
+ Qt::UniqueConnection);
+#endif
+}
+
+MImHwKeyboardTracker::~MImHwKeyboardTracker()
+{}
+
+MImHwKeyboardTracker *MImHwKeyboardTracker::instance()
+{
+ static MImHwKeyboardTracker tracker;
+ return &tracker;
+}
+
+bool MImHwKeyboardTracker::isPresent() const
+{
+#ifdef HAVE_MEEGOTOUCH
+ return MKeyboardStateTracker::instance()->isPresent();
+#else
+ return false;
+#endif
+}
+
+bool MImHwKeyboardTracker::isOpen() const
+{
+#ifdef HAVE_MEEGOTOUCH
+ return MKeyboardStateTracker::instance()->isOpen();
+#else
+ return false;
+#endif
+}
--- src/mimhwkeyboardtracker.h
+++ src/mimhwkeyboardtracker.h
+#ifndef MIMKEYBOARDSTATETRACKER_H
+#define MIMKEYBOARDSTATETRACKER_H
+
+#include <QObject>
+
+//! \internal
+/*!
+ * Class responsible for tracking the hardware keyboard properties and signaling events.
+ * It is designed as singleton. Using isPresent() can query whether the device supports
+ * hardware keyboard or not. If hardware keyboard is supported, using isOpen() to query
+ * its current state. Signal stateChanged will be emitted when hardware keyboard state is changed.
+ */
+
+// TODO: Check (build) depedencies for context provider, and whether I should simply move MKeyboardStateTracker here
+class MImHwKeyboardTracker
+ : public QObject
+{
+ Q_OBJECT
+
+public:
+ //! \brief Returns the singleton instance.
+ static MImHwKeyboardTracker *instance();
+
+ //! \brief Returns whether device has a hardware keyboard.
+ bool isPresent() const;
+
+ //! \brief Returns whether hardware keyboard is opened.
+ bool isOpen() const;
+
+Q_SIGNALS:
+ //! \brief Emitted whenever the hardware keyboard state changed.
+ void stateChanged();
+
+private:
+ MImHwKeyboardTracker();
+ virtual ~MImHwKeyboardTracker();
+};
+//! \internal_end
+
+#endif // MIMKEYBOARDSTATETRACKER_H
--- src/mimpluginmanager.cpp
+++ src/mimpluginmanager.cpp
@@ -17,17 +17,13 @@
#include "mimpluginmanager.h"
#include "mimpluginmanager_p.h"
#include "mimpluginmanageradaptor.h"
-#include "mplainwindow.h"
#include "minputmethodplugin.h"
#include "mattributeextensionmanager.h"
-#include "mimsettingsdialog.h"
#include "mabstractinputmethod.h"
-#include "mkeyoverride.h"
-
-#include <MGConfItem>
-#include <MKeyboardStateTracker>
-#include <MSceneManager>
-#include <MLocale>
+#include "mimsettings.h"
+#include "mimhwkeyboardtracker.h"
+#include "mimapplication.h"
+#include "mimremotewindow.h"
#include <QDir>
#include <QPluginLoader>
@@ -38,8 +34,10 @@
#include <QDBusAbstractAdaptor>
#include <QDBusInterface>
#include <QDBusMetaType>
+#include <QWeakPointer>
#include <QDebug>
+#include <deque>
#include "minputcontextglibdbusconnection.h"
typedef MInputContextGlibDBusConnection MInputContextConnectionImpl;
@@ -68,10 +66,9 @@
: parent(p),
mICConnection(connection),
imAccessoryEnabledConf(0),
- settingsDialog(0),
adaptor(0),
connectionValid(false),
- acceptRegionUpdates(true),
+ acceptRegionUpdates(false),
indicatorService(0),
lastActiveSubViewConf(LastActiveSubView)
{
@@ -95,7 +92,6 @@
{
qDeleteAll(handlerToPluginConfs);
delete mICConnection;
- delete settingsDialog;
}
@@ -129,19 +125,22 @@
MInputMethodPlugin *plugin = qobject_cast<MInputMethodPlugin *>(pluginInstance);
if (plugin) {
if (!plugin->supportedStates().isEmpty()) {
- MInputMethodHost *inputMethodHost = new MInputMethodHost(mICConnection, q,
- indicatorService);
- MAbstractInputMethod *inputMethod = plugin->createInputMethod(inputMethodHost);
+ MInputMethodHost *host = new MInputMethodHost(mICConnection, q, indicatorService);
+ MAbstractInputMethod *im = plugin->createInputMethod(host, mApp->passThruWindow());
// only add valid plugin descriptions
- if (inputMethod) {
- PluginDescription desc = { load.fileName(), inputMethod, inputMethodHost,
- PluginState(), MInputMethod::SwitchUndefined };
+ if (im) {
+ PluginDescription desc = { load.fileName(), im, host, PluginState(),
+ MInputMethod::SwitchUndefined };
plugins[plugin] = desc;
val = true;
- inputMethodHost->setInputMethod(inputMethod);
+ host->setInputMethod(im);
+ MIMPluginManagerPrivate::configureWidgetsForCompositing(mApp->passThruWindow(),
+ mApp->selfComposited());
} else {
- delete inputMethodHost;
+ qWarning() << __PRETTY_FUNCTION__
+ << "Plugin loading failed:" << fileName;
+ delete host;
}
} else {
qWarning() << __PRETTY_FUNCTION__
@@ -319,8 +318,21 @@
// TODO: show/hide from IC matches SIP show/hide requests but here show is used (and
// hide in deactivatePlugin) in a sense completely unrelated to SIP requests. Should
// there be separte methods for plugin activation/deactivation?
- switchedTo->show();
- switchedTo->showLanguageNotification();
+ if (acceptRegionUpdates) {
+ switchedTo->show();
+ switchedTo->showLanguageNotification();
+ }
+
+ // When switching plugin, there is no activeSubViewChanged signal emitted,
+ // but the active subview for OnScreen is really changed. So we update the recorded
+ // active subview here.
+ if (state.contains(MInputMethod::OnScreen)) {
+ activeSubViewIdOnScreen = switchedTo->activeSubView(MInputMethod::OnScreen);
+ setLastActiveSubView(switchedTo->activeSubView(MInputMethod::OnScreen));
+ if (adaptor) {
+ emit adaptor->activeSubViewChanged(MInputMethod::OnScreen);
+ }
+ }
}
@@ -452,7 +464,7 @@
// Update gconfitem to record new plugin for handler map.
// This should be done after real changing the handler map,
// to prevent _q_syncHandlerMap also being called to change handler map.
- MGConfItem gconf(PluginRoot + "/" + inputSourceName(state));
+ MImSettings gconf(PluginRoot + "/" + inputSourceName(state));
gconf.set(replacement->name());
}
}
@@ -514,12 +526,12 @@
QSignalMapper *signalMapper = new QSignalMapper(q);
// Queries all children under PluginRoot, each is a gconf entry that maps an
// input source to a plugin that handles it
- foreach (const QString &handler, MGConfItem(PluginRoot).listEntries()) {
+ foreach (const QString &handler, MImSettings(PluginRoot).listEntries()) {
const QStringList path = handler.split("/");
bool validSource(false);
const MInputMethod::HandlerState source(inputSourceFromName(path.last(), validSource));
if (validSource) {
- MGConfItem *handlerItem = new MGConfItem(handler);
+ MImSettings *handlerItem = new MImSettings(handler);
handlerToPluginConfs.append(handlerItem);
const QString pluginName = handlerItem->value().toString();
addHandlerMap(source, pluginName);
@@ -538,7 +550,7 @@
const MInputMethod::HandlerState source = static_cast<MInputMethod::HandlerState>(state);
MInputMethodPlugin *currentPlugin = activePlugin(source);
- MGConfItem gconf(PluginRoot + "/" + inputSourceName(source));
+ MImSettings gconf(PluginRoot + "/" + inputSourceName(source));
const QString pluginName = gconf.value().toString();
// already synchronized.
@@ -604,9 +616,7 @@
if (adaptor) {
emit adaptor->activeSubViewChanged(MInputMethod::OnScreen);
}
- if (settingsDialog) {
- settingsDialog->refreshUi();
- }
+
break;
}
}
@@ -627,17 +637,6 @@
emit q->regionUpdated(QRegion());
}
-void MIMPluginManagerPrivate::loadInputMethodSettings()
-{
- if (!settingsDialog) {
- MLocale locale;
- // add text-input-settings catalog for the settings translation.
- locale.installTrCatalog("text-input-settings");
- MLocale::setDefault(locale);
- settingsDialog = new MIMSettingsDialog(this, "", M::NoStandardButton);
- }
-}
-
void MIMPluginManagerPrivate::initActiveSubView()
{
// initialize activeSubViewIdOnScreen
@@ -650,9 +649,6 @@
if (adaptor) {
emit adaptor->activeSubViewChanged(MInputMethod::OnScreen);
}
- if (settingsDialog) {
- settingsDialog->refreshUi();
- }
}
}
}
@@ -669,11 +665,6 @@
void MIMPluginManagerPrivate::hideActivePlugins()
{
- if (settingsDialog) {
- // disappear the settings dialog without animation before hiding active plugins.
- MPlainWindow::instance()->sceneManager()->disappearSceneWindowNow(settingsDialog);
- }
-
foreach (MInputMethodPlugin *plugin, activePlugins) {
plugins[plugin].inputMethod->hide();
}
@@ -715,7 +706,7 @@
void MIMPluginManagerPrivate::setActivePlugin(const QString &pluginName,
MInputMethod::HandlerState state)
{
- MGConfItem currentPluginConf(PluginRoot + "/" + inputSourceName(state));
+ MImSettings currentPluginConf(PluginRoot + "/" + inputSourceName(state));
if (!pluginName.isEmpty() && currentPluginConf.value().toString() != pluginName) {
// check whether the pluginName is valid
foreach (MInputMethodPlugin *plugin, plugins.keys()) {
@@ -743,6 +734,44 @@
lastActiveSubViewConf.set(subview);
}
+void MIMPluginManagerPrivate::configureWidgetsForCompositing(QWidget *mainWindow,
+ bool selfCompositing)
+{
+ std::deque<QWidget *> unvisited;
+ unvisited.push_back(mainWindow);
+
+ // Breadth-first traversal of widget hierarchy, until no more
+ // unvisited widgets remain. Will find viewports of QGraphicsViews,
+ // as QAbstractScrollArea reparents the viewport to itself.
+ while (not unvisited.empty()) {
+ QWidget *current = unvisited.front();
+ unvisited.pop_front();
+
+ // Configure widget attributes:
+ current->setAttribute(Qt::WA_OpaquePaintEvent);
+ current->setAttribute(Qt::WA_NoSystemBackground);
+ current->setAutoFillBackground(false);
+ // Be aware that one cannot verify whether the background role *is*
+ // QPalette::NoRole - see QTBUG-17924.
+ current->setBackgroundRole(QPalette::NoRole);
+
+ if (not selfCompositing) {
+ // Careful: This flag can trigger a call to
+ // qt_x11_recreateNativeWidgetsRecursive
+ // - which will crash when it tries to get the effective WId
+ // (as none of widgets have been mapped yet).
+ current->setAttribute(Qt::WA_TranslucentBackground);
+ }
+
+ // Mark children of current widget as unvisited:
+ foreach (QObject *obj, current->children()) {
+ if (QWidget *w = qobject_cast<QWidget *>(obj)) {
+ unvisited.push_back(w);
+ }
+ }
+ }
+}
+
///////////////
// actual class
@@ -766,18 +795,20 @@
connect(d->mICConnection, SIGNAL(keyOverrideCreated()),
this, SLOT(updateKeyOverrides()));
- d->paths = MGConfItem(MImPluginPaths).value(QStringList(DefaultPluginLocation)).toStringList();
- d->blacklist = MGConfItem(MImPluginDisabled).value().toStringList();
+ d->paths = MImSettings(MImPluginPaths).value(QStringList(DefaultPluginLocation)).toStringList();
+ d->blacklist = MImSettings(MImPluginDisabled).value().toStringList();
d->loadPlugins();
d->loadHandlerMap();
- if (MKeyboardStateTracker::instance()->isPresent()) {
- connect(MKeyboardStateTracker::instance(), SIGNAL(stateChanged()), this, SLOT(updateInputSource()));
+ if (MImHwKeyboardTracker::instance()->isPresent()) {
+ connect(MImHwKeyboardTracker::instance(), SIGNAL(stateChanged()),
+ this, SLOT(updateInputSource()),
+ Qt::UniqueConnection);
}
- d->imAccessoryEnabledConf = new MGConfItem(MImAccesoryEnabled, this);
+ d->imAccessoryEnabledConf = new MImSettings(MImAccesoryEnabled, this);
connect(d->imAccessoryEnabledConf, SIGNAL(valueChanged()), this, SLOT(updateInputSource()));
updateInputSource();
@@ -849,7 +880,8 @@
// Hardware and Accessory can work together.
// OnScreen is mutually exclusive to Hardware and Accessory.
QSet<MInputMethod::HandlerState> handlers = d->activeHandlers();
- if (MKeyboardStateTracker::instance()->isOpen()) {
+
+ if (MImHwKeyboardTracker::instance()->isOpen()) {
// hw keyboard is on
handlers.remove(MInputMethod::OnScreen);
handlers.insert(MInputMethod::Hardware);
@@ -897,19 +929,6 @@
}
}
-void MIMPluginManager::showInputMethodSettings()
-{
- Q_D(MIMPluginManager);
- // require the whole screen area as the keyboard area for setting
- const QSize visibleSceneSize = MPlainWindow::instance()->visibleSceneSize(M::Landscape);
- emit regionUpdated(QRegion(0, 0, visibleSceneSize.width(), visibleSceneSize.height()));
- d->loadInputMethodSettings();
- MPlainWindow::instance()->sceneManager()->execDialog(d->settingsDialog);
- // restore the region
- emit regionUpdated(d->activeImRegion);
-}
-
-
void MIMPluginManager::updateRegion(const QRegion ®ion)
{
Q_D(MIMPluginManager);
@@ -917,10 +936,9 @@
// Record input method object's region.
d->activeImRegion = region;
- // If settings dialog is visible, don't update region. Don't update region
- // when no region updates from the plugin side are expected.
- if (d->acceptRegionUpdates &&
- (!d->settingsDialog || !d->settingsDialog->isVisible())) {
+ // Don't update region when no region updates from the plugin side are
+ // expected.
+ if (d->acceptRegionUpdates) {
emit regionUpdated(region);
}
}
--- src/mimpluginmanager.h
+++ src/mimpluginmanager.h
@@ -26,7 +26,7 @@
class MIMPluginManagerPrivate;
class MAttributeExtensionId;
class MAbstractInputMethod;
-
+class MImRemoteWindow;
//! Note: this class is not considered stable API
class MIMPluginManager: public QObject
@@ -77,9 +77,6 @@
//! Switches active plugin to inactive plugin with given \a name
void switchPlugin(const QString &name, MAbstractInputMethod *initiator);
- //! Shows settings for all loaded inputmethod plugins.
- void showInputMethodSettings();
-
signals:
//!
// This signal is emitted when the whole painting area of the
--- src/mimpluginmanager_p.h
+++ src/mimpluginmanager_p.h
@@ -17,6 +17,12 @@
#ifndef MIMPLUGINMANAGER_P_H
#define MIMPLUGINMANAGER_P_H
+#include "minputmethodnamespace.h"
+#include "mattributeextensionid.h"
+#include "minputmethodhost.h"
+#include "mindicatorserviceclient.h"
+#include "mimsettings.h"
+
#include <QObject>
#include <QList>
#include <QStringList>
@@ -25,19 +31,11 @@
#include <QRegion>
#include <QTimer>
-#include <MGConfItem>
-
-#include "minputmethodnamespace.h"
-#include "mattributeextensionid.h"
-#include "minputmethodhost.h"
-#include "mindicatorserviceclient.h"
-
class MInputMethodPlugin;
class MInputContextConnection;
class MIMPluginManager;
-class MGConfItem;
+class MImSettings;
class MAbstractInputMethod;
-class MIMSettingsDialog;
class MIMPluginManagerAdaptor;
@@ -88,7 +86,6 @@
QString activePluginsName(MInputMethod::HandlerState state) const;
void loadHandlerMap();
MInputMethodPlugin *activePlugin(MInputMethod::HandlerState state) const;
- void loadInputMethodSettings();
void initActiveSubView();
void hideActivePlugins();
void showActivePlugins();
@@ -125,6 +122,10 @@
//! Sets last active subview.
void setLastActiveSubView(const QString &subview);
+ //! Configures a widget (and its widget hierarchy) for (self) compositing.
+ static void configureWidgetsForCompositing(QWidget *mainWindow,
+ bool selfCompositing);
+
MIMPluginManager *parent;
MInputContextConnection *mICConnection;
@@ -135,13 +136,11 @@
QStringList blacklist;
HandlerMap handlerToPlugin;
- QList<MGConfItem *> handlerToPluginConfs;
- MGConfItem *imAccessoryEnabledConf;
+ QList<MImSettings *> handlerToPluginConfs;
+ MImSettings *imAccessoryEnabledConf;
QString activeSubViewIdOnScreen;
-
QRegion activeImRegion;
- MIMSettingsDialog *settingsDialog;
MIMPluginManagerAdaptor *adaptor;
MIMPluginManager *q_ptr;
@@ -157,7 +156,7 @@
MIndicatorServiceClient indicatorService;
- MGConfItem lastActiveSubViewConf;
+ MImSettings lastActiveSubViewConf;
QTimer ensureEmptyRegionWhenHiddenTimer;
};
--- src/mimremotewindow.cpp
+++ src/mimremotewindow.cpp
@@ -198,7 +198,8 @@
void MImRemoteWindow::destroyPixmap()
{
- pixmap = QPixmap();
+ if (mApp)
+ pixmap = QPixmap();
if (xpixmap != 0) {
XFreePixmap(QX11Info::display(), xpixmap);
@@ -206,7 +207,7 @@
}
}
-QPixmap MImRemoteWindow::windowPixmap() const
+const QPixmap &MImRemoteWindow::windowPixmap() const
{
// setup remote pixmap when it failed before
if (redirected && pixmap.isNull()) {
--- src/mimremotewindow.h
+++ src/mimremotewindow.h
@@ -54,7 +54,7 @@
void handleDamageEvent(XEvent *event);
//! Returns the window pixmap while the remote application window is redirected
- QPixmap windowPixmap() const;
+ virtual const QPixmap &windowPixmap() const;
WId id() const { return wid; }
@@ -79,7 +79,6 @@
Qt::HANDLE damage;
QPixmap pixmap;
-
bool redirected;
};
//! \internal_end
--- src/mimscene.cpp
+++ src/mimscene.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
- * and appearing in the file LICENSE.LGPL included in the packaging
- * of this file.
- */
-
-
-#include "mimscene.h"
-#include <QEvent>
-
-MImScene::MImScene(QObject *parent)
- : MScene(parent)
-{
-}
-
-bool MImScene::event(QEvent *event)
-{
- // This is another workaround to fix NB#220440
- // We should only filter the TouchBegin and MousePress
- // events to QGraphicsScene, other events should be still
- // sent to MScene.
- switch (event->type()) {
- case QEvent::TouchBegin:
- case QEvent::GraphicsSceneMousePress:
- return QGraphicsScene::event(event);
- default:
- return MScene::event(event);
- }
-}
-
--- src/mimscene.h
+++ src/mimscene.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 MIMSCENE_H
-
-#include <MScene>
-
-/*!
- * \internal
- * \brief MImScene is custom scene class for input method server.
- *
- * This class implements workaround for NB#216904 and could be removed
- * when that bug will be fixed properly.
- */
-class MImScene : public MScene
-{
- Q_OBJECT
-
-public:
- MImScene(QObject *parent = 0);
-
-protected:
- //! \reimp
- bool event(QEvent *event);
- //! \reimp_end
-};
-//! \internal_end
-
-#endif
-
--- src/mimsettings.cpp
+++ src/mimsettings.cpp
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui at nokia.com)
+**
+** This file is part of libmeegotouch.
+**
+** 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.
+**
+****************************************************************************/
+
+#include "mimsettings.h"
+
+#include <QString>
+#include <QStringList>
+#include <QByteArray>
+#include <QVariant>
+#include <QDebug>
+
+#include <gconf/gconf-value.h>
+#include <gconf/gconf-client.h>
+
+struct MImSettingsPrivate {
+ MImSettingsPrivate() :
+ notify_id(0),
+ have_gconf(false)
+ {}
+
+ QString key;
+ QVariant value;
+ guint notify_id;
+ bool have_gconf;
+
+ static void notify_trampoline(GConfClient *, guint, GConfEntry *, gpointer);
+};
+
+/* We get the default client and never release it, on purpose, to
+ avoid disconnecting from the GConf daemon when a program happens to
+ not have any GConfItems for short periods of time.
+ */
+static GConfClient *
+get_gconf_client ()
+{
+ static GConfClient *s_gconf_client = 0;
+ struct GConfClientDestroyer {
+ ~GConfClientDestroyer() { g_object_unref(s_gconf_client); s_gconf_client = 0; }
+ };
+
+ static GConfClientDestroyer gconfClientDestroyer;
+ if (s_gconf_client)
+ return s_gconf_client;
+
+ g_type_init();
+ s_gconf_client = gconf_client_get_default();
+
+ return s_gconf_client;
+}
+
+
+#define withClient(c) for (GConfClient *c = get_gconf_client (); c; c = NULL)
+
+static QByteArray convertKey(const QString &key)
+{
+ if (key.startsWith('/'))
+ return key.toUtf8();
+ else {
+ QString replaced = key;
+ replaced.replace('.', '/');
+ qWarning() << "mgconfitem.cpp" << "Using dot-separated key names with MGConfItem is deprecated.";
+ qWarning() << "mgconfitem.cpp" << "Please use" << '/' + replaced << "instead of" << key;
+ return '/' + replaced.toUtf8();
+ }
+}
+
+static QString convertKey(const char *key)
+{
+ return QString::fromUtf8(key);
+}
+
+static QVariant convertValue(GConfValue *src)
+{
+ if (!src) {
+ return QVariant();
+ } else {
+ switch (src->type) {
+ case GCONF_VALUE_INVALID:
+ return QVariant(QVariant::Invalid);
+ case GCONF_VALUE_BOOL:
+ return QVariant((bool)gconf_value_get_bool(src));
+ case GCONF_VALUE_INT:
+ return QVariant(gconf_value_get_int(src));
+ case GCONF_VALUE_FLOAT:
+ return QVariant(gconf_value_get_float(src));
+ case GCONF_VALUE_STRING:
+ return QVariant(QString::fromUtf8(gconf_value_get_string(src)));
+ case GCONF_VALUE_LIST:
+ switch (gconf_value_get_list_type(src)) {
+ case GCONF_VALUE_STRING: {
+ QStringList result;
+ for (GSList *elts = gconf_value_get_list(src); elts; elts = elts->next)
+ result.append(QString::fromUtf8(gconf_value_get_string((GConfValue *)elts->data)));
+ return QVariant(result);
+ }
+ default: {
+ QList<QVariant> result;
+ for (GSList *elts = gconf_value_get_list(src); elts; elts = elts->next)
+ result.append(convertValue((GConfValue *)elts->data));
+ return QVariant(result);
+ }
+ }
+ case GCONF_VALUE_SCHEMA:
+ default:
+ return QVariant();
+ }
+ }
+}
+
+static GConfValue *convertString(const QString &str)
+{
+ GConfValue *v = gconf_value_new(GCONF_VALUE_STRING);
+ gconf_value_set_string(v, str.toUtf8().data());
+ return v;
+}
+
+static GConfValueType primitiveType(const QVariant &elt)
+{
+ switch (elt.type()) {
+ case QVariant::String:
+ return GCONF_VALUE_STRING;
+ case QVariant::Int:
+ return GCONF_VALUE_INT;
+ case QVariant::Double:
+ return GCONF_VALUE_FLOAT;
+ case QVariant::Bool:
+ return GCONF_VALUE_BOOL;
+ default:
+ return GCONF_VALUE_INVALID;
+ }
+}
+
+static GConfValueType uniformType(const QList<QVariant> &list)
+{
+ GConfValueType result = GCONF_VALUE_INVALID;
+
+ foreach(const QVariant & elt, list) {
+ GConfValueType elt_type = primitiveType(elt);
+
+ if (elt_type == GCONF_VALUE_INVALID)
+ return GCONF_VALUE_INVALID;
+
+ if (result == GCONF_VALUE_INVALID)
+ result = elt_type;
+ else if (result != elt_type)
+ return GCONF_VALUE_INVALID;
+ }
+
+ if (result == GCONF_VALUE_INVALID)
+ return GCONF_VALUE_STRING; // empty list.
+ else
+ return result;
+}
+
+static int convertValue(const QVariant &src, GConfValue **valp)
+{
+ GConfValue *v;
+
+ switch (src.type()) {
+ case QVariant::Invalid:
+ v = NULL;
+ break;
+ case QVariant::Bool:
+ v = gconf_value_new(GCONF_VALUE_BOOL);
+ gconf_value_set_bool(v, src.toBool());
+ break;
+ case QVariant::Int:
+ v = gconf_value_new(GCONF_VALUE_INT);
+ gconf_value_set_int(v, src.toInt());
+ break;
+ case QVariant::Double:
+ v = gconf_value_new(GCONF_VALUE_FLOAT);
+ gconf_value_set_float(v, src.toDouble());
+ break;
+ case QVariant::String:
+ v = convertString(src.toString());
+ break;
+ case QVariant::StringList: {
+ GSList *elts = NULL;
+ v = gconf_value_new(GCONF_VALUE_LIST);
+ gconf_value_set_list_type(v, GCONF_VALUE_STRING);
+ foreach(const QString & str, src.toStringList())
+ elts = g_slist_prepend(elts, convertString(str));
+ gconf_value_set_list_nocopy(v, g_slist_reverse(elts));
+ break;
+ }
+ case QVariant::List: {
+ GConfValueType elt_type = uniformType(src.toList());
+ if (elt_type == GCONF_VALUE_INVALID)
+ v = NULL;
+ else {
+ GSList *elts = NULL;
+ v = gconf_value_new(GCONF_VALUE_LIST);
+ gconf_value_set_list_type(v, elt_type);
+ foreach(const QVariant & elt, src.toList()) {
+ GConfValue *val = NULL;
+ convertValue(elt, &val); // guaranteed to succeed.
+ elts = g_slist_prepend(elts, val);
+ }
+ gconf_value_set_list_nocopy(v, g_slist_reverse(elts));
+ }
+ break;
+ }
+ default:
+ return 0;
+ }
+
+ *valp = v;
+ return 1;
+}
+
+void MImSettingsPrivate::notify_trampoline(GConfClient *,
+ guint,
+ GConfEntry *,
+ gpointer data)
+{
+ MImSettings *item = (MImSettings *)data;
+ item->update_value(true);
+}
+
+void MImSettings::update_value(bool emit_signal)
+{
+ QVariant new_value;
+
+ withClient(client) {
+ GError *error = NULL;
+ QByteArray k = convertKey(priv->key);
+ GConfValue *v = gconf_client_get(client, k.data(), &error);
+
+ if (error) {
+ qWarning() << "MGConfItem" << error->message;
+ g_error_free(error);
+ new_value = priv->value;
+ } else {
+ new_value = convertValue(v);
+ if (v)
+ gconf_value_free(v);
+ }
+ }
+
+ if (new_value != priv->value) {
+ priv->value = new_value;
+ if (emit_signal)
+ emit valueChanged();
+ }
+}
+
+QString MImSettings::key() const
+{
+ return priv->key;
+}
+
+QVariant MImSettings::value() const
+{
+ return priv->value;
+}
+
+QVariant MImSettings::value(const QVariant &def) const
+{
+ if (priv->value.isNull())
+ return def;
+ else
+ return priv->value;
+}
+
+void MImSettings::set(const QVariant &val)
+{
+ withClient(client) {
+ QByteArray k = convertKey(priv->key);
+ GConfValue *v;
+ if (convertValue(val, &v)) {
+ GError *error = NULL;
+
+ if (v) {
+ gconf_client_set(client, k.data(), v, &error);
+ gconf_value_free(v);
+ } else {
+ gconf_client_unset(client, k.data(), &error);
+ }
+
+ if (error) {
+ qWarning() << "MGConfItem" << error->message;
+ g_error_free(error);
+ } else if (priv->value != val) {
+ priv->value = val;
+ emit valueChanged();
+ }
+
+ } else
+ qWarning() << "MGConfItem" << "Can't store a" << val.typeName();
+ }
+}
+
+void MImSettings::unset()
+{
+ set(QVariant());
+}
+
+QList<QString> MImSettings::listDirs() const
+{
+ QList<QString> children;
+
+ withClient(client) {
+ QByteArray k = convertKey(priv->key);
+ GError *error = NULL;
+ GSList *dirs = gconf_client_all_dirs(client, k.data(), &error);
+ if(error) {
+ qWarning() << "MGConfItem" << error->message;
+ g_error_free(error);
+ return children;
+ }
+
+ for (GSList *d = dirs; d; d = d->next) {
+ children.append(convertKey((char *)d->data));
+ g_free(d->data);
+ }
+ g_slist_free(dirs);
+ }
+
+ return children;
+}
+
+QList<QString> MImSettings::listEntries() const
+{
+ QList<QString> children;
+
+ withClient(client) {
+ QByteArray k = convertKey(priv->key);
+ GError *error = NULL;
+ GSList *entries = gconf_client_all_entries(client, k.data(), &error);
+ if(error) {
+ qWarning() << "MGConfItem" << error->message;
+ g_error_free(error);
+ return children;
+ }
+
+ for (GSList *e = entries; e; e = e->next) {
+ children.append(convertKey(((GConfEntry *)e->data)->key));
+ gconf_entry_free((GConfEntry *)e->data);
+ }
+ g_slist_free(entries);
+ }
+
+ return children;
+}
+
+MImSettings::MImSettings(const QString &key, QObject *parent)
+ : QObject(parent)
+{
+ priv = new MImSettingsPrivate;
+ priv->key = key;
+ withClient(client) {
+ QByteArray k = convertKey(priv->key);
+ GError *error = NULL;
+
+ int index = k.lastIndexOf('/');
+ if (index > 0) {
+ QByteArray dir = k.left(index);
+ gconf_client_add_dir(client, dir.data(), GCONF_CLIENT_PRELOAD_ONELEVEL, &error);
+ } else {
+ gconf_client_add_dir(client, k.data(), GCONF_CLIENT_PRELOAD_NONE, &error);
+ }
+
+ if(error) {
+ qWarning() << "MGConfItem" << error->message;
+ g_error_free(error);
+ return;
+ }
+ priv->notify_id = gconf_client_notify_add(client, k.data(),
+ MImSettingsPrivate::notify_trampoline, this,
+ NULL, &error);
+ if(error) {
+ qWarning() << "MGConfItem" << error->message;
+ g_error_free(error);
+ priv->have_gconf = false;
+ return;
+ }
+ update_value(false);
+ }
+ priv->have_gconf = true;
+}
+
+MImSettings::~MImSettings()
+{
+ if(priv->have_gconf) {
+ withClient(client) {
+ QByteArray k = convertKey(priv->key);
+ gconf_client_notify_remove(client, priv->notify_id);
+ GError *error = NULL;
+
+ // Use the same dir as in ctor
+ int index = k.lastIndexOf('/');
+ if (index > 0) {
+ k = k.left(index);
+ }
+ gconf_client_remove_dir(client, k.data(), &error);
+
+ if(error) {
+ qWarning() << "MGConfItem" << error->message;
+ g_error_free(error);
+ //return; // or priv not deleted
+ }
+ }
+ }
+ delete priv;
+}
--- src/mimsettings.h
+++ src/mimsettings.h
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui at nokia.com)
+**
+** This file is part of libmeegotouch.
+**
+** 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 MIMSETTINGS_H
+#define MIMSETTINGS_H
+
+#include <QVariant>
+#include <QStringList>
+#include <QObject>
+
+
+/*!
+
+ \brief MImSettings is a simple C++ wrapper for GConf.
+
+ Creating a MImSettings instance gives you access to a single GConf
+ key. You can get and set its value, and connect to its
+ valueChanged() signal to be notified about changes.
+
+ The value of a GConf key is returned to you as a QVariant, and you
+ pass in a QVariant when setting the value. MGConfItem converts
+ between a QVariant and GConf values as needed, and according to the
+ following rules:
+
+ - A QVariant of type QVariant::Invalid denotes an unset GConf key.
+
+ - QVariant::Int, QVariant::Double, QVariant::Bool are converted to
+ and from the obvious equivalents.
+
+ - QVariant::String is converted to/from a GConf string and always
+ uses the UTF-8 encoding. No other encoding is supported.
+
+ - QVariant::StringList is converted to a list of UTF-8 strings.
+
+ - QVariant::List (which denotes a QList<QVariant>) is converted
+ to/from a GConf list. All elements of such a list must have the
+ same type, and that type must be one of QVariant::Int,
+ QVariant::Double, QVariant::Bool, or QVariant::String. (A list of
+ strings is returned as a QVariant::StringList, however, when you
+ get it back.)
+
+ - Any other QVariant or GConf value is essentially ignored.
+
+ \warning MGConfItem is as thread-safe as GConf.
+
+*/
+
+class MImSettings : public QObject
+{
+ Q_OBJECT
+
+public:
+ /*! Initializes a MGConfItem to access the GConf key denoted by
+ \a key. Key names should follow the normal GConf conventions
+ like "/myapp/settings/first".
+
+ \param key The name of the key.
+ \param parent Parent object
+ */
+ explicit MImSettings(const QString &key, QObject *parent = 0);
+
+ /*! Finalizes a MGConfItem.
+ */
+ virtual ~MImSettings();
+
+ /*! Returns the key of this item, as given to the constructor.
+ */
+ QString key() const;
+
+ /*! Returns the current value of this item, as a QVariant.
+ */
+ QVariant value() const;
+
+ /*! Returns the current value of this item, as a QVariant. If
+ * there is no value for this item, return \a def instead.
+ */
+ QVariant value(const QVariant &def) const;
+
+ /*! Set the value of this item to \a val. If \a val can not be
+ represented in GConf or GConf refuses to accept it for other
+ reasons, the current value is not changed and nothing happens.
+
+ When the new value is different from the old value, the
+ changedValue() signal is emitted on this MGConfItem as part
+ of calling set(), but other MGConfItem:s for the same key do
+ only receive a notification once the main loop runs.
+
+ \param val The new value.
+ */
+ void set(const QVariant &val);
+
+ /*! Unset this item. This is equivalent to
+
+ \code
+ item.set(QVariant(QVariant::Invalid));
+ \endcode
+ */
+ void unset();
+
+ /*! Return a list of the directories below this item. The
+ returned strings are absolute key names like
+ "/myapp/settings".
+
+ A directory is a key that has children. The same key might
+ also have a value, but that is confusing and best avoided.
+ */
+ QList<QString> listDirs() const;
+
+ /*! Return a list of entries below this item. The returned
+ strings are absolute key names like "/myapp/settings/first".
+
+ A entry is a key that has a value. The same key might also
+ have children, but that is confusing and is best avoided.
+ */
+ QList<QString> listEntries() const;
+
+Q_SIGNALS:
+ /*! Emitted when the value of this item has changed.
+ */
+ void valueChanged();
+
+private:
+ friend struct MImSettingsPrivate;
+ struct MImSettingsPrivate *priv;
+
+ void update_value(bool emit_signal);
+};
+
+#endif // MIMSETTINGS_H
--- src/mimsettingsdialog.cpp
+++ src/mimsettingsdialog.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
- * and appearing in the file LICENSE.LGPL included in the packaging
- * of this file.
- */
-
-#include "mimsettingsdialog.h"
-
-#include <MGConfItem>
-#include <MKeyboardStateTracker>
-#include <MWidget>
-#include <MDialog>
-#include <MContainer>
-#include <MContentItem>
-#include <MSceneManager>
-#include <MLocale>
-#include <MPopupList>
-
-#include "minputmethodplugin.h"
-#include "mabstractinputmethodsettings.h"
-#include "mimpluginmanager_p.h"
-#include "mplainwindow.h"
-
-#include <QGraphicsLinearLayout>
-#include <QStandardItemModel>
-#include <QDebug>
-
-
-namespace
-{
- const int MImSubViewIdentifierRole = Qt::UserRole;
- const int MImPluginNameRole = Qt::UserRole + 1;
-
- //!object name for settings' widgets
- const QString ObjectNameActiveInputMethodWidget("ActiveInputMethodWidget");
-};
-
-MIMSettingsDialog::MIMSettingsDialog(MIMPluginManagerPrivate *p, const QString &title,
- M::StandardButtons buttons)
- : MDialog(title, buttons),
- activeSubViewItem(0),
- availableSubViewList(0),
- imPluginManagerPrivate(p)
-{
- Q_ASSERT(imPluginManagerPrivate);
-
- MWidget *settingsWidget = new MWidget(this);
- QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Vertical, settingsWidget);
- activeSubViewItem = new MContentItem(MContentItem::TwoTextLabels, settingsWidget);
- activeSubViewItem->setObjectName(ObjectNameActiveInputMethodWidget);
-
- updateActiveSubViewTitle();
- connect(activeSubViewItem, SIGNAL(clicked()), this, SLOT(showAvailableSubViewList()));
- layout->addItem(activeSubViewItem);
-
- foreach (MInputMethodPlugin *plugin, imPluginManagerPrivate->plugins.keys()) {
- MAbstractInputMethodSettings *settings = plugin->createInputMethodSettings();
- if (settings) {
- QGraphicsWidget *contentWidget = settings->createContentWidget(settingsWidget);
- if (contentWidget) {
- MContainer *container = new MContainer(settings->title(), settingsWidget);
- container->setCentralWidget(contentWidget);
- //TODO: icon for the setting.
- layout->addItem(container);
- settingsContainerMap.insert(settings, container);
- }
- }
- }
- settingsWidget->setLayout(layout);
-
- setCentralWidget(settingsWidget);
- connect(this, SIGNAL(languageChanged()), this, SLOT(retranslateSettingsUi()));
- connect(this, SIGNAL(disappeared()), this, SLOT(handleDialogDisappeared()));
- retranslateSettingsUi();
-}
-
-MIMSettingsDialog::~MIMSettingsDialog()
-{
- delete availableSubViewList;
-}
-
-void MIMSettingsDialog::refreshUi()
-{
- updateActiveSubViewTitle();
- updateActiveSubViewIndex();
-}
-
-void MIMSettingsDialog::retranslateUi()
-{
- emit languageChanged();
- MDialog::retranslateUi();
-}
-
-void MIMSettingsDialog::updateActiveSubViewTitle()
-{
- if (!activeSubViewItem)
- return;
-
- QString subViewId = imPluginManagerPrivate->activeSubView(MInputMethod::OnScreen);
- QString activePluginsName = imPluginManagerPrivate->activePluginsName(MInputMethod::OnScreen);
- QMap<QString, QString> subViews
- = imPluginManagerPrivate->availableSubViews(activePluginsName, MInputMethod::OnScreen);
- QString subViewTitle = subViews.value(subViewId);
-
- activeSubViewItem->setSubtitle(subViewTitle);
-}
-
-void MIMSettingsDialog::showAvailableSubViewList()
-{
- if (!availableSubViewList) {
- availableSubViewList = new MPopupList();
- //% "Active input method"
- availableSubViewList->setTitle(qtTrId("qtn_txts_active_input_method"));
- QStandardItemModel *model = new QStandardItemModel(availableSubViewList);
- model->sort(0);
- availableSubViewList->setItemModel(model);
- connect(availableSubViewList, SIGNAL(clicked(const QModelIndex &)),
- this, SLOT(setActiveSubView(const QModelIndex &)));
- }
- // always update available subview model
- updateAvailableSubViewModel();
- MPlainWindow::instance()->sceneManager()->execDialog(availableSubViewList);
-}
-
-void MIMSettingsDialog::updateActiveSubViewIndex()
-{
- if (availableSubViewList) {
- QString subViewId = imPluginManagerPrivate->activeSubViewIdOnScreen;
- QStandardItemModel *model = static_cast<QStandardItemModel*> (availableSubViewList->itemModel());
- QList<QStandardItem *> items = model->findItems(activeSubViewItem->subtitle());
- foreach (const QStandardItem *item, items) {
- if (subViewId == item->data(MImSubViewIdentifierRole).toString()) {
- availableSubViewList->setCurrentIndex(item->index());
- availableSubViewList->scrollTo(item->index());
- break;
- }
- }
- }
-}
-
-void MIMSettingsDialog::updateAvailableSubViewModel()
-{
- if (!availableSubViewList)
- return;
-
- QStandardItemModel *model = static_cast<QStandardItemModel *> (availableSubViewList->itemModel());
- model->clear();
-
- // get all subviews from plugins which support OnScreen
- foreach (const QString &pluginName,
- imPluginManagerPrivate->loadedPluginsNames(MInputMethod::OnScreen)) {
- QMap<QString, QString> subViews
- = imPluginManagerPrivate->availableSubViews(pluginName, MInputMethod::OnScreen);
- QMap<QString, QString>::const_iterator i = subViews.constBegin();
- while (i != subViews.constEnd()) {
- QStandardItem *item = new QStandardItem(i.value());
- // set the title of subview as the display role,
- // ID as the MImSubViewIdentifierRole role.
- // pluging name as MImPluginNameRole role.
- item->setData(i.value(), Qt::DisplayRole);
- item->setData(i.key(), MImSubViewIdentifierRole);
- item->setData(pluginName, MImPluginNameRole);
- model->appendRow(item);
- ++i;
- }
- }
-
- updateActiveSubViewIndex();
-}
-
-void MIMSettingsDialog::setActiveSubView(const QModelIndex &index)
-{
- if (!index.isValid() || !availableSubViewList
- || !availableSubViewList->selectionModel()->isSelected(index))
- return;
-
- availableSubViewList->setCurrentIndex(index);
- QStandardItemModel *model = static_cast<QStandardItemModel *> (availableSubViewList->itemModel());
-
- // check whether OnScreen plugin is changed.
- QString pluginName = model->itemFromIndex(index)->data(MImPluginNameRole).toString();
- imPluginManagerPrivate->setActivePlugin(pluginName, MInputMethod::OnScreen);
-
- // check whether active subview is changed.
- QString subViewId = model->itemFromIndex(index)->data(MImSubViewIdentifierRole).toString();
- imPluginManagerPrivate->_q_setActiveSubView(subViewId, MInputMethod::OnScreen);
-}
-
-void MIMSettingsDialog::retranslateSettingsUi()
-{
- //% "Text Input"
- setTitle(qtTrId("qtn_txts_text_input"));
-
- if (activeSubViewItem) {
- //% "Active input method"
- activeSubViewItem->setTitle(qtTrId("qtn_txts_active_input_method"));
- }
- if (availableSubViewList) {
- //% "Active input method"
- availableSubViewList->setTitle(qtTrId("qtn_txts_active_input_method"));
- }
-
- foreach (MContainer *container, settingsContainerMap.values()) {
- container->setTitle(settingsContainerMap.key(container)->title());
- }
-}
-
-void MIMSettingsDialog::handleDialogDisappeared()
-{
- // hide availableSubViewList when keyboard is disappeared.
- // availableSubViewList is shown by execDialog/appear
- // means its visibility is controlled by scenemanager,
- // it won't be hidden together with MIMSettingsDialog
- // if we don't call reject/disappear for it.
- if (availableSubViewList) {
- availableSubViewList->reject();
- }
-}
--- src/mimsettingsdialog.h
+++ src/mimsettingsdialog.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 MIMSETTINGDIALOG_H
-#define MIMSETTINGDIALOG_H
-
-#include <QObject>
-#include <QList>
-#include <QStringList>
-#include <QMap>
-#include <QTimer>
-#include <QSet>
-#include <QRegion>
-#include <MDialog>
-
-class MIMPluginManagerPrivate;
-class MContentItem;
-class MPopupList;
-class QModelIndex;
-class MContainer;
-class MAbstractInputMethodSettings;
-
-//! \internal
-class MIMSettingsDialog : public MDialog
-{
- Q_OBJECT
-public:
- MIMSettingsDialog(MIMPluginManagerPrivate *,
- const QString &title, M::StandardButtons buttons);
-
- virtual ~MIMSettingsDialog();
-
- void refreshUi();
-
-Q_SIGNALS:
- void languageChanged();
-
-protected:
- //! \reimp
- virtual void retranslateUi();
- //! \reimp_end
-
-private slots:
- void showAvailableSubViewList();
- void setActiveSubView(const QModelIndex &);
- void retranslateSettingsUi();
- void handleDialogDisappeared();
-
-private:
- void updateActiveSubViewTitle();
- void updateActiveSubViewIndex();
- void updateAvailableSubViewModel();
-
- MContentItem *activeSubViewItem;
- MPopupList *availableSubViewList;
- QMap<MAbstractInputMethodSettings *, MContainer *> settingsContainerMap;
- MIMPluginManagerPrivate *const imPluginManagerPrivate;
-
- friend class Ut_MIMSettingsDialog;
-};
-//! \internal_end
-
-#endif
--- src/mimwidget.cpp
+++ src/mimwidget.cpp
+/* * This file is part of meego-im-framework *
+ *
+ * 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.
+ */
+
+#include "mimwidget_p.h"
+#include "mimwidget.h"
+#include "mimapplication.h"
+
+#include <QPainter>
+#include <QDebug>
+
+MImWidgetPrivate::MImWidgetPrivate()
+ : q_ptr(0)
+{}
+
+MImWidgetPrivate::~MImWidgetPrivate()
+{}
+
+MImWidget::MImWidget(QWidget *parent,
+ Qt::WindowFlags f)
+ : QWidget(parent, f)
+ , d_ptr(new MImWidgetPrivate)
+{
+ init();
+}
+
+MImWidget::MImWidget(MImWidgetPrivate *dd,
+ QWidget *parent,
+ Qt::WindowFlags f)
+
+ : QWidget(parent, f)
+ , d_ptr(dd)
+{
+ init();
+}
+
+MImWidget::~MImWidget()
+{
+ delete d_ptr;
+}
+
+void MImWidget::init()
+{
+ Q_D(MImWidget);
+ d->q_ptr = this;
+
+ if (mApp && mApp->selfComposited()) {
+ setAttribute(Qt::WA_OpaquePaintEvent);
+ setAttribute(Qt::WA_NoSystemBackground);
+ }
+}
+
+void MImWidget::paintEvent(QPaintEvent *ev)
+{
+ if (ev->rect().isEmpty()) {
+ return;
+ }
+
+ const QPixmap &bg(MIMApplication::remoteWindowPixmap());
+ if (not bg.isNull()) {
+ QPainter p(this);
+ p.drawPixmap(ev->rect(), bg, ev->rect());
+ }
+}
--- src/mimwidget.h
+++ src/mimwidget.h
+/* * This file is part of meego-im-framework *
+ *
+ * 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 MIMWIDGET_H
+#define MIMWIDGET_H
+
+#include <QWidget>
+#include <QPixmap>
+#include <QRegion>
+#include <QPaintEvent>
+#include <QRectF>
+
+class MImWidgetPrivate;
+
+//! A QWidget implementation that can be used for input methods
+//! using MAbstractInputMethod.
+//! Need to call MImWidget::paintEvent when overriding paintEvent.
+class MImWidget
+ : public QWidget
+{
+ Q_OBJECT
+public:
+ //! C'tor
+ //! \param parent the parent widget
+ //! \param f the window flags
+ explicit MImWidget(QWidget *parent = 0,
+ Qt::WindowFlags f = 0);
+
+ //! D'tor
+ virtual ~MImWidget();
+
+protected:
+ //! \reimp
+ virtual void paintEvent(QPaintEvent *event);
+ //! \reimp_end
+
+ //! Protected c'tor that allows to re-use private class
+ //! \param dd the PIMPL instance
+ //! \param parent the parent widget
+ //! \param f the window flags
+ MImWidget(MImWidgetPrivate *dd,
+ QWidget *parent,
+ Qt::WindowFlags f = 0);
+
+ MImWidgetPrivate *const d_ptr; //!< PIMPL
+
+private:
+ void init();
+
+ Q_DISABLE_COPY(MImWidget);
+ Q_DECLARE_PRIVATE(MImWidget);
+};
+
+#endif // MIMWIDGET_H
--- src/mimwidget_p.h
+++ src/mimwidget_p.h
+/* * This file is part of meego-im-framework *
+ *
+ * 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 MIMWIDGET_P_H
+#define MIMWIDGET_P_H
+
+#include "mimwidget.h"
+#include <QPixmap>
+
+class MImWidgetPrivate
+{
+ Q_DECLARE_PUBLIC(MImWidget);
+
+protected:
+ MImWidget *q_ptr;
+
+public:
+ explicit MImWidgetPrivate();
+ virtual ~MImWidgetPrivate();
+
+};
+
+#endif // MIMWIDGET_P_H
--- src/minputcontextglibdbusconnection.cpp
+++ src/minputcontextglibdbusconnection.cpp
@@ -32,7 +32,6 @@
#include "mabstractinputmethod.h"
#include "mimapplication.h"
-#include <MTimestamp>
namespace
{
@@ -370,6 +369,9 @@
MInputContextGlibDBusConnection::MInputContextGlibDBusConnection()
: activeContext(NULL),
+ globalCorrectionEnabled(false),
+ redirectionEnabled(false),
+ detectableAutoRepeat(false),
server(NULL)
{
dbus_g_thread_init();
@@ -420,7 +422,6 @@
int replaceStart, int replaceLength,
int cursorPos)
{
- mTimestamp("MInputContextGlibDBusConnection", "start text=" + string);
if (activeContext) {
QByteArray temporaryStorage;
QDataStream valueStream(&temporaryStorage, QIODevice::WriteOnly);
@@ -437,7 +438,6 @@
G_TYPE_INVALID);
g_array_unref(gdata);
}
- mTimestamp("MInputContextGlibDBusConnection", "end");
}
@@ -468,7 +468,7 @@
G_TYPE_INT, key,
G_TYPE_INT, modifiers,
G_TYPE_STRING, keyEvent.text().toUtf8().data(),
- G_TYPE_BOOLEAN, keyEvent.isAutoRepeat() ? TRUE : FALSE,
+ G_TYPE_BOOLEAN, keyEvent.isAutoRepeat(),
G_TYPE_INT, keyEvent.count(),
G_TYPE_UCHAR, static_cast<uchar>(requestType),
G_TYPE_INVALID);
@@ -489,7 +489,7 @@
{
if ((enabled != globalCorrectionEnabled) && activeContext) {
dbus_g_proxy_call_no_reply(activeContext->inputContextProxy, "setGlobalCorrectionEnabled",
- G_TYPE_BOOLEAN, enabled ? TRUE : FALSE,
+ G_TYPE_BOOLEAN, enabled,
G_TYPE_INVALID);
}
@@ -531,7 +531,7 @@
{
if ((detectableAutoRepeat != enabled) && activeContext) {
dbus_g_proxy_call_no_reply(activeContext->inputContextProxy, "setDetectableAutoRepeat",
- G_TYPE_BOOLEAN, enabled ? TRUE : FALSE,
+ G_TYPE_BOOLEAN, enabled,
G_TYPE_INVALID);
}
detectableAutoRepeat = enabled;
--- src/minputcontextglibdbusconnection.h
+++ src/minputcontextglibdbusconnection.h
@@ -27,6 +27,7 @@
#include <QEvent>
#include <QString>
#include <QVariant>
+#include <QWidget>
#include <glib.h>
#include <dbus/dbus-glib-lowlevel.h>
--- src/minputmethodhost.cpp
+++ src/minputmethodhost.cpp
@@ -19,7 +19,10 @@
#include "mimpluginmanager.h"
#include "mindicatorserviceclient.h"
#include "mabstractinputmethod.h"
+#include "mimapplication.h"
+#include <QWidget>
+#include <QGraphicsView>
MInputMethodHost::MInputMethodHost(MInputContextConnection *inputContextConnection,
MIMPluginManager *pluginManager,
@@ -149,7 +152,7 @@
void MInputMethodHost::paste()
{
- if (enabled) {
+ if (enabled) {
connection->paste();
}
}
@@ -183,7 +186,7 @@
}
void MInputMethodHost::switchPlugin(MInputMethod::SwitchDirection direction)
-{
+{
if (enabled) {
pluginManager->switchPlugin(direction, inputMethod);
}
@@ -210,13 +213,6 @@
}
}
-void MInputMethodHost::showSettings()
-{
- if (enabled) {
- pluginManager->showInputMethodSettings();
- }
-}
-
void MInputMethodHost::setSelection(int start, int length)
{
if (enabled) {
@@ -235,4 +231,3 @@
{
return connection->anchorPosition(valid);
}
-
--- src/minputmethodhost.h
+++ src/minputmethodhost.h
@@ -83,7 +83,6 @@
virtual void switchPlugin(const QString &pluginName);
virtual void setScreenRegion(const QRegion ®ion);
virtual void setInputMethodArea(const QRegion ®ion);
- virtual void showSettings();
virtual void setSelection(int start, int length);
virtual void setOrientationAngleLocked(bool lock);
// \reimp_end
--- src/minputmethodnamespace.h
+++ src/minputmethodnamespace.h
@@ -21,6 +21,49 @@
#include <QSharedPointer>
namespace MInputMethod {
+ /*!
+ * This enum contains values of the orientation angle of windows in the application.
+ *
+ * \sa Orientation
+ */
+ enum OrientationAngle {
+ Angle0 = 0,
+ Angle90 = 90,
+ Angle180 = 180,
+ Angle270 = 270
+ };
+
+ /*!
+ * This enum contains possible values for orientation of windows in the application.
+ *
+ * \sa OrientationAngle
+ */
+ enum Orientation {
+ Portrait, //!< equal to either M::Angle90 or M::Angle270 orientation angles
+ Landscape //!< equal to either M::Angle0 or M::Angle180 orientation angles
+ };
+
+ //! Content type for text entries. Used at least with MTextEdit
+ enum TextContentType {
+ //! all characters allowed
+ FreeTextContentType,
+
+ //! only integer numbers allowed
+ NumberContentType,
+
+ //! allows numbers and certain other characters used in phone numbers
+ PhoneNumberContentType,
+
+ //! allows only characters permitted in email address
+ EmailContentType,
+
+ //! allows only character permitted in URL address
+ UrlContentType,
+
+ //! allows content with user defined format
+ CustomContentType
+ };
+
//! Type of toolbar widget
enum ItemType {
//! Undefined item type
--- src/minputmethodplugin.h
+++ src/minputmethodplugin.h
@@ -50,7 +50,8 @@
* this plugin. This function will be only called once and the allocated
* resources will be owned by the input method server.
*/
- virtual MAbstractInputMethod *createInputMethod(MAbstractInputMethodHost *host) = 0;
+ virtual MAbstractInputMethod *createInputMethod(MAbstractInputMethodHost *host,
+ QWidget *mainWindow) = 0;
/*! \brief Creates and returns the MAbstractInputMethodSettings object for
* this plugin. This function will be only called once and the allocated
@@ -69,6 +70,6 @@
Q_DECLARE_INTERFACE(MInputMethodPlugin,
- "com.meego.meegoimframework.MInputMethodPlugin/1.0")
+ "com.meego.meegoimframework.MInputMethodPlugin/1.1")
#endif
--- src/mkeyoverridedata.h
+++ src/mkeyoverridedata.h
@@ -25,7 +25,6 @@
#include "minputmethodnamespace.h"
#include "mkeyoverride.h"
-#include <MNamespace>
/*!
--- src/mplainwindow.cpp
+++ src/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
- * and appearing in the file LICENSE.LGPL included in the packaging
- * of this file.
- */
-
-#include "mplainwindow.h"
-#include "mimscene.h"
-#include "mimapplication.h"
-#include "mimremotewindow.h"
-
-#include <MSceneManager>
-#include <MGConfItem>
-#include <MTimestamp>
-#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(QWidget *parent) :
- MWindow(new MSceneManager(new MImScene), parent),
- remoteWindow(0)
-{
- 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);
-
- setAutoFillBackground(false);
-
- connect(mApp, SIGNAL(remoteWindowChanged(MImRemoteWindow*)), this, SLOT(setRemoteWindow(MImRemoteWindow*)));
- connect(mApp, SIGNAL(remoteWindowGone()), this, SLOT(setRemoteWindow()));
-}
-
-MPlainWindow::~MPlainWindow()
-{
- m_instance = 0;
- delete scene();
- delete sceneManager();
-}
-
-#if defined(M_IM_DISABLE_TRANSLUCENCY) && !defined(M_IM_USE_SHAPE_WINDOW)
-void MPlainWindow::updatePosition(const QRegion ®ion)
-{
- //update view's parameters to compensate movement of MPasstroughWindow
- //this update allows plugin to use screen coordinates
- const QRect rect = region.boundingRect();
- const QSize sceneSize = visibleSceneSize();
- const int size = region.rects().size();
-
- if (!size) {
- setSceneRect(0, 0, sceneSize.width(), sceneSize.height());
- resize(sceneSize);
- move(0, 0);
- return;
- }
-
- switch (orientationAngle())
- {
- case M::Angle0:
- setSceneRect(0, sceneSize.height() - rect.height(),
- sceneSize.width(), rect.height());
- resize(rect.width(), rect.height());
- move(0, 0);
- break;
- case M::Angle90:
- setSceneRect(0, 0, rect.width(), rect.height());
- resize(rect.width(), rect.height());
- move(sceneSize.height() - rect.width(), 0);
- break;
- case M::Angle180:
- setSceneRect(0, 0, rect.width(), sceneSize.height());
- resize(rect.width(), rect.height());
- move(0, sceneSize.height() - rect.height());
- break;
- case M::Angle270:
- setSceneRect(sceneSize.height() - rect.width(), rect.top(),
- rect.width(), sceneSize.width());
- resize(rect.width(), rect.height());
- move(0, 0);
- break;
- }
-}
-#endif
-
-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::setRemoteWindow(MImRemoteWindow *newWindow)
-{
- remoteWindow = newWindow;
-
- if (remoteWindow)
- connect(remoteWindow, SIGNAL(contentUpdated(QRegion)), this, SLOT(update(const QRegion&)));
-}
-
-void MPlainWindow::update(const QRegion ®ion)
-{
- MWindow::update(region);
-}
-
-void MPlainWindow::drawBackground(QPainter *painter, const QRectF &)
-{
- if (!remoteWindow)
- return;
-
- painter->drawPixmap(0, 0, remoteWindow->windowPixmap());
-}
--- src/mplainwindow.h
+++ src/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>
-
-class QRegion;
-class MImRemoteWindow;
-
-class MPlainWindow : public MWindow
-{
- Q_OBJECT
-
-public:
- explicit MPlainWindow(QWidget *parent = 0);
- virtual ~MPlainWindow();
- static MPlainWindow *instance();
-
-public slots:
-#if defined(M_IM_DISABLE_TRANSLUCENCY) && !defined(M_IM_USE_SHAPE_WINDOW)
- void updatePosition(const QRegion ®ion);
-#endif
- void setRemoteWindow(MImRemoteWindow *newWindow = 0);
- void update(const QRegion ®ion);
-
-protected:
- //! \reimp
- virtual bool viewportEvent(QEvent *event);
- virtual void drawBackground(QPainter * painter, const QRectF & rect);
- //! \reimp_end
-
-private:
- Q_DISABLE_COPY(MPlainWindow);
-
- MImRemoteWindow *remoteWindow;
-
- static MPlainWindow *m_instance;
-};
-
-#endif // MPLAINWINDOW_H
--- src/mtoolbardata.cpp
+++ src/mtoolbardata.cpp
@@ -154,11 +154,11 @@
return align;
}
-M::Orientation MToolbarDataPrivate::orientation(const QString &orientationString)
+MInputMethod::Orientation MToolbarDataPrivate::orientation(const QString &orientationString)
{
- M::Orientation orient = M::Portrait;
+ MInputMethod::Orientation orient = MInputMethod::Portrait;
if (orientationString == ImTagOrientationLandscape)
- orient = M::Landscape;
+ orient = MInputMethod::Landscape;
return orient;
}
@@ -271,7 +271,7 @@
{
Q_Q(MToolbarData);
const QString attribute = element.attribute(ImTagOrientation, ImTagOrientationDefValue);
- const M::Orientation orientationData = orientation(attribute);
+ const MInputMethod::Orientation orientationData = orientation(attribute);
QSharedPointer<MToolbarLayout> layout = q->layout(orientationData).constCast<MToolbarLayout>();
if (layout && layout->orientation() == orientationData) {
@@ -282,10 +282,10 @@
layout = QSharedPointer<MToolbarLayout>(new MToolbarLayout(orientationData));
switch (orientationData) {
- case M::Landscape:
+ case MInputMethod::Landscape:
layoutLandscape = layout;
break;
- case M::Portrait:
+ case MInputMethod::Portrait:
layoutPortrait = layout;
break;
default:
@@ -604,14 +604,14 @@
return d->items.values();
}
-QSharedPointer<const MToolbarLayout> MToolbarData::layout(M::Orientation orientation) const
+QSharedPointer<const MToolbarLayout> MToolbarData::layout(MInputMethod::Orientation orientation) const
{
Q_D(const MToolbarData);
switch(orientation) {
- case M::Landscape:
+ case MInputMethod::Landscape:
return d->layoutLandscape;
- case M::Portrait:
+ case MInputMethod::Portrait:
if (d->layoutPortrait) {
return d->layoutPortrait;
}
@@ -637,8 +637,8 @@
return false;
}
- if (layout(M::Landscape) != toolbarLayout
- && layout(M::Portrait) != toolbarLayout) {
+ if (layout(MInputMethod::Landscape) != toolbarLayout
+ && layout(MInputMethod::Portrait) != toolbarLayout) {
return false;
}
--- src/mtoolbardata.h
+++ src/mtoolbardata.h
@@ -23,7 +23,6 @@
#include <QList>
#include "minputmethodnamespace.h"
-#include <MNamespace>
class MToolbarLayout;
class MToolbarItem;
@@ -65,7 +64,7 @@
QList<QSharedPointer<MToolbarItem> > items() const;
//! Returns pointer to layout for given \a orientation.
- QSharedPointer<const MToolbarLayout> layout(M::Orientation orientation) const;
+ QSharedPointer<const MToolbarLayout> layout(MInputMethod::Orientation orientation) const;
/*!
* \brief Return true if toolbar should be visible.
--- src/mtoolbardata_p.h
+++ src/mtoolbardata_p.h
@@ -19,13 +19,14 @@
#ifndef MTOOLBARDATA_P_H
#define MTOOLBARDATA_P_H
+#include "mtoolbaritem.h"
+#include "minputmethodnamespace.h"
+
#include <QSharedPointer>
#include <QMap>
#include <QStringList>
#include <QString>
-#include <mtoolbaritem.h>
-
class MToolbarData;
class MToolbarDataPrivate
@@ -52,7 +53,7 @@
/*!
* \brief Translate orientationString to M::Orientation.
*/
- static M::Orientation orientation(const QString &orientationString);
+ static MInputMethod::Orientation orientation(const QString &orientationString);
/*!
* \brief Translate visibleTypeString to ToolbarWidget::VisibleType.
--- src/mtoolbaritem.h
+++ src/mtoolbaritem.h
@@ -18,7 +18,6 @@
#ifndef MTOOLBARITEM_H
#define MTOOLBARITEM_H
-#include <MNamespace>
#include <QObject>
#include <QList>
#include <QString>
--- src/mtoolbarlayout.cpp
+++ src/mtoolbarlayout.cpp
@@ -18,7 +18,7 @@
#include "mtoolbarlayout.h"
#include "mtoolbarlayout_p.h"
-MToolbarLayout::MToolbarLayout(M::Orientation orientation)
+MToolbarLayout::MToolbarLayout(MInputMethod::Orientation orientation)
: d_ptr(new MToolbarLayoutPrivate)
{
d_ptr->orientation = orientation;
@@ -48,7 +48,7 @@
return d->items;
}
-M::Orientation MToolbarLayout::orientation() const
+MInputMethod::Orientation MToolbarLayout::orientation() const
{
Q_D(const MToolbarLayout);
--- src/mtoolbarlayout.h
+++ src/mtoolbarlayout.h
@@ -19,11 +19,11 @@
#ifndef MTOOLBARLAYOUT_H
#define MTOOLBARLAYOUT_H
+#include "mtoolbaritem.h"
+#include "minputmethodnamespace.h"
+
#include <QList>
#include <QSharedPointer>
-#include <MNamespace>
-
-#include <mtoolbaritem.h>
class MToolbarLayoutPrivate;
@@ -33,7 +33,7 @@
class MToolbarLayout {
public:
//! Creates empty layout object for given \a orientation
- explicit MToolbarLayout(M::Orientation orientation = M::Landscape);
+ explicit MToolbarLayout(MInputMethod::Orientation orientation = MInputMethod::Landscape);
//! Destructor.
virtual ~MToolbarLayout();
@@ -45,7 +45,7 @@
QList<QSharedPointer<MToolbarItem> > items() const;
//! Return layout's orientation
- M::Orientation orientation() const;
+ MInputMethod::Orientation orientation() const;
private:
Q_DISABLE_COPY(MToolbarLayout)
--- src/mtoolbarlayout_p.h
+++ src/mtoolbarlayout_p.h
@@ -19,10 +19,12 @@
#ifndef MTOOLBARDATA_P_H
#define MTOOLBARDATA_P_H
+#include "mtoolbaritem.h"
+#include "minputmethodnamespace.h"
+
#include <QSharedPointer>
#include <QList>
-#include <mtoolbaritem.h>
class MToolbarLayoutPrivate
{
@@ -31,7 +33,7 @@
QList<QSharedPointer<MToolbarItem> > items;
//! Orientation
- M::Orientation orientation;
+ MInputMethod::Orientation orientation;
};
#endif
--- src/src.pro
+++ src/src.pro
@@ -3,6 +3,7 @@
VERSION = 0.1.0
TEMPLATE = lib
TARGET = meegoimframework
+INCLUDEPATH += ../passthroughserver
# Input
HEADERSINSTALL = \
@@ -10,7 +11,6 @@
mabstractinputmethod.h \
mabstractinputmethodhost.h \
mimpluginmanager.h \
- mplainwindow.h \
mtoolbaritem.h \
mtoolbardata.h \
mkeyoverride.h \
@@ -20,6 +20,8 @@
mabstractinputmethodsettings.h \
mtoolbarlayout.h \
mimextensionevent.h \
+ mimgraphicsview.h \
+ mimwidget.h \
HEADERS += $$HEADERSINSTALL \
mimpluginmanager_p.h \
@@ -33,13 +35,16 @@
mkeyoverride_p.h \
mattributeextensionmanager.h \
mattributeextensionid.h \
- mimsettingsdialog.h \
mtoolbarlayout_p.h \
minputcontextglibdbusconnection.h \
- mimscene.h \
mimremotewindow.h \
mimxerrortrap.h \
- mimxextension.h
+ mimxextension.h \
+ mimsettings.h \
+ mimhwkeyboardtracker.h \
+ mimgraphicsview_p.h \
+ mimwidget_p.h \
+ ../passthroughserver/mpassthruwindow.h \
SOURCES += mimpluginmanager.cpp \
mimpluginmanageradaptor.cpp \
@@ -48,7 +53,6 @@
mabstractinputmethodhost.cpp \
minputmethodhost.cpp \
minputcontextconnection.cpp \
- mplainwindow.cpp \
mimapplication.cpp \
mtoolbaritem.cpp \
mtoolbardata.cpp \
@@ -57,19 +61,28 @@
mattributeextensionmanager.cpp \
mattributeextensionid.cpp \
mattributeextension.cpp \
- mimsettingsdialog.cpp \
mtoolbarlayout.cpp \
minputcontextglibdbusconnection.cpp \
- mimscene.cpp \
mimremotewindow.cpp \
mimxerrortrap.cpp \
mimxextension.cpp \
mimextensionevent.cpp \
+ mimsettings.cpp \
+ mimhwkeyboardtracker.cpp \
+ mimgraphicsview.cpp \
+ mimwidget.cpp \
+ ../passthroughserver/mpassthruwindow.cpp \
-CONFIG += meegotouchcore qdbus link_pkgconfig
+CONFIG += qdbus link_pkgconfig
QT = core gui xml
-PKGCONFIG += dbus-glib-1 dbus-1
+PKGCONFIG += dbus-glib-1 dbus-1 gconf-2.0
+
+contains(CONFIG, nomeegotouch) {
+} else {
+ CONFIG += meegotouchcore
+ DEFINES += HAVE_MEEGOTOUCH
+}
# coverage flags are off per default, but can be turned on via qmake COV_OPTION=on
for(OPTION,$$list($$lower($$COV_OPTION))){
--- tests/dummyimplugin/dummyimplugin.cpp
+++ tests/dummyimplugin/dummyimplugin.cpp
@@ -20,9 +20,10 @@
}
MAbstractInputMethod *
-DummyImPlugin::createInputMethod(MAbstractInputMethodHost *imHost)
+DummyImPlugin::createInputMethod(MAbstractInputMethodHost *host,
+ QWidget *mainWindow)
{
- return new DummyInputMethod(imHost);
+ return new DummyInputMethod(host, mainWindow);
}
MAbstractInputMethodSettings *DummyImPlugin::createInputMethodSettings()
--- tests/dummyimplugin/dummyimplugin.h
+++ tests/dummyimplugin/dummyimplugin.h
@@ -2,6 +2,8 @@
#define DUMMYIMPLUGIN_H
#include <QObject>
+#include <QWidget>
+
#include "minputmethodplugin.h"
@@ -20,7 +22,8 @@
virtual QStringList languages() const;
- virtual MAbstractInputMethod *createInputMethod(MAbstractInputMethodHost *imHost);
+ virtual MAbstractInputMethod *createInputMethod(MAbstractInputMethodHost *host,
+ QWidget *mainWindow);
virtual MAbstractInputMethodSettings *createInputMethodSettings();
--- tests/dummyimplugin/dummyimplugin.pro
+++ tests/dummyimplugin/dummyimplugin.pro
@@ -2,12 +2,11 @@
TARGET = ../plugins/$$qtLibraryTarget(dummyimplugin)
DEPENDPATH += .
INCLUDEPATH += . ../../src
-LIBS += -L../../src -lmeegoimframework
OBJECTS_DIR = .obj
MOC_DIR = .moc
-CONFIG += debug plugin meegotouch
+CONFIG += debug plugin
HEADERS += \
dummyimplugin.h \
--- tests/dummyimplugin/dummyinputmethod.cpp
+++ tests/dummyimplugin/dummyinputmethod.cpp
@@ -4,8 +4,9 @@
#include "mabstractinputmethodhost.h"
-DummyInputMethod::DummyInputMethod(MAbstractInputMethodHost *imHost)
- : MAbstractInputMethod(imHost),
+DummyInputMethod::DummyInputMethod(MAbstractInputMethodHost *host,
+ QWidget *mainWindow)
+ : MAbstractInputMethod(host, mainWindow),
setStateCount(0),
switchContextCallCount(0),
directionParam(MInputMethod::SwitchUndefined),
--- tests/dummyimplugin/dummyinputmethod.h
+++ tests/dummyimplugin/dummyinputmethod.h
@@ -3,6 +3,7 @@
#include <mabstractinputmethod.h>
#include <QSet>
+#include <QWidget>
#include "mtoolbardata.h"
#include "minputmethodnamespace.h"
@@ -13,7 +14,8 @@
public:
- DummyInputMethod(MAbstractInputMethodHost *imHost);
+ DummyInputMethod(MAbstractInputMethodHost *host,
+ QWidget *mainWindow);
//! \reimp
virtual void setState(const QSet<MInputMethod::HandlerState> &state);
--- tests/dummyimplugin2/dummyimplugin2.cpp
+++ tests/dummyimplugin2/dummyimplugin2.cpp
@@ -14,9 +14,10 @@
}
MAbstractInputMethod *
-DummyImPlugin2::createInputMethod(MAbstractInputMethodHost * /* imHost */)
+DummyImPlugin2::createInputMethod(MAbstractInputMethodHost *,
+ QWidget *)
{
- return NULL;
+ return 0;
}
MAbstractInputMethodSettings *DummyImPlugin2::createInputMethodSettings()
--- tests/dummyimplugin2/dummyimplugin2.h
+++ tests/dummyimplugin2/dummyimplugin2.h
@@ -2,6 +2,7 @@
#define DUMMYIMPLUGIN2_H
#include <QObject>
+#include <QWidget>
#include "minputmethodplugin.h"
@@ -18,7 +19,8 @@
virtual QStringList languages() const;
- virtual MAbstractInputMethod *createInputMethod(MAbstractInputMethodHost *imHost);
+ virtual MAbstractInputMethod *createInputMethod(MAbstractInputMethodHost *host,
+ QWidget *mainWindow);
virtual MAbstractInputMethodSettings *createInputMethodSettings();
--- tests/dummyimplugin2/dummyimplugin2.pro
+++ tests/dummyimplugin2/dummyimplugin2.pro
@@ -7,7 +7,7 @@
OBJECTS_DIR = .obj
MOC_DIR = .moc
-CONFIG += debug plugin meegotouch
+CONFIG += debug plugin
HEADERS += dummyimplugin2.h
SOURCES += dummyimplugin2.cpp
--- tests/dummyimplugin3/dummyimplugin3.cpp
+++ tests/dummyimplugin3/dummyimplugin3.cpp
@@ -21,9 +21,10 @@
}
MAbstractInputMethod *
-DummyImPlugin3::createInputMethod(MAbstractInputMethodHost *imHost)
+DummyImPlugin3::createInputMethod(MAbstractInputMethodHost *host,
+ QWidget *mainWindow)
{
- return new DummyInputMethod3(imHost);
+ return new DummyInputMethod3(host, mainWindow);
}
MAbstractInputMethodSettings *DummyImPlugin3::createInputMethodSettings()
--- tests/dummyimplugin3/dummyimplugin3.h
+++ tests/dummyimplugin3/dummyimplugin3.h
@@ -2,6 +2,8 @@
#define DUMMYIMPLUGIN3_H
#include <QObject>
+#include <QWidget>
+
#include "minputmethodplugin.h"
//! Dummy input method plugin for ut_mimpluginloader
@@ -19,7 +21,8 @@
virtual QStringList languages() const;
- virtual MAbstractInputMethod *createInputMethod(MAbstractInputMethodHost *imHost);
+ virtual MAbstractInputMethod *createInputMethod(MAbstractInputMethodHost *host,
+ QWidget *mainWindow);
virtual MAbstractInputMethodSettings *createInputMethodSettings();
--- tests/dummyimplugin3/dummyimplugin3.pro
+++ tests/dummyimplugin3/dummyimplugin3.pro
@@ -7,7 +7,7 @@
OBJECTS_DIR = .obj
MOC_DIR = .moc
-CONFIG += debug plugin meegotouch
+CONFIG += debug plugin
HEADERS += \
dummyimplugin3.h \
--- tests/dummyimplugin3/dummyinputmethod3.cpp
+++ tests/dummyimplugin3/dummyinputmethod3.cpp
@@ -2,9 +2,11 @@
#include "mabstractinputmethodhost.h"
#include <QDebug>
+#include <QRegion>
-DummyInputMethod3::DummyInputMethod3(MAbstractInputMethodHost *imHost)
- : MAbstractInputMethod(imHost),
+DummyInputMethod3::DummyInputMethod3(MAbstractInputMethodHost *host,
+ QWidget *mainWindow)
+ : MAbstractInputMethod(host, mainWindow),
setStateCount(0),
switchContextCallCount(0),
directionParam(MInputMethod::SwitchUndefined),
--- tests/dummyimplugin3/dummyinputmethod3.h
+++ tests/dummyimplugin3/dummyinputmethod3.h
@@ -3,6 +3,7 @@
#include <mabstractinputmethod.h>
#include <QSet>
+#include <QWidget>
#include "mtoolbardata.h"
@@ -12,7 +13,8 @@
public:
- DummyInputMethod3(MAbstractInputMethodHost *imHost);
+ DummyInputMethod3(MAbstractInputMethodHost *host,
+ QWidget *mainWindow);
//! \reimp
virtual void setState(const QSet<MInputMethod::HandlerState> &state);
--- tests/dummyplugin/dummyplugin.pro
+++ tests/dummyplugin/dummyplugin.pro
@@ -7,7 +7,7 @@
OBJECTS_DIR = .obj
MOC_DIR = .moc
-CONFIG += debug plugin meegotouch
+CONFIG += debug plugin
HEADERS += dummyplugin.h
SOURCES += dummyplugin.cpp
--- tests/ft_mimpluginmanager/ft_mimpluginmanager.cpp
+++ tests/ft_mimpluginmanager/ft_mimpluginmanager.cpp
@@ -1,9 +1,10 @@
#include "ft_mimpluginmanager.h"
-#include "mgconfitem_stub.h"
+#include "mimsettings_stub.h"
#include "mkeyboardstatetracker_stub.h"
#include "minputcontextconnection_stub.h"
#include "dummyimplugin.h"
#include "dummyinputmethod.h"
+#include "mimapplication.h"
#include <QProcess>
#include <QGraphicsScene>
@@ -36,7 +37,7 @@
static char *argv[1] = { (char *) "ut_mimpluginmanager" };
static int argc = 1;
- app = new QApplication(argc, argv);
+ app = new MIMApplication(argc, argv);
// Use either global test plugin directory or TESTPLUGIN_PATH, if it is
// set (to local sandbox's plugin directory by makefile, at least).
@@ -65,16 +66,16 @@
void Ft_MIMPluginManager::init()
{
- MGConfItem(MImPluginPaths).set(pluginPath);
- MGConfItem(MImPluginDisabled).set(QStringList("libdummyimplugin2.so"));
- MGConfItem(MImPluginActive).set(QStringList("DummyImPlugin"));
-
- MGConfItem(PluginRoot + "onscreen").set(pluginName);
- MGConfItem(PluginRoot + "hardware").set(pluginName);
- MGConfItem(PluginRoot + "accessory").set(pluginName3);
+ MImSettings(MImPluginPaths).set(pluginPath);
+ MImSettings(MImPluginDisabled).set(QStringList("libdummyimplugin2.so"));
+ MImSettings(MImPluginActive).set(QStringList("DummyImPlugin"));
+
+ MImSettings(PluginRoot + "onscreen").set(pluginName);
+ MImSettings(PluginRoot + "hardware").set(pluginName);
+ MImSettings(PluginRoot + "accessory").set(pluginName3);
gMKeyboardStateTrackerStub->setOpenState(false);
- MGConfItem(MImAccesoryEnabled).set(QVariant(false));
+ MImSettings(MImAccesoryEnabled).set(QVariant(false));
subject = new MIMPluginManager();
}
@@ -102,7 +103,7 @@
void Ft_MIMPluginManager::testSwitchPluginState()
{
- MGConfItem(MImAccesoryEnabled).set(QVariant(true));
+ MImSettings(MImAccesoryEnabled).set(QVariant(true));
QStringList loadedPlugins = subject->loadedPluginsNames();
QCOMPARE(loadedPlugins.count(), 2);
@@ -117,8 +118,10 @@
void Ft_MIMPluginManager::testMultiplePlugins()
{
+ //QSKIP("This test fails to activate > 1 plugins, for unknown reasons.", SkipAll);
+
gMKeyboardStateTrackerStub->setOpenState(true);
- MGConfItem(MImAccesoryEnabled).set(QVariant(true));
+ MImSettings(MImAccesoryEnabled).set(QVariant(true));
QStringList loadedPlugins = subject->loadedPluginsNames();
QCOMPARE(loadedPlugins.count(), 2);
--- tests/ft_mimpluginmanager/ft_mimpluginmanager.h
+++ tests/ft_mimpluginmanager/ft_mimpluginmanager.h
@@ -5,7 +5,7 @@
#include <QObject>
-class QApplication;
+class MIMApplication;
class MIMPluginManager;
class QGraphicsScene;
@@ -27,7 +27,7 @@
void testSwitchToSpecifiedPlugin();
private:
- QApplication *app;
+ MIMApplication *app;
QString pluginPath;
MIMPluginManager *subject;
};
--- tests/ft_mimpluginmanager/ft_mimpluginmanager.pro
+++ tests/ft_mimpluginmanager/ft_mimpluginmanager.pro
@@ -9,7 +9,7 @@
# Input
HEADERS += \
ft_mimpluginmanager.h \
- ../stubs/mgconfitem_stub.h \
+ ../stubs/mimsettings_stub.h \
../stubs/fakegconf.h \
../stubs/fakeproperty.h \
../stubs/mkeyboardstatetracker_stub.h \
@@ -22,7 +22,7 @@
../stubs/minputcontextconnection_stub.cpp \
-CONFIG += plugin meegotouch qdbus
+CONFIG += plugin qdbus
LIBS += \
../../src/libmeegoimframework.so \
--- tests/ft_mimsettingsapplet/ft_mimsettingsapplet.cpp
+++ tests/ft_mimsettingsapplet/ft_mimsettingsapplet.cpp
@@ -1,11 +1,16 @@
#include "ft_mimsettingsapplet.h"
+
+#ifdef HAVE_MEEGOTOUCH
#include <dcpappletmetadata.h>
#include <dcpappletplugin.h>
+#endif
+
#include <QFileInfo>
#include <QDebug>
void ft_MImSettingsApplet::testAppletIsLoadable()
{
+#ifdef HAVE_MEEGOTOUCH
// stub_dcpappletmetadata.cpp gives the real applet file.
DcpAppletMetadata metadata("/dev/null");
qDebug()<< "Checking lib at:" << metadata.fullBinary();
@@ -19,7 +24,7 @@
DcpAppletPlugin loader(&metadata);
QVERIFY(loader.applet());
+#endif
}
QTEST_APPLESS_MAIN(ft_MImSettingsApplet)
-
--- tests/ft_mimsettingsapplet/ft_mimsettingsapplet.pro
+++ tests/ft_mimsettingsapplet/ft_mimsettingsapplet.pro
@@ -1,5 +1,11 @@
include(../common_top.pri)
+contains(CONFIG, nomeegotouch) {
+} else {
+ DEFINES += HAVE_MEEGOTOUCH
+ CONFIG += meegotouch duicontrolpanel
+}
+
# Input
HEADERS += ft_mimsettingsapplet.h \
@@ -8,7 +14,7 @@
TARGET = ft_mimsettingsapplet
-CONFIG += duicontrolpanel meegotouch console
+CONFIG += console
CONFIG -= gui windows
include(../common_check.pri)
--- tests/ft_mimsettingsapplet/stub_dcpappletmetadata.cpp
+++ tests/ft_mimsettingsapplet/stub_dcpappletmetadata.cpp
@@ -1,3 +1,4 @@
+#ifdef HAVE_MEEGOTOUCH
#include <dcpappletmetadata.h>
#include <QFileInfo>
@@ -17,4 +18,4 @@
return QString("/usr/lib/duicontrolpanel/applets/" + filename);
}
}
-
+#endif
--- tests/stubs/mgconfitem_stub.h
+++ tests/stubs/mgconfitem_stub.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 __MGCONFITEM_STUB_H__
-#define __MGCONFITEM_STUB_H__
-
-#include <MGConfItem>
-#include <QDebug>
-
-#include "fakegconf.h"
-
-/**
- * MGConfItem stub class.
- * To fake MGConfItem operations, derive from this class
- * and implement the methods you want to fake. Instantiate your
- * derived stub class and assign it to gMGConfItemStub
- * global variable.
- */
-class MGConfItemStub
-{
-public:
- virtual void mGConfItemConstructor(const MGConfItem *instance, const QString &key, QObject *parent = 0);
- virtual void mGConfItemDestructor(const MGConfItem *instance);
- virtual QString key(const MGConfItem *instance);
- virtual QVariant value(const MGConfItem *instance);
- virtual QVariant value(const MGConfItem *instance, const QVariant &def);
- virtual void set(const MGConfItem *instance, const QVariant &val);
- virtual QList<QString> listDirs(const MGConfItem *instance);
- virtual QList<QString> listEntries(const MGConfItem *instance);
-
-protected:
- QMap<const MGConfItem *, QString> instanceKeys; // This map links MGConfItem instance to its present key.
- FakeGConf fakeGConf; // This is the in-memory storage for settings.
-};
-
-void MGConfItemStub::mGConfItemConstructor(const MGConfItem *instance, const QString &key, QObject *)
-{
- if (!key.isEmpty()) {
- FakeGConfItem *fakeItem = fakeGConf.initKey(key);
- QObject::connect(fakeItem, SIGNAL(valueChanged()), instance, SIGNAL(valueChanged()));
-
- instanceKeys[instance] = key;
- }
-}
-
-void MGConfItemStub::mGConfItemDestructor(const MGConfItem *instance)
-{
- instanceKeys.remove(instance);
-}
-
-QString MGConfItemStub::key(const MGConfItem *instance)
-{
- return instanceKeys[instance];
-}
-
-QVariant MGConfItemStub::value(const MGConfItem *instance)
-{
- return fakeGConf.value(instanceKeys[instance]);
-}
-
-QVariant MGConfItemStub::value(const MGConfItem *instance, const QVariant &def)
-{
- QVariant val = fakeGConf.value(instanceKeys[instance]);
- if (val.isNull())
- val = def;
- return val;
-}
-
-void MGConfItemStub::set(const MGConfItem *instance, const QVariant &value)
-{
- fakeGConf.setValue(instanceKeys[instance], value);
-}
-
-QList<QString> MGConfItemStub::listDirs(const MGConfItem *instance)
-{
- return fakeGConf.listDirs(instanceKeys[instance]);
-}
-
-QList<QString> MGConfItemStub::listEntries(const MGConfItem *instance)
-{
- return fakeGConf.listEntries(instanceKeys[instance]);
-}
-
-/**
- * This is the stub class instance used by the system. If you want to alter behaviour,
- * derive your stub class from MGConfItemStub, implement the methods you want to
- * fake, create an instance of your stub class and assign the instance into this global variable.
- */
-// this dynamic alloc for gMGConfItemStub will cause memory leak. But it is accaptable for
-// // unit test, because it is just a small memory leak. And this can avoid core dump if there are
-// // some static MGConfItem object declared by application.
-MGConfItemStub *gMGConfItemStub = new MGConfItemStub;
-
-/**
- * These are the proxy method implementations of MGConfItem. They will
- * call the stub object methods of the gMGConfItemStub.
- */
-
-MGConfItem::MGConfItem(const QString &key, QObject *parent)
-{
- gMGConfItemStub->mGConfItemConstructor(this, key, parent);
-}
-
-MGConfItem::~MGConfItem()
-{
- gMGConfItemStub->mGConfItemDestructor(this);
-}
-
-QString MGConfItem::key() const
-{
- return gMGConfItemStub->key(this);
-}
-
-QVariant MGConfItem::value() const
-{
- return gMGConfItemStub->value(this);
-}
-
-QVariant MGConfItem::value(const QVariant &def) const
-{
- return gMGConfItemStub->value(this, def);
-}
-
-void MGConfItem::set(const QVariant &val)
-{
- gMGConfItemStub->set(this, val);
-}
-
-QList<QString> MGConfItem::listDirs() const
-{
- return gMGConfItemStub->listDirs(this);
-}
-
-QList<QString> MGConfItem::listEntries() const
-{
- return gMGConfItemStub->listEntries(this);
-}
-
-#endif //__MGCONFITEM_STUB_H__
--- tests/stubs/mimsettings_stub.h
+++ tests/stubs/mimsettings_stub.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 __MIMSETTINGS_STUB_H__
+#define __MIMSETTINGS_STUB_H__
+
+#include "mimsettings.h"
+#include "fakegconf.h"
+
+#include <QDebug>
+
+
+/**
+ * MImSettings stub class.
+ * To fake MImSettings operations, derive from this class
+ * and implement the methods you want to fake. Instantiate your
+ * derived stub class and assign it to gMImSettingsStub
+ * global variable.
+ */
+class MImSettingsStub
+{
+public:
+ virtual void mGConfItemConstructor(const MImSettings *instance, const QString &key, QObject *parent = 0);
+ virtual void mGConfItemDestructor(const MImSettings *instance);
+ virtual QString key(const MImSettings *instance);
+ virtual QVariant value(const MImSettings *instance);
+ virtual QVariant value(const MImSettings *instance, const QVariant &def);
+ virtual void set(const MImSettings *instance, const QVariant &val);
+ virtual QList<QString> listDirs(const MImSettings *instance);
+ virtual QList<QString> listEntries(const MImSettings *instance);
+
+protected:
+ QMap<const MImSettings *, QString> instanceKeys; // This map links MImSettings instance to its present key.
+ FakeGConf fakeGConf; // This is the in-memory storage for settings.
+};
+
+void MImSettingsStub::mGConfItemConstructor(const MImSettings *instance, const QString &key, QObject *)
+{
+ if (!key.isEmpty()) {
+ FakeGConfItem *fakeItem = fakeGConf.initKey(key);
+ QObject::connect(fakeItem, SIGNAL(valueChanged()), instance, SIGNAL(valueChanged()));
+
+ instanceKeys[instance] = key;
+ }
+}
+
+void MImSettingsStub::mGConfItemDestructor(const MImSettings *instance)
+{
+ instanceKeys.remove(instance);
+}
+
+QString MImSettingsStub::key(const MImSettings *instance)
+{
+ return instanceKeys[instance];
+}
+
+QVariant MImSettingsStub::value(const MImSettings *instance)
+{
+ return fakeGConf.value(instanceKeys[instance]);
+}
+
+QVariant MImSettingsStub::value(const MImSettings *instance, const QVariant &def)
+{
+ QVariant val = fakeGConf.value(instanceKeys[instance]);
+ if (val.isNull())
+ val = def;
+ return val;
+}
+
+void MImSettingsStub::set(const MImSettings *instance, const QVariant &value)
+{
+ fakeGConf.setValue(instanceKeys[instance], value);
+}
+
+QList<QString> MImSettingsStub::listDirs(const MImSettings *instance)
+{
+ return fakeGConf.listDirs(instanceKeys[instance]);
+}
+
+QList<QString> MImSettingsStub::listEntries(const MImSettings *instance)
+{
+ return fakeGConf.listEntries(instanceKeys[instance]);
+}
+
+/**
+ * This is the stub class instance used by the system. If you want to alter behaviour,
+ * derive your stub class from MImSettingsStub, implement the methods you want to
+ * fake, create an instance of your stub class and assign the instance into this global variable.
+ */
+// this dynamic alloc for gMImSettingsStub will cause memory leak. But it is accaptable for
+// // unit test, because it is just a small memory leak. And this can avoid core dump if there are
+// // some static MImSettings object declared by application.
+MImSettingsStub *gMImSettingsStub = new MImSettingsStub;
+
+/**
+ * These are the proxy method implementations of MImSettings. They will
+ * call the stub object methods of the gMImSettingsStub.
+ */
+
+MImSettings::MImSettings(const QString &key, QObject *parent)
+{
+ gMImSettingsStub->mGConfItemConstructor(this, key, parent);
+}
+
+MImSettings::~MImSettings()
+{
+ gMImSettingsStub->mGConfItemDestructor(this);
+}
+
+QString MImSettings::key() const
+{
+ return gMImSettingsStub->key(this);
+}
+
+QVariant MImSettings::value() const
+{
+ return gMImSettingsStub->value(this);
+}
+
+QVariant MImSettings::value(const QVariant &def) const
+{
+ return gMImSettingsStub->value(this, def);
+}
+
+void MImSettings::set(const QVariant &val)
+{
+ gMImSettingsStub->set(this, val);
+}
+
+QList<QString> MImSettings::listDirs() const
+{
+ return gMImSettingsStub->listDirs(this);
+}
+
+QList<QString> MImSettings::listEntries() const
+{
+ return gMImSettingsStub->listEntries(this);
+}
+
+#endif //__MIMSETTINGS_STUB_H__
--- tests/stubs/mkeyboardstatetracker_stub.h
+++ tests/stubs/mkeyboardstatetracker_stub.h
@@ -16,10 +16,10 @@
#ifndef MKEYBOARDSTATETRACKER_STUB_H
#define MKEYBOARDSTATETRACKER_STUB_H
-#include <MKeyboardStateTracker>
#include <QDebug>
#include "fakeproperty.h"
+#include "mimhwkeyboardtracker.h"
/**
* MKeyboardStateTracker stub class.
@@ -28,11 +28,13 @@
* derived stub class and assign it to gMKeyboardStateTracker
* global variable.
*/
-class MKeyboardStateTrackerStub
+class MImHwKeyboardTrackerStub
{
public:
- MKeyboardStateTrackerStub();
- virtual void mKeyboardStateTrackerConstructor(const MKeyboardStateTracker *instance);
+ MImHwKeyboardTrackerStub();
+
+ virtual void mimHwKeyboardTrackerConstructor(const MImHwKeyboardTracker *instance);
+
virtual bool isPresent();
virtual bool isOpen();
virtual void setOpenState(bool state);
@@ -41,58 +43,57 @@
FakeProperty openProperty;
};
-MKeyboardStateTrackerStub::MKeyboardStateTrackerStub()
+MImHwKeyboardTrackerStub::MImHwKeyboardTrackerStub()
: openProperty("/maemo/InternalKeyboard/Open")
{
}
-void MKeyboardStateTrackerStub::mKeyboardStateTrackerConstructor(const MKeyboardStateTracker *instance)
+void MImHwKeyboardTrackerStub::mimHwKeyboardTrackerConstructor(const MImHwKeyboardTracker *instance)
{
openProperty.setValue(QVariant(false));
QObject::connect(&openProperty, SIGNAL(valueChanged()), instance, SIGNAL(stateChanged()));
}
-bool MKeyboardStateTrackerStub::isPresent()
+bool MImHwKeyboardTrackerStub::isPresent()
{
return true;
}
-bool MKeyboardStateTrackerStub::isOpen()
+bool MImHwKeyboardTrackerStub::isOpen()
{
return openProperty.value().toBool();
}
-void MKeyboardStateTrackerStub::setOpenState(bool state)
+void MImHwKeyboardTrackerStub::setOpenState(bool state)
{
openProperty.setValue(QVariant(state));
}
-MKeyboardStateTrackerStub gDefaultMKeyboardStateTrackerStub;
+MImHwKeyboardTrackerStub gDefaultMKeyboardStateTrackerStub;
/**
* This is the stub class instance used by the system. If you want to alter behaviour,
* derive your stub class from MKeyboardStateTrackerStub, implement the methods you want to
* fake, create an instance of your stub class and assign the instance into this global variable.
*/
-MKeyboardStateTrackerStub *gMKeyboardStateTrackerStub = &gDefaultMKeyboardStateTrackerStub;
+MImHwKeyboardTrackerStub *gMKeyboardStateTrackerStub = &gDefaultMKeyboardStateTrackerStub;
/**
* These are the proxy method implementations of MKeyboardStateTracker. They will
* call the stub object methods of the gMKeyboardStateTracker.
*/
-MKeyboardStateTracker::MKeyboardStateTracker()
- : d_ptr(0)
+MImHwKeyboardTracker::MImHwKeyboardTracker()
{
- gMKeyboardStateTrackerStub->mKeyboardStateTrackerConstructor(this);
+ gMKeyboardStateTrackerStub->mimHwKeyboardTrackerConstructor(this);
}
-bool MKeyboardStateTracker::isPresent() const
+bool MImHwKeyboardTracker::isPresent() const
{
return gMKeyboardStateTrackerStub->isPresent();
}
-bool MKeyboardStateTracker::isOpen() const
+bool MImHwKeyboardTracker::isOpen() const
{
return gMKeyboardStateTrackerStub->isOpen();
}
--- tests/tests.pro
+++ tests/tests.pro
@@ -17,9 +17,9 @@
ut_mattributeextensionmanager \
ft_mimsettingsapplet \
ut_mimsettingsconf \
- ut_mimsettingsdialog \
ut_mimapplication \
ut_mkeyoverride \
+ ut_selfcompositing \
target.commands += $$system(touch tests.xml)
target.path = /usr/share/meego-im-framework-tests
--- tests/ut_mattributeextensionmanager/ut_mattributeextensionmanager.pro
+++ tests/ut_mattributeextensionmanager/ut_mattributeextensionmanager.pro
@@ -5,7 +5,7 @@
# Input
HEADERS += \
ut_mattributeextensionmanager.h \
- ../stubs/mgconfitem_stub.h \
+ ../stubs/mimsettings_stub.h \
../stubs/fakegconf.h \
../stubs/minputcontextconnection_stub.h \
--- tests/ut_mimapplication/ut_mimapplication.cpp
+++ tests/ut_mimapplication/ut_mimapplication.cpp
@@ -1,7 +1,6 @@
#include "ut_mimapplication.h"
#include <mimapplication.h>
-#include <mplainwindow.h>
#include <mpassthruwindow.h>
#include <QCoreApplication>
#include <QSignalSpy>
@@ -10,33 +9,32 @@
#include <X11/X.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h> // defines IconicState
-
+
+namespace {
+ const WId FakeRemoteWId = 1; // must be non-zero to be considered "valid"
+}
void Ut_MIMApplication::initTestCase()
{
static char *argv[1] = { (char *) "ut_mimapplication" };
static int argc = 1;
+#ifdef HAVE_MEEGOTOUCH
MApplication::setLoadMInputContext(false);
- app = new MIMApplication(argc, argv);
+#endif
- testWidget = new MPassThruWindow(true);
- testWidget->setFocusPolicy(Qt::NoFocus);
- app->setPassThruWindow(testWidget);
-
- new MPlainWindow(testWidget);
+ app = new MIMApplication(argc, argv);
+ subject = static_cast<MPassThruWindow *>(app->passThruWindow());
}
void Ut_MIMApplication::cleanupTestCase()
{
- delete testWidget;
- delete MPlainWindow::instance();
delete app;
}
void Ut_MIMApplication::init()
{
- app->setTransientHint(testWidget->effectiveWinId());
+ app->setTransientHint(FakeRemoteWId);
}
void Ut_MIMApplication::cleanup()
@@ -47,7 +45,7 @@
{
XEvent xevent;
xevent.type = UnmapNotify;
- xevent.xunmap.event = testWidget->effectiveWinId();
+ xevent.xunmap.event = FakeRemoteWId;
QSignalSpy spy(app, SIGNAL(remoteWindowGone()));
app->x11EventFilter(&xevent);
@@ -58,14 +56,14 @@
{
XEvent xevent;
xevent.type = MapNotify;
- xevent.xmap.event = testWidget->effectiveWinId();
+ xevent.xmap.event = subject->effectiveWinId();
QSignalSpy mapSpy(app, SIGNAL(passThruWindowMapped()));
app->x11EventFilter(&xevent);
QCOMPARE(mapSpy.count(), 1);
xevent.type = UnmapNotify;
- xevent.xunmap.event = testWidget->effectiveWinId();
+ xevent.xunmap.event = subject->effectiveWinId();
QSignalSpy unmapSpy(app, SIGNAL(passThruWindowUnmapped()));
app->x11EventFilter(&xevent);
--- tests/ut_mimapplication/ut_mimapplication.h
+++ tests/ut_mimapplication/ut_mimapplication.h
@@ -24,7 +24,7 @@
private:
void handleMessages();
- MPassThruWindow *testWidget;
+ MPassThruWindow *subject;
MIMApplication *app;
};
--- tests/ut_mimapplication/ut_mimapplication.pro
+++ tests/ut_mimapplication/ut_mimapplication.pro
@@ -6,7 +6,7 @@
# Input
HEADERS += \
ut_mimapplication.h \
- ../stubs/mgconfitem_stub.h \
+ ../stubs/mimsettings_stub.h \
../stubs/fakegconf.h \
../stubs/minputcontextconnection_stub.h \
@@ -27,9 +27,9 @@
}
-CONFIG += plugin meegotouch qdbus
+CONFIG += plugin qdbus
LIBS += \
- ../../src/libmeegoimframework.so.0 \
+ ../../src/libmeegoimframework.so.0 -lXfixes
include(../common_check.pri)
--- tests/ut_mimpluginmanager/ut_mimpluginmanager.cpp
+++ tests/ut_mimpluginmanager/ut_mimpluginmanager.cpp
@@ -1,5 +1,6 @@
#include "ut_mimpluginmanager.h"
-#include "mgconfitem_stub.h"
+#include "mimapplication.h"
+#include "mimsettings_stub.h"
#include "minputcontextconnection_stub.h"
#include "dummyimplugin.h"
#include "dummyimplugin3.h"
@@ -9,6 +10,8 @@
#include <QProcess>
#include <QGraphicsScene>
+#include <QGraphicsView>
+#include <QWidget>
#include <QRegExp>
#include <QCoreApplication>
#include <QPointer>
@@ -36,6 +39,7 @@
const QString MImPluginDisabled = ConfigRoot + "disabledpluginfiles";
const QString PluginRoot = "/meegotouch/inputmethods/plugins/";
+ const QString LastActiveSubView = "/meegotouch/inputmethods/virtualkeyboard/lastactivesubview";
const QString pluginName = "DummyImPlugin";
const QString pluginName2 = "DummyImPlugin2";
@@ -64,7 +68,7 @@
static char *argv[1] = { (char *) "ut_mimpluginloader" };
static int argc = 1;
- app = new QCoreApplication(argc, argv);
+ app = new MIMApplication(argc, argv);
Toolbar1 = QCoreApplication::applicationDirPath() + Toolbar1;
QVERIFY2(QFile(Toolbar1).exists(), "toolbar1.xml does not exist");
@@ -98,16 +102,16 @@
void Ut_MIMPluginManager::init()
{
- MGConfItem pathConf(MImPluginPaths);
+ MImSettings pathConf(MImPluginPaths);
pathConf.set(pluginPath);
- MGConfItem blackListConf(MImPluginDisabled);
+ MImSettings blackListConf(MImPluginDisabled);
QStringList blackList;
blackList << "libdummyimplugin2.so";
//ignore the meego-keyboard
blackList << "libmeego-keyboard.so";
blackListConf.set(blackList);
- MGConfItem handlerItem(PluginRoot + "onscreen");
+ MImSettings handlerItem(PluginRoot + "onscreen");
handlerItem.set(pluginName);
manager = new MIMPluginManager();
@@ -331,7 +335,7 @@
}
-void Ut_MIMPluginManager::testMultilePlugins()
+void Ut_MIMPluginManager::testMultiplePlugins()
{
QSet<MInputMethod::HandlerState> actualState;
DummyImPlugin *plugin = 0;
@@ -566,7 +570,7 @@
const QString key
= QString(PluginRoot
+ subject->inputSourceName(static_cast<MInputMethod::HandlerState>(handler)));
- MGConfItem gconf(key);
+ MImSettings gconf(key);
QCOMPARE(gconf.value().toString(), name);
}
@@ -579,6 +583,7 @@
MAbstractInputMethod *abstractInputMethod = 0;
QPointer<DummyInputMethod > inputMethod = 0;
QPointer<DummyInputMethod3> inputMethod3 = 0;
+ MImSettings lastActiveSubviewGconf(LastActiveSubView);
subject->addHandlerMap(MInputMethod::OnScreen, pluginName);
subject->addHandlerMap(MInputMethod::Hardware, pluginName);
@@ -605,6 +610,7 @@
// nothing should be changed
subject->switchPlugin(pluginName, inputMethod);
+ QCOMPARE(QString("dummyimsv1"), lastActiveSubviewGconf.value().toString());
QVERIFY(inputMethod != 0);
QCOMPARE(inputMethod->switchContextCallCount, 0);
QCOMPARE(subject->plugins[plugin].lastSwitchDirection, MInputMethod::SwitchUndefined);
@@ -614,8 +620,10 @@
QVERIFY(handler == plugin);
}
+ QCOMPARE(QString("dummyimsv1"), lastActiveSubviewGconf.value().toString());
// switch to another plugin
subject->switchPlugin(pluginName3, inputMethod);
+ QCOMPARE(QString("dummyim3sv1"), lastActiveSubviewGconf.value().toString());
QCOMPARE(subject->plugins[plugin].lastSwitchDirection, MInputMethod::SwitchUndefined);
QVERIFY(inputMethod != 0);
@@ -647,7 +655,7 @@
subject->setActivePlugin(pluginName3, MInputMethod::OnScreen);
// check gconf item
- MGConfItem handlerItem(PluginRoot + "onscreen");
+ MImSettings handlerItem(PluginRoot + "onscreen");
QCOMPARE(handlerItem.value().toString(), pluginName3);
QVERIFY(subject->activePlugins.size() == 1);
@@ -865,6 +873,36 @@
MAttributeExtensionManager::instance().unregisterAttributeExtension(toolbarId2);
}
+void Ut_MIMPluginManager::testConfigureWidgetsForCompositing_data()
+{
+ QTest::addColumn<bool>("selfCompositing");
+ QTest::newRow("selfComposting enabled") << true;
+ QTest::newRow("selfComposting disabled") << false;
+}
+
+void Ut_MIMPluginManager::testConfigureWidgetsForCompositing()
+{
+ QFETCH(bool, selfCompositing);
+
+ QWidget mainWindow;
+ QGraphicsView view(&mainWindow);
+
+ subject->configureWidgetsForCompositing(&mainWindow, selfCompositing);
+
+ QList<QWidget *> widgets;
+ widgets << &mainWindow << &view << view.viewport();
+
+ foreach (QWidget *w, widgets) {
+ QVERIFY(w->testAttribute(Qt::WA_NoSystemBackground)
+ || not selfCompositing);
+ QVERIFY(w->testAttribute(Qt::WA_OpaquePaintEvent)
+ || not selfCompositing);
+ QVERIFY(w->testAttribute(Qt::WA_TranslucentBackground)
+ || selfCompositing);
+ QVERIFY(not w->autoFillBackground());
+ }
+}
+
void Ut_MIMPluginManager::handleMessages()
{
while (app->hasPendingEvents()) {
--- tests/ut_mimpluginmanager/ut_mimpluginmanager.h
+++ tests/ut_mimpluginmanager/ut_mimpluginmanager.h
@@ -4,7 +4,7 @@
#include <QtTest/QtTest>
#include <QObject>
-
+class MIMApplication;
class MIMPluginManager;
class MIMPluginManagerPrivate;
class QCoreApplication;
@@ -26,7 +26,7 @@
void testConvertAndFilterHandlers_data();
void testConvertAndFilterHandlers();
void testSwitchPluginState();
- void testMultilePlugins();
+ void testMultiplePlugins();
void testExistInputMethod();
void testPluginSwitcher_data();
@@ -44,10 +44,14 @@
void testRegionUpdates();
void testSetToolbar();
+
+ void testConfigureWidgetsForCompositing_data();
+ void testConfigureWidgetsForCompositing();
+
private:
void handleMessages();
- QCoreApplication *app;
+ MIMApplication *app;
QString pluginPath;
MIMPluginManager *manager;
MIMPluginManagerPrivate *subject;
--- tests/ut_mimpluginmanager/ut_mimpluginmanager.pro
+++ tests/ut_mimpluginmanager/ut_mimpluginmanager.pro
@@ -7,21 +7,22 @@
# Input
HEADERS += \
ut_mimpluginmanager.h \
- ../stubs/mgconfitem_stub.h \
+ ../stubs/mimsettings_stub.h \
../stubs/fakegconf.h \
../stubs/minputcontextconnection_stub.h \
$$SRC_DIR/mimpluginmanager_p.h \
$$SRC_DIR/minputmethodplugin.h \
$$SRC_DIR/minputcontextconnection.h \
+ $$SRC_DIR/mimapplication.h \
SOURCES += \
ut_mimpluginmanager.cpp \
../stubs/fakegconf.cpp \
../stubs/minputcontextconnection_stub.cpp \
$$SRC_DIR/minputcontextconnection.cpp \
+ $$SRC_DIR/mimapplication.cpp \
-
-CONFIG += plugin meegotouch qdbus
+CONFIG += plugin qdbus
LIBS += \
../../src/libmeegoimframework.so.0 \
--- tests/ut_mimsettingsconf/ut_mimsettingsconf.cpp
+++ tests/ut_mimsettingsconf/ut_mimsettingsconf.cpp
@@ -1,7 +1,8 @@
#include "ut_mimsettingsconf.h"
#include "mimsettingsconf.h"
-#include "mgconfitem_stub.h"
+#include "mimsettings_stub.h"
#include "fakegconf.h"
+#include "mimapplication.h"
#include <QProcess>
#include <QRegExp>
@@ -33,7 +34,7 @@
static char *argv[1] = { (char *) "ut_mimsettingsconf" };
static int argc = 1;
- app = new QCoreApplication(argc, argv);
+ app = new MIMApplication(argc, argv);
// Use either global test plugin directory or TESTPLUGIN_PATH, if it is
// set (to local sandbox's plugin directory by makefile, at least).
@@ -54,16 +55,16 @@
}
QVERIFY2(QDir(pluginPath).exists(), "Test plugin directory does not exist.");
- MGConfItem pathConf(MImPluginPaths);
+ MImSettings pathConf(MImPluginPaths);
pathConf.set(pluginPath);
- MGConfItem blackListConf(MImPluginDisabled);
+ MImSettings blackListConf(MImPluginDisabled);
QStringList blackList;
blackList << "libdummyimplugin2.so";
//ignore the meego-keyboard
blackList << "libmeego-keyboard.so";
blackListConf.set(blackList);
- MGConfItem handlerItem(PluginRoot + "onscreen");
+ MImSettings handlerItem(PluginRoot + "onscreen");
handlerItem.set(pluginName);
manager = new MIMPluginManager();
@@ -115,7 +116,7 @@
MImSettingsConf::instance().setActivePlugin(pluginName3);
handleMessages();
- MGConfItem handlerItem(PluginRoot + "onscreen");
+ MImSettings handlerItem(PluginRoot + "onscreen");
QCOMPARE(handlerItem.value().toString(), pluginName3);
QVERIFY(manager->activePluginsNames().size() == 1);
QCOMPARE(manager->activePluginsName(MInputMethod::OnScreen), pluginName3);
@@ -138,6 +139,8 @@
void Ut_MIMSettingsConf::testActiveSubView()
{
+ QSKIP("This test fails to activate > 1 plugins, for unknown reasons.", SkipAll);
+
MImSettingsConf::MImSubView activeSubView = MImSettingsConf::instance().activeSubView();
QCOMPARE(activeSubView.subViewId, QString("dummyimsv1"));
--- tests/ut_mimsettingsconf/ut_mimsettingsconf.h
+++ tests/ut_mimsettingsconf/ut_mimsettingsconf.h
@@ -7,7 +7,7 @@
class MIMPluginManager;
class MImSettingsConf;
-class QCoreApplication;
+class MIMApplication;
class Ut_MIMSettingsConf : public QObject
{
@@ -28,7 +28,7 @@
private:
void handleMessages();
- QCoreApplication *app;
+ MIMApplication *app;
QString pluginPath;
MIMPluginManager *manager;
};
--- tests/ut_mimsettingsconf/ut_mimsettingsconf.pro
+++ tests/ut_mimsettingsconf/ut_mimsettingsconf.pro
@@ -9,7 +9,7 @@
# Input
HEADERS += \
ut_mimsettingsconf.h \
- ../stubs/mgconfitem_stub.h \
+ ../stubs/mimsettings_stub.h \
../stubs/fakegconf.h \
$$SETTINGSAPPLET_DIR/mimsettingsconf.h \
@@ -19,7 +19,7 @@
$$SETTINGSAPPLET_DIR/mimsettingsconf.cpp \
-CONFIG += plugin meegotouch qdbus
+CONFIG += plugin qdbus
LIBS += \
../../src/libmeegoimframework.so.0 \
--- tests/ut_mimsettingsdialog
+++ tests/ut_mimsettingsdialog
-(directory)
--- tests/ut_mimsettingsdialog/ut_mimsettingsdialog.cpp
+++ tests/ut_mimsettingsdialog/ut_mimsettingsdialog.cpp
-#include "ut_mimsettingsdialog.h"
-
-#include "mgconfitem_stub.h"
-#include "minputcontextconnection_stub.h"
-#include "fakegconf.h"
-
-#include <QProcess>
-#include <QGraphicsScene>
-
-#include <mimsettingsdialog.h>
-#include <mimpluginmanager.h>
-#include <mimpluginmanager_p.h>
-#include <mplainwindow.h>
-#include <MDialog>
-#include <MPopupList>
-#include <MSceneManager>
-#include <MApplication>
-#include <QDir>
-#include <QStandardItemModel>
-#include <QSignalSpy>
-#include <QVariant>
-#include <QDebug>
-
-namespace {
- const QString GlobalTestPluginPath("/usr/lib/meego-im-framework-tests/plugins");
- const QString TestPluginPathEnvVariable("TESTPLUGIN_PATH");
-
- const QString ConfigRoot = "/meegotouch/inputmethods/";
- const QString MImPluginPaths = ConfigRoot + "paths";
- const QString MImPluginDisabled = ConfigRoot + "disabledpluginfiles";
-
- const QString PluginRoot = "/meegotouch/inputmethods/plugins/";
-
- const QString PluginName = "DummyImPlugin";
- const QString PluginName2 = "DummyImPlugin2";
- const QString PluginName3 = "DummyImPlugin3";
-}
-
-// Stubbing..................................................................
-
-int MSceneManager::execDialog(MDialog *dialog)
-{
- // avoid MSceneManager create private even loop
- appearSceneWindowNow(dialog);
- return 0;
-}
-
-void Ut_MIMSettingsDialog::initTestCase()
-{
- static char *argv[1] = { (char *) "ut_mimsettingsdialog" };
- static int argc = 1;
-
- // Avoid waiting if im server is not responding
- MApplication::setLoadMInputContext(false);
-
- app = new MApplication(argc, argv);
-
- // Use either global test plugin directory or TESTPLUGIN_PATH, if it is
- // set (to local sandbox's plugin directory by makefile, at least).
- pluginPath = GlobalTestPluginPath;
-
- QString pathCandidate = QProcessEnvironment::systemEnvironment().value(TestPluginPathEnvVariable);
- QVERIFY2(QDir(pluginPath).exists(), "Test plugin directory does not exist.");
-
- new MPlainWindow;
-}
-
-void Ut_MIMSettingsDialog::cleanupTestCase()
-{
- delete MPlainWindow::instance();
- delete app;
-}
-
-void Ut_MIMSettingsDialog::init()
-{
- MGConfItem pathConf(MImPluginPaths);
- pathConf.set(pluginPath);
-
- MGConfItem handlerItem(PluginRoot + "onscreen");
- handlerItem.set(PluginName);
-
- pluginMgr = new MIMPluginManager();
- subject = new MIMSettingsDialog(pluginMgr->d_ptr,
- "", M::NoStandardButton);
- pluginMgr->d_ptr->settingsDialog = subject;
- MPlainWindow::instance()->sceneManager()->appearSceneWindowNow(subject);
-}
-
-void Ut_MIMSettingsDialog::cleanup()
-{
- MPlainWindow::instance()->sceneManager()->disappearSceneWindowNow(subject);
- delete subject;
- subject = 0;
- pluginMgr->d_ptr->settingsDialog = 0;
- delete pluginMgr;
- pluginMgr = 0;
-}
-
-void Ut_MIMSettingsDialog::testShowAvailableSubViewList()
-{
- QString activePlugin = pluginMgr->activePluginsName(MInputMethod::OnScreen);
- QVERIFY(activePlugin == PluginName);
-
- QMap<QString, QString> availableSubviews = pluginMgr->availableSubViews(activePlugin,
- MInputMethod::OnScreen);
- QCOMPARE(availableSubviews.count(), 2);
-
- pluginMgr->setActiveSubView(QString("dummyimsv2"), MInputMethod::OnScreen);
- QCOMPARE(pluginMgr->activeSubView(MInputMethod::OnScreen), QString("dummyimsv2"));
-
- subject->showAvailableSubViewList();
-
- QVERIFY(subject->availableSubViewList);
- QVERIFY(subject->availableSubViewList->isVisible());
-
- QStandardItemModel *model = static_cast<QStandardItemModel*> (subject->availableSubViewList->itemModel());
- QVERIFY(model->rowCount() > 2);
-
- QList<QStandardItem *> items = model->findItems(QString("dummyimsv2"));
- QCOMPARE(items.count(), 1);
- QCOMPARE(items[0]->index(), subject->availableSubViewList->currentIndex());
-}
-
-void Ut_MIMSettingsDialog::testSetActiveView()
-{
- subject->showAvailableSubViewList();
- QVERIFY(subject->availableSubViewList);
- QVERIFY(subject->availableSubViewList->isVisible());
-
- QStandardItemModel *model = static_cast<QStandardItemModel*> (subject->availableSubViewList->itemModel());
- QVERIFY(model->rowCount() > 2);
-
- QList<QStandardItem *> items = model->findItems(QString("dummyimsv2"));
- QCOMPARE(items.count(), 1);
- subject->availableSubViewList->click(items[0]->index());
-
- QCOMPARE(pluginMgr->activeSubView(MInputMethod::OnScreen), QString("dummyimsv2"));
-}
-
-void Ut_MIMSettingsDialog::testRetranslateUi()
-{
- QSignalSpy spy(subject, SIGNAL(languageChanged()));
- subject->retranslateUi();
- QCOMPARE(spy.count(), 1);
-}
-
-void Ut_MIMSettingsDialog::testHandleDialogDisappeared()
-{
- subject->showAvailableSubViewList();
- QVERIFY(subject->availableSubViewList);
- QVERIFY(subject->availableSubViewList->isVisible());
-
- QSignalSpy spy(subject->availableSubViewList, SIGNAL(rejected()));
- MPlainWindow::instance()->sceneManager()->disappearSceneWindowNow(subject);
- QCOMPARE(spy.count(), 1);
-}
-
-QTEST_APPLESS_MAIN(Ut_MIMSettingsDialog)
-
--- tests/ut_mimsettingsdialog/ut_mimsettingsdialog.h
+++ tests/ut_mimsettingsdialog/ut_mimsettingsdialog.h
-#ifndef UT_MIMSETTINGDIALOG_H
-#define UT_MIMSETTINGDIALOG_H
-
-#include <QtTest/QtTest>
-#include <QObject>
-
-class MApplication;
-class MIMSettingsDialog;
-class MIMPluginManager;
-class MPlainWindow;
-
-class Ut_MIMSettingsDialog : public QObject
-{
- Q_OBJECT
-
-private slots:
- void initTestCase();
- void cleanupTestCase();
-
- void init();
- void cleanup();
-
- void testShowAvailableSubViewList();
- void testSetActiveView();
- void testRetranslateUi();
- void testHandleDialogDisappeared();
-
-private:
- MApplication *app;
- QString pluginPath;
- MIMSettingsDialog *subject;
- MIMPluginManager *pluginMgr;
-};
-
-#endif
-
--- tests/ut_mimsettingsdialog/ut_mimsettingsdialog.pro
+++ tests/ut_mimsettingsdialog/ut_mimsettingsdialog.pro
-include(../common_top.pri)
-
-
-INCLUDEPATH += ../stubs \
-
-# Input
-HEADERS += \
- ut_mimsettingsdialog.h \
- ../stubs/mgconfitem_stub.h \
- ../stubs/fakegconf.h \
- ../stubs/minputcontextconnection_stub.h \
-
-SOURCES += \
- ut_mimsettingsdialog.cpp \
- ../stubs/fakegconf.cpp \
- ../stubs/minputcontextconnection_stub.cpp \
-
-isEqual(code_coverage_option, off){
-HEADERS += \
- $$SRC_DIR/mimsettingsdialog.h \
- $$SRC_DIR/minputmethodnamespace.h \
-
-SOURCES += \
- $$SRC_DIR/mimsettingsdialog.cpp \
-}
-
-CONFIG += plugin meegotouch qdbus
-
-LIBS += \
- ../../src/libmeegoimframework.so.0 \
-
-include(../common_check.pri)
--- tests/ut_minputcontext/ut_minputcontext.cpp
+++ tests/ut_minputcontext/ut_minputcontext.cpp
@@ -6,8 +6,11 @@
#include <QClipboard>
#include <QGraphicsView>
+#ifdef HAVE_MEEGOTOUCH
#include <MWindow>
-#include "mpreeditinjectionevent.h"
+#include <mpreeditinjectionevent.h>
+#endif
+
#include "glibdbusimserverproxy.h"
@@ -330,10 +333,12 @@
{
m_inputMethodQueryCount++;
- if (static_cast<int>(query) == M::VisualizationPriorityQuery) {
- return QVariant(visualizationPriority);
- } else if (query == Qt::ImSurroundingText) {
+ if (query == Qt::ImSurroundingText) {
return QVariant(WidgetStubSurroundingText);
+#ifdef HAVE_MEEGOTOUCH
+ } else if (static_cast<int>(query) == M::VisualizationPriorityQuery) {
+ return QVariant(visualizationPriority);
+#endif
} else if (query == Qt::ImCursorPosition) {
return QVariant(WidgetStubCursorPosition);
} else if (query == Qt::ImCurrentSelection) {
@@ -423,8 +428,7 @@
QApplication::setGraphicsSystem("raster");
QCoreApplication::setLibraryPaths(QStringList("./inputmethods"));
- MApplication::setLoadMInputContext(false);
- app.reset(new MApplication(argc, argv));
+ app.reset(new QApplication(argc, argv));
m_stub = new InputMethodServerDBusStub(this);
@@ -432,6 +436,11 @@
m_subject = new MInputContext;
QVERIFY(m_subject != 0);
+
+ // Overly cautious sanity check, but we do use native C API in
+ // MInputContext and friends:
+ QCOMPARE(TRUE, true);
+ QCOMPARE(FALSE, false);
}
@@ -463,6 +472,7 @@
void Ut_MInputContext::testEvent()
{
+#ifdef HAVE_MEEGOTOUCH
WidgetStub widget(0);
gFocusedWidget = &widget;
@@ -496,6 +506,7 @@
delete injectionEvent;
gFocusedWidget = 0;
+#endif
}
@@ -643,6 +654,7 @@
void Ut_MInputContext::testAppOrientationChanged()
{
+#ifdef HAVE_MEEGOTOUCH
m_subject->notifyOrientationChanged(M::Angle90);
// Make sure DBus call gets through
@@ -650,6 +662,7 @@
// TODO: can not recieve signal, should check it
QCOMPARE(m_stub->orientationChangedCount(), 1);
+#endif
}
void Ut_MInputContext::testNonTextEntryWidget()
@@ -882,6 +895,7 @@
void Ut_MInputContext::testSetOrientationAngleLocked()
{
+#ifdef HAVE_MEEGOTOUCH
QFETCH(QList<OrientationAngleLockOperation >, ops);
QFETCH(bool, expectedLockedState);
@@ -904,6 +918,7 @@
}
}
QCOMPARE(window.isOrientationAngleLocked(), expectedLockedState);
+#endif
}
QTEST_APPLESS_MAIN(Ut_MInputContext)
--- tests/ut_minputcontext/ut_minputcontext.h
+++ tests/ut_minputcontext/ut_minputcontext.h
@@ -1,7 +1,7 @@
#ifndef UT_MINPUTCONTEXT_H
#define UT_MINPUTCONTEXT_H
-#include <MApplication>
+#include <QApplication>
#include <memory>
#include <QPointer>
@@ -176,7 +176,7 @@
void waitAndProcessEvents(int waitTime);
private:
- std::auto_ptr<MApplication> app;
+ std::auto_ptr<QApplication> app;
QPointer<MInputContext> m_subject;
QPointer<InputMethodServerDBusStub> m_stub;
};
--- tests/ut_minputcontext/ut_minputcontext.pro
+++ tests/ut_minputcontext/ut_minputcontext.pro
@@ -16,7 +16,7 @@
$$ICDIR/minputcontext.cpp
-CONFIG += plugin meegotouch qdbus link_pkgconfig
+CONFIG += plugin qdbus link_pkgconfig
PKGCONFIG += dbus-glib-1
--- tests/ut_minputcontextplugin/ut_minputcontextplugin.cpp
+++ tests/ut_minputcontextplugin/ut_minputcontextplugin.cpp
@@ -18,7 +18,7 @@
#include "minputcontextplugin.h"
#include <QInputContext>
-#include <MApplication>
+#include <QApplication>
namespace
{
@@ -54,7 +54,7 @@
static int argc = 1;
static char *argv[1] = { (char *) "ut_minputcontextplugin" };
- app = new MApplication(argc, argv);
+ app = new QApplication(argc, argv);
}
void Ut_MInputContextPlugin::cleanupTestCase()
--- tests/ut_mkeyoverride/ut_mkeyoverride.pro
+++ tests/ut_mkeyoverride/ut_mkeyoverride.pro
@@ -5,7 +5,7 @@
# Input
HEADERS += \
ut_mkeyoverride.h \
- ../stubs/mgconfitem_stub.h \
+ ../stubs/mimsettings_stub.h \
../stubs/fakegconf.h \
SOURCES += \
--- tests/ut_mtoolbardata/ut_mtoolbardata.cpp
+++ tests/ut_mtoolbardata/ut_mtoolbardata.cpp
@@ -61,7 +61,7 @@
QVERIFY(subject->isVisible() == true);
//test landscape part
- QSharedPointer<const MToolbarLayout> landscape = subject->layout(M::Landscape);
+ QSharedPointer<const MToolbarLayout> landscape = subject->layout(MInputMethod::Landscape);
QVERIFY(!landscape.isNull());
QCOMPARE(landscape->items().count(), 4);
@@ -143,7 +143,7 @@
QCOMPARE(item->actions().at(0)->group(), QString());
// test portrait part
- QSharedPointer<const MToolbarLayout> portrait = subject->layout(M::Portrait);
+ QSharedPointer<const MToolbarLayout> portrait = subject->layout(MInputMethod::Portrait);
QVERIFY(!portrait.isNull());
QCOMPARE(portrait->items().count(), 4);
@@ -170,7 +170,7 @@
QVERIFY(subject->isVisible() == false);
//test landscape part
- QSharedPointer<const MToolbarLayout> landscape = subject->layout(M::Landscape);
+ QSharedPointer<const MToolbarLayout> landscape = subject->layout(MInputMethod::Landscape);
QVERIFY(!landscape.isNull());
QCOMPARE(landscape->items().count(), 5);
@@ -181,7 +181,7 @@
QCOMPARE(landscape->items().at(3)->type(), MInputMethod::ItemLabel);
QCOMPARE(landscape->items().at(4)->type(), MInputMethod::ItemButton);
- QVERIFY(subject->layout(M::Landscape) == subject->layout(M::Portrait));
+ QVERIFY(subject->layout(MInputMethod::Landscape) == subject->layout(MInputMethod::Portrait));
}
void Ut_MToolbarData::testLoadOldXML()
@@ -195,11 +195,11 @@
QVERIFY(subject->isVisible() == true);
//test landscape part
- QSharedPointer<const MToolbarLayout> landscape = subject->layout(M::Landscape);
+ QSharedPointer<const MToolbarLayout> landscape = subject->layout(MInputMethod::Landscape);
QVERIFY(!landscape.isNull());
QCOMPARE(landscape->items().count(), 5);
- QVERIFY(subject->layout(M::Landscape) == subject->layout(M::Portrait));
+ QVERIFY(subject->layout(MInputMethod::Landscape) == subject->layout(MInputMethod::Portrait));
}
void Ut_MToolbarData::testMinimalXML()
@@ -251,7 +251,7 @@
ok = subject->loadToolbarXml(Toolbar1);
QVERIFY2(ok, "toolbar1.xml was not loaded correctly");
- QSharedPointer<MToolbarLayout> landscape = subject->layout(M::Landscape).constCast<MToolbarLayout>();
+ QSharedPointer<MToolbarLayout> landscape = subject->layout(MInputMethod::Landscape).constCast<MToolbarLayout>();
QVERIFY(!landscape.isNull());
QVERIFY(!landscape->items().isEmpty());
@@ -265,7 +265,7 @@
ok = subject->append(QSharedPointer<MToolbarLayout>(), button);
QVERIFY2(!ok, "Item should not be added to non-existing row");
- QSharedPointer<MToolbarLayout> portrait = subject->layout(M::Portrait).constCast<MToolbarLayout>();
+ QSharedPointer<MToolbarLayout> portrait = subject->layout(MInputMethod::Portrait).constCast<MToolbarLayout>();
QVERIFY(!portrait.isNull());
QVERIFY(!portrait->items().isEmpty());
--- tests/ut_mtoolbardata/ut_mtoolbardata.pro
+++ tests/ut_mtoolbardata/ut_mtoolbardata.pro
@@ -5,7 +5,7 @@
# Input
HEADERS += \
ut_mtoolbardata.h \
- ../stubs/mgconfitem_stub.h \
+ ../stubs/mimsettings_stub.h \
../stubs/fakegconf.h \
../stubs/minputcontextconnection_stub.h \
@@ -28,7 +28,7 @@
}
-CONFIG += plugin meegotouch qdbus
+CONFIG += plugin qdbus
LIBS += \
../../src/libmeegoimframework.so.0 \
--- tests/ut_mtoolbaritem/ut_mtoolbaritem.pro
+++ tests/ut_mtoolbaritem/ut_mtoolbaritem.pro
@@ -5,7 +5,7 @@
# Input
HEADERS += \
ut_mtoolbaritem.h \
- ../stubs/mgconfitem_stub.h \
+ ../stubs/mimsettings_stub.h \
../stubs/fakegconf.h \
../stubs/minputcontextconnection_stub.h \
@@ -23,7 +23,7 @@
$$SRC_DIR/mtoolbaritem.cpp \
}
-CONFIG += plugin meegotouch qdbus
+CONFIG += plugin qdbus
LIBS += \
../../src/libmeegoimframework.so.0 \
--- tests/ut_passthroughserver/ut_passthroughserver.cpp
+++ tests/ut_passthroughserver/ut_passthroughserver.cpp
@@ -1,9 +1,7 @@
#include "ut_passthroughserver.h"
#include "mpassthruwindow.h"
-#include "mplainwindow.h"
#include "mimapplication.h"
-#include <MWindow>
#include <QCommonStyle>
void Ut_PassthroughServer::initTestCase()
@@ -11,32 +9,24 @@
static int argc = 1;
static char *app_name[1] = { (char *) "ut_passthroughserver" };
- MApplication::setLoadMInputContext(false);
app = new MIMApplication(argc, app_name);
app->setStyle(new QCommonStyle);
app->setTransientHint(1); // remote win id should be non-zero
-
- new MPlainWindow;
}
void Ut_PassthroughServer::cleanupTestCase()
{
- delete MPlainWindow::instance();
delete app;
app = 0;
}
void Ut_PassthroughServer::init()
{
- subject = new MPassThruWindow;
- app->setPassThruWindow(subject);
+ subject = static_cast<MPassThruWindow *>(app->passThruWindow());
}
void Ut_PassthroughServer::cleanup()
-{
- delete subject;
- subject = 0;
-}
+{}
void Ut_PassthroughServer::testHideShow()
{
@@ -71,6 +61,7 @@
// Should be shown after non-empty region update
subject->inputPassthrough(QRegion(0, 0, 100, 100));
+ QTest::qWaitForWindowShown(subject);
QVERIFY(subject->testAttribute(Qt::WA_Mapped) && subject->isVisible());
--- tests/ut_selfcompositing
+++ tests/ut_selfcompositing
+(directory)
--- tests/ut_selfcompositing/ut_selfcompositing.cpp
+++ tests/ut_selfcompositing/ut_selfcompositing.cpp
+/* * This file is part of meego-im-framework *
+ *
+ * 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.
+ */
+
+#include "ut_selfcompositing.h"
+#include "mimgraphicsview.h"
+#include "mimwidget.h"
+#include "mimapplication.h"
+
+namespace
+{
+ const QSize windowSize(200, 200);
+
+ class Remote
+ : public QWidget
+ {
+ public:
+ explicit Remote(QWidget *p = 0,
+ Qt::WindowFlags f = 0)
+ : QWidget(p, f)
+ {
+ setWindowFlags(Qt::FramelessWindowHint | Qt::X11BypassWindowManagerHint);
+ }
+
+ void paintEvent(QPaintEvent *)
+ {
+ QPainter p(this);
+ p.setBrush(QBrush(QColor(Qt::green)));
+ p.drawRect(QRect(QPoint(), size()));
+ QFont f;
+ f.setPointSize(32);
+ p.setFont(f);
+ p.drawText(QRect(QPoint(), size()).adjusted(16, 16, -16, -16),
+ QString("Maliit"));
+ }
+ };
+
+ QWidget *createGraphicsView(QWidget *parent)
+ {
+ MImGraphicsView *subject = new MImGraphicsView(new QGraphicsScene(parent), parent);
+ subject->setSceneRect(QRect(QPoint(), windowSize));
+ subject->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+ subject->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+ subject->setFrameStyle(0);
+ subject->setAttribute(Qt::WA_OpaquePaintEvent);
+ subject->setAttribute(Qt::WA_NoSystemBackground);
+ subject->viewport()->setAttribute(Qt::WA_OpaquePaintEvent);
+ subject->viewport()->setAttribute(Qt::WA_NoSystemBackground);
+ subject->resize(parent->size());
+ subject->setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
+ subject->setCacheMode(QGraphicsView::CacheNone);
+ return subject;
+ }
+
+ QWidget *createWidget(QWidget *parent)
+ {
+ MImWidget *subject = new MImWidget(parent);
+ subject->setAttribute(Qt::WA_OpaquePaintEvent);
+ subject->setAttribute(Qt::WA_NoSystemBackground);
+ subject->resize(parent->size());
+ return subject;
+ }
+}
+
+typedef QWidget * (* WidgetCreator)(QWidget *parent);
+Q_DECLARE_METATYPE(WidgetCreator);
+
+void Ut_SelfCompositing::initTestCase()
+{
+ static char *argv[2] = { (char *) "Ut_SelfCompositing",
+ (char *) "-use-self-composition" };
+ static int argc = 2;
+
+ // Enforcing raster GS to make test reliable:
+ QApplication::setGraphicsSystem("raster");
+
+ app = new MIMApplication(argc, argv);
+ QVERIFY(app->selfComposited());
+}
+
+void Ut_SelfCompositing::cleanupTestCase()
+{
+ delete app;
+}
+
+void Ut_SelfCompositing::init()
+{}
+
+void Ut_SelfCompositing::cleanup()
+{}
+
+void Ut_SelfCompositing::testSelfCompositing_data()
+{
+ QTest::addColumn<WidgetCreator>("widgetCreator");
+ QTest::newRow("MImWidget") << &createWidget;
+ QTest::newRow("MImGraphicsView") << &createGraphicsView;
+}
+
+void Ut_SelfCompositing::testSelfCompositing()
+{
+ QFETCH(WidgetCreator, widgetCreator);
+
+ Remote remote;
+ remote.setGeometry(0, 0, windowSize.width(), windowSize.height());
+
+ QWidget *passthru = app->passThruWindow();
+ passthru->setGeometry(remote.geometry().right() + 10, 0,
+ windowSize.width(), windowSize.height());
+
+ QWidget *subject = widgetCreator(passthru);
+
+ remote.show();
+ passthru->show();
+ subject->show();
+
+ QTest::qWaitForWindowShown(remote.window());
+ QTest::qWaitForWindowShown(passthru->window());
+ passthru->raise();
+ QApplication::setActiveWindow(passthru);
+
+ app->setTransientHint(remote.window()->effectiveWinId());
+ app->remoteWindow()->redirect();
+
+ remote.update(); // Not strictly required, due to our window attributes.
+ QCoreApplication::processEvents();
+
+ QGraphicsView *view = qobject_cast<QGraphicsView *>(subject);
+ QImage subjectImage = QPixmap::grabWidget(view ? view->viewport() : subject).toImage();
+ QImage remoteImage = QPixmap::grabWidget(&remote).toImage();
+ QCOMPARE(subjectImage, remoteImage);
+
+ app->remoteWindow()->unredirect();
+}
+
+QTEST_APPLESS_MAIN(Ut_SelfCompositing)
--- tests/ut_selfcompositing/ut_selfcompositing.h
+++ tests/ut_selfcompositing/ut_selfcompositing.h
+/* * This file is part of meego-im-framework *
+ *
+ * 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 UT_SELFCOMPOSITING_H
+#define UT_SELFCOMPOSITING_H
+
+#include <QtTest/QtTest>
+#include <QtCore>
+#include <QtGui>
+
+class MIMApplication;
+
+class Ut_SelfCompositing : public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void initTestCase();
+ void cleanupTestCase();
+
+ void init();
+ void cleanup();
+
+ void testSelfCompositing_data();
+ void testSelfCompositing();
+
+private:
+ MIMApplication *app;
+};
+
+#endif // UT_SELFCOMPOSITING_H
--- tests/ut_selfcompositing/ut_selfcompositing.pro
+++ tests/ut_selfcompositing/ut_selfcompositing.pro
+include(../common_top.pri)
+
+PASSTHRU_DIR = ../../passthroughserver
+INCLUDEPATH += \
+ $$SRC_DIR \
+ $$PASSTHRU_DIR \
+
+DEFINES += UNIT_TEST
+
+# Input
+HEADERS += \
+ ut_selfcompositing.h \
+ $$SRC_DIR/mimapplication.h \
+ $$SRC_DIR/mimremotewindow.h \
+ $$SRC_DIR/mimwidget.h \
+ $$SRC_DIR/mimgraphicsview.h \
+ $$PASSTHRU_DIR/mpassthruwindow.h \
+
+SOURCES += \
+ ut_selfcompositing.cpp \
+ $$SRC_DIR/mimapplication.cpp \
+ $$SRC_DIR/mimremotewindow.cpp \
+ $$SRC_DIR/mimwidget.cpp \
+ $$SRC_DIR/mimgraphicsview.cpp \
+ $$PASSTHRU_DIR/mpassthruwindow.cpp \
+
+LIBS += \
+ $$SRC_DIR/libmeegoimframework.so.0
+
+include(../common_check.pri)
++++++ meegotouch-inputmethodframework.yaml
--- meegotouch-inputmethodframework.yaml
+++ meegotouch-inputmethodframework.yaml
@@ -1,6 +1,6 @@
Name: meegotouch-inputmethodframework
Summary: MeeGo UI Input Method Framework
-Version: 0.19.46
+Version: 0.20.0
Release: 1
Group: System/Libraries
License: LGPLv2.1
More information about the MeeGo-commits
mailing list