[meego-commits] 10010: Changes to Trunk:Testing/meegotouch-inputmethodframework

Fathi Boudra no_reply at build.meego.com
Fri Nov 26 12:56:53 UTC 2010


Hi,
I have made the following changes to meegotouch-inputmethodframework in project Trunk:Testing. Please review and accept ASAP.

Thank You,
Fathi Boudra

[This message was auto-generated]

---

Request #10010:

  submit:   devel:qt-mtf/meegotouch-inputmethodframework(r32) -> Trunk:Testing/meegotouch-inputmethodframework


Message:
    * Thu Nov 25 2010 Luis Araujo <luis.araujo at collabora.co.uk> - 0.19.30
- Update to release tag 0.19.30-1 (BMC#10500)

* Fri Nov 25 2010 Fathi Boudra <fathi.boudra at nokia.com> - 0.19.27
-  Fix Url
-  Remove useless BuildRequires (QtOpenGL and gl)
-  Use ExtraSources and RunFdupes in yaml

* Thu Nov 12 2010 Luis Araujo <luis.araujo at collabora.co.uk> - 0.19.27
- Update to release tag 0.19.27-1
- Fail to launch VKB fixed (BMC#8541)
- The character "0" and another two symbols are not fully displayed in virtual
  keyboard in landscape mode fixed (BMC#6085)
- The virtual keyboard does not have a commit button fixed (BMC#7517)
- Lack of VKB close button fixed (BMC#7665)

State:   new          2010-11-26T04:56:52 boudra
Comment: None



changes files:
--------------
--- meegotouch-inputmethodframework.changes
+++ meegotouch-inputmethodframework.changes
@@ -1 +1,17 @@
-* Wed Oct 12 2010 Kaitlin Rupert <kaitlin.rupert at intel.com> - 0.19.20
+* Thu Nov 25 2010 Luis Araujo <luis.araujo at collabora.co.uk> - 0.19.30
+- Update to release tag 0.19.30-1 (BMC#10500)
+
+* Fri Nov 25 2010 Fathi Boudra <fathi.boudra at nokia.com> - 0.19.27
+-  Fix Url
+-  Remove useless BuildRequires (QtOpenGL and gl)
+-  Use ExtraSources and RunFdupes in yaml
+
+* Thu Nov 12 2010 Luis Araujo <luis.araujo at collabora.co.uk> - 0.19.27
+- Update to release tag 0.19.27-1
+- Fail to launch VKB fixed (BMC#8541)
+- The character "0" and another two symbols are not fully displayed in virtual
+  keyboard in landscape mode fixed (BMC#6085)
+- The virtual keyboard does not have a commit button fixed (BMC#7517)
+- Lack of VKB close button fixed (BMC#7665)
+
+* Tue Oct 12 2010 Kaitlin Rupert <kaitlin.rupert at intel.com> - 0.19.20
@@ -5 +21 @@
-* Wed Oct 12 2010 Rakesh Cherian <rakeshcherian at gmail.com> - 0.19.20
+* Tue Oct 12 2010 Rakesh Cherian <rakeshcherian at gmail.com> - 0.19.20
@@ -16 +32 @@
-- Change mkspecs install location due to qt update 
+- Change mkspecs install location due to qt update
@@ -51 +66,0 @@
-

old:
----
  meegotouch-inputmethodframework-0.19.20.tar.bz2

new:
----
  meegotouch-inputmethodframework-0.19.30.tar.bz2

spec files:
-----------
--- meegotouch-inputmethodframework.spec
+++ meegotouch-inputmethodframework.spec
@@ -7,11 +7,11 @@
 
 Name:       meegotouch-inputmethodframework
 Summary:    MeeGo UI Input Method Framework
-Version:    0.19.20
+Version:    0.19.30
 Release:    1
 Group:      System/Libraries
-License:    LGPL v2.1
-URL:        http://www.meego.com
+License:    LGPLv2.1
+URL:        http://meego.gitorious.org/meegotouch/meegotouch-inputmethodframework
 Source0:    %{name}-%{version}.tar.bz2
 Source1:    meego-im-uiserver.desktop
 Source100:  meegotouch-inputmethodframework.yaml
@@ -22,12 +22,10 @@
 Requires(postun): /sbin/ldconfig
 BuildRequires:  pkgconfig(QtCore) >= 4.6.0
 BuildRequires:  pkgconfig(QtDBus)
-BuildRequires:  pkgconfig(QtOpenGL)
 BuildRequires:  pkgconfig(QtNetwork)
 BuildRequires:  pkgconfig(QtGui)
 BuildRequires:  pkgconfig(dbus-1)
 BuildRequires:  pkgconfig(gconf-2.0)
-BuildRequires:  pkgconfig(gl)
 BuildRequires:  pkgconfig(meegotouch)
 BuildRequires:  pkgconfig(meegotouch-feedback)
 BuildRequires:  pkgconfig(meegotouch-feedbackreactionmaps)
@@ -46,6 +44,7 @@
 MeeGo UI Input Method Framework
 
 
+
 %package devel
 Summary:    MeeGo UI Input Method Development Package
 Group:      Development/Libraries
@@ -71,12 +70,10 @@
 %setup -q -n %{name}-%{version}
 
 # >> setup
-%define _qt4_prefix %{_libdir}/qt4
 # << setup
 
 %build
 # >> build pre
-export PATH=$PATH:/usr/lib/qt4/bin
 # Set ENABLE_MULTITOUCH to false for now as not all devices support it
 sed -e 's|ENABLE_MULTITOUCH|false|' > meego-im-framework.schemas < meego-im-framework.schemas.in
 sed -e "s:M_IM_FRAMEWORK_FEATURE::g" %{_builddir}/%{?buildsubdir}/src/meegoimframework.prf.in > %{_builddir}/%{?buildsubdir}/src/meegoimframework.prf
@@ -94,13 +91,13 @@
 # >> install pre
 # << install pre
 %qmake_install
+mkdir -p %{buildroot}%{_sysconfdir}/xdg/autostart
+cp -a %{SOURCE1} %{buildroot}%{_sysconfdir}/xdg/autostart
 
-# >> install post
-%fdupes %{buildroot}%{_libdir}
 
-mkdir -p %{buildroot}/etc/xdg/autostart
-cp %{SOURCE1} %{buildroot}/etc/xdg/autostart
+# >> install post
 # << install post
+%fdupes  %{buildroot}/%{_libdir}
 
 %pre
 if [ "$1" -gt 1 ]; then
@@ -136,7 +133,6 @@
 %files
 %defattr(-,root,root,-)
 # >> files
-%defattr(-, root, root, -)
 %{_libdir}/*.so.*
 %config /etc/xdg/autostart/*.desktop
 %{_bindir}/meego-im-uiserver
@@ -145,7 +141,7 @@
 %{_libdir}/duicontrolpanel/meegotouch-text-input-applet.desktop
 %{_datadir}/l10n/meegotouch/text-input-settings.qm
 %{_datadir}/gconf/schemas/meego-im-framework.schemas
-%{_datadir}/meegotouch/imtoolbars/imframework/standard.xml
+%{_datadir}/meegoimframework/imtoolbars/standard.xml
 # << files
 
 
@@ -153,7 +149,7 @@
 %defattr(-,root,root,-)
 # >> files devel
 %{_libdir}/*.so
-%{_includedir}/meegotouch/meegoimframework
+%{_includedir}/meegoimframework/
 %{_datadir}/qt4/mkspecs/features/meegoimframework.prf
 %{_libdir}/pkgconfig/*.pc
 # << files devel

other changes:
--------------

++++++ meegotouch-inputmethodframework-0.19.20.tar.bz2 -> meegotouch-inputmethodframework-0.19.30.tar.bz2
--- NEWS
+++ NEWS
@@ -1,3 +1,67 @@
+0.19.30
+=======
+* API changes
+ - Toolbar specification was changed. Add a new attibute "enabled" for button.
+   Check latest version of the specification in the file doc/src/toolbarxml.dox.
+
+0.19.27
+=======
+
+* API changes
+ - MInputMethodBase was renamed to MAbstractInputMethod
+ - MInputMethodSettingsBase was renamed to MAbstractInputMethodSettings
+ - Removed region signal from MAbstractInputMethod and replaced them with
+   setScreenRegion() and setInputMethodArea() in MAbstractInputMethodHost.
+ - renamed in MAbstractInputMethod:
+   - mouseClickedOnPreedit() -> handleMouseClickOnPreedit(
+   - focusChanged() -> handleFocusChange()
+   - visualizationPriorityChanged() -> handleVisualizationPriorityChange
+   - appOrientationChanged() -> handleAppOrientationChange()
+   - clientChanged -> handleClientChange()
+
+0.19.26
+========
+
+* API changes
+ - A request type parameter was added to MInputContext::keyEvent to
+   allow signal only and event only key events.
+ - Similar change to MInputContextConnection::sendKeyEvent and the "keyEvent"
+   method in DBUS interface "com.meego.inputmethod.inputcontext1".
+ - Removed MInputContextConnection from public API and replaced it with
+   MAbstractInputMethodHost for MInputMethodBase.
+ - Removed some ...Requsted() signals from MInputMethodBase and replaced with
+   methods in MAbstractInputMethodHost
+ - Removed indicator setting from MInputMethodBase and replaced with method on
+   MAbstractInputMethodHost. Moved the indicator enum to MInputMethod namespace.
+ - Changed the D-Bus interface of MIMPluginManager to use meego prefix.
+
+0.19.24
+========
+
+* API changes
+ - Toolbar specification was changed.
+   Check latest version of the specification in the file doc/src/toolbarxml.dox
+ - class MToolbarRow was removed
+
+0.19.22
+========
+
+* API changes
+ - moved contents from mpreeditface.h, mimdirection.h and mimhandlerstate.h
+   to minputmethodnamespace.h using "MInputMethod" namespace.
+   Also renamed MInputMethodSwitchDirection -> SwitchDirection.
+
+- Moved headers out of meegotouch dir to /usr/include/meegoimframework/
+
+0.19.21
+========
+
+* API changes
+ - MInputContext::keyEvent will always emit a signal, additional parameter "signalOnly"
+   is used to suppress delivering the KeyEvent to focused widget.
+ - D-BUS message "keyEvent" in interface "com.meego.inputmethod.inputcontext1" has new
+   boolean parameter to match the new parameter in MInputContext::keyEvent
+
 0.19.20
 ========
 
--- debian/api
+++ debian/api
@@ -1,20 +1,20 @@
 interface: libmeegoimframework
 type: library
 scope: Platform
-state: unstable
+state: stable
 libs-pkg: libmeegoimframework0
 dev-pkg: libmeegoimframework-dev
 
 interface: com.meego.inputmethod.uiserver1
 type: dbus
 scope: Platform
-state: unstable
+state: stable
 libs-pkg: libmeegoimframework0
 dev-pkg: libmeegoimframework-dev
 
 interface: Toolbar XML
 type: file
 scope: Platform
-state: unstable
+state: stable
 libs-pkg: libmeegoimframework0
 dev-pkg: libmeegoimframework-dev
--- debian/changelog
+++ debian/changelog
@@ -1,3 +1,87 @@
+meego-im-framework (0.19.31~1) unstable; urgency=low
+
+  * [UNRELEASED]
+
+ -- huaming wang <huaming.wang at nokia.com>  Tue, 23 Nov 2010 11:56:39 +0200
+
+meego-im-framework (0.19.30-1) unstable; urgency=low
+
+  * Fixes: NB#206117 - meego-im-uiserver restart screws up dialer
+  * Changes: Remove QtDBus stuffs
+  * Fixes: NB#183914 - Cannot disable a button in vkb's input methods toolbar
+
+ -- huaming wang <huaming.wang at nokia.com>  Tue, 23 Nov 2010 11:54:27 +0200
+
+meego-im-framework (0.19.29-1) unstable; urgency=low
+
+  * new release
+
+ -- huaming wang <huaming.wang at nokia.com>  Wed, 17 Nov 2010 14:23:26 +0200
+
+meego-im-framework (0.19.28-1) unstable; urgency=low
+
+  * Changes: moved MIMPluginManagerAdaptor into its own files
+
+ -- Gibran Rodriguez <ext-gibran-rodriguez at nokia.com>  Wed, 10 Nov 2010 12:55:10 +0200
+
+meego-im-framework (0.19.27-1) unstable; urgency=low
+
+  * Changes: add color style for preedit
+  * Fixes: NB#195194 - Paste button doesn't appear when one copies using hwkbd
+  * Fixes: NB#191425 - Source package 'meego-im-framework' and 'meego-keyboard' ...
+  * Renamed MInputMethodBase to MAbstractInputMethod
+  * Renamed MInputMethodSettingsBase to MAbstractInputMethodSettings
+  * Replaced some signals in MAbstractInputMethod with method in MAbstactInputMethodHost
+  * Renamed ...Changed() methods in MAbstractInputMethod to handle...()
+
+ -- Gibran Rodriguez <ext-gibran.rodriguez at nokia.com>  Wed, 03 Nov 2010 13:58:37 +0200
+
+meego-im-framework (0.19.26-1) unstable; urgency=low
+
+  * Changes: MInputContext::keyEvent() method signature changed
+  * Changes: Replaced MInputContextConnection MAbstractInputMethodHost in public API
+  * Changes: moved signals and methods from MInputMethodBase to MAbstractInputMethodHost
+  * Changes: D-Bus interface name of plugin manager to have meego prefix
+
+ -- huaming wang <huaming.wang at nokia.com>  Thu, 28 Oct 2010 11:31:45 +0300
+
+meego-im-framework (0.19.25-1) unstable; urgency=low
+
+  * Support configurable domain button for URL/Email toolbars
+
+ -- Gibran Rodriguez <ext-gibran.rodriguez at nokia.com>  Fri, 22 Oct 2010 10:33:22 +0300
+
+meego-im-framework (0.19.24-1) unstable; urgency=low
+
+  * Fixes: NB#198057 - COREWEB: /usr/bin/meego-im-uiserver '__sincosf'
+  * Toolbar is single line
+  * Copy/paste button is on the left side of toolbar
+  * Toolbar is rectangular
+  * Custom toolbar buttons aligned in the center
+
+ -- huaming wang <huaming.wang at nokia.com>  Tue, 19 Oct 2010 13:43:06 +0300
+
+meego-im-framework (0.19.23-1) unstable; urgency=low
+
+  * Bump up version
+
+ -- huaming wang <huaming.wang at nokia.com>  Fri, 15 Oct 2010 11:03:01 +0300
+
+meego-im-framework (0.19.22-1) unstable; urgency=low
+
+  * Gathered enums from multiple files to minputmethodnamespace.h
+  * Fixes: NB#195548 - COREWEB: /usr/bin/meego-im-uiserver 'QDBusAbstractInterface::isValid MInputMethodBasePrivate::_q_handleIndicatorServiceChanged MInputMethodBase::qt_metacall MKeyboardHost::qt_metacall'
+  * Moved im framework stuff out of meegotouch dir
+
+ -- Pekka Vuorela <pekka.ta.vuorela at nokia.com>  Thu, 14 Oct 2010 18:33:04 +0300
+
+meego-im-framework (0.19.21-1) unstable; urgency=low
+
+  * Changed VKB to always emit a signal from key press and release
+  * Fixes: NB#184023 - VKB shown for a while in front of unlock-UI
+
+ -- huaming wang <huaming.wang at nokia.com>  Tue, 12 Oct 2010 12:47:45 +0300
+
 meego-im-framework (0.19.20-1) unstable; urgency=low
 
   * Uses MInputMethodState signaling for notifying app about real hw kbd events
--- 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) | libqt4-maemo5-dev (>= 4.6), doxygen, libqt4-opengl-dev | libqt4-maemo5-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, libxext-dev, libmeegoreactionmap-dev (>= 0.14.0-1), dbus-1-utils, pkg-config, dpkg-dev, libmeegotouch-dev (>= 0.20.42), libduicontrolpanel-dev (>= 0.7.20), graphviz
+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, libxext-dev, libmeegoreactionmap-dev (>= 0.14.0-1), dbus-1-utils, pkg-config, dpkg-dev, libmeegotouch-dev (>= 0.20.42), libduicontrolpanel-dev (>= 0.7.20), graphviz
 Standards-Version: 3.7.2
 
 Package: meego-im-uiserver
@@ -21,7 +21,7 @@
 Package: libmeegoimframework-dev
 Section: libdevel
 Architecture: all
-Depends: libmeegoimframework0 (>= ${source:Version}), libqt4-dev (>= 4.6) | libqt4-maemo5-dev (>= 4.6)
+Depends: libmeegoimframework0 (>= ${source:Version}), libqt4-dev (>= 4.6)
 Description: libmimmuiframework development files
  Development files for MeegoTouch Input Method UI Framework.
 
@@ -41,7 +41,7 @@
 
 Package: meego-im-framework-tests
 Architecture: any
-Depends:  testrunner, ci-testing, meego-im-uiserver (= ${binary:Version}), libmeegoimframework0 (= ${binary:Version}), meego-im-settings-applet (= ${binary:Version}), ${misc:Depends}, ${shlibs:Depends}
+Depends:  testrunner-lite, ci-testing, meego-im-uiserver (= ${binary:Version}), libmeegoimframework0 (= ${binary:Version}), meego-im-settings-applet (= ${binary:Version}), ${misc:Depends}, ${shlibs:Depends}
 XB-Maemo-CI-Packages: libmeegoimframework0, meego-im-uiserver
 XB-Maemo-CI-Stage: fast, staging
 Description: MeegoTouch Input Method Framework Unit Test Suite 
--- debian/libmeegoimframework-dev.install.in
+++ debian/libmeegoimframework-dev.install.in
@@ -1,3 +1,3 @@
-usr/include/meegotouch/meegoimframework/*
+usr/include/meegoimframework/*
 QT_INSTALL_DATA/mkspecs/features/*
 
--- debian/libmeegoimframework0.install
+++ debian/libmeegoimframework0.install
@@ -1,5 +1,5 @@
 usr/lib/lib*.so*
 usr/share/gconf
 usr/share/l10n/meegotouch/text-input-settings.qm
-usr/share/meegotouch/imtoolbars/imframework/standard.xml
+usr/share/meegoimframework/imtoolbars/standard.xml
 
--- debian/rules
+++ debian/rules
@@ -59,6 +59,11 @@
         ENABLE_MULTITOUCH = false
 endif
 
+ifneq (,$(filter timestamps,$(TMP_BUILD_OPTS)))
+    QMAKE_OPTIONS += DEFINES+=M_TIMESTAMP
+endif
+
+
 # shared library versions, option 1
 version=0.1.0
 major=0
--- doc/src/pluginsystem.dox
+++ doc/src/pluginsystem.dox
@@ -42,9 +42,9 @@
 \subsubsection SettingsHandler Handler 
 Plugin Manager selects the active plugin based on the settings. GConf stores the settings of the plugin names which will be selected whenever the handler or language is changed or run in the first time. The settings hierarchy looks like this:
 
-/code
+\code
 /M/InputMethods/Plugins/Handler/<HANDLER> : <PLUGIN-NAME>
-/endcode
+\endcode
 
 \subsection PluginMap Plugin Map
 When input method server is started, Plugin Manager reads the available plugins in the system and collects the handler information from the plugins. It then generates an in-memory map to be used whenever the handler is changed. The map is refreshed whenever a new plugin is installed or removed.
--- doc/src/toolbarxml.dox
+++ doc/src/toolbarxml.dox
@@ -2,57 +2,49 @@
 <b>Version</b>: 0.1
 
 \section Overview
-This document describes the XML specification of the toolbar widget. 
+This document describes the XML specification of the toolbar widget.
 
 \sa MToolbarData
 
 \section Tags
-\subsection TOOLBAR
-Root tag, it contains the definition for all items in the toolbar.
-The LOCKED attribute enables or disables user interactions for toolbar.
-If user interactions are disabled then user can not hide visible toolbar or show hidden toolbar.
+\subsection INPUT-METHOD
+Root tag, it contains information which should be used by input method plugin.
 The VERSION attribute defines version of this specification. Current version is 1.
 Warning: you need to specify version number explicitly, otherwise parser may assume wrong version number and then parsing will fail.
 The VISIBLE attribute defines toolbar's visibility. Toolbar is visible by default, but you could hide it by setting VISIBLE to false.
 Warning: normal application should not use this attribute.
-The REFUSE attribute enumerates names of standard items which should not be added to your toolbar. Names should be separated by commas. See also "Standard toolbar items".
-
-\subsection Layout
+The REFUSE attribute enumerates names of standard items which should not be added to your toolbar. Names should be separated by commas without spaces. See also "Standard toolbar items".
 
-Layout describes the actual toolbar layout for a given screen orientation.  If the layout doesn't have a portrait variant, the software shall use the landscape variant when the device is in portrait orientation. Each layout contains one or more rows.
-
-\subsection Row
+\subsection TOOLBAR
+It contains the definition for all items in the toolbar.
+TOOLBAR tag could be used as root tag for backward compatibility.
+This tag have same attributes as INPUT-METHOD.
 
-This tag defines one row in toolbar.
-It is not recommended to create more than one row for landscape orientation.
-Row may not be empty.
+\subsection ITEMS
+This tag contains definitions of all items which will be placed into layouts.
 
 \subsubsection BUTTON
 This tag will be constructed as MButton.
 The NAME attribute is used as a reference in the toolbar system.
 All buttons with the same NAME share their state. If two buttons have the same name then their state is defined by first one and then overriden (completely or partially) by second one. This feature allows to have consistent button state with different device orientation. All names starting with underscore are reserved for Input Method Framework.
-Warning: it is not recommended to create two buttons with the same name inside one layout.
+Warning: it is not recommended to create more than one button with the same name inside one layout.
 The GROUP attribute defines the group this button belongs to.
-The PRIORITY attribute defines priority order of displaying, the smaller the number, the earlier it is put into the toolbar among items with the same ALIGMENT. Please note that button with right alignment will be never placed before button with left alignment. Normal toolbar button should have priority from 1 to 100. Values from 101 to 200 and from -100 to -1 are reserved for Input Method Framework. If application developer wants to create button which will be placed at the end of toolbar afer any button provided by Input Method Framework, then the PRIORITY should be in the range 201..300. If application developer wants to create button which will be placed at the begin of toolbar before any button provided by Input Method Framework, then the PRIORITY should be in the range -200..-101.
 The SHOWON attribute tells when the button is displayed. If the value is "selectedtext", it will be only displayed when there is a selected text. If the value is "always" then it is always displayed.
 Similar rule applies with HIDEON attribute, except that there is no "always" value.
-The button is aligned within the toolbar according to the value of ALIGMENT attribute.
+The button is aligned within the toolbar according to the value of ALIGMENT attribute. Normal button should have default (center) alignment, but you could use right or left alignment if you want to override close or copy/paste button.
 The ICON attribute holds the icon file name (absolute file name). The icon will be displayed in the center of the button.
 The SIZE attribute holds the icon size percentage. The icon will be resized according this attribute and the button size.
 The ICON_ID attribute holds the icon logical id to be displayed on button. ICON_ID has higher priority than ICON, so if both ICON and ICON_ID are specified, ICON_ID will be used. Note: only the ICON_ID of the icons loaded by meegotouch theme will be used.
 The TEXT attribute holds the text and TEXT_ID holds the logical id of the text.
 The TOGGLE attribute defines the type of the button whether it is a toggle button or not, by default the value is false.
 If the TOGGLE attribute is true, the PRESSED attribute holds the button state whether the button is pressed or not.
+The HIGHLIGHTED attribute selects which background image should be used.
+The ENABLED attribute holds whether the button is enabled. Default value is true. If it is set to false, the button will be disabled.
 
 \subsubsection LABEL
 This tag will be constructed as MLabel.
-The NAME attribute has the same meaning as for BUTTON.
-The GROUP attribute defines the group this label belongs to.
-The PRIORITY attribute has the same meaning as for BUTTON.
-The SHOWON attribute tells when the label is displayed. If the value is "selectedtext", it will be only displayed when there is a selected text. If the value is "always" then it is always displayed.
-Similar rule applies with HIDEON attribute, except that there is no "always" value.
-The label is aligned within the toolbar according to the value of ALIGMENT attribute.
-The TEXT attribute holds the text and TEXT_ID holds the logical id of the text. Similiar like ICON_ID, TEXT_ID has higher priority than TEXT.
+LABEL tag could have following attributes: NAME, GROUP, SHOWON, HIDEON, ALIGMENT, TEXT and TEXT_ID.
+Every attribute has the same meaning as for BUTTON tag.
 
 \subsubsubsection ACTIONS
 This tag holds a sequence of actions defined within.
@@ -78,16 +70,33 @@
 \subsubsubsubsection PASTE
 This tag defines that the action is to paste from clipboard.
 
+\subsection Layout
+
+Layout describes the actual toolbar layout for a given screen orientation.  If the layout doesn't have a portrait variant, the software shall use the landscape variant when the device is in portrait orientation. Each layout contains one row only.
+
+\subsubsection Row
+
+This tag defines one row in toolbar.
+It is not recommended to create more than one row for landscape orientation.
+Row may not be empty.
+Warning: this tag is deprecated and will be removed soon, because toolbar should have one row only.
+
+\subsubsection Item
+
+This tag defines which item should be placed into toolbar.
+NAME attribute selects correspondig item (button or label) which is defined in the Items section.
+
 \section Standard toolbar items
-Button "_close" closes keyboard and removes focus from active text entry.
-Button "_copypaste" copies selected text (if any) or pastes current clipboard content.
+Button "_close" closes keyboard and removes focus from active text entry. This button is right aligned.
+Button "_copypaste" copies selected text (if any) or pastes current clipboard content. This button is left aligned.
 
 \section DTD
 \code
-<!DOCTYPE MEEGO_IM_TOOLBAR_WIDGET [
-<!ELEMENT toolbar (layout+)>
-<!ELEMENT layout (row+)>
-<!ELEMENT row ((button|label)+)>
+<!DOCTYPE MEEGO_INPUT_METHOD [
+<!ELEMENT input-method (toolbar)>
+<!ELEMENT toolbar (items,layout+)>
+<!ELEMENT items ((button|label)+)>
+<!ELEMENT layout (item+)>
 <!ELEMENT button (actions*)>
 <!ELEMENT actions (sendkeysequence|sendstring|sendcommand|copy|paste|showgroup|hidegroup)*>
 <!ELEMENT sendkeysequence (#CDATA)>
@@ -96,7 +105,10 @@
 <!ELEMENT copy EMPTY>
 <!ELEMENT paste EMPTY>
 
-<!ATTLIST toolbar locked (true|false) "false">
+<!ATTLIST input-method version (0|1) "0">
+<!ATTLIST input-method visible (true|false) "true">
+<!ATTLIST input-method refuse CDATA "">
+
 <!ATTLIST toolbar version (0|1) "0">
 <!ATTLIST toolbar visible (true|false) "true">
 <!ATTLIST toolbar refuse CDATA "">
@@ -105,10 +117,9 @@
 
 <!ATTLIST button name CDATA #REQUIRED>
 <!ATTLIST button group CDATA>
-<!ATTLIST button priority CDATA>
 <!ATTLIST button showon (selectedtext|always)>
 <!ATTLIST button hideon (selectedtext)>
-<!ATTLIST button alignment (left|right)>
+<!ATTLIST button alignment (left|right|center) "center">
 <!ATTLIST button icon CDATA "">
 <!ATTLIST button size CDATA "">
 <!ATTLIST button icon_id CDATA "">
@@ -116,13 +127,14 @@
 <!ATTLIST button text_id CDATA "">
 <!ATTLIST button toggle (true|false)>
 <!ATTLIST button pressed (true|false)>
+<!ATTLIST button highlighted (true|false) "false">
+<!ATTLIST button enabled (true|false) "true">
 
 <!ATTLIST label name CDATA #REQUIRED>
 <!ATTLIST label group CDATA>
-<!ATTLIST label priority CDATA>
 <!ATTLIST label showOn (selectedtext|always)>
 <!ATTLIST label hideOn (selectedtext)>
-<!ATTLIST label alignment (left|right)>
+<!ATTLIST label alignment (left|right|center) "center">
 <!ATTLIST label text CDATA "">
 <!ATTLIST label text_id CDATA "">
 
@@ -132,6 +144,7 @@
 <!ATTLIST showgroup group CDATA>
 <!ATTLIST hidegroup group CDATA>
 
+<!ATTLIST item name CDATA #REQUIRED>
 ]>
 \endcode
 */
--- input-context/input-context.pro
+++ input-context/input-context.pro
@@ -12,24 +12,19 @@
 # Input
 HEADERS += minputcontext.h \
     minputcontextplugin.h \
+    mdbusglibinputcontextadaptor.h \
+    glibdbusimserverproxy.h \
     $$STYLE_HEADERS \
 
 SOURCES += minputcontext.cpp \
     minputcontextplugin.cpp \
+    mdbusglibinputcontextadaptor.cpp \
+    glibdbusimserverproxy.cpp \
 
 QT = core gui
-CONFIG += plugin debug meegotouch
+CONFIG += plugin debug meegotouch link_pkgconfig
 
-contains(DEFINES, QT_DBUS) {
-    SOURCES += minputcontextadaptor.cpp qtdbusimserverproxy.cpp
-    HEADERS += qtdbusimserverproxy.h minputcontextadaptor.h
-    CONFIG += qdbus
-} else {
-    CONFIG += link_pkgconfig
-    PKGCONFIG += dbus-glib-1
-    SOURCES += mdbusglibinputcontextadaptor.cpp glibdbusimserverproxy.cpp
-    HEADERS += mdbusglibinputcontextadaptor.h glibdbusimserverproxy.h
-}
+PKGCONFIG += dbus-glib-1
 
 # coverage flags are off per default, but can be turned on via qmake COV_OPTION=on
 for(OPTION,$$list($$lower($$COV_OPTION))){
@@ -52,3 +47,8 @@
 check.target = check
 check.depends += lib$${TARGET}.so
 
+QMAKE_EXTRA_TARGETS += mdbusglibicconnectionserviceglue.h
+mdbusglibicconnectionserviceglue.h.commands = \
+    dbus-binding-tool --prefix=m_dbus_glib_input_context_adaptor --mode=glib-server \
+        --output=mdbusglibicconnectionserviceglue.h minputmethodcontext1interface.xml
+mdbusglibicconnectionserviceglue.h.depends = minputmethodcontext1interface.xml
--- input-context/mdbusglibicconnectionserviceglue.h
+++ input-context/mdbusglibicconnectionserviceglue.h
-/* Generated by dbus-binding-tool; do not edit! */
-
-
-#ifndef __dbus_glib_marshal_m_dbus_glib_input_context_adaptor_MARSHAL_H__
-#define __dbus_glib_marshal_m_dbus_glib_input_context_adaptor_MARSHAL_H__
-
-#include	<glib-object.h>
-
-G_BEGIN_DECLS
-
-#ifdef G_ENABLE_DEBUG
-#define g_marshal_value_peek_boolean(v)  g_value_get_boolean (v)
-#define g_marshal_value_peek_char(v)     g_value_get_char (v)
-#define g_marshal_value_peek_uchar(v)    g_value_get_uchar (v)
-#define g_marshal_value_peek_int(v)      g_value_get_int (v)
-#define g_marshal_value_peek_uint(v)     g_value_get_uint (v)
-#define g_marshal_value_peek_long(v)     g_value_get_long (v)
-#define g_marshal_value_peek_ulong(v)    g_value_get_ulong (v)
-#define g_marshal_value_peek_int64(v)    g_value_get_int64 (v)
-#define g_marshal_value_peek_uint64(v)   g_value_get_uint64 (v)
-#define g_marshal_value_peek_enum(v)     g_value_get_enum (v)
-#define g_marshal_value_peek_flags(v)    g_value_get_flags (v)
-#define g_marshal_value_peek_float(v)    g_value_get_float (v)
-#define g_marshal_value_peek_double(v)   g_value_get_double (v)
-#define g_marshal_value_peek_string(v)   (char*) g_value_get_string (v)
-#define g_marshal_value_peek_param(v)    g_value_get_param (v)
-#define g_marshal_value_peek_boxed(v)    g_value_get_boxed (v)
-#define g_marshal_value_peek_pointer(v)  g_value_get_pointer (v)
-#define g_marshal_value_peek_object(v)   g_value_get_object (v)
-#else /* !G_ENABLE_DEBUG */
-/* WARNING: This code accesses GValues directly, which is UNSUPPORTED API.
- *          Do not access GValues directly in your code. Instead, use the
- *          g_value_get_*() functions
- */
-#define g_marshal_value_peek_boolean(v)  (v)->data[0].v_int
-#define g_marshal_value_peek_char(v)     (v)->data[0].v_int
-#define g_marshal_value_peek_uchar(v)    (v)->data[0].v_uint
-#define g_marshal_value_peek_int(v)      (v)->data[0].v_int
-#define g_marshal_value_peek_uint(v)     (v)->data[0].v_uint
-#define g_marshal_value_peek_long(v)     (v)->data[0].v_long
-#define g_marshal_value_peek_ulong(v)    (v)->data[0].v_ulong
-#define g_marshal_value_peek_int64(v)    (v)->data[0].v_int64
-#define g_marshal_value_peek_uint64(v)   (v)->data[0].v_uint64
-#define g_marshal_value_peek_enum(v)     (v)->data[0].v_long
-#define g_marshal_value_peek_flags(v)    (v)->data[0].v_ulong
-#define g_marshal_value_peek_float(v)    (v)->data[0].v_float
-#define g_marshal_value_peek_double(v)   (v)->data[0].v_double
-#define g_marshal_value_peek_string(v)   (v)->data[0].v_pointer
-#define g_marshal_value_peek_param(v)    (v)->data[0].v_pointer
-#define g_marshal_value_peek_boxed(v)    (v)->data[0].v_pointer
-#define g_marshal_value_peek_pointer(v)  (v)->data[0].v_pointer
-#define g_marshal_value_peek_object(v)   (v)->data[0].v_pointer
-#endif /* !G_ENABLE_DEBUG */
-
-
-/* BOOLEAN:BOOLEAN,POINTER (/tmp/dbus-binding-tool-c-marshallers.DKORHV:1) */
-extern void dbus_glib_marshal_m_dbus_glib_input_context_adaptor_BOOLEAN__BOOLEAN_POINTER (GClosure     *closure,
-                                                                                          GValue       *return_value,
-                                                                                          guint         n_param_values,
-                                                                                          const GValue *param_values,
-                                                                                          gpointer      invocation_hint,
-                                                                                          gpointer      marshal_data);
-void
-dbus_glib_marshal_m_dbus_glib_input_context_adaptor_BOOLEAN__BOOLEAN_POINTER (GClosure     *closure,
-                                                                              GValue       *return_value G_GNUC_UNUSED,
-                                                                              guint         n_param_values,
-                                                                              const GValue *param_values,
-                                                                              gpointer      invocation_hint G_GNUC_UNUSED,
-                                                                              gpointer      marshal_data)
-{
-  typedef gboolean (*GMarshalFunc_BOOLEAN__BOOLEAN_POINTER) (gpointer     data1,
-                                                             gboolean     arg_1,
-                                                             gpointer     arg_2,
-                                                             gpointer     data2);
-  register GMarshalFunc_BOOLEAN__BOOLEAN_POINTER callback;
-  register GCClosure *cc = (GCClosure*) closure;
-  register gpointer data1, data2;
-  gboolean v_return;
-
-  g_return_if_fail (return_value != NULL);
-  g_return_if_fail (n_param_values == 3);
-
-  if (G_CCLOSURE_SWAP_DATA (closure))
-    {
-      data1 = closure->data;
-      data2 = g_value_peek_pointer (param_values + 0);
-    }
-  else
-    {
-      data1 = g_value_peek_pointer (param_values + 0);
-      data2 = closure->data;
-    }
-  callback = (GMarshalFunc_BOOLEAN__BOOLEAN_POINTER) (marshal_data ? marshal_data : cc->callback);
-
-  v_return = callback (data1,
-                       g_marshal_value_peek_boolean (param_values + 1),
-                       g_marshal_value_peek_pointer (param_values + 2),
-                       data2);
-
-  g_value_set_boolean (return_value, v_return);
-}
-
-/* BOOLEAN:POINTER,POINTER,POINTER,POINTER,POINTER,POINTER (/tmp/dbus-binding-tool-c-marshallers.DKORHV:2) */
-extern void dbus_glib_marshal_m_dbus_glib_input_context_adaptor_BOOLEAN__POINTER_POINTER_POINTER_POINTER_POINTER_POINTER (GClosure     *closure,
-                                                                                                                          GValue       *return_value,
-                                                                                                                          guint         n_param_values,
-                                                                                                                          const GValue *param_values,
-                                                                                                                          gpointer      invocation_hint,
-                                                                                                                          gpointer      marshal_data);
-void
-dbus_glib_marshal_m_dbus_glib_input_context_adaptor_BOOLEAN__POINTER_POINTER_POINTER_POINTER_POINTER_POINTER (GClosure     *closure,
-                                                                                                              GValue       *return_value G_GNUC_UNUSED,
-                                                                                                              guint         n_param_values,
-                                                                                                              const GValue *param_values,
-                                                                                                              gpointer      invocation_hint G_GNUC_UNUSED,
-                                                                                                              gpointer      marshal_data)
-{
-  typedef gboolean (*GMarshalFunc_BOOLEAN__POINTER_POINTER_POINTER_POINTER_POINTER_POINTER) (gpointer     data1,
-                                                                                             gpointer     arg_1,
-                                                                                             gpointer     arg_2,
-                                                                                             gpointer     arg_3,
-                                                                                             gpointer     arg_4,
-                                                                                             gpointer     arg_5,
-                                                                                             gpointer     arg_6,
-                                                                                             gpointer     data2);
-  register GMarshalFunc_BOOLEAN__POINTER_POINTER_POINTER_POINTER_POINTER_POINTER callback;
-  register GCClosure *cc = (GCClosure*) closure;
-  register gpointer data1, data2;
-  gboolean v_return;
-
-  g_return_if_fail (return_value != NULL);
-  g_return_if_fail (n_param_values == 7);
-
-  if (G_CCLOSURE_SWAP_DATA (closure))
-    {
-      data1 = closure->data;
-      data2 = g_value_peek_pointer (param_values + 0);
-    }
-  else
-    {
-      data1 = g_value_peek_pointer (param_values + 0);
-      data2 = closure->data;
-    }
-  callback = (GMarshalFunc_BOOLEAN__POINTER_POINTER_POINTER_POINTER_POINTER_POINTER) (marshal_data ? marshal_data : cc->callback);
-
-  v_return = callback (data1,
-                       g_marshal_value_peek_pointer (param_values + 1),
-                       g_marshal_value_peek_pointer (param_values + 2),
-                       g_marshal_value_peek_pointer (param_values + 3),
-                       g_marshal_value_peek_pointer (param_values + 4),
-                       g_marshal_value_peek_pointer (param_values + 5),
-                       g_marshal_value_peek_pointer (param_values + 6),
-                       data2);
-
-  g_value_set_boolean (return_value, v_return);
-}
-
-/* BOOLEAN:BOXED,POINTER (/tmp/dbus-binding-tool-c-marshallers.DKORHV:3) */
-extern void dbus_glib_marshal_m_dbus_glib_input_context_adaptor_BOOLEAN__BOXED_POINTER (GClosure     *closure,
-                                                                                        GValue       *return_value,
-                                                                                        guint         n_param_values,
-                                                                                        const GValue *param_values,
-                                                                                        gpointer      invocation_hint,
-                                                                                        gpointer      marshal_data);
-void
-dbus_glib_marshal_m_dbus_glib_input_context_adaptor_BOOLEAN__BOXED_POINTER (GClosure     *closure,
-                                                                            GValue       *return_value G_GNUC_UNUSED,
-                                                                            guint         n_param_values,
-                                                                            const GValue *param_values,
-                                                                            gpointer      invocation_hint G_GNUC_UNUSED,
-                                                                            gpointer      marshal_data)
-{
-  typedef gboolean (*GMarshalFunc_BOOLEAN__BOXED_POINTER) (gpointer     data1,
-                                                           gpointer     arg_1,
-                                                           gpointer     arg_2,
-                                                           gpointer     data2);
-  register GMarshalFunc_BOOLEAN__BOXED_POINTER callback;
-  register GCClosure *cc = (GCClosure*) closure;
-  register gpointer data1, data2;
-  gboolean v_return;
-
-  g_return_if_fail (return_value != NULL);
-  g_return_if_fail (n_param_values == 3);
-
-  if (G_CCLOSURE_SWAP_DATA (closure))
-    {
-      data1 = closure->data;
-      data2 = g_value_peek_pointer (param_values + 0);
-    }
-  else
-    {
-      data1 = g_value_peek_pointer (param_values + 0);
-      data2 = closure->data;
-    }
-  callback = (GMarshalFunc_BOOLEAN__BOXED_POINTER) (marshal_data ? marshal_data : cc->callback);
-
-  v_return = callback (data1,
-                       g_marshal_value_peek_boxed (param_values + 1),
-                       g_marshal_value_peek_pointer (param_values + 2),
-                       data2);
-
-  g_value_set_boolean (return_value, v_return);
-}
-
-/* BOOLEAN:POINTER (/tmp/dbus-binding-tool-c-marshallers.DKORHV:4) */
-extern void dbus_glib_marshal_m_dbus_glib_input_context_adaptor_BOOLEAN__POINTER (GClosure     *closure,
-                                                                                  GValue       *return_value,
-                                                                                  guint         n_param_values,
-                                                                                  const GValue *param_values,
-                                                                                  gpointer      invocation_hint,
-                                                                                  gpointer      marshal_data);
-void
-dbus_glib_marshal_m_dbus_glib_input_context_adaptor_BOOLEAN__POINTER (GClosure     *closure,
-                                                                      GValue       *return_value G_GNUC_UNUSED,
-                                                                      guint         n_param_values,
-                                                                      const GValue *param_values,
-                                                                      gpointer      invocation_hint G_GNUC_UNUSED,
-                                                                      gpointer      marshal_data)
-{
-  typedef gboolean (*GMarshalFunc_BOOLEAN__POINTER) (gpointer     data1,
-                                                     gpointer     arg_1,
-                                                     gpointer     data2);
-  register GMarshalFunc_BOOLEAN__POINTER callback;
-  register GCClosure *cc = (GCClosure*) closure;
-  register gpointer data1, data2;
-  gboolean v_return;
-
-  g_return_if_fail (return_value != NULL);
-  g_return_if_fail (n_param_values == 2);
-
-  if (G_CCLOSURE_SWAP_DATA (closure))
-    {
-      data1 = closure->data;
-      data2 = g_value_peek_pointer (param_values + 0);
-    }
-  else
-    {
-      data1 = g_value_peek_pointer (param_values + 0);
-      data2 = closure->data;
-    }
-  callback = (GMarshalFunc_BOOLEAN__POINTER) (marshal_data ? marshal_data : cc->callback);
-
-  v_return = callback (data1,
-                       g_marshal_value_peek_pointer (param_values + 1),
-                       data2);
-
-  g_value_set_boolean (return_value, v_return);
-}
-
-/* BOOLEAN:STRING,UINT,POINTER (/tmp/dbus-binding-tool-c-marshallers.DKORHV:5) */
-extern void dbus_glib_marshal_m_dbus_glib_input_context_adaptor_BOOLEAN__STRING_UINT_POINTER (GClosure     *closure,
-                                                                                              GValue       *return_value,
-                                                                                              guint         n_param_values,
-                                                                                              const GValue *param_values,
-                                                                                              gpointer      invocation_hint,
-                                                                                              gpointer      marshal_data);
-void
-dbus_glib_marshal_m_dbus_glib_input_context_adaptor_BOOLEAN__STRING_UINT_POINTER (GClosure     *closure,
-                                                                                  GValue       *return_value G_GNUC_UNUSED,
-                                                                                  guint         n_param_values,
-                                                                                  const GValue *param_values,
-                                                                                  gpointer      invocation_hint G_GNUC_UNUSED,
-                                                                                  gpointer      marshal_data)
-{
-  typedef gboolean (*GMarshalFunc_BOOLEAN__STRING_UINT_POINTER) (gpointer     data1,
-                                                                 gpointer     arg_1,
-                                                                 guint        arg_2,
-                                                                 gpointer     arg_3,
-                                                                 gpointer     data2);
-  register GMarshalFunc_BOOLEAN__STRING_UINT_POINTER callback;
-  register GCClosure *cc = (GCClosure*) closure;
-  register gpointer data1, data2;
-  gboolean v_return;
-
-  g_return_if_fail (return_value != NULL);
-  g_return_if_fail (n_param_values == 4);
-
-  if (G_CCLOSURE_SWAP_DATA (closure))
-    {
-      data1 = closure->data;
-      data2 = g_value_peek_pointer (param_values + 0);
-    }
-  else
-    {
-      data1 = g_value_peek_pointer (param_values + 0);
-      data2 = closure->data;
-    }
-  callback = (GMarshalFunc_BOOLEAN__STRING_UINT_POINTER) (marshal_data ? marshal_data : cc->callback);
-
-  v_return = callback (data1,
-                       g_marshal_value_peek_string (param_values + 1),
-                       g_marshal_value_peek_uint (param_values + 2),
-                       g_marshal_value_peek_pointer (param_values + 3),
-                       data2);
-
-  g_value_set_boolean (return_value, v_return);
-}
-
-/* BOOLEAN:STRING,POINTER (/tmp/dbus-binding-tool-c-marshallers.DKORHV:6) */
-extern void dbus_glib_marshal_m_dbus_glib_input_context_adaptor_BOOLEAN__STRING_POINTER (GClosure     *closure,
-                                                                                         GValue       *return_value,
-                                                                                         guint         n_param_values,
-                                                                                         const GValue *param_values,
-                                                                                         gpointer      invocation_hint,
-                                                                                         gpointer      marshal_data);
-void
-dbus_glib_marshal_m_dbus_glib_input_context_adaptor_BOOLEAN__STRING_POINTER (GClosure     *closure,
-                                                                             GValue       *return_value G_GNUC_UNUSED,
-                                                                             guint         n_param_values,
-                                                                             const GValue *param_values,
-                                                                             gpointer      invocation_hint G_GNUC_UNUSED,
-                                                                             gpointer      marshal_data)
-{
-  typedef gboolean (*GMarshalFunc_BOOLEAN__STRING_POINTER) (gpointer     data1,
-                                                            gpointer     arg_1,
-                                                            gpointer     arg_2,
-                                                            gpointer     data2);
-  register GMarshalFunc_BOOLEAN__STRING_POINTER callback;
-  register GCClosure *cc = (GCClosure*) closure;
-  register gpointer data1, data2;
-  gboolean v_return;
-
-  g_return_if_fail (return_value != NULL);
-  g_return_if_fail (n_param_values == 3);
-
-  if (G_CCLOSURE_SWAP_DATA (closure))
-    {
-      data1 = closure->data;
-      data2 = g_value_peek_pointer (param_values + 0);
-    }
-  else
-    {
-      data1 = g_value_peek_pointer (param_values + 0);
-      data2 = closure->data;
-    }
-  callback = (GMarshalFunc_BOOLEAN__STRING_POINTER) (marshal_data ? marshal_data : cc->callback);
-
-  v_return = callback (data1,
-                       g_marshal_value_peek_string (param_values + 1),
-                       g_marshal_value_peek_pointer (param_values + 2),
-                       data2);
-
-  g_value_set_boolean (return_value, v_return);
-}
-
-/* BOOLEAN:INT,INT,INT,STRING,BOOLEAN,INT,POINTER (/tmp/dbus-binding-tool-c-marshallers.DKORHV:7) */
-extern void dbus_glib_marshal_m_dbus_glib_input_context_adaptor_BOOLEAN__INT_INT_INT_STRING_BOOLEAN_INT_POINTER (GClosure     *closure,
-                                                                                                                 GValue       *return_value,
-                                                                                                                 guint         n_param_values,
-                                                                                                                 const GValue *param_values,
-                                                                                                                 gpointer      invocation_hint,
-                                                                                                                 gpointer      marshal_data);
-void
-dbus_glib_marshal_m_dbus_glib_input_context_adaptor_BOOLEAN__INT_INT_INT_STRING_BOOLEAN_INT_POINTER (GClosure     *closure,
-                                                                                                     GValue       *return_value G_GNUC_UNUSED,
-                                                                                                     guint         n_param_values,
-                                                                                                     const GValue *param_values,
-                                                                                                     gpointer      invocation_hint G_GNUC_UNUSED,
-                                                                                                     gpointer      marshal_data)
-{
-  typedef gboolean (*GMarshalFunc_BOOLEAN__INT_INT_INT_STRING_BOOLEAN_INT_POINTER) (gpointer     data1,
-                                                                                    gint         arg_1,
-                                                                                    gint         arg_2,
-                                                                                    gint         arg_3,
-                                                                                    gpointer     arg_4,
-                                                                                    gboolean     arg_5,
-                                                                                    gint         arg_6,
-                                                                                    gpointer     arg_7,
-                                                                                    gpointer     data2);
-  register GMarshalFunc_BOOLEAN__INT_INT_INT_STRING_BOOLEAN_INT_POINTER callback;
-  register GCClosure *cc = (GCClosure*) closure;
-  register gpointer data1, data2;
-  gboolean v_return;
-
-  g_return_if_fail (return_value != NULL);
-  g_return_if_fail (n_param_values == 8);
-
-  if (G_CCLOSURE_SWAP_DATA (closure))
-    {
-      data1 = closure->data;
-      data2 = g_value_peek_pointer (param_values + 0);
-    }
-  else
-    {
-      data1 = g_value_peek_pointer (param_values + 0);
-      data2 = closure->data;
-    }
-  callback = (GMarshalFunc_BOOLEAN__INT_INT_INT_STRING_BOOLEAN_INT_POINTER) (marshal_data ? marshal_data : cc->callback);
-
-  v_return = callback (data1,
-                       g_marshal_value_peek_int (param_values + 1),
-                       g_marshal_value_peek_int (param_values + 2),
-                       g_marshal_value_peek_int (param_values + 3),
-                       g_marshal_value_peek_string (param_values + 4),
-                       g_marshal_value_peek_boolean (param_values + 5),
-                       g_marshal_value_peek_int (param_values + 6),
-                       g_marshal_value_peek_pointer (param_values + 7),
-                       data2);
-
-  g_value_set_boolean (return_value, v_return);
-}
-
-G_END_DECLS
-
-#endif /* __dbus_glib_marshal_m_dbus_glib_input_context_adaptor_MARSHAL_H__ */
-
-#include <dbus/dbus-glib.h>
-static const DBusGMethodInfo dbus_glib_m_dbus_glib_input_context_adaptor_methods[] = {
-  { (GCallback) m_dbus_glib_input_context_adaptor_activation_lost_event, dbus_glib_marshal_m_dbus_glib_input_context_adaptor_BOOLEAN__POINTER, 0 },
-  { (GCallback) m_dbus_glib_input_context_adaptor_im_initiated_hide, dbus_glib_marshal_m_dbus_glib_input_context_adaptor_BOOLEAN__POINTER, 59 },
-  { (GCallback) m_dbus_glib_input_context_adaptor_commit_string, dbus_glib_marshal_m_dbus_glib_input_context_adaptor_BOOLEAN__STRING_POINTER, 114 },
-  { (GCallback) m_dbus_glib_input_context_adaptor_update_preedit, dbus_glib_marshal_m_dbus_glib_input_context_adaptor_BOOLEAN__STRING_UINT_POINTER, 175 },
-  { (GCallback) m_dbus_glib_input_context_adaptor_key_event, dbus_glib_marshal_m_dbus_glib_input_context_adaptor_BOOLEAN__INT_INT_INT_STRING_BOOLEAN_INT_POINTER, 246 },
-  { (GCallback) m_dbus_glib_input_context_adaptor_update_input_method_area, dbus_glib_marshal_m_dbus_glib_input_context_adaptor_BOOLEAN__BOXED_POINTER, 348 },
-  { (GCallback) m_dbus_glib_input_context_adaptor_set_global_correction_enabled, dbus_glib_marshal_m_dbus_glib_input_context_adaptor_BOOLEAN__BOOLEAN_POINTER, 419 },
-  { (GCallback) m_dbus_glib_input_context_adaptor_preedit_rectangle, dbus_glib_marshal_m_dbus_glib_input_context_adaptor_BOOLEAN__POINTER_POINTER_POINTER_POINTER_POINTER_POINTER, 494 },
-  { (GCallback) m_dbus_glib_input_context_adaptor_copy, dbus_glib_marshal_m_dbus_glib_input_context_adaptor_BOOLEAN__POINTER, 615 },
-  { (GCallback) m_dbus_glib_input_context_adaptor_paste, dbus_glib_marshal_m_dbus_glib_input_context_adaptor_BOOLEAN__POINTER, 659 },
-  { (GCallback) m_dbus_glib_input_context_adaptor_set_redirect_keys, dbus_glib_marshal_m_dbus_glib_input_context_adaptor_BOOLEAN__BOOLEAN_POINTER, 704 },
-  { (GCallback) m_dbus_glib_input_context_adaptor_set_detectable_auto_repeat, dbus_glib_marshal_m_dbus_glib_input_context_adaptor_BOOLEAN__BOOLEAN_POINTER, 768 },
-};
-
-const DBusGObjectInfo dbus_glib_m_dbus_glib_input_context_adaptor_object_info = {
-  0,
-  dbus_glib_m_dbus_glib_input_context_adaptor_methods,
-  12,
-"com.meego.inputmethod.inputcontext1\0activationLostEvent\0S\0\0com.meego.inputmethod.inputcontext1\0imInitiatedHide\0S\0\0com.meego.inputmethod.inputcontext1\0commitString\0S\0arg0\0I\0s\0\0com.meego.inputmethod.inputcontext1\0updatePreedit\0S\0arg0\0I\0s\0arg1\0I\0u\0\0com.meego.inputmethod.inputcontext1\0keyEvent\0S\0arg0\0I\0i\0arg1\0I\0i\0arg2\0I\0i\0arg3\0I\0s\0arg4\0I\0b\0arg5\0I\0i\0\0com.meego.inputmethod.inputcontext1\0updateInputMethodArea\0S\0arg0\0I\0ay\0\0com.meego.inputmethod.inputcontext1\0setGlobalCorrectionEnabled\0S\0arg0\0I\0b\0\0com.meego.inputmethod.inputcontext1\0preeditRectangle\0S\0arg0\0O\0F\0N\0b\0arg1\0O\0F\0N\0i\0arg2\0O\0F\0N\0i\0arg3\0O\0F\0N\0i\0arg4\0O\0F\0N\0i\0\0com.meego.inputmethod.inputcontext1\0copy\0S\0\0com.meego.inputmethod.inputcontext1\0paste\0S\0\0com.meego.inputmethod.inputcontext1\0setRedirectKeys\0S\0arg0\0I\0b\0\0com.meego.inputmethod.inputcontext1\0setDetectableAutoRepeat\0S\0arg0\0I\0b\0\0\0",
-"\0",
-"\0"
-};
-
--- input-context/mdbusglibinputcontextadaptor.cpp
+++ input-context/mdbusglibinputcontextadaptor.cpp
@@ -47,16 +47,17 @@
     GError **/*error*/)
 {
     obj->inputContext->updatePreedit(QString::fromUtf8(string),
-                                     static_cast<PreeditFace>(preeditFace));
+                                     static_cast<MInputMethod::PreeditFace>(preeditFace));
     return TRUE;
 }
 
 static gboolean m_dbus_glib_input_context_adaptor_key_event(
     MDBusGlibInputContextAdaptor *obj, gint32 type, gint32 key, gint32 modifiers, const char *text,
-    gboolean autoRepeat, gint32 count, GError **/*error*/)
+    gboolean autoRepeat, gint32 count, guchar requestType, GError **/*error*/)
 {
     obj->inputContext->keyEvent(type, key, modifiers, QString::fromUtf8(text),
-                                autoRepeat == TRUE, count);
+                                autoRepeat == TRUE, count,
+                                static_cast<MInputMethod::EventRequestType>(requestType));
     return TRUE;
 }
 
--- input-context/minputcontext.cpp
+++ input-context/minputcontext.cpp
@@ -33,14 +33,8 @@
 #include <MLibrary>
 #include <MInputMethodState>
 
-#ifdef QT_DBUS
-#include <QDBusConnection>
-#include "minputcontextadaptor.h"
-#include "qtdbusimserverproxy.h"
-#else
 #include "mdbusglibinputcontextadaptor.h"
 #include "glibdbusimserverproxy.h"
-#endif
 #include "mpreeditstyle.h"
 #include "mtimestamp.h"
 
@@ -73,6 +67,7 @@
       styleContainer(0),
       connectedObject(0),
       pasteAvailable(false),
+      copyAvailable(false),
       copyAllowed(true),
       redirectKeys(false),
       objectPath(QString("%1%2").arg(DBusCallbackPath).arg(++connectionCount))
@@ -150,25 +145,12 @@
 void MInputContext::connectToDBus()
 {
     qDebug() << __PRETTY_FUNCTION__;
-#ifdef QT_DBUS
-    imServer = new QtDBusIMServerProxy(dbusObjectPath());
-
-    // connect methods we are offering to DBus
-    new MInputContextAdaptor(this);
-
-    if (!QDBusConnection::sessionBus().registerObject(dbusObjectPath(), this)) {
-        qCritical("MInputContext failed to register object via D-Bus: %s",
-                  dbusObjectPath().toAscii().data());
-    }
-
-#else
     MDBusGlibInputContextAdaptor *inputContextAdaptor
         = M_DBUS_GLIB_INPUT_CONTEXT_ADAPTOR(
             g_object_new(M_TYPE_DBUS_GLIB_INPUT_CONTEXT_ADAPTOR, NULL));
 
     inputContextAdaptor->inputContext = this;
     imServer = new GlibDBusIMServerProxy(G_OBJECT(inputContextAdaptor), DBusCallbackPath);
-#endif
 
     connect(imServer, SIGNAL(dbusConnected()), this, SLOT(onDBusConnection()));
     connect(imServer, SIGNAL(dbusDisconnected()), this, SLOT(onDBusDisconnection()));
@@ -189,8 +171,9 @@
                                     << injectionEvent->preedit();
             // 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().
+            updatePreedit(injectionEvent->preedit(), MInputMethod::PreeditDefault);
             imServer->setPreedit(injectionEvent->preedit());
-            updatePreedit(injectionEvent->preedit(), PreeditDefault);
 
             event->accept();
             return true;
@@ -236,7 +219,7 @@
     mDebug("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 
+    // allowed, but trolls gave permission to use it. Most of qt's internal
     // input methods do the same thing.
     QInputMethodEvent event;
     event.setCommitString(preedit);
@@ -295,8 +278,6 @@
 {
     QObject *focusedObject = focused;
     QGraphicsItem *focusItem = 0;
-    bool copyAvailable = false;
-
     mDebug("MInputContext") << "in" << __PRETTY_FUNCTION__ << focused;
     QInputContext::setFocusWidget(focused);
 
@@ -339,16 +320,19 @@
             copyAllowed = !(focused->inputMethodHints() & Qt::ImhHiddenText);
         }
 
-        // FIXME: paste status doesn't update if paste becomes available from application side
         pasteAvailable = !QApplication::clipboard()->text().isEmpty();
 
+        connect(QApplication::clipboard(), SIGNAL(dataChanged()), this, SLOT(handleClipboardDataChange()), Qt::UniqueConnection);
     } else {
+        copyAvailable = false;
         copyAllowed = false;
         imServer->updateWidgetInformation(stateInformation, true);
+
+        disconnect(QApplication::clipboard(), SIGNAL(dataChanged()), this, 0);
     }
 
     // show or hide Copy/Paste button on input method server
-    manageCopyPasteState(copyAvailable);
+    notifyCopyPasteState();
 
     if (inputPanelState == InputPanelShowPending && focused) {
         imServer->showInputMethod();
@@ -370,7 +354,7 @@
     if (focusedObject && focusedObject->metaObject()
             && focusedObject->metaObject()->indexOfSignal(signalName) != -1) {
         connect(focusedObject, SIGNAL(copyAvailable(bool)),
-                this, SLOT(manageCopyPasteState(bool)));
+                this, SLOT(handleCopyAvailabilityChange(bool)));
         connectedObject = focusedObject;
     }
 }
@@ -485,7 +469,7 @@
 }
 
 
-void MInputContext::updatePreedit(const QString &string, PreeditFace preeditFace)
+void MInputContext::updatePreedit(const QString &string, MInputMethod::PreeditFace preeditFace)
 {
     mDebug("MInputContext") << "in" << __PRETTY_FUNCTION__ << "preedit:" << string;
     mTimestamp("MInputContext", string);
@@ -494,15 +478,15 @@
 
     // update style mode
     switch (preeditFace) {
-    case PreeditNoCandidates:
+    case MInputMethod::PreeditNoCandidates:
         styleContainer->setModeNoCandidates();
         break;
 
-    case PreeditKeyPress:
+    case MInputMethod::PreeditKeyPress:
         styleContainer->setModeKeyPress();
         break;
 
-    case PreeditDefault:
+    case MInputMethod::PreeditDefault:
     default:
         styleContainer->setModeDefault();
     }
@@ -511,6 +495,7 @@
     QTextCharFormat format;
     format.merge(standardFormat(QInputContext::PreeditFormat));
     format.setUnderlineStyle((*styleContainer)->underline());
+    format.setUnderlineColor((*styleContainer)->underlineColor());
     QColor color = (*styleContainer)->backgroundColor();
 
     if (color.isValid()) {
@@ -534,20 +519,28 @@
 
 
 void MInputContext::keyEvent(int type, int key, int modifiers, const QString &text,
-                             bool autoRepeat, int count)
+                             bool autoRepeat, int count,
+                             MInputMethod::EventRequestType requestType)
 {
     mDebug("MInputContext") << "in" << __PRETTY_FUNCTION__;
 
-    if (focusWidget() == 0) {
-        return;
-    }
-
-    // just construct an event instance out of the parameters.
-    QKeyEvent event(static_cast<QEvent::Type>(type), key,
+    // Construct an event instance out of the parameters.
+    QEvent::Type eventType = static_cast<QEvent::Type>(type);
+    QKeyEvent event(eventType, key,
                     static_cast<Qt::KeyboardModifiers>(modifiers),
                     text, autoRepeat, count);
 
-    QCoreApplication::sendEvent(focusWidget(), &event);
+    if (requestType != MInputMethod::EventRequestEventOnly) {
+        if (eventType == QEvent::KeyPress) {
+            MInputMethodState::instance()->emitKeyPress(event);
+        } else if (eventType == QEvent::KeyRelease) {
+            MInputMethodState::instance()->emitKeyRelease(event);
+        }
+    }
+
+    if (focusWidget() != 0 && requestType != MInputMethod::EventRequestSignalOnly) {
+        QCoreApplication::sendEvent(focusWidget(), &event);
+    }
 }
 
 
@@ -577,6 +570,17 @@
 }
 
 
+void MInputContext::handleClipboardDataChange()
+{
+    bool newPasteAvailable = !QApplication::clipboard()->text().isEmpty();
+
+    if (newPasteAvailable != pasteAvailable) {
+        pasteAvailable = newPasteAvailable;
+        notifyCopyPasteState();
+    }
+}
+
+
 void MInputContext::copy()
 {
     bool ok = false;
@@ -592,8 +596,6 @@
         keyEvent(QEvent::KeyPress, Qt::Key_C, Qt::ControlModifier, "", false, 1);
         keyEvent(QEvent::KeyRelease, Qt::Key_C, Qt::ControlModifier, "", false, 1);
     }
-
-    pasteAvailable = !QApplication::clipboard()->text().isEmpty(); //verify if something was copied
 }
 
 
@@ -612,10 +614,6 @@
         keyEvent(QEvent::KeyPress, Qt::Key_V, Qt::ControlModifier, "", false, 1);
         keyEvent(QEvent::KeyRelease, Qt::Key_V, Qt::ControlModifier, "", false, 1);
     }
-
-    QApplication::clipboard()->clear();
-    pasteAvailable = false;
-    manageCopyPasteState(false); // there is no chance to have selection after paste
 }
 
 
@@ -624,7 +622,6 @@
     qDebug() << __PRETTY_FUNCTION__;
     active = false;
     redirectKeys = false;
-    inputPanelState = InputPanelHidden;
     MInputMethodState::instance()->setInputMethodArea(QRect());
 }
 
@@ -643,16 +640,25 @@
         // onDBusDisconnection set active to false.
         active = false;
         setFocusWidget(widget);
-        imServer->showInputMethod();
-        inputPanelState = InputPanelShown;
+        if (inputPanelState != InputPanelHidden) {
+            imServer->showInputMethod();
+            inputPanelState = InputPanelShown;
+        }
     }
 }
 
-void MInputContext::manageCopyPasteState(bool copyAvailable)
+void MInputContext::handleCopyAvailabilityChange(bool copyAvailable)
 {
-    imServer->setCopyPasteState(copyAvailable && copyAllowed, pasteAvailable);
+    if (this->copyAvailable != copyAvailable) {
+        this->copyAvailable = copyAvailable;
+        notifyCopyPasteState();
+    }
 }
 
+void MInputContext::notifyCopyPasteState()
+{
+    imServer->setCopyPasteState(copyAvailable && copyAllowed, pasteAvailable);
+}
 
 void MInputContext::notifyOrientationChange(M::OrientationAngle orientation)
 {
--- input-context/minputcontext.h
+++ input-context/minputcontext.h
@@ -23,16 +23,11 @@
 #include <QPointer>
 
 #include <mnamespace.h>
-#include <mpreeditface.h>
+#include <minputmethodnamespace.h>
 
 class MPreeditStyleContainer;
-#ifdef QT_DBUS
-class QtDBusIMServerProxy;
-typedef QtDBusIMServerProxy DBusIMServerProxy;
-#else
 class GlibDBusIMServerProxy;
 typedef GlibDBusIMServerProxy DBusIMServerProxy;
-#endif
 
 /*!
  * \brief On the application side, MInputContext implements input method
@@ -87,11 +82,12 @@
     // \brief Updates preedit string of the current focus widget
     // \param string    The new string
     // \param preeditFace Selects style for preedit string
-    virtual void updatePreedit(const QString &string, PreeditFace preeditFace);
+    virtual void updatePreedit(const QString &string, MInputMethod::PreeditFace preeditFace);
 
     //! \brief Sends a non-printable key event. Parameters as in QKeyEvent constructor
     virtual void keyEvent(int type, int key, int modifiers, const QString &text, bool autoRepeat,
-                          int count);
+                          int count, MInputMethod::EventRequestType requestType
+                          = MInputMethod::EventRequestBoth);
 
     //!
     // \brief Updates the input method window area
@@ -146,10 +142,10 @@
     void onDBusConnection();
 
     /*!
-     * \brief Notifies input method server of copy/paste availability.
+     * \brief Notifies input method server of copy availability.
      * \param copyAvailable bool Specifies wheter copy is available
      */
-    void manageCopyPasteState(bool copyAvailable);
+    void handleCopyAvailabilityChange(bool copyAvailable);
 
     //! Notify input method plugin about new \a orientation angle of application's active window.
     void notifyOrientationChange(M::OrientationAngle orientation);
@@ -163,6 +159,9 @@
     //! Notify input method plugin about the \attribute of the \a item in the custom toolbar which has the unique \a id is changed to \a value.
     void notifyToolbarItemAttributeChanged(int id, const QString &item, const QString &attribute, const QVariant& value);
 
+    //! Checks whether there is someting to paste in the clipboard and notifies input method plugin about it.
+    void handleClipboardDataChange();
+
 private:
     Q_DISABLE_COPY(MInputContext)
 
@@ -174,6 +173,8 @@
 
     void connectToDBus();
 
+    void notifyCopyPasteState();
+
     //! returns content type corresponding to specified hints
     M::TextContentType contentType(Qt::InputMethodHints hints) const;
 
@@ -205,6 +206,7 @@
 
     QPointer<QObject> connectedObject;
     bool pasteAvailable;
+    bool copyAvailable;
     bool copyAllowed;
     //! redirect all hw key events to the input method or not
     bool redirectKeys;
--- input-context/minputcontextadaptor.cpp
+++ input-context/minputcontextadaptor.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 "minputcontext.h"
-#include "minputcontextadaptor.h"
-
-#include <QDBusArgument>
-
-
-MInputContextAdaptor::MInputContextAdaptor(MInputContext *parent)
-    : QDBusAbstractAdaptor(parent),
-      owner(parent)
-{
-    if (!parent) {
-        qFatal("Creating MInputContextAdaptor without a parent");
-    }
-}
-
-
-MInputContextAdaptor::~MInputContextAdaptor()
-{
-    // nothing
-}
-
-
-void MInputContextAdaptor::activationLostEvent()
-{
-    owner->activationLostEvent();
-}
-
-
-void MInputContextAdaptor::imInitiatedHide()
-{
-    owner->imInitiatedHide();
-}
-
-
-void MInputContextAdaptor::commitString(const QString &string)
-{
-    owner->commitString(string);
-}
-
-
-void MInputContextAdaptor::updatePreedit(const QString &string, int preeditFace)
-{
-    PreeditFace face = PreeditDefault;
-
-    if (preeditFace >= PreeditDefault
-        && preeditFace <= PreeditNoCandidates)
-        face = PreeditFace(preeditFace);
-
-    owner->updatePreedit(string, face);
-}
-
-
-void MInputContextAdaptor::keyEvent(int type, int key, int modifiers, const QString &text,
-                                    bool autoRepeat, int count)
-{
-    owner->keyEvent(type, key, modifiers, text, autoRepeat, count);
-}
-
-
-void MInputContextAdaptor::updateInputMethodArea(const QList<QVariant>& data)
-{
-    QList<QVariant> newData;
-    const int dataSize = data.size();
-    for (int i = 0; i < dataSize; ++i) {
-        QDBusArgument e = qvariant_cast<QDBusArgument>(data.at(i));
-        QRect r = qdbus_cast<QRect>(e);
-        newData.append(r);
-    }
-    owner->updateInputMethodArea(newData);
-}
-
-
-void MInputContextAdaptor::setGlobalCorrectionEnabled(bool enabled)
-{
-    owner->setGlobalCorrectionEnabled(enabled);
-}
-
-
-void MInputContextAdaptor::copy()
-{
-    owner->copy();
-}
-
-
-void MInputContextAdaptor::paste()
-{
-    owner->paste();
-}
-
-QRect MInputContextAdaptor::preeditRectangle(bool &valid)
-{
-    return owner->preeditRectangle(valid);
-}
-
-void MInputContextAdaptor::setRedirectKeys(bool enabled)
-{
-    owner->setRedirectKeys(enabled);
-}
-
-void MInputContextAdaptor::setDetectableAutoRepeat(bool enabled)
-{
-    owner->setDetectableAutoRepeat(enabled);
-}
--- input-context/minputcontextadaptor.h
+++ input-context/minputcontextadaptor.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 MINPUTCONTEXTADAPTOR_H
-#define MINPUTCONTEXTADAPTOR_H
-
-#include <QString>
-#include <QDBusAbstractAdaptor>
-#include <QList>
-#include <QMap>
-#include <QRect>
-
-class MInputContext;
-
-
-class MInputContextAdaptor: public QDBusAbstractAdaptor
-{
-    Q_OBJECT
-    Q_CLASSINFO("D-Bus Interface", "com.meego.inputmethod.inputcontext1")
-
-    // FIXME: introspection
-
-public:
-    explicit MInputContextAdaptor(MInputContext *parent);
-    virtual ~MInputContextAdaptor();
-
-public slots:
-    virtual Q_NOREPLY void activationLostEvent();
-    virtual Q_NOREPLY void imInitiatedHide();
-    virtual Q_NOREPLY void commitString(const QString &string);
-    virtual Q_NOREPLY void updatePreedit(const QString &string, int preeditFace);
-    virtual Q_NOREPLY void keyEvent(int type, int key, int modifiers, const QString &text,
-                                    bool autoRepeat, int count);
-    virtual Q_NOREPLY void updateInputMethodArea(const QList<QVariant> &data);
-    virtual Q_NOREPLY void setGlobalCorrectionEnabled(bool);
-    virtual Q_NOREPLY void copy();
-    virtual Q_NOREPLY void paste();
-    virtual Q_NOREPLY void setRedirectKeys(bool enabled);
-    virtual Q_NOREPLY void setDetectableAutoRepeat(bool enabled);
-
-    // valid is out parameter for value validity
-    virtual QRect preeditRectangle(bool &valid);
-
-private:
-    MInputContext *owner;
-};
-
-
-#endif
--- input-context/minputmethodcontext1interface.xml
+++ input-context/minputmethodcontext1interface.xml
@@ -19,6 +19,7 @@
       <arg type="s"/>
       <arg type="b"/>
       <arg type="i"/>
+      <arg type="y"/>
     </method>
     <method name="updateInputMethodArea">
       <arg type="ay"/>
--- input-context/mpreeditstyle.h
+++ input-context/mpreeditstyle.h
@@ -33,6 +33,7 @@
 
 public:
     M_STYLE_ATTRIBUTE(QTextCharFormat::UnderlineStyle, underline, Underline)
+    M_STYLE_ATTRIBUTE(QColor, underlineColor, UnderlineColor)
     M_STYLE_ATTRIBUTE(QColor, fontColor, FontColor)
     M_STYLE_ATTRIBUTE(QColor, backgroundColor, BackgroundColor)
 };
--- input-context/qtdbusimserverproxy.cpp
+++ input-context/qtdbusimserverproxy.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 "qtdbusimserverproxy.h"
-
-#include <QPoint>
-#include <QRect>
-#include <QString>
-#include <QVariant>
-#include <QDebug>
-#include <QDBusConnection>
-#include <QDBusInterface>
-#include <QDBusConnectionInterface>
-
-#include <MDebug>
-
-
-namespace
-{
-    const QString DBusServiceName("com.meego.inputmethod.uiserver1");
-    const QString DBusPath("/com/meego/inputmethod/uiserver1");
-    const QString DBusInterface("com.meego.inputmethod.uiserver1");
-}
-
-
-QtDBusIMServerProxy::QtDBusIMServerProxy(const QString &dbusObjectPath)
-    : iface(NULL),
-      dbusObjectPath(dbusObjectPath)
-{
-    QDBusConnection connection = QDBusConnection::sessionBus();
-
-    if (connection.isConnected() == false) {
-        mDebug("MInputContext") << "Cannot connect to the DBus session bus";
-    }
-
-    QDBusConnectionInterface *connectionInterface = connection.interface();
-
-    // start to follow server changes
-    connect(connectionInterface, SIGNAL(serviceOwnerChanged(QString, QString, QString)),
-            this, SLOT(serviceChangeHandler(QString, QString, QString)));
-
-    // iface MUST NOT be sibling of object of class derived from QDBusAbstractAdaptor
-    // due to bug in Qt
-    iface = new QDBusInterface(DBusServiceName, DBusPath, DBusInterface, connection, 0);
-
-    // The input method server might not be running when MInputContext is created.
-    // The iface validity is rechecked at serviceChangeHandler().
-    if (!iface->isValid()) {
-        mDebug("MInputContext") << "MInputContext was unable to connect to input method server: "
-                                << connection.lastError().message();
-    } else {
-        setContextObject(dbusObjectPath);
-    }
-}
-
-QtDBusIMServerProxy::~QtDBusIMServerProxy()
-{
-}
-
-// Auxiliary connection handling.............................................
-
-void QtDBusIMServerProxy::serviceChangeHandler(const QString &name, const QString &/*oldOwner*/,
-                                               const QString &newOwner)
-{
-    if (name != DBusServiceName) {
-        return;
-    }
-
-    emit dbusDisconnected();
-
-    if (!newOwner.isEmpty()) {
-        if (!iface->isValid()) {
-            if (!iface->isValid()) {
-                // dbus interface don't seem to become valid if on construction the server
-                // wasn't found. workaround this by creating the interface again
-                mDebug("MInputContext") << "recreating dbus interface";
-                delete iface;
-                QDBusConnection connection = QDBusConnection::sessionBus();
-                iface = new QDBusInterface(DBusServiceName, DBusPath, DBusInterface, connection, 0);
-            }
-
-            mDebug("MInputContext")
-                << "InputContext: service owner changed. Registering callback again";
-            setContextObject(dbusObjectPath);
-        }
-        emit dbusConnected();
-    }
-}
-
-
-// Remote methods............................................................
-
-void QtDBusIMServerProxy::setContextObject(const QString &dbusObjectPath)
-{
-    iface->call(QDBus::NoBlock, "setContextObject", dbusObjectPath);
-}
-
-void QtDBusIMServerProxy::activateContext()
-{
-    iface->call(QDBus::NoBlock, "activateContext");
-}
-
-void QtDBusIMServerProxy::showInputMethod()
-{
-    iface->call(QDBus::NoBlock, "showInputMethod");
-}
-
-void QtDBusIMServerProxy::hideInputMethod()
-{
-    iface->call(QDBus::NoBlock, "hideInputMethod");
-}
-
-void QtDBusIMServerProxy::mouseClickedOnPreedit(const QPoint &pos, const QRect &preeditRect)
-{
-    iface->call(QDBus::NoBlock, "mouseClickedOnPreedit", pos, preeditRect);
-}
-
-void QtDBusIMServerProxy::setPreedit(const QString &text)
-{
-    iface->call(QDBus::NoBlock, "setPreedit", text);
-}
-
-void QtDBusIMServerProxy::updateWidgetInformation(const QMap<QString, QVariant> &stateInformation,
-                                                  bool focusChanged)
-{
-    iface->call(QDBus::NoBlock, "updateWidgetInformation", stateInformation, focusChanged);
-}
-
-void QtDBusIMServerProxy::reset()
-{
-    iface->call(QDBus::NoBlock, "reset");
-}
-
-void QtDBusIMServerProxy::appOrientationChanged(int angle)
-{
-    iface->call(QDBus::NoBlock, "appOrientationChanged", angle);
-}
-
-void QtDBusIMServerProxy::setCopyPasteState(bool copyAvailable, bool pasteAvailable)
-{
-    iface->call(QDBus::NoBlock, "setCopyPasteState", copyAvailable, pasteAvailable);
-}
-
-void QtDBusIMServerProxy::processKeyEvent(QEvent::Type keyType, Qt::Key keyCode,
-                                          Qt::KeyboardModifiers modifiers,
-                                          const QString &text, bool autoRepeat, int count,
-                                          quint32 nativeScanCode, quint32 nativeModifiers)
-{
-    iface->call(QDBus::NoBlock, "processKeyEvent", static_cast<int>(keyType),
-                static_cast<int>(keyCode), static_cast<int>(modifiers), text, autoRepeat, count,
-                nativeScanCode, nativeModifiers);
-}
-
-void QtDBusIMServerProxy::registerToolbar(int id, const QString &fileName)
-{
-    iface->call(QDBus::NoBlock, "registerToolbar", id, fileName);
-}
-
-void QtDBusIMServerProxy::unregisterToolbar(int id)
-{
-    iface->call(QDBus::NoBlock, "unregisterToolbar", id);
-}
-
-void QtDBusIMServerProxy::setToolbarItemAttribute(int id, const QString &item,
-                                                  const QString &attribute, const QVariant &value)
-{
-    iface->call(QDBus::NoBlock, "setToolbarItemAttribute", item, attribute, value);
-}
--- input-context/qtdbusimserverproxy.h
+++ input-context/qtdbusimserverproxy.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 QTDBUSIMSERVERPROXY_H
-#define QTDBUSIMSERVERPROXY_H
-
-#include <QObject>
-#include <QEvent>
-#include <Qt>
-#include <QMap>
-
-class QPoint;
-class QRect;
-class QString;
-class QVariant;
-class QRegion;
-class QDBusInterface;
-
-/* \brief Qt D-Bus implementation of a proxy through which input method server
- * methods can be called
- */
-class QtDBusIMServerProxy : public QObject
-{
-    Q_OBJECT
-
-public:
-    QtDBusIMServerProxy(const QString &dbusObjectPath);
-    virtual ~QtDBusIMServerProxy();
-
-    void setContextObject(const QString &dbusObjectPath);
-    void activateContext();
-
-    void showInputMethod();
-
-    void hideInputMethod();
-
-    void mouseClickedOnPreedit(const QPoint &pos, const QRect &preeditRect);
-
-    void setPreedit(const QString &text);
-
-    void updateWidgetInformation(const QMap<QString, QVariant> &stateInformation,
-                                 bool focusChanged);
-
-    void reset();
-
-    void appOrientationChanged(int angle);
-
-    void setCopyPasteState(bool copyAvailable, bool pasteAvailable);
-
-    void processKeyEvent(QEvent::Type keyType, Qt::Key keyCode,
-                         Qt::KeyboardModifiers modifiers,
-                         const QString &text, bool autoRepeat, int count,
-                         quint32 nativeScanCode, quint32 nativeModifiers);
-
-    void registerToolbar(int id, const QString &fileName);
-
-    void unregisterToolbar(int id);
-
-    void setToolbarItemAttribute(int id, const QString &item,
-                                 const QString &attribute, const QVariant &value);
-
-signals:
-    void dbusDisconnected();
-    void dbusConnected();
-
-private slots:
-    void serviceChangeHandler(const QString &name, const QString &oldOwner,
-                              const QString &newOwner);
-
-private:
-    QDBusInterface *iface;
-    QString dbusObjectPath;
-};
-
-#endif
--- mconfig.pri
+++ mconfig.pri
@@ -1,16 +1,8 @@
-# Directories (taken from libmeegotouch)
 unix {
      M_PREFIX = /usr
      M_INSTALL_BIN = $$M_PREFIX/bin
      M_INSTALL_LIBS = $$M_PREFIX/lib
-     M_INSTALL_HEADERS = $$M_PREFIX/include/meegotouch
-     M_THEME_DIR = $$M_PREFIX/share/themes
-     M_TRANSLATION_DIR = $$M_PREFIX/share/l10n/meegotouch
-     M_APPLET_DIR = $$M_PREFIX/lib/meegotouch/applets/
-     M_APPLET_DATA_DIR = $$M_PREFIX/share/meegotouch/applets
-     M_THEME_PRELOAD_DIR = /var/lib/meegotouch/theme/preload.d
-     M_THEME_POST_PRELOAD_DIR = /var/lib/meegotouch/theme/preload.post
-     M_APPLET_SETTINGS_DIR= $$M_PREFIX/share/meegotouch/applets/settings
+     M_INSTALL_HEADERS = $$M_PREFIX/include
 }
 mac {
      # Do mac stuff here
@@ -19,21 +11,12 @@
     INCLUDEPATH += include/
     M_INSTALL_BIN = $$M_PREFIX/bin/
     M_INSTALL_LIBS = $$M_PREFIX/lib/
-    M_INSTALL_HEADERS = $$M_PREFIX/include/meegotouch/
-    M_THEME_DIR = $$M_PREFIX/share/themes
-    M_TRANSLATION_DIR = $$M_PREFIX/share/l10n/meegotouch/
-    M_APPLET_DIR = $$M_PREFIX/lib/meegotouch/applets/
-    M_APPLET_DATA_DIR = $$M_PREFIX/share/meegotouch/applets/
-    M_APPLET_SETTINGS_DIR= $$M_PREFIX/share/meegotouch/applets/settings/
+    M_INSTALL_HEADERS = $$M_PREFIX/include
 }
 win32 {
      # Do win32 stuff here
      M_PREFIX = /usr
      M_INSTALL_BIN = $$M_PREFIX/bin/
      M_INSTALL_LIBS = $$M_PREFIX/lib/
-     M_INSTALL_HEADERS = $$M_PREFIX/include/meegotouch/
-     M_THEME_DIR = $$M_PREFIX/share/themes
-     M_TRANSLATION_DIR = $$M_PREFIX/share/l10n/meegotouch/
-     M_APPLET_DIR = $$M_PREFIX/lib/meegotouch/applets/
-     M_APPLET_DATA_DIR = $$M_PREFIX/share/meegotouch/applets/
+     M_INSTALL_HEADERS = $$M_PREFIX/include
 }
--- passthroughserver/main.cpp
+++ passthroughserver/main.cpp
@@ -34,6 +34,23 @@
 #include "mpassthruwindow.h"
 #include "mimapplication.h"
 
+namespace {
+    void disableMInputContextPlugin()
+    {
+        // prevent loading of minputcontext because we don't need it and starting
+        // it might trigger starting of this service by the d-bus. not nice if that is
+        // already happening :)
+        if (-1 == unsetenv("QT_IM_MODULE")) {
+            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);
+    }
+}
+
 int main(int argc, char **argv)
 {
     bool bypassWMHint = false;
@@ -45,17 +62,10 @@
         }
     }
 
-    // prevent loading of minputcontext because we don't need it and starting
-    // it might trigger starting of this service by the d-bus. not nice if that is
-    // already happening :)
-    if (-1 == unsetenv("QT_IM_MODULE")) {
-        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 state.
-    QApplication::setStyle(new QCommonStyle);
+    // QT_IM_MODULE, MApplication and QtMaemo5Style all try to load
+    // MInputContext, which is fine for the application. For the passthrough
+    // server itself, we absolutely need to prevent that.
+    disableMInputContextPlugin();
 
     MIMApplication app(argc, argv);
 
@@ -79,7 +89,7 @@
     QSize sceneSize = view->visibleSceneSize(M::Landscape);
     int w = sceneSize.width();
     int h = sceneSize.height();
-    view->scene()->setSceneRect(0, 0, w, h);
+    view->setSceneRect(0, 0, w, h);
 
     widget.resize(sceneSize);
 
--- passthroughserver/passthroughserver.pro
+++ passthroughserver/passthroughserver.pro
@@ -49,11 +49,7 @@
 
 SERVICE_FILE = minputmethodserver.service.in
 
-contains(DEFINES, QT_DBUS) {
-    ACTIVATION_OR_REAL_INTERFACE = com.meego.inputmethod.uiserver1
-} else {
-    ACTIVATION_OR_REAL_INTERFACE = com.meego.inputmethod.uiserveractivation
-}
+ACTIVATION_OR_REAL_INTERFACE = com.meego.inputmethod.uiserveractivation
 
 servicefilegenerator.output = minputmethodserver.service
 servicefilegenerator.input = SERVICE_FILE
--- settings-applet/meegotouch-text-input-applet.desktop
+++ settings-applet/meegotouch-text-input-applet.desktop
@@ -11,7 +11,7 @@
 X-DUIApplet-Applet=libmimsettingsapplet.so
 
 [DCP]
-Category= Regional settings
+Category=Language & Keyboard
 Order=4
-WidgetType= Label
+WidgetType=Label
 
--- settings-applet/mimsettingsapplet.cpp
+++ settings-applet/mimsettingsapplet.cpp
@@ -14,10 +14,11 @@
  * of this file.
  */
 
+#include "mimsettingsapplet.h"
+
 #include <MAction>
 #include <MLocale>
 
-#include "mimsettingsapplet.h"
 #include "mimsettingswidget.h"
 #include "mimsettingsbrief.h"
 #include "mimsettingsconf.h"
@@ -37,8 +38,14 @@
 
 DcpWidget* MImSettingsApplet::constructWidget(int widgetId)
 {
-    Q_UNUSED(widgetId);
-    MImSettingsWidget *widget = new MImSettingsWidget();
+    DcpWidget *widget = NULL;
+
+    // Create the main settings page
+    if (widgetId == 0)
+        widget = new MImSettingsWidget();
+    // widgetId tells the settings page number for a certain settings plug-in.
+    // If we will have multiple settings pages in the future, they must
+    // be constructed according to the widgetId. So far we have only one page.
     return widget;
 }
 
--- settings-applet/mimsettingsconf.cpp
+++ settings-applet/mimsettingsconf.cpp
@@ -20,7 +20,7 @@
 #include <QDBusInterface>
 #include <QDBusReply>
 #include <QDebug>
-#include "minputmethodbase.h"
+
 #include "minputmethodplugin.h"
 #include "mimsettingsconf.h"
 
@@ -32,9 +32,9 @@
     const QString MImPluginPaths = ConfigRoot + "paths";
     const QString MImPluginDisabled = ConfigRoot + "disabledpluginfiles";
 
-    const char * const DBusMIMPluginManagerServiceName = "com.maemo.inputmethodpluginmanager1";
-    const char * const DBusMIMPluginManagerPath = "/com/maemo/inputmethodpluginmanager1";
-    const char * const DBusMIMPluginManagerInterface = "com.maemo.inputmethodpluginmanager1";
+    const char * const DBusMIMPluginManagerServiceName = "com.meego.inputmethodpluginmanager1";
+    const char * const DBusMIMPluginManagerPath = "/com/meego/inputmethodpluginmanager1";
+    const char * const DBusMIMPluginManagerInterface = "com.meego.inputmethodpluginmanager1";
 }
 
 MImSettingsConf *MImSettingsConf::imSettingsConfInstance = 0;
@@ -118,7 +118,7 @@
 void MImSettingsConf::loadSettings()
 {
     foreach (MInputMethodPlugin *plugin, plugins()) {
-        MInputMethodSettingsBase *settings = plugin->createInputMethodSettings();
+        MAbstractInputMethodSettings *settings = plugin->createInputMethodSettings();
         if (settings) {
             settingList.append(settings);
         }
@@ -131,13 +131,13 @@
     foreach (MInputMethodPlugin *plugin, imPlugins.keys()) {
         if (blacklist.contains(imPlugins.value(plugin)))
             continue;
-        if (plugin->supportedStates().contains(OnScreen))
+        if (plugin->supportedStates().contains(MInputMethod::OnScreen))
             pluginList << plugin;
     }
     return pluginList;
 }
 
-QList<MInputMethodSettingsBase *> MImSettingsConf::settings() const
+QList<MAbstractInputMethodSettings *> MImSettingsConf::settings() const
 {
     return settingList;
 }
@@ -145,14 +145,16 @@
 void MImSettingsConf::setActivePlugin(const QString &pluginName, const QString &subViewId)
 {
     if (!pluginName.isEmpty() && impluginMgrIface) {
-        impluginMgrIface->call(QDBus::NoBlock, "setActivePlugin", pluginName, static_cast<int>(OnScreen), subViewId);
+        impluginMgrIface->call(QDBus::NoBlock, "setActivePlugin", pluginName,
+                               static_cast<int>(MInputMethod::OnScreen), subViewId);
     }
 }
 
 void MImSettingsConf::setActiveSubView(const QString &subViewId)
 {
     if (!subViewId.isEmpty() && impluginMgrIface) {
-        impluginMgrIface->call(QDBus::NoBlock, "setActiveSubView", subViewId, static_cast<int>(OnScreen));
+        impluginMgrIface->call(QDBus::NoBlock, "setActiveSubView", subViewId,
+                               static_cast<int>(MInputMethod::OnScreen));
     }
 }
 
@@ -161,16 +163,16 @@
 {
     MImSubView subView;
     if (impluginMgrIface) {
-        QDBusReply< QMap<QString, QVariant> > activeSubViewReply = impluginMgrIface->call("queryActiveSubView",
-                                                                                          OnScreen);
+        QDBusReply< QMap<QString, QVariant> > activeSubViewReply
+            = impluginMgrIface->call("queryActiveSubView", MInputMethod::OnScreen);
         if (activeSubViewReply.isValid() && activeSubViewReply.value().count()) {
             subView.subViewId = activeSubViewReply.value().keys().at(0);
             subView.pluginName = activeSubViewReply.value().values().at(0).toString();
         }
 
-        QDBusReply< QMap<QString, QVariant> > subViewsReply = impluginMgrIface->call("queryAvailableSubViews",
-                                                                                     subView.pluginName,
-                                                                                     OnScreen);
+        QDBusReply< QMap<QString, QVariant> > subViewsReply
+            = impluginMgrIface->call("queryAvailableSubViews", subView.pluginName,
+                                     MInputMethod::OnScreen);
         if (subViewsReply.isValid()) {
             subView.subViewTitle = subViewsReply.value().value(subView.subViewId).toString();
         }
@@ -183,11 +185,13 @@
 {
     QList<MImSubView> views;
     if (impluginMgrIface) {
-        QDBusReply<QStringList> reply = impluginMgrIface->call("queryAvailablePlugins", OnScreen);
+        QDBusReply<QStringList> reply
+            = impluginMgrIface->call("queryAvailablePlugins", MInputMethod::OnScreen);
         if (reply.isValid()) {
             foreach (const QString &plugin, reply.value()) {
-                QDBusReply< QMap<QString, QVariant> > replySubViews = impluginMgrIface->call("queryAvailableSubViews",
-                                                                                             plugin, OnScreen);
+                QDBusReply< QMap<QString, QVariant> > replySubViews
+                    = impluginMgrIface->call("queryAvailableSubViews",
+                                             plugin, MInputMethod::OnScreen);
                 if (replySubViews.isValid()) {
                     QMap<QString, QVariant> sv = replySubViews.value();
                     QMap<QString, QVariant>::const_iterator iterator = sv.constBegin();
--- settings-applet/mimsettingsconf.h
+++ settings-applet/mimsettingsconf.h
@@ -21,10 +21,11 @@
 #include <QMap>
 #include <QList>
 #include <QStringList>
-#include "mimhandlerstate.h"
+
+#include "minputmethodnamespace.h"
 
 class MInputMethodPlugin;
-class MInputMethodSettingsBase;
+class MAbstractInputMethodSettings;
 class QDBusInterface;
 
 class MImSettingsConf : public QObject
@@ -53,7 +54,7 @@
     /*!
      * \brief Return all input method settings.
      */
-    QList<MInputMethodSettingsBase *> settings() const;
+    QList<MAbstractInputMethodSettings *> settings() const;
 
     /*!
      * \brief Set \a pluginName as the active input method plugin, and \a subViewId as the active subView.
@@ -96,7 +97,7 @@
     QMap<MInputMethodPlugin *, QString> imPlugins;
     QStringList paths;
     QStringList blacklist;
-    QList<MInputMethodSettingsBase *> settingList;
+    QList<MAbstractInputMethodSettings *> settingList;
     //! Singleton instance
     static MImSettingsConf *imSettingsConfInstance;
 
--- settings-applet/mimsettingswidget.cpp
+++ settings-applet/mimsettingswidget.cpp
@@ -14,6 +14,8 @@
  * of this file.
  */
 
+#include "mimsettingswidget.h"
+
 #include <MContainer>
 #include <MContentItem>
 #include <MLocale>
@@ -23,10 +25,9 @@
 #include <QItemSelectionModel>
 #include <QDebug>
 
-#include <minputmethodsettingsbase.h>
+#include <mabstractinputmethodsettings.h>
 #include <minputmethodplugin.h>
 
-#include "mimsettingswidget.h"
 #include "mimsettingsconf.h"
 
 namespace {
@@ -39,6 +40,7 @@
 
 MImSettingsWidget::MImSettingsWidget()
     : DcpWidget(),
+      activeSubViewContainer(0),
       activeSubViewItem(0),
       availableSubViewList(0)
 {
@@ -60,35 +62,41 @@
 
 void MImSettingsWidget::initWidget()
 {
-    QGraphicsLinearLayout* layout = new QGraphicsLinearLayout(Qt::Vertical, this);
+    QGraphicsLinearLayout* mainLayout = new QGraphicsLinearLayout(Qt::Vertical, this);
 
+    activeSubViewContainer = new MContainer("", this);
     activeSubViewItem = new MContentItem(MContentItem::TwoTextLabels, this);
     activeSubViewItem->setObjectName(ObjectNameActiveInputMethodWidget);
     connect(activeSubViewItem, SIGNAL(clicked()), this, SLOT(showAvailableSubViewList()));
-    layout->addItem(activeSubViewItem);
+    activeSubViewContainer->setStyleName("CommonLargePanel");
+    activeSubViewContainer->setCentralWidget(activeSubViewItem);
+    mainLayout->addItem(activeSubViewContainer);
 
-    foreach (MInputMethodSettingsBase *settings, MImSettingsConf::instance().settings()) {
+    foreach (MAbstractInputMethodSettings *settings, MImSettingsConf::instance().settings()) {
         if (settings) {
             QGraphicsWidget *contentWidget = settings->createContentWidget(this);
             if (contentWidget) {
                 MContainer *container = new MContainer(settings->title(), this);
                 container->setCentralWidget(contentWidget);
+                container->setStyleName("CommonLargePanel");
                 //TODO: icon for the settings.
-                layout->addItem(container);
+                mainLayout->addItem(container);
                 settingsContainerMap.insert(settings, container);
             }
         }
     }
-    setLayout(layout);
+    setLayout(mainLayout);
     retranslateUi();
     connect(&MImSettingsConf::instance(), SIGNAL(activeSubViewChanged()), this, SLOT(syncActiveSubView()));
 }
 
 void MImSettingsWidget::retranslateUi()
 {
-    if (!activeSubViewItem)
+    if (!activeSubViewItem || !activeSubViewContainer)
         return;
 
+    //% "Text input"
+    activeSubViewContainer->setTitle(qtTrId("qtn_txts_text_input"));
     //% "Active input method"
     activeSubViewItem->setTitle(qtTrId("qtn_txts_active_input_method"));
     updateActiveSubViewTitle();
--- settings-applet/mimsettingswidget.h
+++ settings-applet/mimsettingswidget.h
@@ -22,7 +22,7 @@
 
 class MContentItem;
 class MPopupList;
-class MInputMethodSettingsBase;
+class MAbstractInputMethodSettings;
 class MContainer;
 
 class MImSettingsWidget : public DcpWidget
@@ -55,8 +55,9 @@
 private:
     void updateActiveSubViewTitle();
 
+    MContainer *activeSubViewContainer;
     MContentItem *activeSubViewItem;
     MPopupList *availableSubViewList;
-    QMap<MInputMethodSettingsBase *, MContainer *> settingsContainerMap;
+    QMap<MAbstractInputMethodSettings *, MContainer *> settingsContainerMap;
 };
 #endif
--- src/MeegoImFramework.pc
+++ src/MeegoImFramework.pc
@@ -1,7 +1,7 @@
 prefix=/usr
 exec_prefix=${prefix}
 libdir=${exec_prefix}/lib
-includedir=${prefix}/include/meegotouch/meegoimframework
+includedir=${prefix}/include/meegoimframework
 
 Name: MeegoIMFramework
 Description: MeegoTouch Input Method UI Framework
--- src/mabstractinputmethod.cpp
+++ src/mabstractinputmethod.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 "mabstractinputmethod.h"
+#include "mabstractinputmethodhost.h"
+
+#include <QKeyEvent>
+
+class MAbstractInputMethodPrivate
+{
+public:
+    MAbstractInputMethodPrivate(MAbstractInputMethodHost *imHost, MAbstractInputMethod *parent);
+    ~MAbstractInputMethodPrivate();
+
+    MAbstractInputMethodHost *imHost;
+};
+
+
+
+MAbstractInputMethodPrivate::MAbstractInputMethodPrivate(MAbstractInputMethodHost *imHost,
+                                                         MAbstractInputMethod *parent)
+    : imHost(imHost)
+{
+}
+
+
+MAbstractInputMethodPrivate::~MAbstractInputMethodPrivate()
+{
+}
+
+///////////////
+
+MAbstractInputMethod::MAbstractInputMethod(MAbstractInputMethodHost *imHost, QObject *parent)
+    : QObject(parent),
+      d_ptr(new MAbstractInputMethodPrivate(imHost, this))
+{
+    // nothing
+}
+
+
+MAbstractInputMethod::~MAbstractInputMethod()
+{
+    delete d_ptr;
+}
+
+
+MAbstractInputMethodHost *
+MAbstractInputMethod::inputMethodHost() const
+{
+    Q_D(const MAbstractInputMethod);
+
+    return d->imHost;
+}
+
+void MAbstractInputMethod::show()
+{
+    // empty default implementation
+}
+
+void MAbstractInputMethod::hide()
+{
+    // empty default implementation
+}
+
+void MAbstractInputMethod::setPreedit(const QString &)
+{
+    // empty default implementation
+}
+
+void MAbstractInputMethod::update()
+{
+    // empty default implementation
+}
+
+void MAbstractInputMethod::reset()
+{
+    // empty default implementation
+}
+
+void MAbstractInputMethod::handleMouseClickOnPreedit(const QPoint &pos, const QRect &preeditRect)
+{
+    // empty default implementation
+    Q_UNUSED(pos);
+    Q_UNUSED(preeditRect);
+}
+
+void MAbstractInputMethod::handleFocusChange(bool /* focusIn */)
+{
+    // empty default implementation
+}
+
+void MAbstractInputMethod::handleVisualizationPriorityChange(bool priority)
+{
+    // empty default implementation
+    Q_UNUSED(priority);
+}
+
+void MAbstractInputMethod::handleAppOrientationChange(int angle)
+{
+    // empty default implementation
+    Q_UNUSED(angle);
+}
+
+void MAbstractInputMethod::setToolbar(QSharedPointer<const MToolbarData> toolbar)
+{
+    // empty default implementation
+    Q_UNUSED(toolbar);
+}
+
+void MAbstractInputMethod::processKeyEvent(QEvent::Type keyType, Qt::Key keyCode,
+                                       Qt::KeyboardModifiers modifiers,
+                                       const QString &text, bool autoRepeat, int count,
+                                       quint32 /* nativeScanCode */, quint32 /* nativeModifiers */)
+{
+    // default implementation, just sendKeyEvent back
+    inputMethodHost()->sendKeyEvent(QKeyEvent(keyType, keyCode, modifiers, text, autoRepeat,
+                                              count));
+}
+
+void MAbstractInputMethod::setState(const QSet<MInputMethod::HandlerState> &state)
+{
+    // empty default implementation
+    Q_UNUSED(state);
+}
+
+void MAbstractInputMethod::handleClientChange()
+{
+    // empty default implementation
+}
+
+void MAbstractInputMethod::switchContext(MInputMethod::SwitchDirection direction,
+                                         bool enableAnimation)
+{
+    // empty default implementation
+    Q_UNUSED(direction);
+    Q_UNUSED(enableAnimation);
+}
+
+QList<MAbstractInputMethod::MInputMethodSubView>
+MAbstractInputMethod::subViews(MInputMethod::HandlerState state) const
+{
+    Q_UNUSED(state);
+    QList<MInputMethodSubView> sVs;
+    return sVs;
+}
+
+void MAbstractInputMethod::setActiveSubView(const QString &subViewId,
+                                            MInputMethod::HandlerState state)
+{
+    // empty default implementation
+    Q_UNUSED(subViewId);
+    Q_UNUSED(state);
+}
+
+QString MAbstractInputMethod::activeSubView(MInputMethod::HandlerState state) const
+{
+    Q_UNUSED(state);
+    return QString();
+}
+
+void MAbstractInputMethod::showLanguageNotification()
+{
+    // empty default implementation
+}
+
--- src/mabstractinputmethod.h
+++ src/mabstractinputmethod.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 MABSTRACTINPUTMETHOD_H
+#define MABSTRACTINPUTMETHOD_H
+
+#include <QObject>
+#include <QEvent>
+#include <QVariant>
+#include <QMap>
+#include <MNamespace>
+
+#include "minputmethodnamespace.h"
+
+class QRegion;
+class QPoint;
+class QRect;
+class QGraphicsScene;
+class MAbstractInputMethodHost;
+class MAbstractInputMethodPrivate;
+class MToolbarData;
+
+/*!
+ * \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
+ */
+class MAbstractInputMethod: public QObject
+{
+    Q_OBJECT
+
+public:
+     /*!
+     * MInputMethodSubView defines an input method subview with an identifier \a subViewId
+     * and a title \a subViewTitle.
+     *
+     * The subview is a view which provided by this input method. The view could be a view of one
+     * language, or one keyboard, it depends on the input method. Each subview has an identifier
+     * and title.
+     */
+    struct MInputMethodSubView {
+        QString subViewId;
+        QString subViewTitle;
+    };
+
+    /*! Constructor for input method base
+     * \param imHost input method host instace, not owned by input method base
+     */
+    MAbstractInputMethod(MAbstractInputMethodHost *imHost, QObject *parent = 0);
+
+    ~MAbstractInputMethod();
+
+    /*! \brief Returns input method host
+     */
+    MAbstractInputMethodHost *inputMethodHost() const;
+
+    /*! \brief Shows the input method.
+     */
+    virtual void show();
+
+    /*! \brief Hides the input method
+     */
+    virtual void hide();
+
+    /*! \brief Sets preedit string of the input method server
+     */
+    virtual void setPreedit(const QString &preeditString);
+
+    /*! \brief Update input method server state
+     */
+    virtual void update();
+
+    /*! \brief Resets input method server state
+     */
+    virtual void reset();
+
+    /*! \brief Notifies input method server about mouse click on the preedit string
+     */
+    virtual void handleMouseClickOnPreedit(const QPoint &pos, const QRect &preeditRect);
+
+    /*! \brief Notifies input method server about changed focus
+     *  \param focusIn true - focus has entered a widget, false - focus has left a widget
+     */
+    virtual void handleFocusChange(bool focusIn);
+
+    /*! \brief Notifies that the focus widget in application changed visualization priority
+     */
+    virtual void handleVisualizationPriorityChange(bool priority);
+
+    /*! \brief Target application changed orientation. Input method usually changes its
+     *         own orientation according to this.
+     */
+    virtual void handleAppOrientationChange(int angle);
+
+    /*!
+     * \brief Uses a custom toolbar which is defined by given parameter.
+     * \param toolbar Pointer to toolbar definition.
+     */
+    virtual void setToolbar(QSharedPointer<const MToolbarData> toolbar);
+
+    /*!
+     * \brief Process a key event redirected from hardware keyboard to input method.
+     *
+     * This is called only if one has enabled redirection by calling
+     * \a MInputContextConnection::setRedirectKeys.
+     */
+    virtual void processKeyEvent(QEvent::Type keyType, Qt::Key keyCode,
+                                 Qt::KeyboardModifiers modifiers, const QString &text,
+                                 bool autoRepeat, int count, quint32 nativeScanCode,
+                                 quint32 nativeModifiers);
+
+    /* \brief This method is called to inform about keyboard status changes
+     *
+     * That is, hardware keyboard is opened or closed, BT keyboard is connected or
+     * disconnected
+     * \param state set of current states for this plugin
+     */
+    virtual void setState(const QSet<MInputMethod::HandlerState> &state);
+
+    /*! \brief This method is called when target client is changed.
+     */
+    virtual void handleClientChange();
+
+    /*!
+     * \brief Switch context to given direction
+     * \param direction Switching direction
+     * \param enableAnimation Contains true if swipe should be animated
+     */
+    virtual void switchContext(MInputMethod::SwitchDirection direction, bool enableAnimation);
+
+    /*! \brief Returns all subviews (IDs and titles) which are supported for \a state.
+     *
+     * Implement this function to return the subviews which are supported by this input
+     * method for the specified state. The subview titles will be shown in the input method settings.
+     */
+    virtual QList<MInputMethodSubView> subViews(MInputMethod::HandlerState state
+                                                 = MInputMethod::OnScreen) const;
+
+    /*!
+     * \brief Sets \a subViewId as the active subview for \a state.
+     * \param subViewId the identifier of subview.
+     * \param state the state which \a subViewId belongs to.
+     *
+     *  Implement this method to set the active subview. Input method plugins manager will call
+     *  this method when active subview for specified state is changed from the input method
+     *  settings.
+     */
+    virtual void setActiveSubView(const QString &subViewId,
+                                  MInputMethod::HandlerState state = MInputMethod::OnScreen);
+
+    /*!
+     * \brief Returns current active subview ID for \a state.
+     *
+     *  Implement this method to inform input method plugins manager about current active subview
+     *  for specified state.
+     */
+    virtual QString activeSubView(MInputMethod::HandlerState state = MInputMethod::OnScreen) const;
+
+    //! Show notification informing about current language
+    virtual void showLanguageNotification();
+
+signals:
+    /*!
+     * Inform that active subview is changed to \a subViewId for \a state.
+     * \param subViewId the identifier of the new subview.
+     * \param state the state which \a subViewId belongs to.
+     * Emitted when plugin changes the active subview for specified state.
+     */
+    void activeSubViewChanged(const QString &subViewId,
+                              MInputMethod::HandlerState state = MInputMethod::OnScreen);
+
+private:
+    Q_DISABLE_COPY(MAbstractInputMethod)
+    Q_DECLARE_PRIVATE(MAbstractInputMethod)
+
+    MAbstractInputMethodPrivate * const d_ptr;
+};
+
+#endif
--- src/mabstractinputmethodhost.cpp
+++ src/mabstractinputmethodhost.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 "mabstractinputmethodhost.h"
+
+
+class MAbstractInputMethodHostPrivate
+{
+public:
+    MAbstractInputMethodHostPrivate();
+    ~MAbstractInputMethodHostPrivate();
+};
+
+
+MAbstractInputMethodHostPrivate::MAbstractInputMethodHostPrivate()
+{
+}
+
+MAbstractInputMethodHostPrivate::~MAbstractInputMethodHostPrivate()
+{
+}
+
+
+MAbstractInputMethodHost::MAbstractInputMethodHost(QObject *parent)
+    : QObject(parent),
+      d(new MAbstractInputMethodHostPrivate)
+{
+    // nothing
+}
+
+MAbstractInputMethodHost::~MAbstractInputMethodHost()
+{
+    delete d;
+}
+
--- src/mabstractinputmethodhost.h
+++ src/mabstractinputmethodhost.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 MABSTRACTINPUTMETHODHOST_H
+#define MABSTRACTINPUTMETHODHOST_H
+
+#include "minputmethodnamespace.h"
+
+#include <QRect>
+#include <QObject>
+
+class QString;
+class QRegion;
+class QKeyEvent;
+
+class MToolbarId;
+
+class MAbstractInputMethodHostPrivate;
+
+/*!
+ * \brief Provides an interface for input method instances to connect to the environment.
+ *
+ * MAbstractInputMethodHost provides methods MAbstractInputMethod instances can use
+ * 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
+{
+    Q_OBJECT
+
+public:
+    explicit MAbstractInputMethodHost(QObject *parent = 0);
+    virtual ~MAbstractInputMethodHost();
+
+    /*!
+     * \brief returns content type for focused widget if output parameter valid is true,
+     * value matches enum M::TextContentType
+     */
+    virtual int contentType(bool &valid) = 0;
+
+    /*!
+     * \brief returns input method correction hint if output parameter valid is true.
+     */
+    virtual bool correctionEnabled(bool &valid) = 0;
+
+    /*!
+     * \brief returns input method word prediction hint if output parameter valid is true.
+     */
+    virtual bool predictionEnabled(bool &valid) = 0;
+
+    /*!
+     * \brief returns input method auto-capitalization hint if output parameter valid is true.
+     */
+    virtual bool autoCapitalizationEnabled(bool &valid) = 0;
+
+    /*!
+     * \brief get surrounding text and cursor position information
+     */
+    virtual bool surroundingText(QString &text, int &cursorPosition) = 0;
+
+    /*!
+     * \brief returns true if there is selecting text
+     */
+    virtual bool hasSelection(bool &valid) = 0;
+
+    /*!
+     * \brief get input method mode
+     */
+    virtual int inputMethodMode(bool &valid) = 0;
+
+    /*!
+     * \brief get input method mode
+     */
+    virtual QRect preeditRectangle(bool &valid) = 0;
+
+public slots:
+    /*!
+     * \brief Updates pre-edit string in the application widget
+     *
+     * \param string    The new pre-edit string
+     * \param preeditFace Selects visual styling for preedit
+     */
+    virtual void sendPreeditString(const QString &string,
+                                   MInputMethod::PreeditFace preeditFace
+                                    = MInputMethod::PreeditDefault) = 0;
+
+    /*!
+     * \brief Updates commit string in the application widget
+     *
+     * \param string    The string to be committed
+     */
+    virtual void sendCommitString(const QString &string) = 0;
+
+    /*!
+     * \brief Sends key event to the application
+     *
+     * This method is used to deliver the key event to active widget.
+     * A \a MInputMethodState::keyPress or \a MInputMethodState::keyRelease
+     * event is also emitted. Depending on the value of \a requestType
+     * parameter, a Qt::KeyEvent and/or a signal is emitted.
+     * \param keyEvent The event to send
+     * \param signalOnly only the signal should be emitted.
+     */
+    virtual void sendKeyEvent(const QKeyEvent &keyEvent,
+                              MInputMethod::EventRequestType requestType
+                               = MInputMethod::EventRequestBoth) = 0;
+
+    /*!
+     * \brief notifies about hiding initiated by the input method server side
+     */
+    virtual void notifyImInitiatedHiding() = 0;
+
+    /*!
+    * \brief copy selected text
+    */
+    virtual void copy() = 0;
+
+    /*!
+    * \brief paste plain text from clipboard
+    */
+    virtual void paste() = 0;
+
+    /*!
+     * \brief Set if the input method wants to process all raw key events
+     * from hardware keyboard (via \a processKeyEvent calls).
+     */
+    virtual void setRedirectKeys(bool enabled) = 0;
+
+    /*!
+     * \brief Set detectable autorepeat for X on/off
+     *
+     * Detectable autorepeat means that instead of press, release, press, release, press,
+     * release... sequence of key events you get press, press, press, release key events
+     * when a key is repeated.  The setting is X client specific.  This is intended to be
+     * used when key event redirection is enabled with \a setRedirectKeys.
+     */
+    virtual void setDetectableAutoRepeat(bool enabled) = 0;
+
+    /*!
+     * \brief set global correction option enable/disable
+     */
+    virtual void setGlobalCorrectionEnabled(bool enabled) = 0;
+
+    /*!
+     * \brief Sets input mode indicator state.
+     * \param mode Input mode indicator state.
+     * \sa InputModeIndicator.
+     */
+    virtual void setInputModeIndicator(MInputMethod::InputModeIndicator mode) = 0;
+
+    /*!
+     * Asks environment to change active plugin according to \a direction.
+     */
+    virtual void switchPlugin(MInputMethod::SwitchDirection direction) = 0;
+
+    /*!
+     * Asks environment to change active plugin to specified one.
+     * \param pluginName Name for plugin which will be activated
+     */
+    virtual void switchPlugin(const QString &pluginName) = 0;
+
+    /*!
+     * Reserves screen area for input method. Mouse events on top of this
+     * area do not fall through to the application
+     *
+     * \param region the new region
+     */
+    virtual void setScreenRegion(const QRegion &region) = 0;
+
+    /*!
+     * Sets part of the screen area covered by the input method that
+     * should be avoided by the application receiving input in order not to be
+     * obscured.
+     *
+     * For now this region must be so simple that its bounding box can be
+     * effectively used as the avoidance area.
+     *
+     * \param region the new region
+     */
+    virtual void setInputMethodArea(const QRegion &region) = 0;
+
+    /*!
+     * Asks environment to show settings.
+     */
+    virtual void showSettings() = 0;
+
+private:
+    Q_DISABLE_COPY(MAbstractInputMethodHost)
+    Q_DECLARE_PRIVATE(MAbstractInputMethodHost)
+
+    MAbstractInputMethodHostPrivate *d;
+};
+
+
+#endif
--- src/mabstractinputmethodsettings.h
+++ src/mabstractinputmethodsettings.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 MABSTRACTINPUTMETHODSETTINGS_H
+#define MABSTRACTINPUTMETHODSETTINGS_H
+
+#include <QString>
+
+class QGraphicsWidget;
+
+/*!
+ * \brief MAbstractInputMethodSettings is a base class for input method settings.
+ *
+ * MAbstractInputMethodSettings defines the setting of a input method plugin. contentWidget()
+ * holds its content.
+ * Each input method plugin can implement its own setting by inheriting this class.
+ *
+ */
+
+class MAbstractInputMethodSettings
+{
+public:
+    /*!
+     *\brief Returns the title of the setting.
+     * The title should be already translated according current display language.
+     */
+    virtual QString title() = 0;
+
+    /*!
+     *\brief Returns the icon of the setting.
+     * It is the absolute file name for the icon
+     */
+    virtual QString icon() = 0;
+
+    /*!
+     *\brief Creates and returns the content widget of the setting.
+     * \param parent pointer of QGraphicsWidget, it is set to the parent for content widget.
+     *
+     * WARNING: The return pointer of QGraphicsWidget is owned by the caller, and \parent is set
+     * as its parent. It could be manually deleted outside or together with \a parent.
+     */
+    virtual QGraphicsWidget *createContentWidget(QGraphicsWidget *parent = 0) = 0;
+
+};
+
+#endif
--- src/mdbusglibicconnectionserviceglue.h
+++ src/mdbusglibicconnectionserviceglue.h
-/* Generated by dbus-binding-tool; do not edit! */
-
-
-#ifndef __dbus_glib_marshal_m_dbus_glib_ic_connection_MARSHAL_H__
-#define __dbus_glib_marshal_m_dbus_glib_ic_connection_MARSHAL_H__
-
-#include	<glib-object.h>
-
-G_BEGIN_DECLS
-
-#ifdef G_ENABLE_DEBUG
-#define g_marshal_value_peek_boolean(v)  g_value_get_boolean (v)
-#define g_marshal_value_peek_char(v)     g_value_get_char (v)
-#define g_marshal_value_peek_uchar(v)    g_value_get_uchar (v)
-#define g_marshal_value_peek_int(v)      g_value_get_int (v)
-#define g_marshal_value_peek_uint(v)     g_value_get_uint (v)
-#define g_marshal_value_peek_long(v)     g_value_get_long (v)
-#define g_marshal_value_peek_ulong(v)    g_value_get_ulong (v)
-#define g_marshal_value_peek_int64(v)    g_value_get_int64 (v)
-#define g_marshal_value_peek_uint64(v)   g_value_get_uint64 (v)
-#define g_marshal_value_peek_enum(v)     g_value_get_enum (v)
-#define g_marshal_value_peek_flags(v)    g_value_get_flags (v)
-#define g_marshal_value_peek_float(v)    g_value_get_float (v)
-#define g_marshal_value_peek_double(v)   g_value_get_double (v)
-#define g_marshal_value_peek_string(v)   (char*) g_value_get_string (v)
-#define g_marshal_value_peek_param(v)    g_value_get_param (v)
-#define g_marshal_value_peek_boxed(v)    g_value_get_boxed (v)
-#define g_marshal_value_peek_pointer(v)  g_value_get_pointer (v)
-#define g_marshal_value_peek_object(v)   g_value_get_object (v)
-#else /* !G_ENABLE_DEBUG */
-/* WARNING: This code accesses GValues directly, which is UNSUPPORTED API.
- *          Do not access GValues directly in your code. Instead, use the
- *          g_value_get_*() functions
- */
-#define g_marshal_value_peek_boolean(v)  (v)->data[0].v_int
-#define g_marshal_value_peek_char(v)     (v)->data[0].v_int
-#define g_marshal_value_peek_uchar(v)    (v)->data[0].v_uint
-#define g_marshal_value_peek_int(v)      (v)->data[0].v_int
-#define g_marshal_value_peek_uint(v)     (v)->data[0].v_uint
-#define g_marshal_value_peek_long(v)     (v)->data[0].v_long
-#define g_marshal_value_peek_ulong(v)    (v)->data[0].v_ulong
-#define g_marshal_value_peek_int64(v)    (v)->data[0].v_int64
-#define g_marshal_value_peek_uint64(v)   (v)->data[0].v_uint64
-#define g_marshal_value_peek_enum(v)     (v)->data[0].v_long
-#define g_marshal_value_peek_flags(v)    (v)->data[0].v_ulong
-#define g_marshal_value_peek_float(v)    (v)->data[0].v_float
-#define g_marshal_value_peek_double(v)   (v)->data[0].v_double
-#define g_marshal_value_peek_string(v)   (v)->data[0].v_pointer
-#define g_marshal_value_peek_param(v)    (v)->data[0].v_pointer
-#define g_marshal_value_peek_boxed(v)    (v)->data[0].v_pointer
-#define g_marshal_value_peek_pointer(v)  (v)->data[0].v_pointer
-#define g_marshal_value_peek_object(v)   (v)->data[0].v_pointer
-#endif /* !G_ENABLE_DEBUG */
-
-
-/* BOOLEAN:INT,POINTER (/tmp/dbus-binding-tool-c-marshallers.EL9VHV:1) */
-extern void dbus_glib_marshal_m_dbus_glib_ic_connection_BOOLEAN__INT_POINTER (GClosure     *closure,
-                                                                              GValue       *return_value,
-                                                                              guint         n_param_values,
-                                                                              const GValue *param_values,
-                                                                              gpointer      invocation_hint,
-                                                                              gpointer      marshal_data);
-void
-dbus_glib_marshal_m_dbus_glib_ic_connection_BOOLEAN__INT_POINTER (GClosure     *closure,
-                                                                  GValue       *return_value G_GNUC_UNUSED,
-                                                                  guint         n_param_values,
-                                                                  const GValue *param_values,
-                                                                  gpointer      invocation_hint G_GNUC_UNUSED,
-                                                                  gpointer      marshal_data)
-{
-  typedef gboolean (*GMarshalFunc_BOOLEAN__INT_POINTER) (gpointer     data1,
-                                                         gint         arg_1,
-                                                         gpointer     arg_2,
-                                                         gpointer     data2);
-  register GMarshalFunc_BOOLEAN__INT_POINTER callback;
-  register GCClosure *cc = (GCClosure*) closure;
-  register gpointer data1, data2;
-  gboolean v_return;
-
-  g_return_if_fail (return_value != NULL);
-  g_return_if_fail (n_param_values == 3);
-
-  if (G_CCLOSURE_SWAP_DATA (closure))
-    {
-      data1 = closure->data;
-      data2 = g_value_peek_pointer (param_values + 0);
-    }
-  else
-    {
-      data1 = g_value_peek_pointer (param_values + 0);
-      data2 = closure->data;
-    }
-  callback = (GMarshalFunc_BOOLEAN__INT_POINTER) (marshal_data ? marshal_data : cc->callback);
-
-  v_return = callback (data1,
-                       g_marshal_value_peek_int (param_values + 1),
-                       g_marshal_value_peek_pointer (param_values + 2),
-                       data2);
-
-  g_value_set_boolean (return_value, v_return);
-}
-
-/* BOOLEAN:BOOLEAN,BOOLEAN,POINTER (/tmp/dbus-binding-tool-c-marshallers.EL9VHV:2) */
-extern void dbus_glib_marshal_m_dbus_glib_ic_connection_BOOLEAN__BOOLEAN_BOOLEAN_POINTER (GClosure     *closure,
-                                                                                          GValue       *return_value,
-                                                                                          guint         n_param_values,
-                                                                                          const GValue *param_values,
-                                                                                          gpointer      invocation_hint,
-                                                                                          gpointer      marshal_data);
-void
-dbus_glib_marshal_m_dbus_glib_ic_connection_BOOLEAN__BOOLEAN_BOOLEAN_POINTER (GClosure     *closure,
-                                                                              GValue       *return_value G_GNUC_UNUSED,
-                                                                              guint         n_param_values,
-                                                                              const GValue *param_values,
-                                                                              gpointer      invocation_hint G_GNUC_UNUSED,
-                                                                              gpointer      marshal_data)
-{
-  typedef gboolean (*GMarshalFunc_BOOLEAN__BOOLEAN_BOOLEAN_POINTER) (gpointer     data1,
-                                                                     gboolean     arg_1,
-                                                                     gboolean     arg_2,
-                                                                     gpointer     arg_3,
-                                                                     gpointer     data2);
-  register GMarshalFunc_BOOLEAN__BOOLEAN_BOOLEAN_POINTER callback;
-  register GCClosure *cc = (GCClosure*) closure;
-  register gpointer data1, data2;
-  gboolean v_return;
-
-  g_return_if_fail (return_value != NULL);
-  g_return_if_fail (n_param_values == 4);
-
-  if (G_CCLOSURE_SWAP_DATA (closure))
-    {
-      data1 = closure->data;
-      data2 = g_value_peek_pointer (param_values + 0);
-    }
-  else
-    {
-      data1 = g_value_peek_pointer (param_values + 0);
-      data2 = closure->data;
-    }
-  callback = (GMarshalFunc_BOOLEAN__BOOLEAN_BOOLEAN_POINTER) (marshal_data ? marshal_data : cc->callback);
-
-  v_return = callback (data1,
-                       g_marshal_value_peek_boolean (param_values + 1),
-                       g_marshal_value_peek_boolean (param_values + 2),
-                       g_marshal_value_peek_pointer (param_values + 3),
-                       data2);
-
-  g_value_set_boolean (return_value, v_return);
-}
-
-/* BOOLEAN:POINTER (/tmp/dbus-binding-tool-c-marshallers.EL9VHV:3) */
-extern void dbus_glib_marshal_m_dbus_glib_ic_connection_BOOLEAN__POINTER (GClosure     *closure,
-                                                                          GValue       *return_value,
-                                                                          guint         n_param_values,
-                                                                          const GValue *param_values,
-                                                                          gpointer      invocation_hint,
-                                                                          gpointer      marshal_data);
-void
-dbus_glib_marshal_m_dbus_glib_ic_connection_BOOLEAN__POINTER (GClosure     *closure,
-                                                              GValue       *return_value G_GNUC_UNUSED,
-                                                              guint         n_param_values,
-                                                              const GValue *param_values,
-                                                              gpointer      invocation_hint G_GNUC_UNUSED,
-                                                              gpointer      marshal_data)
-{
-  typedef gboolean (*GMarshalFunc_BOOLEAN__POINTER) (gpointer     data1,
-                                                     gpointer     arg_1,
-                                                     gpointer     data2);
-  register GMarshalFunc_BOOLEAN__POINTER callback;
-  register GCClosure *cc = (GCClosure*) closure;
-  register gpointer data1, data2;
-  gboolean v_return;
-
-  g_return_if_fail (return_value != NULL);
-  g_return_if_fail (n_param_values == 2);
-
-  if (G_CCLOSURE_SWAP_DATA (closure))
-    {
-      data1 = closure->data;
-      data2 = g_value_peek_pointer (param_values + 0);
-    }
-  else
-    {
-      data1 = g_value_peek_pointer (param_values + 0);
-      data2 = closure->data;
-    }
-  callback = (GMarshalFunc_BOOLEAN__POINTER) (marshal_data ? marshal_data : cc->callback);
-
-  v_return = callback (data1,
-                       g_marshal_value_peek_pointer (param_values + 1),
-                       data2);
-
-  g_value_set_boolean (return_value, v_return);
-}
-
-/* BOOLEAN:INT,INT,INT,STRING,BOOLEAN,INT,UINT,UINT,POINTER (/tmp/dbus-binding-tool-c-marshallers.EL9VHV:4) */
-extern void dbus_glib_marshal_m_dbus_glib_ic_connection_BOOLEAN__INT_INT_INT_STRING_BOOLEAN_INT_UINT_UINT_POINTER (GClosure     *closure,
-                                                                                                                   GValue       *return_value,
-                                                                                                                   guint         n_param_values,
-                                                                                                                   const GValue *param_values,
-                                                                                                                   gpointer      invocation_hint,
-                                                                                                                   gpointer      marshal_data);
-void
-dbus_glib_marshal_m_dbus_glib_ic_connection_BOOLEAN__INT_INT_INT_STRING_BOOLEAN_INT_UINT_UINT_POINTER (GClosure     *closure,
-                                                                                                       GValue       *return_value G_GNUC_UNUSED,
-                                                                                                       guint         n_param_values,
-                                                                                                       const GValue *param_values,
-                                                                                                       gpointer      invocation_hint G_GNUC_UNUSED,
-                                                                                                       gpointer      marshal_data)
-{
-  typedef gboolean (*GMarshalFunc_BOOLEAN__INT_INT_INT_STRING_BOOLEAN_INT_UINT_UINT_POINTER) (gpointer     data1,
-                                                                                              gint         arg_1,
-                                                                                              gint         arg_2,
-                                                                                              gint         arg_3,
-                                                                                              gpointer     arg_4,
-                                                                                              gboolean     arg_5,
-                                                                                              gint         arg_6,
-                                                                                              guint        arg_7,
-                                                                                              guint        arg_8,
-                                                                                              gpointer     arg_9,
-                                                                                              gpointer     data2);
-  register GMarshalFunc_BOOLEAN__INT_INT_INT_STRING_BOOLEAN_INT_UINT_UINT_POINTER callback;
-  register GCClosure *cc = (GCClosure*) closure;
-  register gpointer data1, data2;
-  gboolean v_return;
-
-  g_return_if_fail (return_value != NULL);
-  g_return_if_fail (n_param_values == 10);
-
-  if (G_CCLOSURE_SWAP_DATA (closure))
-    {
-      data1 = closure->data;
-      data2 = g_value_peek_pointer (param_values + 0);
-    }
-  else
-    {
-      data1 = g_value_peek_pointer (param_values + 0);
-      data2 = closure->data;
-    }
-  callback = (GMarshalFunc_BOOLEAN__INT_INT_INT_STRING_BOOLEAN_INT_UINT_UINT_POINTER) (marshal_data ? marshal_data : cc->callback);
-
-  v_return = callback (data1,
-                       g_marshal_value_peek_int (param_values + 1),
-                       g_marshal_value_peek_int (param_values + 2),
-                       g_marshal_value_peek_int (param_values + 3),
-                       g_marshal_value_peek_string (param_values + 4),
-                       g_marshal_value_peek_boolean (param_values + 5),
-                       g_marshal_value_peek_int (param_values + 6),
-                       g_marshal_value_peek_uint (param_values + 7),
-                       g_marshal_value_peek_uint (param_values + 8),
-                       g_marshal_value_peek_pointer (param_values + 9),
-                       data2);
-
-  g_value_set_boolean (return_value, v_return);
-}
-
-/* BOOLEAN:INT,INT,INT,INT,INT,INT,POINTER (/tmp/dbus-binding-tool-c-marshallers.EL9VHV:5) */
-extern void dbus_glib_marshal_m_dbus_glib_ic_connection_BOOLEAN__INT_INT_INT_INT_INT_INT_POINTER (GClosure     *closure,
-                                                                                                  GValue       *return_value,
-                                                                                                  guint         n_param_values,
-                                                                                                  const GValue *param_values,
-                                                                                                  gpointer      invocation_hint,
-                                                                                                  gpointer      marshal_data);
-void
-dbus_glib_marshal_m_dbus_glib_ic_connection_BOOLEAN__INT_INT_INT_INT_INT_INT_POINTER (GClosure     *closure,
-                                                                                      GValue       *return_value G_GNUC_UNUSED,
-                                                                                      guint         n_param_values,
-                                                                                      const GValue *param_values,
-                                                                                      gpointer      invocation_hint G_GNUC_UNUSED,
-                                                                                      gpointer      marshal_data)
-{
-  typedef gboolean (*GMarshalFunc_BOOLEAN__INT_INT_INT_INT_INT_INT_POINTER) (gpointer     data1,
-                                                                             gint         arg_1,
-                                                                             gint         arg_2,
-                                                                             gint         arg_3,
-                                                                             gint         arg_4,
-                                                                             gint         arg_5,
-                                                                             gint         arg_6,
-                                                                             gpointer     arg_7,
-                                                                             gpointer     data2);
-  register GMarshalFunc_BOOLEAN__INT_INT_INT_INT_INT_INT_POINTER callback;
-  register GCClosure *cc = (GCClosure*) closure;
-  register gpointer data1, data2;
-  gboolean v_return;
-
-  g_return_if_fail (return_value != NULL);
-  g_return_if_fail (n_param_values == 8);
-
-  if (G_CCLOSURE_SWAP_DATA (closure))
-    {
-      data1 = closure->data;
-      data2 = g_value_peek_pointer (param_values + 0);
-    }
-  else
-    {
-      data1 = g_value_peek_pointer (param_values + 0);
-      data2 = closure->data;
-    }
-  callback = (GMarshalFunc_BOOLEAN__INT_INT_INT_INT_INT_INT_POINTER) (marshal_data ? marshal_data : cc->callback);
-
-  v_return = callback (data1,
-                       g_marshal_value_peek_int (param_values + 1),
-                       g_marshal_value_peek_int (param_values + 2),
-                       g_marshal_value_peek_int (param_values + 3),
-                       g_marshal_value_peek_int (param_values + 4),
-                       g_marshal_value_peek_int (param_values + 5),
-                       g_marshal_value_peek_int (param_values + 6),
-                       g_marshal_value_peek_pointer (param_values + 7),
-                       data2);
-
-  g_value_set_boolean (return_value, v_return);
-}
-
-/* BOOLEAN:BOXED,BOOLEAN,POINTER (/tmp/dbus-binding-tool-c-marshallers.EL9VHV:6) */
-extern void dbus_glib_marshal_m_dbus_glib_ic_connection_BOOLEAN__BOXED_BOOLEAN_POINTER (GClosure     *closure,
-                                                                                        GValue       *return_value,
-                                                                                        guint         n_param_values,
-                                                                                        const GValue *param_values,
-                                                                                        gpointer      invocation_hint,
-                                                                                        gpointer      marshal_data);
-void
-dbus_glib_marshal_m_dbus_glib_ic_connection_BOOLEAN__BOXED_BOOLEAN_POINTER (GClosure     *closure,
-                                                                            GValue       *return_value G_GNUC_UNUSED,
-                                                                            guint         n_param_values,
-                                                                            const GValue *param_values,
-                                                                            gpointer      invocation_hint G_GNUC_UNUSED,
-                                                                            gpointer      marshal_data)
-{
-  typedef gboolean (*GMarshalFunc_BOOLEAN__BOXED_BOOLEAN_POINTER) (gpointer     data1,
-                                                                   gpointer     arg_1,
-                                                                   gboolean     arg_2,
-                                                                   gpointer     arg_3,
-                                                                   gpointer     data2);
-  register GMarshalFunc_BOOLEAN__BOXED_BOOLEAN_POINTER callback;
-  register GCClosure *cc = (GCClosure*) closure;
-  register gpointer data1, data2;
-  gboolean v_return;
-
-  g_return_if_fail (return_value != NULL);
-  g_return_if_fail (n_param_values == 4);
-
-  if (G_CCLOSURE_SWAP_DATA (closure))
-    {
-      data1 = closure->data;
-      data2 = g_value_peek_pointer (param_values + 0);
-    }
-  else
-    {
-      data1 = g_value_peek_pointer (param_values + 0);
-      data2 = closure->data;
-    }
-  callback = (GMarshalFunc_BOOLEAN__BOXED_BOOLEAN_POINTER) (marshal_data ? marshal_data : cc->callback);
-
-  v_return = callback (data1,
-                       g_marshal_value_peek_boxed (param_values + 1),
-                       g_marshal_value_peek_boolean (param_values + 2),
-                       g_marshal_value_peek_pointer (param_values + 3),
-                       data2);
-
-  g_value_set_boolean (return_value, v_return);
-}
-
-/* BOOLEAN:INT,STRING,STRING,BOXED,POINTER (/tmp/dbus-binding-tool-c-marshallers.EL9VHV:7) */
-extern void dbus_glib_marshal_m_dbus_glib_ic_connection_BOOLEAN__INT_STRING_STRING_BOXED_POINTER (GClosure     *closure,
-                                                                                                  GValue       *return_value,
-                                                                                                  guint         n_param_values,
-                                                                                                  const GValue *param_values,
-                                                                                                  gpointer      invocation_hint,
-                                                                                                  gpointer      marshal_data);
-void
-dbus_glib_marshal_m_dbus_glib_ic_connection_BOOLEAN__INT_STRING_STRING_BOXED_POINTER (GClosure     *closure,
-                                                                                      GValue       *return_value G_GNUC_UNUSED,
-                                                                                      guint         n_param_values,
-                                                                                      const GValue *param_values,
-                                                                                      gpointer      invocation_hint G_GNUC_UNUSED,
-                                                                                      gpointer      marshal_data)
-{
-  typedef gboolean (*GMarshalFunc_BOOLEAN__INT_STRING_STRING_BOXED_POINTER) (gpointer     data1,
-                                                                             gint         arg_1,
-                                                                             gpointer     arg_2,
-                                                                             gpointer     arg_3,
-                                                                             gpointer     arg_4,
-                                                                             gpointer     arg_5,
-                                                                             gpointer     data2);
-  register GMarshalFunc_BOOLEAN__INT_STRING_STRING_BOXED_POINTER callback;
-  register GCClosure *cc = (GCClosure*) closure;
-  register gpointer data1, data2;
-  gboolean v_return;
-
-  g_return_if_fail (return_value != NULL);
-  g_return_if_fail (n_param_values == 6);
-
-  if (G_CCLOSURE_SWAP_DATA (closure))
-    {
-      data1 = closure->data;
-      data2 = g_value_peek_pointer (param_values + 0);
-    }
-  else
-    {
-      data1 = g_value_peek_pointer (param_values + 0);
-      data2 = closure->data;
-    }
-  callback = (GMarshalFunc_BOOLEAN__INT_STRING_STRING_BOXED_POINTER) (marshal_data ? marshal_data : cc->callback);
-
-  v_return = callback (data1,
-                       g_marshal_value_peek_int (param_values + 1),
-                       g_marshal_value_peek_string (param_values + 2),
-                       g_marshal_value_peek_string (param_values + 3),
-                       g_marshal_value_peek_boxed (param_values + 4),
-                       g_marshal_value_peek_pointer (param_values + 5),
-                       data2);
-
-  g_value_set_boolean (return_value, v_return);
-}
-
-/* BOOLEAN:INT,STRING,POINTER (/tmp/dbus-binding-tool-c-marshallers.EL9VHV:8) */
-extern void dbus_glib_marshal_m_dbus_glib_ic_connection_BOOLEAN__INT_STRING_POINTER (GClosure     *closure,
-                                                                                     GValue       *return_value,
-                                                                                     guint         n_param_values,
-                                                                                     const GValue *param_values,
-                                                                                     gpointer      invocation_hint,
-                                                                                     gpointer      marshal_data);
-void
-dbus_glib_marshal_m_dbus_glib_ic_connection_BOOLEAN__INT_STRING_POINTER (GClosure     *closure,
-                                                                         GValue       *return_value G_GNUC_UNUSED,
-                                                                         guint         n_param_values,
-                                                                         const GValue *param_values,
-                                                                         gpointer      invocation_hint G_GNUC_UNUSED,
-                                                                         gpointer      marshal_data)
-{
-  typedef gboolean (*GMarshalFunc_BOOLEAN__INT_STRING_POINTER) (gpointer     data1,
-                                                                gint         arg_1,
-                                                                gpointer     arg_2,
-                                                                gpointer     arg_3,
-                                                                gpointer     data2);
-  register GMarshalFunc_BOOLEAN__INT_STRING_POINTER callback;
-  register GCClosure *cc = (GCClosure*) closure;
-  register gpointer data1, data2;
-  gboolean v_return;
-
-  g_return_if_fail (return_value != NULL);
-  g_return_if_fail (n_param_values == 4);
-
-  if (G_CCLOSURE_SWAP_DATA (closure))
-    {
-      data1 = closure->data;
-      data2 = g_value_peek_pointer (param_values + 0);
-    }
-  else
-    {
-      data1 = g_value_peek_pointer (param_values + 0);
-      data2 = closure->data;
-    }
-  callback = (GMarshalFunc_BOOLEAN__INT_STRING_POINTER) (marshal_data ? marshal_data : cc->callback);
-
-  v_return = callback (data1,
-                       g_marshal_value_peek_int (param_values + 1),
-                       g_marshal_value_peek_string (param_values + 2),
-                       g_marshal_value_peek_pointer (param_values + 3),
-                       data2);
-
-  g_value_set_boolean (return_value, v_return);
-}
-
-/* BOOLEAN:STRING,POINTER (/tmp/dbus-binding-tool-c-marshallers.EL9VHV:9) */
-extern void dbus_glib_marshal_m_dbus_glib_ic_connection_BOOLEAN__STRING_POINTER (GClosure     *closure,
-                                                                                 GValue       *return_value,
-                                                                                 guint         n_param_values,
-                                                                                 const GValue *param_values,
-                                                                                 gpointer      invocation_hint,
-                                                                                 gpointer      marshal_data);
-void
-dbus_glib_marshal_m_dbus_glib_ic_connection_BOOLEAN__STRING_POINTER (GClosure     *closure,
-                                                                     GValue       *return_value G_GNUC_UNUSED,
-                                                                     guint         n_param_values,
-                                                                     const GValue *param_values,
-                                                                     gpointer      invocation_hint G_GNUC_UNUSED,
-                                                                     gpointer      marshal_data)
-{
-  typedef gboolean (*GMarshalFunc_BOOLEAN__STRING_POINTER) (gpointer     data1,
-                                                            gpointer     arg_1,
-                                                            gpointer     arg_2,
-                                                            gpointer     data2);
-  register GMarshalFunc_BOOLEAN__STRING_POINTER callback;
-  register GCClosure *cc = (GCClosure*) closure;
-  register gpointer data1, data2;
-  gboolean v_return;
-
-  g_return_if_fail (return_value != NULL);
-  g_return_if_fail (n_param_values == 3);
-
-  if (G_CCLOSURE_SWAP_DATA (closure))
-    {
-      data1 = closure->data;
-      data2 = g_value_peek_pointer (param_values + 0);
-    }
-  else
-    {
-      data1 = g_value_peek_pointer (param_values + 0);
-      data2 = closure->data;
-    }
-  callback = (GMarshalFunc_BOOLEAN__STRING_POINTER) (marshal_data ? marshal_data : cc->callback);
-
-  v_return = callback (data1,
-                       g_marshal_value_peek_string (param_values + 1),
-                       g_marshal_value_peek_pointer (param_values + 2),
-                       data2);
-
-  g_value_set_boolean (return_value, v_return);
-}
-
-G_END_DECLS
-
-#endif /* __dbus_glib_marshal_m_dbus_glib_ic_connection_MARSHAL_H__ */
-
-#include <dbus/dbus-glib.h>
-static const DBusGMethodInfo dbus_glib_m_dbus_glib_ic_connection_methods[] = {
-  { (GCallback) m_dbus_glib_ic_connection_activate_context, dbus_glib_marshal_m_dbus_glib_ic_connection_BOOLEAN__POINTER, 0 },
-  { (GCallback) m_dbus_glib_ic_connection_show_input_method, dbus_glib_marshal_m_dbus_glib_ic_connection_BOOLEAN__POINTER, 51 },
-  { (GCallback) m_dbus_glib_ic_connection_hide_input_method, dbus_glib_marshal_m_dbus_glib_ic_connection_BOOLEAN__POINTER, 102 },
-  { (GCallback) m_dbus_glib_ic_connection_mouse_clicked_on_preedit, dbus_glib_marshal_m_dbus_glib_ic_connection_BOOLEAN__INT_INT_INT_INT_INT_INT_POINTER, 153 },
-  { (GCallback) m_dbus_glib_ic_connection_set_preedit, dbus_glib_marshal_m_dbus_glib_ic_connection_BOOLEAN__STRING_POINTER, 264 },
-  { (GCallback) m_dbus_glib_ic_connection_update_widget_information, dbus_glib_marshal_m_dbus_glib_ic_connection_BOOLEAN__BOXED_BOOLEAN_POINTER, 319 },
-  { (GCallback) m_dbus_glib_ic_connection_reset, dbus_glib_marshal_m_dbus_glib_ic_connection_BOOLEAN__POINTER, 397 },
-  { (GCallback) m_dbus_glib_ic_connection_app_orientation_changed, dbus_glib_marshal_m_dbus_glib_ic_connection_BOOLEAN__INT_POINTER, 438 },
-  { (GCallback) m_dbus_glib_ic_connection_set_copy_paste_state, dbus_glib_marshal_m_dbus_glib_ic_connection_BOOLEAN__BOOLEAN_BOOLEAN_POINTER, 504 },
-  { (GCallback) m_dbus_glib_ic_connection_process_key_event, dbus_glib_marshal_m_dbus_glib_ic_connection_BOOLEAN__INT_INT_INT_STRING_BOOLEAN_INT_UINT_UINT_POINTER, 575 },
-  { (GCallback) m_dbus_glib_ic_connection_register_toolbar, dbus_glib_marshal_m_dbus_glib_ic_connection_BOOLEAN__INT_STRING_POINTER, 698 },
-  { (GCallback) m_dbus_glib_ic_connection_unregister_toolbar, dbus_glib_marshal_m_dbus_glib_ic_connection_BOOLEAN__INT_POINTER, 767 },
-  { (GCallback) m_dbus_glib_ic_connection_set_toolbar_item_attribute, dbus_glib_marshal_m_dbus_glib_ic_connection_BOOLEAN__INT_STRING_STRING_BOXED_POINTER, 829 },
-};
-
-const DBusGObjectInfo dbus_glib_m_dbus_glib_ic_connection_object_info = {
-  0,
-  dbus_glib_m_dbus_glib_ic_connection_methods,
-  13,
-"com.meego.inputmethod.uiserver1\0activateContext\0S\0\0com.meego.inputmethod.uiserver1\0showInputMethod\0S\0\0com.meego.inputmethod.uiserver1\0hideInputMethod\0S\0\0com.meego.inputmethod.uiserver1\0mouseClickedOnPreedit\0S\0arg0\0I\0i\0arg1\0I\0i\0arg2\0I\0i\0arg3\0I\0i\0arg4\0I\0i\0arg5\0I\0i\0\0com.meego.inputmethod.uiserver1\0setPreedit\0S\0arg0\0I\0s\0\0com.meego.inputmethod.uiserver1\0updateWidgetInformation\0S\0arg0\0I\0ay\0arg1\0I\0b\0\0com.meego.inputmethod.uiserver1\0reset\0S\0\0com.meego.inputmethod.uiserver1\0appOrientationChanged\0S\0arg0\0I\0i\0\0com.meego.inputmethod.uiserver1\0setCopyPasteState\0S\0arg0\0I\0b\0arg1\0I\0b\0\0com.meego.inputmethod.uiserver1\0processKeyEvent\0S\0arg0\0I\0i\0arg1\0I\0i\0arg2\0I\0i\0arg3\0I\0s\0arg4\0I\0b\0arg5\0I\0i\0arg6\0I\0u\0arg7\0I\0u\0\0com.meego.inputmethod.uiserver1\0registerToolbar\0S\0arg0\0I\0i\0arg1\0I\0s\0\0com.meego.inputmethod.uiserver1\0unregisterToolbar\0S\0arg0\0I\0i\0\0com.meego.inputmethod.uiserver1\0setToolba
 rItemAttribute\0S\0arg0\0I\0i\0arg1\0I\0s\0arg2\0I\0s\0arg3\0I\0ay\0\0\0",
-"\0",
-"\0"
-};
-
--- src/meegoimframework.prf.in
+++ src/meegoimframework.prf.in
@@ -1,5 +1,5 @@
 M_IM_FRAMEWORK_PREFIX=/usr
-M_IM_FRAMEWORK_INSTALL_HEADERS=$${M_IM_FRAMEWORK_PREFIX}/include/meegotouch/meegoimframework
+M_IM_FRAMEWORK_INSTALL_HEADERS=$${M_IM_FRAMEWORK_PREFIX}/include/meegoimframework
 LIBS += -L$${M_IM_FRAMEWORK_PREFIX}/lib
 INCLUDEPATH += $${M_IM_FRAMEWORK_INSTALL_HEADERS}
 qtAddLibrary(meegoimframework)
--- src/mimapplication.cpp
+++ src/mimapplication.cpp
@@ -71,23 +71,18 @@
 
     remoteWinId = newRemoteWinId;
 
-    // The transient hint is strictly speaken not necessary yet - we still
-    // handle window stacking order manually by making the VKB plugin raise
-    // over the top-most application window.
-    // TODO: Get rid of window stacking code in plugin side, depends on fix
-    // for NB#172937.
-    XSetTransientForHint(QX11Info::display(), activeWindow()->winId(), remoteWinId);
+    XSetTransientForHint(QX11Info::display(),
+                         passThruWindow->effectiveWinId(),
+                         remoteWinId);
 
-    // Using PropertyChangeMask is a work-around for NB#172722.
-    XSelectInput(QX11Info::display(), newRemoteWinId, StructureNotifyMask | PropertyChangeMask);
+    // Using PropertyChangeMask is a work-around for NB#172722 (a WONTFIX):
+    XSelectInput(QX11Info::display(),
+                 remoteWinId,
+                 StructureNotifyMask | PropertyChangeMask);
 }
 
 void MIMApplication::setPassThruWindow(QWidget *newPassThruWindow)
 {
-    // The MPassThruWindow is different from the activeWindow, but we have to
-    // follow the X11 events from the activeWindow while hiding its viewport (an
-    // MPassThruWindow instance, usually), in order to not mess with the
-    // application logic.
     if (newPassThruWindow != passThruWindow) {
         passThruWindow = newPassThruWindow;
     }
--- src/mimdirection.h
+++ src/mimdirection.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 MIMDIRECTION_H
-#define MIMDIRECTION_H
-
-namespace M
-{
-
-/*!
- * This enum defines direction of plugin switching
- */
-enum InputMethodSwitchDirection {
-    SwitchUndefined, //!< Special value for uninitialized variables
-    SwitchForward, //!< Activate next plugin
-    SwitchBackward //!< Activate previous plugin
-};
-
-}
-
-#endif
-
--- src/mimhandlerstate.h
+++ src/mimhandlerstate.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 MIMHANDLERSTATE_H
-#define MIMHANDLERSTATE_H
-
-enum MIMHandlerState { OnScreen, Hardware, Accessory };
-
-#endif
-
--- src/mimpluginmanager.cpp
+++ src/mimpluginmanager.cpp
@@ -16,17 +16,18 @@
 
 #include "mimpluginmanager.h"
 #include "mimpluginmanager_p.h"
+#include "mimpluginmanageradaptor.h"
 #include "mplainwindow.h"
+#include "minputmethodplugin.h"
+#include "mtoolbarmanager.h"
+#include "mimsettingsdialog.h"
+#include "mabstractinputmethod.h"
 
 #include <MGConfItem>
 #include <MKeyboardStateTracker>
 #include <MSceneManager>
 #include <MLocale>
 
-#include "minputmethodplugin.h"
-#include "mtoolbarmanager.h"
-#include "mimsettingsdialog.h"
-
 #include <QDir>
 #include <QPluginLoader>
 #include <QSignalMapper>
@@ -39,19 +40,12 @@
 
 #include <QDebug>
 
-#ifdef QT_DBUS
-#include "minputcontextdbusconnection.h"
-typedef MInputContextDBusConnection MInputContextConnectionImpl;
-#else
 #include "minputcontextglibdbusconnection.h"
 typedef MInputContextGlibDBusConnection MInputContextConnectionImpl;
-#endif
 
 
 namespace
 {
-    const int DeleteInputMethodTimeout = 60000;
-
     const QString DefaultPluginLocation("/usr/lib/meego-im-plugins/");
 
     const QString ConfigRoot          = "/meegotouch/inputmethods/";
@@ -61,8 +55,8 @@
     const QString PluginRoot          = "/meegotouch/inputmethods/plugins";
     const QString MImAccesoryEnabled  = "/meegotouch/inputmethods/accessoryenabled";
 
-    const char * const DBusServiceName = "com.maemo.inputmethodpluginmanager1";
-    const char * const DBusPath = "/com/maemo/inputmethodpluginmanager1";
+    const char * const DBusServiceName = "com.meego.inputmethodpluginmanager1";
+    const char * const DBusPath = "/com/meego/inputmethodpluginmanager1";
 }
 
 MIMPluginManagerPrivate::MIMPluginManagerPrivate(MInputContextConnection *connection,
@@ -73,11 +67,12 @@
       settingsDialog(0),
       adaptor(0),
       connectionValid(false),
-      acceptRegionUpdates(true)
+      acceptRegionUpdates(true),
+      indicatorService(0)
 {
-    inputSourceToNameMap[OnScreen] = "onscreen";
-    inputSourceToNameMap[Hardware] = "hardware";
-    inputSourceToNameMap[Accessory] = "accessory";
+    inputSourceToNameMap[MInputMethod::OnScreen] = "onscreen";
+    inputSourceToNameMap[MInputMethod::Hardware] = "hardware";
+    inputSourceToNameMap[MInputMethod::Accessory] = "accessory";
 
     for (InputSourceToNameMap::const_iterator i(inputSourceToNameMap.begin());
          i != inputSourceToNameMap.end(); ++i) {
@@ -111,6 +106,8 @@
 
 bool MIMPluginManagerPrivate::loadPlugin(const QString &fileName)
 {
+    Q_Q(MIMPluginManager);
+
     bool val = false;
     QPluginLoader load(fileName);
     QObject *pluginInstance = load.instance();
@@ -122,12 +119,19 @@
         MInputMethodPlugin *plugin = qobject_cast<MInputMethodPlugin *>(pluginInstance);
         if (plugin) {
             if (!plugin->supportedStates().isEmpty()) {
-                MInputMethodBase *inputMethod = plugin->createInputMethod(mICConnection);
+                MInputMethodHost *inputMethodHost = new MInputMethodHost(mICConnection, q,
+                                                                         indicatorService);
+                MAbstractInputMethod *inputMethod = plugin->createInputMethod(inputMethodHost);
+
                 // only add valid plugin descriptions
                 if (inputMethod) {
-                    PluginDescription desc = { load.fileName(), inputMethod, PluginState(), M::SwitchUndefined };
+                    PluginDescription desc = { load.fileName(), inputMethod, inputMethodHost,
+                                               PluginState(), MInputMethod::SwitchUndefined };
                     plugins[plugin] = desc;
                     val = true;
+                    inputMethodHost->setInputMethod(inputMethod);
+                } else {
+                    delete inputMethodHost;
                 }
             } else {
                 qWarning() << __PRETTY_FUNCTION__
@@ -148,40 +152,18 @@
         return;
     }
 
-    MInputMethodBase *inputMethod = 0;
+    MAbstractInputMethod *inputMethod = 0;
 
     activePlugins.insert(plugin);
     inputMethod = plugins[plugin].inputMethod;
-
+    plugins[plugin].imHost->setEnabled(true);
 
     Q_ASSERT(inputMethod);
-    QObject::connect(inputMethod, SIGNAL(regionUpdated(const QRegion &)),
-                     q, SLOT(updateRegion(const QRegion &)));
-
-    QObject::connect(inputMethod,
-                     SIGNAL(inputMethodAreaUpdated(const QRegion &)),
-                     mICConnection,
-                     SLOT(updateInputMethodArea(const QRegion &)));
-
-    QObject::connect(inputMethod,
-                     SIGNAL(pluginSwitchRequired(M::InputMethodSwitchDirection)),
-                     q,
-                     SLOT(switchPlugin(M::InputMethodSwitchDirection)));
-
-    QObject::connect(inputMethod,
-                     SIGNAL(pluginSwitchRequired(const QString&)),
-                     q,
-                     SLOT(switchPlugin(const QString&)));
 
     QObject::connect(inputMethod,
-                     SIGNAL(settingsRequested()),
+                     SIGNAL(activeSubViewChanged(QString, MInputMethod::HandlerState)),
                      q,
-                     SLOT(showInputMethodSettings()));
-
-    QObject::connect(inputMethod,
-                     SIGNAL(activeSubViewChanged(QString, MIMHandlerState)),
-                     q,
-                     SLOT(_q_setActiveSubView(QString, MIMHandlerState)));
+                     SLOT(_q_setActiveSubView(QString, MInputMethod::HandlerState)));
 
     mICConnection->addTarget(inputMethod); // redirect incoming requests
 
@@ -189,7 +171,8 @@
 }
 
 
-void MIMPluginManagerPrivate::addHandlerMap(MIMHandlerState state, const QString &pluginName)
+void MIMPluginManagerPrivate::addHandlerMap(MInputMethod::HandlerState state,
+                                            const QString &pluginName)
 {
     foreach (MInputMethodPlugin *plugin, plugins.keys()) {
         if (plugin->name() == pluginName) {
@@ -200,10 +183,10 @@
 }
 
 
-void MIMPluginManagerPrivate::setActiveHandlers(const QSet<MIMHandlerState> &states)
+void MIMPluginManagerPrivate::setActiveHandlers(const QSet<MInputMethod::HandlerState> &states)
 {
     QSet<MInputMethodPlugin *> activatedPlugins;
-    MInputMethodBase *inputMethod = 0;
+    MAbstractInputMethod *inputMethod = 0;
 
     //clear all cached states before activating new one
     for (Plugins::iterator iterator = plugins.begin();
@@ -213,7 +196,7 @@
     }
 
     //activate new plugins
-    foreach (MIMHandlerState state, states) {
+    foreach (MInputMethod::HandlerState state, states) {
         HandlerMap::const_iterator iterator = handlerToPlugin.find(state);
         MInputMethodPlugin *plugin = 0;
 
@@ -245,9 +228,9 @@
 }
 
 
-QSet<MIMHandlerState> MIMPluginManagerPrivate::activeHandlers() const
+QSet<MInputMethod::HandlerState> MIMPluginManagerPrivate::activeHandlers() const
 {
-    QSet<MIMHandlerState> handlers;
+    QSet<MInputMethod::HandlerState> handlers;
     foreach (MInputMethodPlugin *plugin, activePlugins) {
         handlers << handlerToPlugin.key(plugin);
     }
@@ -262,7 +245,8 @@
         return;
 
     activePlugins.remove(plugin);
-    MInputMethodBase *inputMethod = plugins[plugin].inputMethod;
+    MAbstractInputMethod *inputMethod = plugins[plugin].inputMethod;
+    plugins[plugin].imHost->setEnabled(false);
 
     if (!inputMethod)
         return;
@@ -271,42 +255,39 @@
     inputMethod->hide();
     inputMethod->reset();
     QObject::disconnect(inputMethod, 0, q, 0),
-    QObject::disconnect(inputMethod,
-                        SIGNAL(inputMethodAreaUpdated(const QRegion &)),
-                        mICConnection,
-                        SLOT(updateInputMethodArea(const QRegion &)));
     mICConnection->removeTarget(inputMethod);
 }
 
 
 void MIMPluginManagerPrivate::convertAndFilterHandlers(const QStringList &handlerNames,
-                                                       QSet<MIMHandlerState> *handlers)
+                                                       QSet<MInputMethod::HandlerState> *handlers)
 {
     bool ok = false;
     bool disableOnscreenKbd = false;
 
     foreach (const QString &name, handlerNames) {
-        int handlerNumber = (MIMHandlerState)name.toInt(&ok);
-        if (ok && handlerNumber >= OnScreen && handlerNumber <= Accessory) {
+        int handlerNumber = (MInputMethod::HandlerState)name.toInt(&ok);
+        if (ok && handlerNumber >= MInputMethod::OnScreen
+            && handlerNumber <= MInputMethod::Accessory) {
             if (!disableOnscreenKbd) {
-                disableOnscreenKbd = handlerNumber != OnScreen;
+                disableOnscreenKbd = handlerNumber != MInputMethod::OnScreen;
             }
-            handlers->insert((MIMHandlerState)handlerNumber);
+            handlers->insert((MInputMethod::HandlerState)handlerNumber);
         }
     }
 
     if (disableOnscreenKbd) {
-        handlers->remove(OnScreen);
+        handlers->remove(MInputMethod::OnScreen);
     }
 }
 
 
-void MIMPluginManagerPrivate::replacePlugin(M::InputMethodSwitchDirection direction,
+void MIMPluginManagerPrivate::replacePlugin(MInputMethod::SwitchDirection direction,
                                             Plugins::iterator initiator,
                                             Plugins::iterator replacement)
 {
     PluginState state = initiator->state;
-    MInputMethodBase *switchedTo = 0;
+    MAbstractInputMethod *switchedTo = 0;
 
     deactivatePlugin(initiator.key());
     activatePlugin(replacement.key());
@@ -321,13 +302,14 @@
         MToolbarManager::instance().toolbarData(toolbarId);
     switchedTo->setToolbar(toolbar);
     switchedTo->show();
+    switchedTo->showLanguageNotification();
 }
 
 
-bool MIMPluginManagerPrivate::switchPlugin(M::InputMethodSwitchDirection direction,
-                                           MInputMethodBase *initiator)
+bool MIMPluginManagerPrivate::switchPlugin(MInputMethod::SwitchDirection direction,
+                                           MAbstractInputMethod *initiator)
 {
-    if (direction == M::SwitchUndefined) {
+    if (direction == MInputMethod::SwitchUndefined) {
         return true; //do nothing for this direction
     }
 
@@ -348,7 +330,7 @@
 
     //find next inactive plugin and activate it
     for (int n = 0; n < plugins.size() - 1; ++n) {
-        if (direction == M::SwitchForward) {
+        if (direction == MInputMethod::SwitchForward) {
             ++iterator;
             if (iterator == plugins.end()) {
                 iterator = plugins.begin();
@@ -368,7 +350,7 @@
     return false;
 }
 
-bool MIMPluginManagerPrivate::switchPlugin(const QString &name, MInputMethodBase *initiator)
+bool MIMPluginManagerPrivate::switchPlugin(const QString &name, MAbstractInputMethod *initiator)
 {
     //Find plugin initiated this switch
     Plugins::iterator iterator(plugins.begin());
@@ -400,15 +382,15 @@
         return true;
     }
 
-    return doSwitchPlugin(M::SwitchUndefined, source, iterator);
+    return doSwitchPlugin(MInputMethod::SwitchUndefined, source, iterator);
 }
 
-bool MIMPluginManagerPrivate::doSwitchPlugin(M::InputMethodSwitchDirection direction,
+bool MIMPluginManagerPrivate::doSwitchPlugin(MInputMethod::SwitchDirection direction,
                                              Plugins::iterator source,
                                              Plugins::iterator replacement)
 {
     if (!activePlugins.contains(replacement.key())) {
-        const QSet<MIMHandlerState> intersect(replacement.key()->supportedStates()
+        const QSet<MInputMethod::HandlerState> intersect(replacement.key()->supportedStates()
                 & source->state);
         // switch to other plugin if it could handle any state
         // handled by current plugin just now
@@ -422,13 +404,14 @@
     return false;
 }
 
-QString MIMPluginManagerPrivate::inputSourceName(MIMHandlerState source) const
+QString MIMPluginManagerPrivate::inputSourceName(MInputMethod::HandlerState source) const
 {
     return inputSourceToNameMap.value(source);
 }
 
 
-MIMHandlerState MIMPluginManagerPrivate::inputSourceFromName(const QString &name, bool &valid) const
+MInputMethod::HandlerState
+MIMPluginManagerPrivate::inputSourceFromName(const QString &name, bool &valid) const
 {
     const QString lowercaseName(name.toLower());
     valid = nameToInputSourceMap.contains(lowercaseName);
@@ -437,9 +420,9 @@
 
 void MIMPluginManagerPrivate::changeHandlerMap(MInputMethodPlugin *origin,
                                                MInputMethodPlugin *replacement,
-                                               QSet<MIMHandlerState> states)
+                                               QSet<MInputMethod::HandlerState> states)
 {
-    foreach (MIMHandlerState state, states) {
+    foreach (MInputMethod::HandlerState state, states) {
         HandlerMap::iterator iterator = handlerToPlugin.find(state);
         if (iterator != handlerToPlugin.end() && *iterator == origin) {
             *iterator = replacement; //for unit tests
@@ -464,7 +447,7 @@
 }
 
 
-QStringList MIMPluginManagerPrivate::loadedPluginsNames(MIMHandlerState state) const
+QStringList MIMPluginManagerPrivate::loadedPluginsNames(MInputMethod::HandlerState state) const
 {
     QStringList result;
 
@@ -489,7 +472,7 @@
 }
 
 
-QString MIMPluginManagerPrivate::activePluginsName(MIMHandlerState state) const
+QString MIMPluginManagerPrivate::activePluginsName(MInputMethod::HandlerState state) const
 {
     QString result;
 
@@ -511,7 +494,7 @@
     foreach (const QString &handler, MGConfItem(PluginRoot).listEntries()) {
         const QStringList path = handler.split("/");
         bool validSource(false);
-        const MIMHandlerState source(inputSourceFromName(path.last(), validSource));
+        const MInputMethod::HandlerState source(inputSourceFromName(path.last(), validSource));
         if (validSource) {
             MGConfItem *handlerItem = new MGConfItem(handler);
             handlerToPluginConfs.append(handlerItem);
@@ -529,9 +512,17 @@
 
 void MIMPluginManagerPrivate::_q_syncHandlerMap(int state)
 {
-    HandlerMap::iterator iterator = handlerToPlugin.find(static_cast<MIMHandlerState>(state));
-    MGConfItem gconf(PluginRoot + "/" + inputSourceName(static_cast<MIMHandlerState>(state)));
-    QString pluginName = gconf.value().toString();
+    const MInputMethod::HandlerState source = static_cast<MInputMethod::HandlerState>(state);
+
+    MInputMethodPlugin *currentPlugin = activePlugin(source);
+    MGConfItem gconf(PluginRoot + "/" + inputSourceName(source));
+    const QString pluginName = gconf.value().toString();
+
+    // already synchronized.
+    if (currentPlugin && pluginName == currentPlugin->name()) {
+       return;
+    }
+
     MInputMethodPlugin *replacement = 0;
     foreach (MInputMethodPlugin *plugin, plugins.keys()) {
         if (plugin->name() == pluginName) {
@@ -539,12 +530,10 @@
             break;
         }
     }
-    if (replacement
-        && iterator != handlerToPlugin.end()
-        && iterator.value()->name() != pluginName) {
+    if (replacement) {
         // switch plugin if handler gconf is changed.
-        MInputMethodBase *inputMethod = plugins[iterator.value()].inputMethod;
-        addHandlerMap(static_cast<MIMHandlerState>(state), pluginName);
+        MAbstractInputMethod *inputMethod = plugins[currentPlugin].inputMethod;
+        addHandlerMap(static_cast<MInputMethod::HandlerState>(state), pluginName);
         if (!switchPlugin(pluginName, inputMethod)) {
             qWarning() << __PRETTY_FUNCTION__ << ", switching to plugin:"
                        << pluginName << " failed";
@@ -552,12 +541,12 @@
     }
 
     // need update activeSubview if plugin is switched.
-    if (state == OnScreen) {
+    if (state == MInputMethod::OnScreen) {
         initActiveSubView();
     }
 }
 
-MInputMethodPlugin *MIMPluginManagerPrivate::activePlugin(MIMHandlerState state) const
+MInputMethodPlugin *MIMPluginManagerPrivate::activePlugin(MInputMethod::HandlerState state) const
 {
     MInputMethodPlugin *plugin = 0;
     HandlerMap::const_iterator iterator = handlerToPlugin.find(state);
@@ -567,21 +556,29 @@
     return plugin;
 }
 
-void MIMPluginManagerPrivate::_q_setActiveSubView(const QString &subViewId, MIMHandlerState state)
+void MIMPluginManagerPrivate::_q_setActiveSubView(const QString &subViewId,
+                                                  MInputMethod::HandlerState state)
 {
     // now we only support active subview for OnScreen state.
-    if (state == OnScreen && !subViewId.isEmpty() && activePlugin(OnScreen)
+    if (state == MInputMethod::OnScreen && !subViewId.isEmpty()
+        && activePlugin(MInputMethod::OnScreen)
         && (activeSubViewIdOnScreen != subViewId)) {
+
         // check whether this subView is supported by current active plugin.
-        MInputMethodBase *inputMethod = plugins[activePlugin(OnScreen)].inputMethod;
+        MAbstractInputMethod *inputMethod
+            = plugins[activePlugin(MInputMethod::OnScreen)].inputMethod;
         Q_ASSERT(inputMethod);
-        foreach (const MInputMethodBase::MInputMethodSubView &subView, inputMethod->subViews(OnScreen)) {
+
+        foreach (const MAbstractInputMethod::MInputMethodSubView &subView,
+                 inputMethod->subViews(MInputMethod::OnScreen)) {
             if (subView.subViewId == subViewId) {
                 activeSubViewIdOnScreen = subViewId;
-                if (inputMethod->activeSubView(OnScreen) != activeSubViewIdOnScreen) {
-                    inputMethod->setActiveSubView(activeSubViewIdOnScreen, OnScreen);
+                if (inputMethod->activeSubView(MInputMethod::OnScreen) != activeSubViewIdOnScreen) {
+                    inputMethod->setActiveSubView(activeSubViewIdOnScreen, MInputMethod::OnScreen);
+                }
+                if (adaptor) {
+                    emit adaptor->activeSubViewChanged(MInputMethod::OnScreen);
                 }
-                emit adaptor->activeSubViewChanged(OnScreen);
                 if (settingsDialog) {
                     settingsDialog->refreshUi();
                 }
@@ -589,7 +586,7 @@
             }
         }
     }
-    if (state != OnScreen) {
+    if (state != MInputMethod::OnScreen) {
         qWarning() << "Unsupported state:" << state << " for active subview";
     }
 }
@@ -609,11 +606,18 @@
 void MIMPluginManagerPrivate::initActiveSubView()
 {
     // initialize activeSubViewIdOnScreen
-    if (activePlugin(OnScreen)) {
-        MInputMethodBase *inputMethod = plugins[activePlugin(OnScreen)].inputMethod;
-        if (activeSubViewIdOnScreen != inputMethod->activeSubView(OnScreen)) {
+    if (activePlugin(MInputMethod::OnScreen)) {
+        MAbstractInputMethod *inputMethod
+            = plugins[activePlugin(MInputMethod::OnScreen)].inputMethod;
+        if (activeSubViewIdOnScreen != inputMethod->activeSubView(MInputMethod::OnScreen)) {
             // activeSubViewIdOnScreen is invalid, should be initialized.
-            activeSubViewIdOnScreen = inputMethod->activeSubView(OnScreen);
+            activeSubViewIdOnScreen = inputMethod->activeSubView(MInputMethod::OnScreen);
+            if (adaptor) {
+                emit adaptor->activeSubViewChanged(MInputMethod::OnScreen);
+            }
+            if (settingsDialog) {
+                settingsDialog->refreshUi();
+            }
         }
     }
 }
@@ -637,7 +641,9 @@
     }
 }
 
-QMap<QString, QString> MIMPluginManagerPrivate::availableSubViews(const QString &plugin, MIMHandlerState state) const
+QMap<QString, QString>
+MIMPluginManagerPrivate::availableSubViews(const QString &plugin,
+                                           MInputMethod::HandlerState state) const
 {
     QMap<QString, QString> subViews;
     Plugins::iterator iterator(plugins.begin());
@@ -645,7 +651,7 @@
     for (; iterator != plugins.end(); ++iterator) {
         if (iterator.key()->name() == plugin) {
             if (iterator->inputMethod) {
-                foreach (const MInputMethodBase::MInputMethodSubView &subView,
+                foreach (const MAbstractInputMethod::MInputMethodSubView &subView,
                          iterator->inputMethod->subViews(state)) {
                     subViews.insert(subView.subViewId, subView.subViewTitle);
                 }
@@ -656,7 +662,7 @@
     return subViews;
 }
 
-QString MIMPluginManagerPrivate::activeSubView(MIMHandlerState state) const
+QString MIMPluginManagerPrivate::activeSubView(MInputMethod::HandlerState state) const
 {
     QString subView;
     MInputMethodPlugin *currentPlugin = activePlugin(state);
@@ -666,7 +672,8 @@
     return subView;
 }
 
-void MIMPluginManagerPrivate::setActivePlugin(const QString &pluginName, MIMHandlerState state)
+void MIMPluginManagerPrivate::setActivePlugin(const QString &pluginName,
+                                              MInputMethod::HandlerState state)
 {
     MGConfItem currentPluginConf(PluginRoot + "/" + inputSourceName(state));
     if (!pluginName.isEmpty() && currentPluginConf.value().toString() != pluginName) {
@@ -674,6 +681,12 @@
         foreach (MInputMethodPlugin *plugin, plugins.keys()) {
             if (plugin->name() == pluginName) {
                 currentPluginConf.set(pluginName);
+                // Force call _q_syncHandlerMap() even though we already connect
+                // _q_syncHandlerMap() with gconf valueChanged(). Because if the
+                // request comes from different threads, the _q_syncHandlerMap()
+                // won't be called at once. This means the synchronization of
+                // handler map could be delayed if we don't force call it.
+                _q_syncHandlerMap(state);
                 break;
             }
         }
@@ -681,77 +694,6 @@
 }
 
 
-MIMPluginManagerAdaptor::MIMPluginManagerAdaptor(MIMPluginManager *parent)
-    : QDBusAbstractAdaptor(parent),
-      owner(parent)
-{
-    if (!parent) {
-        qFatal("Creating MIMPluginManagerAdaptor without a parent");
-    }
-}
-
-
-MIMPluginManagerAdaptor::~MIMPluginManagerAdaptor()
-{
-    // nothing
-}
-
-QStringList MIMPluginManagerAdaptor::queryAvailablePlugins()
-{
-    Q_ASSERT(owner);
-    return owner->loadedPluginsNames();
-}
-
-QStringList MIMPluginManagerAdaptor::queryAvailablePlugins(int state)
-{
-    Q_ASSERT(owner);
-    return owner->loadedPluginsNames(static_cast<MIMHandlerState>(state));
-}
-
-QString MIMPluginManagerAdaptor::queryActivePlugin(int state)
-{
-    Q_ASSERT(owner);
-    return owner->activePluginsName(static_cast<MIMHandlerState>(state));
-}
-
-QMap<QString, QVariant> MIMPluginManagerAdaptor::queryAvailableSubViews(const QString &plugin, int state)
-{
-    Q_ASSERT(owner);
-    QMap<QString, QVariant> vSubViews;
-
-    QMap<QString, QString> subViews = owner->availableSubViews(plugin, static_cast<MIMHandlerState>(state));
-    QMapIterator<QString, QString> subView(subViews);
-    while (subView.hasNext()) {
-        subView.next();
-        vSubViews.insert(subView.key(), subView.value());
-    }
-    return vSubViews;
-}
-
-QMap<QString, QVariant> MIMPluginManagerAdaptor::queryActiveSubView(int state)
-{
-    Q_ASSERT(owner);
-    QMap<QString, QVariant> activeSubbView;
-    activeSubbView.insert(owner->activeSubView(static_cast<MIMHandlerState>(state)),
-                          owner->activePluginsName(static_cast<MIMHandlerState>(state)));
-    return activeSubbView;
-}
-
-void MIMPluginManagerAdaptor::setActivePlugin(const QString &pluginName, int state, const QString &subViewId)
-{
-    Q_ASSERT(owner);
-    owner->setActivePlugin(pluginName, static_cast<MIMHandlerState>(state));
-    if (!subViewId.isEmpty()) {
-        owner->setActiveSubView(subViewId, static_cast<MIMHandlerState>(state));
-    }
-}
-
-void MIMPluginManagerAdaptor::setActiveSubView(const QString &subViewId, int state)
-{
-    Q_ASSERT(owner);
-    owner->setActiveSubView(subViewId, static_cast<MIMHandlerState>(state));
-}
-
 ///////////////
 // actual class
 
@@ -826,7 +768,7 @@
 }
 
 
-QStringList MIMPluginManager::loadedPluginsNames(MIMHandlerState state) const
+QStringList MIMPluginManager::loadedPluginsNames(MInputMethod::HandlerState state) const
 {
     Q_D(const MIMPluginManager);
     return d->loadedPluginsNames(state);
@@ -840,7 +782,7 @@
 }
 
 
-QString MIMPluginManager::activePluginsName(MIMHandlerState state) const
+QString MIMPluginManager::activePluginsName(MInputMethod::HandlerState state) const
 {
     Q_D(const MIMPluginManager);
     return d->activePluginsName(state);
@@ -851,22 +793,22 @@
     Q_D(MIMPluginManager);
     // Hardware and Accessory can work together.
     // OnScreen is mutually exclusive to Hardware and Accessory.
-    QSet<MIMHandlerState> handlers = d->activeHandlers();
+    QSet<MInputMethod::HandlerState> handlers = d->activeHandlers();
     if (MKeyboardStateTracker::instance()->isOpen()) {
         // hw keyboard is on
-        handlers.remove(OnScreen);
-        handlers.insert(Hardware);
+        handlers.remove(MInputMethod::OnScreen);
+        handlers.insert(MInputMethod::Hardware);
     } else {
         // hw keyboard is off
-        handlers.remove(Hardware);
-        handlers.insert(OnScreen);
+        handlers.remove(MInputMethod::Hardware);
+        handlers.insert(MInputMethod::OnScreen);
     }
 
     if (d->imAccessoryEnabledConf->value().toBool()) {
-        handlers.remove(OnScreen);
-        handlers.insert(Accessory);
+        handlers.remove(MInputMethod::OnScreen);
+        handlers.insert(MInputMethod::Accessory);
     } else {
-        handlers.remove(Accessory);
+        handlers.remove(MInputMethod::Accessory);
     }
 
     if (!handlers.isEmpty()) {
@@ -874,10 +816,10 @@
     }
 }
 
-void MIMPluginManager::switchPlugin(M::InputMethodSwitchDirection direction)
+void MIMPluginManager::switchPlugin(MInputMethod::SwitchDirection direction,
+                                    MAbstractInputMethod *initiator)
 {
     Q_D(MIMPluginManager);
-    MInputMethodBase *initiator = qobject_cast<MInputMethodBase*>(sender());
 
     if (initiator) {
         if (!d->switchPlugin(direction, initiator)) {
@@ -887,10 +829,10 @@
     }
 }
 
-void MIMPluginManager::switchPlugin(const QString &name)
+void MIMPluginManager::switchPlugin(const QString &name,
+                                    MAbstractInputMethod *initiator)
 {
     Q_D(MIMPluginManager);
-    MInputMethodBase *initiator = qobject_cast<MInputMethodBase*>(sender());
 
     if (initiator) {
         if (!d->switchPlugin(name, initiator)) {
@@ -965,25 +907,26 @@
     emit regionUpdated(QRegion());
 }
 
-QMap<QString, QString> MIMPluginManager::availableSubViews(const QString &plugin, MIMHandlerState state) const
+QMap<QString, QString> MIMPluginManager::availableSubViews(const QString &plugin,
+                                                           MInputMethod::HandlerState state) const
 {
     Q_D(const MIMPluginManager);
     return d->availableSubViews(plugin, state);
 }
 
-QString MIMPluginManager::activeSubView(MIMHandlerState state) const
+QString MIMPluginManager::activeSubView(MInputMethod::HandlerState state) const
 {
     Q_D(const MIMPluginManager);
     return d->activeSubView(state);
 }
 
-void MIMPluginManager::setActivePlugin(const QString &pluginName, MIMHandlerState state)
+void MIMPluginManager::setActivePlugin(const QString &pluginName, MInputMethod::HandlerState state)
 {
     Q_D(MIMPluginManager);
     d->setActivePlugin(pluginName, state);
 }
 
-void MIMPluginManager::setActiveSubView(const QString &subViewId, MIMHandlerState state)
+void MIMPluginManager::setActiveSubView(const QString &subViewId, MInputMethod::HandlerState state)
 {
     Q_D(MIMPluginManager);
     d->_q_setActiveSubView(subViewId, state);
--- src/mimpluginmanager.h
+++ src/mimpluginmanager.h
@@ -19,23 +19,24 @@
 
 #include <QObject>
 #include <QMap>
-#include "mimdirection.h"
-#include "mimhandlerstate.h"
 
-class MIMPluginManagerPrivate;
+#include "minputmethodnamespace.h"
+
 class QRegion;
+class MIMPluginManagerPrivate;
 class MToolbarId;
+class MAbstractInputMethod;
 
+
+//! Note: this class is not considered stable API
 class MIMPluginManager: public QObject
 {
     Q_OBJECT
-    Q_CLASSINFO("D-Bus Interface", "com.maemo.inputmethodpluginmanager1")
+    Q_CLASSINFO("D-Bus Interface", "com.meego.inputmethodpluginmanager1")
 
 public:
     /*!
      * \Brief Constructs object MIMPluginManager
-     * \param deleteIMtimeout int timeout for deletion of inactive input method objects.
-     * Use default value to set default timeout.
      */
     MIMPluginManager();
 
@@ -45,29 +46,40 @@
     QStringList loadedPluginsNames() const;
 
     //! Returns names of loaded plugins which support \a state
-    QStringList loadedPluginsNames(MIMHandlerState state) const;
+    QStringList loadedPluginsNames(MInputMethod::HandlerState state) const;
 
     //! Returns names of activated plugins
     QStringList activePluginsNames() const;
 
     //! Returns names of activated plugin for \a state
-    QString activePluginsName(MIMHandlerState state) const;
+    QString activePluginsName(MInputMethod::HandlerState state) const;
 
     //! Returns all subviews (IDs and titles) of loaded plugins which support \a state.
-    QMap<QString, QString> availableSubViews(const QString &plugin, MIMHandlerState state = OnScreen) const;
+    QMap<QString, QString> availableSubViews(const QString &plugin,
+                                             MInputMethod::HandlerState state
+                                              = MInputMethod::OnScreen) const;
 
     //! Returns the ID of active subview of the activated plugin for \a state.
-    QString activeSubView(MIMHandlerState state) const;
+    QString activeSubView(MInputMethod::HandlerState state) const;
 
     //! Sets \a pluginName as the activated plugin for \a state.
-    void setActivePlugin(const QString &pluginName, MIMHandlerState state);
+    void setActivePlugin(const QString &pluginName, MInputMethod::HandlerState state);
 
     //! Sets \a subViewId as the active subview of the activated plugin for \a state.
-    void setActiveSubView(const QString &subViewId, MIMHandlerState state);
+    void setActiveSubView(const QString &subViewId, MInputMethod::HandlerState state);
 
     //! Returns true if the connection to D-Bus is valid and the object is properly usable
     bool isDBusConnectionValid() const;
 
+    //! Switches plugin in according to given \a direction
+    void switchPlugin(MInputMethod::SwitchDirection direction, MAbstractInputMethod *initiator);
+
+    //! 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
@@ -81,22 +93,13 @@
     //! Hide active plugins.
     void hideActivePlugins();
 
+    //! Updates the whole painting area for input method objects.
+    void updateRegion(const QRegion &region);
+
 private slots:
     //! Update and activate input source.
     void updateInputSource();
 
-    //! Switches plugin in according to given \a direction
-    void switchPlugin(M::InputMethodSwitchDirection direction);
-
-    //! Switches active plugin to inactive plugin with given \a name
-    void switchPlugin(const QString &name);
-
-    //! Shows settings for all loaded inputmethod plugins.
-    void showInputMethodSettings();
-
-    //! Updates the whole painting area for input method objects.
-    void updateRegion(const QRegion &region);
-
     //! Set toolbar to active plugin with given \a id
     void setToolbar(const MToolbarId &id);
 
@@ -107,7 +110,7 @@
     Q_DISABLE_COPY(MIMPluginManager)
     Q_DECLARE_PRIVATE(MIMPluginManager)
     Q_PRIVATE_SLOT(d_func(), void _q_syncHandlerMap(int));
-    Q_PRIVATE_SLOT(d_func(), void _q_setActiveSubView(const QString &, MIMHandlerState));
+    Q_PRIVATE_SLOT(d_func(), void _q_setActiveSubView(const QString &, MInputMethod::HandlerState));
 
     friend class Ut_MIMPluginManager;
     friend class Ft_MIMPluginManager;
--- src/mimpluginmanager_p.h
+++ src/mimpluginmanager_p.h
@@ -23,36 +23,37 @@
 #include <QMap>
 #include <QSet>
 #include <QRegion>
-#include <QDBusAbstractAdaptor>
-#include <MDialog>
 
-#include "mimhandlerstate.h"
-#include "mimdirection.h"
+#include "minputmethodnamespace.h"
 #include "mtoolbarid.h"
+#include "minputmethodhost.h"
+#include "mindicatorserviceclient.h"
 
 class MInputMethodPlugin;
 class MInputContextConnection;
 class MIMPluginManager;
 class MGConfItem;
-class MInputMethodBase;
+class MAbstractInputMethod;
 class MIMSettingsDialog;
 class MIMPluginManagerAdaptor;
 
+
 /* Internal class only! Interfaces here change, internal developers only*/
 class MIMPluginManagerPrivate
 {
     Q_DECLARE_PUBLIC(MIMPluginManager)
 public:
-    typedef QSet<MIMHandlerState> PluginState;
+    typedef QSet<MInputMethod::HandlerState> PluginState;
     struct PluginDescription {
         QString fileName;
-        MInputMethodBase *inputMethod;
+        MAbstractInputMethod *inputMethod;
+        MInputMethodHost *imHost;
         PluginState state;
-        M::InputMethodSwitchDirection lastSwitchDirection;
+        MInputMethod::SwitchDirection lastSwitchDirection;
     };
     typedef QMap<MInputMethodPlugin *, PluginDescription> Plugins;
     typedef QSet<MInputMethodPlugin *> ActivePlugins;
-    typedef QMap<MIMHandlerState, MInputMethodPlugin *> HandlerMap;
+    typedef QMap<MInputMethod::HandlerState, MInputMethodPlugin *> HandlerMap;
 
     MIMPluginManagerPrivate(MInputContextConnection *connection, MIMPluginManager *p);
     virtual ~MIMPluginManagerPrivate();
@@ -60,29 +61,30 @@
     void activatePlugin(MInputMethodPlugin *plugin);
     void loadPlugins();
     bool loadPlugin(const QString &fileName);
-    void addHandlerMap(MIMHandlerState state, const QString &pluginName);
-    void setActiveHandlers(const QSet<MIMHandlerState> &states);
-    QSet<MIMHandlerState> activeHandlers() const;
+    void addHandlerMap(MInputMethod::HandlerState state, const QString &pluginName);
+    void setActiveHandlers(const QSet<MInputMethod::HandlerState> &states);
+    QSet<MInputMethod::HandlerState> activeHandlers() const;
     void deactivatePlugin(MInputMethodPlugin *plugin);
-    void convertAndFilterHandlers(const QStringList &handlerNames, QSet<MIMHandlerState> *handlers);
+    void convertAndFilterHandlers(const QStringList &handlerNames,
+                                  QSet<MInputMethod::HandlerState> *handlers);
 
-    void replacePlugin(M::InputMethodSwitchDirection direction, Plugins::iterator initiator,
+    void replacePlugin(MInputMethod::SwitchDirection direction, Plugins::iterator initiator,
                        Plugins::iterator replacement);
-    bool switchPlugin(M::InputMethodSwitchDirection direction, MInputMethodBase *initiator);
-    bool switchPlugin(const QString &name, MInputMethodBase *initiator);
-    bool doSwitchPlugin(M::InputMethodSwitchDirection direction,
+    bool switchPlugin(MInputMethod::SwitchDirection direction, MAbstractInputMethod *initiator);
+    bool switchPlugin(const QString &name, MAbstractInputMethod *initiator);
+    bool doSwitchPlugin(MInputMethod::SwitchDirection direction,
                         Plugins::iterator source,
                         Plugins::iterator replacement);
     void changeHandlerMap(MInputMethodPlugin *origin,
                           MInputMethodPlugin *replacement,
-                          QSet<MIMHandlerState> states);
+                          QSet<MInputMethod::HandlerState> states);
 
     QStringList loadedPluginsNames() const;
-    QStringList loadedPluginsNames(MIMHandlerState state) const;
+    QStringList loadedPluginsNames(MInputMethod::HandlerState state) const;
     QStringList activePluginsNames() const;
-    QString activePluginsName(MIMHandlerState state) const;
+    QString activePluginsName(MInputMethod::HandlerState state) const;
     void loadHandlerMap();
-    MInputMethodPlugin *activePlugin(MIMHandlerState state) const;
+    MInputMethodPlugin *activePlugin(MInputMethod::HandlerState state) const;
     void loadInputMethodSettings();
     void initActiveSubView();
     void hideActivePlugins();
@@ -91,7 +93,7 @@
     /*!
      * This method is called when one of the gconf about handler map is changed
      * to synchronize the handlerToPluginConfs.
-     * \param state (can be cast to MIMHandlerState) indicates which state of the
+     * \param state (can be cast to MInputMethod::HandlerState) indicates which state of the
      * handler map is changed.
      */
     void _q_syncHandlerMap(int state);
@@ -99,14 +101,16 @@
     /*!
      * \brief This method is called when activeSubview is changed by settings or plugin.
      */
-    void _q_setActiveSubView(const QString &, MIMHandlerState);
+    void _q_setActiveSubView(const QString &, MInputMethod::HandlerState);
 
-    QMap<QString, QString> availableSubViews(const QString &plugin, MIMHandlerState state = OnScreen) const;
-    QString activeSubView(MIMHandlerState state) const;
-    void setActivePlugin(const QString &pluginName, MIMHandlerState state);
+    QMap<QString, QString> availableSubViews(const QString &plugin,
+                                             MInputMethod::HandlerState state
+                                              = MInputMethod::OnScreen) const;
+    QString activeSubView(MInputMethod::HandlerState state) const;
+    void setActivePlugin(const QString &pluginName, MInputMethod::HandlerState state);
 
-    QString inputSourceName(MIMHandlerState source) const;
-    MIMHandlerState inputSourceFromName(const QString &name, bool &valid) const;
+    QString inputSourceName(MInputMethod::HandlerState source) const;
+    MInputMethod::HandlerState inputSourceFromName(const QString &name, bool &valid) const;
 
 public:
     MIMPluginManager *parent;
@@ -133,40 +137,13 @@
 
     bool acceptRegionUpdates;
 
-    typedef QMap<MIMHandlerState, QString> InputSourceToNameMap;
-    QMap<MIMHandlerState, QString> inputSourceToNameMap;
-    QMap<QString, MIMHandlerState> nameToInputSourceMap;
+    typedef QMap<MInputMethod::HandlerState, QString> InputSourceToNameMap;
+    QMap<MInputMethod::HandlerState, QString> inputSourceToNameMap;
+    QMap<QString, MInputMethod::HandlerState> nameToInputSourceMap;
 
     MToolbarId toolbarId;
-};
-
-class MIMPluginManagerAdaptor: public QDBusAbstractAdaptor
-{
-    Q_OBJECT
-    Q_CLASSINFO("D-Bus Interface", "com.maemo.inputmethodpluginmanager1")
-public:
-    explicit MIMPluginManagerAdaptor(MIMPluginManager *parent);
-    virtual ~MIMPluginManagerAdaptor();
 
-public slots:
-    QStringList queryAvailablePlugins();
-    QStringList queryAvailablePlugins(int state);
-    QString queryActivePlugin(int state);
-    //! Returns all available subviews (IDs and titles).
-    QMap<QString, QVariant> queryAvailableSubViews(const QString &pluginName, int state);
-    //! Returns the active subview ID and the plugin which it belongs.
-    QMap<QString, QVariant> queryActiveSubView(int state);
-    Q_NOREPLY void setActivePlugin(const QString &pluginname, int state, const QString &subviewId = "");
-    Q_NOREPLY void setActiveSubView(const QString &subViewId, int state);
-
-signals:
-    //! This signal is emitted when the active subview of \a state is changed.
-    void activeSubViewChanged(int state);
-
-private:
-    MIMPluginManager *owner;
-    friend class MIMPluginManager;
-    friend class MIMPluginManagerPrivate;
+    MIndicatorServiceClient indicatorService;
 };
 
 #endif
--- src/mimpluginmanageradaptor.cpp
+++ src/mimpluginmanageradaptor.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 "mimpluginmanager.h"
+#include "mimpluginmanageradaptor.h"
+
+
+MIMPluginManagerAdaptor::MIMPluginManagerAdaptor(MIMPluginManager *parent)
+    : QDBusAbstractAdaptor(parent),
+      owner(parent)
+{
+    if (!parent) {
+        qFatal("Creating MIMPluginManagerAdaptor without a parent");
+    }
+}
+
+
+MIMPluginManagerAdaptor::~MIMPluginManagerAdaptor()
+{
+    // nothing
+}
+
+QStringList MIMPluginManagerAdaptor::queryAvailablePlugins()
+{
+    return owner->loadedPluginsNames();
+}
+
+QStringList MIMPluginManagerAdaptor::queryAvailablePlugins(int state)
+{
+    return owner->loadedPluginsNames(static_cast<MInputMethod::HandlerState>(state));
+}
+
+QString MIMPluginManagerAdaptor::queryActivePlugin(int state)
+{
+    return owner->activePluginsName(static_cast<MInputMethod::HandlerState>(state));
+}
+
+QMap<QString, QVariant> MIMPluginManagerAdaptor::queryAvailableSubViews(const QString &plugin,
+                                                                        int state)
+{
+    QMap<QString, QVariant> vSubViews;
+
+    QMap<QString, QString> subViews
+        = owner->availableSubViews(plugin, static_cast<MInputMethod::HandlerState>(state));
+    QMapIterator<QString, QString> subView(subViews);
+
+    while (subView.hasNext()) {
+        subView.next();
+        vSubViews.insert(subView.key(), subView.value());
+    }
+
+    return vSubViews;
+}
+
+QMap<QString, QVariant> MIMPluginManagerAdaptor::queryActiveSubView(int state)
+{
+    QMap<QString, QVariant> activeSubbView;
+    activeSubbView.insert(owner->activeSubView(static_cast<MInputMethod::HandlerState>(state)),
+                          owner->activePluginsName(static_cast<MInputMethod::HandlerState>(state)));
+    return activeSubbView;
+}
+
+void MIMPluginManagerAdaptor::setActivePlugin(const QString &pluginName, int state,
+                                              const QString &subViewId)
+{
+    owner->setActivePlugin(pluginName, static_cast<MInputMethod::HandlerState>(state));
+
+    if (!subViewId.isEmpty()) {
+        owner->setActiveSubView(subViewId, static_cast<MInputMethod::HandlerState>(state));
+    }
+}
+
+void MIMPluginManagerAdaptor::setActiveSubView(const QString &subViewId, int state)
+{
+    owner->setActiveSubView(subViewId, static_cast<MInputMethod::HandlerState>(state));
+}
+
--- src/mimpluginmanageradaptor.h
+++ src/mimpluginmanageradaptor.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 MIMPLUGINMANAGERADAPTOR_H
+#define MIMPLUGINMANAGERADAPTOR_H
+
+#include <QObject>
+#include <QDBusAbstractAdaptor>
+#include <QString>
+#include <QStringList>
+#include <QMap>
+
+
+class MIMPluginManager;
+
+
+class MIMPluginManagerAdaptor: public QDBusAbstractAdaptor
+{
+    Q_OBJECT
+    Q_CLASSINFO("D-Bus Interface", "com.meego.inputmethodpluginmanager1")
+
+public:
+    explicit MIMPluginManagerAdaptor(MIMPluginManager *parent);
+    virtual ~MIMPluginManagerAdaptor();
+
+public slots:
+    QStringList queryAvailablePlugins();
+    QStringList queryAvailablePlugins(int state);
+    QString queryActivePlugin(int state);
+
+    //! Returns all available subviews (IDs and titles).
+    QMap<QString, QVariant> queryAvailableSubViews(const QString &pluginName, int state);
+
+    //! Returns the active subview ID and the plugin which it belongs.
+    QMap<QString, QVariant> queryActiveSubView(int state);
+    Q_NOREPLY void setActivePlugin(const QString &pluginname, int state,
+                                   const QString &subviewId = QString());
+    Q_NOREPLY void setActiveSubView(const QString &subViewId, int state);
+
+signals:
+    //! This signal is emitted when the active subview of \a state is changed.
+    void activeSubViewChanged(int state);
+
+private:
+    MIMPluginManager *owner;
+    friend class MIMPluginManager;
+    friend class MIMPluginManagerPrivate;
+};
+
+#endif
--- src/mimsdbusactivaterserviceglue.h
+++ src/mimsdbusactivaterserviceglue.h
-/* Generated by dbus-binding-tool; do not edit! */
-
-
-#ifndef __dbus_glib_marshal_m_ims_dbus_activater_MARSHAL_H__
-#define __dbus_glib_marshal_m_ims_dbus_activater_MARSHAL_H__
-
-#include	<glib-object.h>
-
-G_BEGIN_DECLS
-
-#ifdef G_ENABLE_DEBUG
-#define g_marshal_value_peek_boolean(v)  g_value_get_boolean (v)
-#define g_marshal_value_peek_char(v)     g_value_get_char (v)
-#define g_marshal_value_peek_uchar(v)    g_value_get_uchar (v)
-#define g_marshal_value_peek_int(v)      g_value_get_int (v)
-#define g_marshal_value_peek_uint(v)     g_value_get_uint (v)
-#define g_marshal_value_peek_long(v)     g_value_get_long (v)
-#define g_marshal_value_peek_ulong(v)    g_value_get_ulong (v)
-#define g_marshal_value_peek_int64(v)    g_value_get_int64 (v)
-#define g_marshal_value_peek_uint64(v)   g_value_get_uint64 (v)
-#define g_marshal_value_peek_enum(v)     g_value_get_enum (v)
-#define g_marshal_value_peek_flags(v)    g_value_get_flags (v)
-#define g_marshal_value_peek_float(v)    g_value_get_float (v)
-#define g_marshal_value_peek_double(v)   g_value_get_double (v)
-#define g_marshal_value_peek_string(v)   (char*) g_value_get_string (v)
-#define g_marshal_value_peek_param(v)    g_value_get_param (v)
-#define g_marshal_value_peek_boxed(v)    g_value_get_boxed (v)
-#define g_marshal_value_peek_pointer(v)  g_value_get_pointer (v)
-#define g_marshal_value_peek_object(v)   g_value_get_object (v)
-#else /* !G_ENABLE_DEBUG */
-/* WARNING: This code accesses GValues directly, which is UNSUPPORTED API.
- *          Do not access GValues directly in your code. Instead, use the
- *          g_value_get_*() functions
- */
-#define g_marshal_value_peek_boolean(v)  (v)->data[0].v_int
-#define g_marshal_value_peek_char(v)     (v)->data[0].v_int
-#define g_marshal_value_peek_uchar(v)    (v)->data[0].v_uint
-#define g_marshal_value_peek_int(v)      (v)->data[0].v_int
-#define g_marshal_value_peek_uint(v)     (v)->data[0].v_uint
-#define g_marshal_value_peek_long(v)     (v)->data[0].v_long
-#define g_marshal_value_peek_ulong(v)    (v)->data[0].v_ulong
-#define g_marshal_value_peek_int64(v)    (v)->data[0].v_int64
-#define g_marshal_value_peek_uint64(v)   (v)->data[0].v_uint64
-#define g_marshal_value_peek_enum(v)     (v)->data[0].v_long
-#define g_marshal_value_peek_flags(v)    (v)->data[0].v_ulong
-#define g_marshal_value_peek_float(v)    (v)->data[0].v_float
-#define g_marshal_value_peek_double(v)   (v)->data[0].v_double
-#define g_marshal_value_peek_string(v)   (v)->data[0].v_pointer
-#define g_marshal_value_peek_param(v)    (v)->data[0].v_pointer
-#define g_marshal_value_peek_boxed(v)    (v)->data[0].v_pointer
-#define g_marshal_value_peek_pointer(v)  (v)->data[0].v_pointer
-#define g_marshal_value_peek_object(v)   (v)->data[0].v_pointer
-#endif /* !G_ENABLE_DEBUG */
-
-
-/* BOOLEAN:POINTER,POINTER (/tmp/dbus-binding-tool-c-marshallers.AAIIHV:1) */
-extern void dbus_glib_marshal_m_ims_dbus_activater_BOOLEAN__POINTER_POINTER (GClosure     *closure,
-                                                                             GValue       *return_value,
-                                                                             guint         n_param_values,
-                                                                             const GValue *param_values,
-                                                                             gpointer      invocation_hint,
-                                                                             gpointer      marshal_data);
-void
-dbus_glib_marshal_m_ims_dbus_activater_BOOLEAN__POINTER_POINTER (GClosure     *closure,
-                                                                 GValue       *return_value G_GNUC_UNUSED,
-                                                                 guint         n_param_values,
-                                                                 const GValue *param_values,
-                                                                 gpointer      invocation_hint G_GNUC_UNUSED,
-                                                                 gpointer      marshal_data)
-{
-  typedef gboolean (*GMarshalFunc_BOOLEAN__POINTER_POINTER) (gpointer     data1,
-                                                             gpointer     arg_1,
-                                                             gpointer     arg_2,
-                                                             gpointer     data2);
-  register GMarshalFunc_BOOLEAN__POINTER_POINTER callback;
-  register GCClosure *cc = (GCClosure*) closure;
-  register gpointer data1, data2;
-  gboolean v_return;
-
-  g_return_if_fail (return_value != NULL);
-  g_return_if_fail (n_param_values == 3);
-
-  if (G_CCLOSURE_SWAP_DATA (closure))
-    {
-      data1 = closure->data;
-      data2 = g_value_peek_pointer (param_values + 0);
-    }
-  else
-    {
-      data1 = g_value_peek_pointer (param_values + 0);
-      data2 = closure->data;
-    }
-  callback = (GMarshalFunc_BOOLEAN__POINTER_POINTER) (marshal_data ? marshal_data : cc->callback);
-
-  v_return = callback (data1,
-                       g_marshal_value_peek_pointer (param_values + 1),
-                       g_marshal_value_peek_pointer (param_values + 2),
-                       data2);
-
-  g_value_set_boolean (return_value, v_return);
-}
-
-G_END_DECLS
-
-#endif /* __dbus_glib_marshal_m_ims_dbus_activater_MARSHAL_H__ */
-
-#include <dbus/dbus-glib.h>
-static const DBusGMethodInfo dbus_glib_m_ims_dbus_activater_methods[] = {
-  { (GCallback) m_ims_dbus_activater_address, dbus_glib_marshal_m_ims_dbus_activater_BOOLEAN__POINTER_POINTER, 0 },
-};
-
-const DBusGObjectInfo dbus_glib_m_ims_dbus_activater_object_info = {
-  0,
-  dbus_glib_m_ims_dbus_activater_methods,
-  1,
-"com.meego.inputmethod.uiserveractivation\0address\0S\0arg0\0O\0F\0N\0s\0\0\0",
-"\0",
-"\0"
-};
-
--- src/mimsettingsdialog.cpp
+++ src/mimsettingsdialog.cpp
@@ -27,7 +27,7 @@
 #include <MPopupList>
 
 #include "minputmethodplugin.h"
-#include "minputmethodsettingsbase.h"
+#include "mabstractinputmethodsettings.h"
 #include "mimpluginmanager_p.h"
 #include "mplainwindow.h"
 
@@ -64,7 +64,7 @@
     layout->addItem(activeSubViewItem);
 
     foreach (MInputMethodPlugin *plugin, imPluginManagerPrivate->plugins.keys()) {
-        MInputMethodSettingsBase *settings = plugin->createInputMethodSettings();
+        MAbstractInputMethodSettings *settings = plugin->createInputMethodSettings();
         if (settings) {
             QGraphicsWidget *contentWidget = settings->createContentWidget(settingsWidget);
             if (contentWidget) {
@@ -106,9 +106,10 @@
     if (!activeSubViewItem)
         return;
 
-    QString subViewId = imPluginManagerPrivate->activeSubView(OnScreen);
-    QMap<QString, QString> subViews =
-        imPluginManagerPrivate->availableSubViews(imPluginManagerPrivate->activePluginsName(OnScreen), OnScreen);
+    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);
@@ -156,8 +157,10 @@
     model->clear();
 
     // get all subviews from plugins which support OnScreen
-    foreach (const QString &pluginName, imPluginManagerPrivate->loadedPluginsNames(OnScreen)) {
-        QMap<QString, QString> subViews = imPluginManagerPrivate->availableSubViews(pluginName, 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());
@@ -186,11 +189,11 @@
 
     // check whether OnScreen plugin is changed.
     QString pluginName = model->itemFromIndex(index)->data(MImPluginNameRole).toString();
-    imPluginManagerPrivate->setActivePlugin(pluginName, OnScreen);
+    imPluginManagerPrivate->setActivePlugin(pluginName, MInputMethod::OnScreen);
 
     // check whether active subview is changed.
     QString subViewId = model->itemFromIndex(index)->data(MImSubViewIdentifierRole).toString();
-    imPluginManagerPrivate->_q_setActiveSubView(subViewId, OnScreen);
+    imPluginManagerPrivate->_q_setActiveSubView(subViewId, MInputMethod::OnScreen);
 }
 
 void MIMSettingsDialog::retranslateSettingsUi()
--- src/mimsettingsdialog.h
+++ src/mimsettingsdialog.h
@@ -30,7 +30,7 @@
 class MPopupList;
 class QModelIndex;
 class MContainer;
-class MInputMethodSettingsBase;
+class MAbstractInputMethodSettings;
 
 class MIMSettingsDialog : public MDialog
 {
@@ -64,7 +64,7 @@
 
     MContentItem *activeSubViewItem;
     MPopupList *availableSubViewList;
-    QMap<MInputMethodSettingsBase *, MContainer *> settingsContainerMap;
+    QMap<MAbstractInputMethodSettings *, MContainer *> settingsContainerMap;
     MIMPluginManagerPrivate *const imPluginManagerPrivate;
 
     friend class Ut_MIMSettingsDialog;
--- src/mindicatorserviceclient.cpp
+++ src/mindicatorserviceclient.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 "mindicatorserviceclient.h"
+
+#include <QDBusInterface>
+#include <QDBusServiceWatcher>
+#include <QDebug>
+
+namespace {
+    const char * const DBusIndicatorServiceName = "com.meego.core.MInputMethodStatusIndicator";
+    const char * const DBusIndicatorPath = "/inputmethodstatusindicator";
+    const char * const DBusIndicatorInterface = "com.meego.core.MInputMethodStatusIndicator";
+};
+
+
+MIndicatorServiceClient::MIndicatorServiceClient(QObject *parent)
+    : QObject(parent),
+      indicatorIface(0),
+      indicatorServiceWatcher(new QDBusServiceWatcher(DBusIndicatorServiceName,
+                                                      QDBusConnection::sessionBus(),
+                                                      QDBusServiceWatcher::WatchForOwnerChange,
+                                                      this))
+{
+    connectToIndicatorDBus();
+    connect(indicatorServiceWatcher, SIGNAL(serviceOwnerChanged(QString, QString, QString)),
+            this, SLOT(handleIndicatorServiceChanged(QString, QString, QString)));
+
+    indicatorMap.insert(MInputMethod::NoIndicator, "");
+    indicatorMap.insert(MInputMethod::LatinLowerIndicator, "icon-s-status-latin-lowercase");
+    indicatorMap.insert(MInputMethod::LatinUpperIndicator, "icon-s-status-latin-uppercase");
+    indicatorMap.insert(MInputMethod::LatinLockedIndicator, "icon-s-status-latin-caps");
+    indicatorMap.insert(MInputMethod::CyrillicLowerIndicator, "icon-s-status-cyrillic-lowercase");
+    indicatorMap.insert(MInputMethod::CyrillicUpperIndicator, "icon-s-status-cyrillic-uppercase");
+    indicatorMap.insert(MInputMethod::CyrillicLockedIndicator, "icon-s-status-cyrillic-caps");
+    indicatorMap.insert(MInputMethod::ArabicIndicator, "icon-s-status-arabic");
+    indicatorMap.insert(MInputMethod::PinyinIndicator, "icon-s-status-pinyin");
+    indicatorMap.insert(MInputMethod::ZhuyinIndicator, "icon-s-status-zhuyin");
+    indicatorMap.insert(MInputMethod::CangjieIndicator, "icon-s-status-cangjie");
+    indicatorMap.insert(MInputMethod::NumAndSymLatchedIndicator, "icon-s-status-number");
+    indicatorMap.insert(MInputMethod::NumAndSymLockedIndicator, "icon-s-status-number-locked");
+    indicatorMap.insert(MInputMethod::DeadKeyAcuteIndicator, "icon-s-status-acute");
+    indicatorMap.insert(MInputMethod::DeadKeyCaronIndicator, "icon-s-status-caron");
+    indicatorMap.insert(MInputMethod::DeadKeyCircumflexIndicator, "icon-s-status-circumflex");
+    indicatorMap.insert(MInputMethod::DeadKeyDiaeresisIndicator, "icon-s-status-diaeresis");
+    indicatorMap.insert(MInputMethod::DeadKeyGraveIndicator, "icon-s-status-grave");
+    indicatorMap.insert(MInputMethod::DeadKeyTildeIndicator, "icon-s-status-tilde");
+}
+
+MIndicatorServiceClient::~MIndicatorServiceClient()
+{
+    delete indicatorIface;
+}
+
+void MIndicatorServiceClient::setInputModeIndicator(MInputMethod::InputModeIndicator mode)
+{
+    if (indicatorIface) {
+        indicatorIface->call(QDBus::NoBlock, "setIconID", indicatorIconID(mode));
+    }
+}
+
+void MIndicatorServiceClient::connectToIndicatorDBus()
+{
+    qDebug() << __PRETTY_FUNCTION__;
+    QDBusConnection connection = QDBusConnection::sessionBus();
+
+    if (!connection.isConnected()) {
+        qWarning() << "Cannot connect to the DBus session bus";
+        return;
+    }
+
+    indicatorIface = new QDBusInterface(DBusIndicatorServiceName, DBusIndicatorPath,
+                                        DBusIndicatorInterface, connection);
+
+    if (!indicatorIface->isValid()) {
+        qWarning() << "MInputContextDBusConnection was unable to connect to indicator server: "
+                   << connection.lastError().message();
+        delete indicatorIface;
+        indicatorIface = 0;
+    }
+}
+
+void MIndicatorServiceClient::handleIndicatorServiceChanged(const QString &serviceName,
+                                                            const QString &oldOwner,
+                                                            const QString &newOwner)
+{
+    Q_UNUSED(oldOwner);
+
+    qDebug() << __PRETTY_FUNCTION__;
+
+    if (serviceName != DBusIndicatorServiceName) {
+        return;
+    }
+
+    if (indicatorIface && !indicatorIface->isValid()) {
+        delete indicatorIface;
+        indicatorIface = 0;
+    }
+
+    if (!newOwner.isEmpty()) {
+        connectToIndicatorDBus();
+    }
+}
+
+QString MIndicatorServiceClient::indicatorIconID(MInputMethod::InputModeIndicator mode)
+{
+    return indicatorMap.value(mode);
+}
+
--- src/mindicatorserviceclient.h
+++ src/mindicatorserviceclient.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 MINDICATORSERVICECLIENT_H
+#define MINDICATORSERVICECLIENT_H
+
+
+#include <QObject>
+#include <QMap>
+
+#include "minputmethodnamespace.h"
+
+class QString;
+class QDBusInterface;
+class QDBusServiceWatcher;
+
+/*!
+ * \brief Provides interface for setting the system keyboard indicator state.
+ *
+ */
+class MIndicatorServiceClient: public QObject
+{
+    Q_OBJECT
+
+public:
+    explicit MIndicatorServiceClient(QObject *parent = 0);
+    ~MIndicatorServiceClient();
+
+    void setInputModeIndicator(MInputMethod::InputModeIndicator mode);
+
+private slots:
+    void handleIndicatorServiceChanged(const QString &serviceName, const QString &oldOwner,
+                                       const QString &newOwner);
+private:
+    Q_DISABLE_COPY(MIndicatorServiceClient)
+
+    void connectToIndicatorDBus();
+
+    //! map the InputModeIndicator to icon id
+    QString indicatorIconID(MInputMethod::InputModeIndicator mode);
+
+    QDBusInterface *indicatorIface; // indicator server interface
+    QDBusServiceWatcher *indicatorServiceWatcher;
+    QMap<MInputMethod::InputModeIndicator, QString> indicatorMap;
+};
+
+#endif
--- src/minputcontextconnection.cpp
+++ src/minputcontextconnection.cpp
@@ -15,8 +15,8 @@
  */
 
 #include "minputcontextconnection.h"
+#include "mabstractinputmethod.h"
 
-#include "minputmethodbase.h"
 #include <QSet>
 
 class MInputContextConnectionPrivate
@@ -25,7 +25,7 @@
     MInputContextConnectionPrivate();
     ~MInputContextConnectionPrivate();
 
-    QSet<MInputMethodBase *> targets; // not owned by us
+    QSet<MAbstractInputMethod *> targets; // not owned by us
 };
 
 
@@ -56,12 +56,12 @@
     delete d;
 }
 
-void MInputContextConnection::addTarget(MInputMethodBase *target)
+void MInputContextConnection::addTarget(MAbstractInputMethod *target)
 {
     d->targets.insert(target);
 }
 
-void MInputContextConnection::removeTarget(MInputMethodBase *target)
+void MInputContextConnection::removeTarget(MAbstractInputMethod *target)
 {
     d->targets.remove(target);
 }
@@ -71,7 +71,7 @@
     Q_UNUSED(region);
 }
 
-QSet<MInputMethodBase *> MInputContextConnection::targets()
+QSet<MAbstractInputMethod *> MInputContextConnection::targets()
 {
     return d->targets;
 }
--- src/minputcontextconnection.h
+++ src/minputcontextconnection.h
@@ -17,7 +17,8 @@
 #ifndef MINPUTCONTEXTCONNECTION_H
 #define MINPUTCONTEXTCONNECTION_H
 
-#include "mpreeditface.h"
+#include "minputmethodnamespace.h"
+
 #include <QRect>
 #include <QObject>
 
@@ -26,7 +27,7 @@
 class QKeyEvent;
 
 class MInputContextConnectionPrivate;
-class MInputMethodBase;
+class MAbstractInputMethod;
 class MToolbarId;
 
 
@@ -45,12 +46,12 @@
     /*!
      * \brief Adds the target which get called on incoming requests
      */
-    virtual void addTarget(MInputMethodBase *target);
+    virtual void addTarget(MAbstractInputMethod *target);
 
     /*!
      * \brief Removes the handler of the connection
      */
-    virtual void removeTarget(MInputMethodBase *target);
+    virtual void removeTarget(MAbstractInputMethod *target);
 
     /*!
      * \brief returns content type for focused widget if output parameter valid is true,
@@ -101,7 +102,8 @@
      * \param preeditFace Selects visual styling for preedit
      */
     virtual void sendPreeditString(const QString &string,
-                                   PreeditFace preeditFace = PreeditDefault) = 0;
+                                   MInputMethod::PreeditFace preeditFace
+                                    = MInputMethod::PreeditDefault) = 0;
 
     /*!
      * \brief Updates commit string in the application widget
@@ -113,8 +115,17 @@
 
     /*!
      * \brief Sends key event to the application
-     */
-    virtual void sendKeyEvent(const QKeyEvent &keyEvent) = 0;
+     *
+     * This method is used to deliver the key event to active widget.
+     * A \a MInputMethodState::keyPress or \a MInputMethodState::keyRelease
+     * event is also emitted. Depending on the value of \a requestType
+     * parameter, a Qt::KeyEvent and/or a signal is emitted.
+     * \param keyEvent The event to send
+     * \param requestType The type of the request: event, signal, or both.
+     */
+    virtual void sendKeyEvent(const QKeyEvent &keyEvent,
+                              MInputMethod::EventRequestType requestType
+                              = MInputMethod::EventRequestBoth) = 0;
 
     /*!
      * \brief notifies about hiding initiated by the input method server side
@@ -171,7 +182,7 @@
     //! \internal_end.
 
 protected:
-    QSet<MInputMethodBase *> targets();
+    QSet<MAbstractInputMethod *> targets();
 
 private:
     MInputContextConnectionPrivate *d;
--- src/minputcontextdbusconnection.cpp
+++ src/minputcontextdbusconnection.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 "minputcontextdbusconnection.h"
-#include "minputcontextdbusconnection_p.h"
-#include "mtoolbarmanager.h"
-#include "mtoolbarid.h"
-
-#include <QObject>
-#include <QDebug>
-#include <QRegion>
-#include <QKeyEvent>
-#include <QDBusAbstractAdaptor>
-#include <QDBusArgument>
-#include <QDBusInterface>
-#include <QDBusMetaType>
-#include <QDBusReply>
-#include <QMap>
-#include <QString>
-#include <QVariant>
-
-#include "minputmethodbase.h"
-#include "mimapplication.h"
-
-namespace
-{
-    const char * const DBusServiceName = "com.meego.inputmethod.uiserver1";
-    const char * const DBusPath = "/com/meego/inputmethod/uiserver1";
-
-    const char * const DBusClientInterface = "com.meego.inputmethod.inputcontext1";
-
-    // attribute names for updateWidgetInformation() map
-    const char * const FocusStateAttribute = "focusState";
-    const char * const ContentTypeAttribute = "contentType";
-    const char * const CorrectionAttribute = "correctionEnabled";
-    const char * const PredictionAttribute = "predictionEnabled";
-    const char * const AutoCapitalizationAttribute = "autocapitalizationEnabled";
-    const char * const SurroundingTextAttribute = "surroundingText";
-    const char * const CursorPositionAttribute = "cursorPosition";
-    const char * const HasSelectionAttribute = "hasSelection";
-    const char * const InputMethodModeAttribute = "inputMethodMode";
-    const char * const VisualizationAttribute = "visualizationPriority";
-    const char * const ToolbarIdAttribute = "toolbarId";
-    const char * const ToolbarAttribute = "toolbar";
-    const char * const WinId = "winId";
-}
-
-
-
-MInputContextDBusAdaptor::MInputContextDBusAdaptor(MInputContextDBusConnection *host)
-    : QDBusAbstractAdaptor(host),
-      host(host)
-{
-    // nothing
-}
-
-
-MInputContextDBusAdaptor::~MInputContextDBusAdaptor()
-{
-    // nothing
-}
-
-
-void MInputContextDBusAdaptor::setContextObject(QString callbackObject)
-{
-    host->setContextObject(callbackObject);
-}
-
-
-void MInputContextDBusAdaptor::activateContext()
-{
-    host->activateContext();
-}
-
-
-void MInputContextDBusAdaptor::showInputMethod()
-{
-    host->showInputMethod();
-}
-
-
-void MInputContextDBusAdaptor::hideInputMethod()
-{
-    host->hideInputMethod();
-}
-
-
-void MInputContextDBusAdaptor::mouseClickedOnPreedit(const QPoint &pos, const QRect &preeditRect)
-{
-    host->mouseClickedOnPreedit(pos, preeditRect);
-}
-
-
-void MInputContextDBusAdaptor::setPreedit(const QString &text)
-{
-    host->setPreedit(text);
-}
-
-void MInputContextDBusAdaptor::updateWidgetInformation(const QMap<QString, QVariant> &stateInfo,
-                                                       bool focusChanged)
-{
-    host->updateWidgetInformation(stateInfo, focusChanged);
-}
-
-
-void MInputContextDBusAdaptor::reset()
-{
-    host->reset();
-}
-
-void MInputContextDBusAdaptor::appOrientationChanged(int angle)
-{
-    host->appOrientationChanged(angle);
-}
-
-void MInputContextDBusAdaptor::setCopyPasteState(bool copyAvailable, bool pasteAvailable)
-{
-    host->setCopyPasteState(copyAvailable, pasteAvailable);
-}
-
-void MInputContextDBusAdaptor::processKeyEvent(int keyType, int keyCode, int modifiers,
-                                               const QString &text, bool autoRepeat,
-                                               int count, int nativeScanCode, int nativeModifiers)
-{
-    host->processKeyEvent(static_cast<QEvent::Type>(keyType), static_cast<Qt::Key>(keyCode),
-                          static_cast<Qt::KeyboardModifiers>(modifiers), text, autoRepeat, count,
-                          static_cast<quint32>(nativeScanCode),
-                          static_cast<quint32>(nativeModifiers));
-}
-
-void MInputContextDBusAdaptor::registerToolbar(int id, const QString &toolbar)
-{
-    host->registerToolbar(id, toolbar);
-}
-
-void MInputContextDBusAdaptor::unregisterToolbar(int id)
-{
-    host->unregisterToolbar(id);
-}
-
-void MInputContextDBusAdaptor::setToolbarItemAttribute(
-    int id, const QString &item, const QString &attribute, const QVariant &value)
-{
-    host->setToolbarItemAttribute(id, item, attribute, value);
-}
-
-////////////////
-// private class
-
-
-MInputContextDBusConnectionPrivate::MInputContextDBusConnectionPrivate()
-    : activeContext(0),
-      valid(true),
-      globalCorrectionEnabled(false),
-      redirectionEnabled(false),
-      detectableAutoRepeat(false)
-{
-    // nothing
-}
-
-
-MInputContextDBusConnectionPrivate::~MInputContextDBusConnectionPrivate()
-{
-    QMapIterator<QString, QDBusInterface *> it(clients);
-
-    while (it.hasNext()) {
-        it.next();
-        delete it.value();
-    }
-}
-
-
-///////////////
-// actual class
-
-
-MInputContextDBusConnection::MInputContextDBusConnection()
-    : d(new MInputContextDBusConnectionPrivate)
-{
-    new MInputContextDBusAdaptor(this);
-    bool success = QDBusConnection::sessionBus().registerObject(DBusPath, this);
-
-    if (!success) {
-        d->valid = false;
-        qDebug() << "MInputContextDBusConnection failed to register D-Bus object";
-    }
-
-    if (!QDBusConnection::sessionBus().registerService(DBusServiceName)) {
-        d->valid = false;
-        qDebug() << "MInputContextDBusConnection failed to register D-Bus service";
-        qDebug() << QDBusConnection::sessionBus().lastError().message();
-    }
-
-    qDBusRegisterMetaType<QRect>();
-    qDBusRegisterMetaType<QMap<QString, QVariant> >();
-}
-
-
-MInputContextDBusConnection::~MInputContextDBusConnection()
-{
-    delete d;
-}
-
-
-bool MInputContextDBusConnection::isValid()
-{
-    return d->valid;
-}
-
-
-void MInputContextDBusConnection::sendPreeditString(const QString &string,
-        PreeditFace preeditFace)
-{
-    if (d->activeContext) {
-        d->activeContext->call("updatePreedit", string, preeditFace);
-    }
-}
-
-
-void MInputContextDBusConnection::sendCommitString(const QString &string)
-{
-    if (d->activeContext) {
-        d->activeContext->call("commitString", string);
-    }
-}
-
-
-void MInputContextDBusConnection::sendKeyEvent(const QKeyEvent &keyEvent)
-{
-    if (d->activeContext) {
-        int type = static_cast<int>(keyEvent.type());
-        int key = static_cast<int>(keyEvent.key());
-        int modifiers = static_cast<int>(keyEvent.modifiers());
-
-        d->activeContext->call("keyEvent", type, key, modifiers, keyEvent.text(),
-                               keyEvent.isAutoRepeat(), keyEvent.count());
-    }
-}
-
-
-void MInputContextDBusConnection::notifyImInitiatedHiding()
-{
-    if (d->activeContext) {
-        d->activeContext->call("imInitiatedHide");
-    }
-}
-
-
-int MInputContextDBusConnection::contentType(bool &valid)
-{
-    QVariant contentTypeVariant = d->widgetState[ContentTypeAttribute];
-    return contentTypeVariant.toInt(&valid);
-}
-
-
-bool MInputContextDBusConnection::correctionEnabled(bool &valid)
-{
-    QVariant correctionVariant = d->widgetState[CorrectionAttribute];
-    valid = correctionVariant.isValid();
-    return correctionVariant.toBool();
-}
-
-
-bool MInputContextDBusConnection::predictionEnabled(bool &valid)
-{
-    QVariant predictionVariant = d->widgetState[PredictionAttribute];
-    valid = predictionVariant.isValid();
-    return predictionVariant.toBool();
-}
-
-
-bool MInputContextDBusConnection::autoCapitalizationEnabled(bool &valid)
-{
-    QVariant capitalizationVariant = d->widgetState[AutoCapitalizationAttribute];
-    valid = capitalizationVariant.isValid();
-    return capitalizationVariant.toBool();
-}
-
-
-void MInputContextDBusConnection::setGlobalCorrectionEnabled(bool enabled)
-{
-    if ((enabled != d->globalCorrectionEnabled) && d->activeContext) {
-        d->activeContext->call("setGlobalCorrectionEnabled", enabled);
-    }
-
-    d->globalCorrectionEnabled = enabled;
-}
-
-
-bool MInputContextDBusConnection::surroundingText(QString &text, int &cursorPosition)
-{
-    QVariant textVariant = d->widgetState[SurroundingTextAttribute];
-    QVariant posVariant = d->widgetState[CursorPositionAttribute];
-
-    if (textVariant.isValid() && posVariant.isValid()) {
-        text = textVariant.toString();
-        cursorPosition = posVariant.toInt();
-        return true;
-    }
-
-    return false;
-}
-
-
-bool MInputContextDBusConnection::hasSelection(bool &valid)
-{
-    QVariant selectionVariant = d->widgetState[HasSelectionAttribute];
-    valid = selectionVariant.isValid();
-    return selectionVariant.toBool();
-}
-
-
-int MInputContextDBusConnection::inputMethodMode(bool &valid)
-{
-    QVariant modeVariant = d->widgetState[InputMethodModeAttribute];
-    return modeVariant.toInt(&valid);
-}
-
-int MInputContextDBusConnection::winId(bool &valid)
-{
-    QVariant winIdVariant = d->widgetState[WinId];
-    return winIdVariant.toInt(&valid);
-}
-
-
-QRect MInputContextDBusConnection::preeditRectangle(bool &valid)
-{
-    QRect rect;
-    valid = false;
-    if (d->activeContext) {
-        QDBusMessage reply = d->activeContext->call("preeditRectangle");
-
-        if (reply.type() == QDBusMessage::ReplyMessage) {
-            QList<QVariant> arguments = reply.arguments();
-            rect = qdbus_cast<QRect>(arguments.at(0).value<QDBusArgument>());
-            valid = arguments.at(1).toBool();
-        }
-    }
-
-    return rect;
-}
-
-void MInputContextDBusConnection::setRedirectKeys(bool enabled)
-{
-    if ((d->redirectionEnabled != enabled) && d->activeContext) {
-        d->activeContext->call("setRedirectKeys", enabled);
-    }
-
-    d->redirectionEnabled = enabled;
-}
-
-void MInputContextDBusConnection::setDetectableAutoRepeat(bool enabled)
-{
-    if ((d->detectableAutoRepeat != enabled) && d->activeContext) {
-        d->activeContext->call("setDetectableAutoRepeat", enabled);
-    }
-
-    d->detectableAutoRepeat = enabled;
-}
-
-
-void MInputContextDBusConnection::copy()
-{
-    if (d->activeContext) {
-        d->activeContext->call("copy");
-    }
-}
-
-
-void MInputContextDBusConnection::paste()
-{
-    if (d->activeContext) {
-        d->activeContext->call("paste");
-    }
-}
-
-
-
-//void MInputContextDBusConnection::setContextObject(QDBusObjectPath callbackObject)
-void MInputContextDBusConnection::setContextObject(QString callbackObject)
-{
-    qDebug() << "in" << __PRETTY_FUNCTION__;
-
-    QDBusConnection conn = connection();
-    const QDBusMessage &msg = message();
-
-    //qDebug() << "base service:" << conn.baseService();
-    //qDebug() << "message:" << msg.member() << msg.service() << msg.path() << msg.interface();
-    //qDebug() << "callbackobject:" << callbackObject;
-
-    // delete existing dbus interface object in case this method gets called multiple times
-    if (d->clients.contains(msg.service())) {
-        delete d->clients[msg.service()];
-        d->clientIds.remove(msg.service());
-    }
-
-    // creates interface object for the caller
-    // (using no explicit session bus, no parent (FIXME?))
-    QDBusInterface *clientConnection = new QDBusInterface(msg.service(), callbackObject,
-            DBusClientInterface);
-    if (clientConnection->isValid() == false) {
-        qDebug() << "ERROR: DBus connection to client input context cannot be made";
-        qDebug() << "msg:" << QDBusConnection::sessionBus().lastError().message();
-    }
-
-    d->clients[msg.service()] = clientConnection;
-    static int clientIdCounter = 1;
-    int newClentId = clientIdCounter;
-    clientIdCounter++;
-    d->clientIds[msg.service()] = newClentId;
-}
-
-
-void MInputContextDBusConnection::activateContext()
-{
-    qDebug() << "in" << __PRETTY_FUNCTION__;
-
-    const QDBusMessage &msg = message();
-    QDBusInterface *previousActive = d->activeContext;
-
-    // set active context to interface corresponding caller
-    if (d->clients.contains(msg.service())) {
-        d->activeContext = d->clients[msg.service()];
-
-        // update the state of the new active context
-        d->activeContext->call("setGlobalCorrectionEnabled", d->globalCorrectionEnabled);
-        d->activeContext->call("setRedirectKeys", d->redirectionEnabled);
-        d->activeContext->call("setDetectableAutoRepeat", d->detectableAutoRepeat);
-
-    } else {
-        qDebug() << __PRETTY_FUNCTION__ << "unable to activate context";
-        d->activeContext = 0;
-    }
-
-    if ((previousActive != 0) && (previousActive != d->activeContext)) {
-        previousActive->call("activationLostEvent");
-    }
-
-    // notify plugins
-    foreach (MInputMethodBase *target, targets()) {
-        target->clientChanged();
-    }
-}
-
-
-void MInputContextDBusConnection::showInputMethod()
-{
-    emit showInputMethodRequest();
-}
-
-
-void MInputContextDBusConnection::hideInputMethod()
-{
-    emit hideInputMethodRequest();
-}
-
-
-void MInputContextDBusConnection::mouseClickedOnPreedit(const QPoint &pos,
-                                                        const QRect &preeditRect)
-{
-    foreach (MInputMethodBase *target, targets()) {
-        target->mouseClickedOnPreedit(pos, preeditRect);
-    }
-}
-
-
-void MInputContextDBusConnection::setPreedit(const QString &text)
-{
-    foreach (MInputMethodBase *target, targets()) {
-        target->setPreedit(text);
-    }
-}
-
-
-void MInputContextDBusConnection::reset()
-{
-    foreach (MInputMethodBase *target, targets()) {
-        target->reset();
-    }
-}
-
-
-void
-MInputContextDBusConnection::updateWidgetInformation(const QMap<QString, QVariant> &stateInfo,
-                                                     bool focusChanged)
-{
-    // check visualization change
-    bool oldVisualization = false;
-    bool newVisualization = false;
-
-    QVariant variant = d->widgetState[VisualizationAttribute];
-
-    if (variant.isValid()) {
-        oldVisualization = variant.toBool();
-    }
-
-    variant = stateInfo[VisualizationAttribute];
-    if (variant.isValid()) {
-        newVisualization = variant.toBool();
-    }
-
-    // toolbar change
-    MToolbarId oldToolbarId;
-    MToolbarId newToolbarId;
-    oldToolbarId = d->toolbarId;
-
-    variant = stateInfo[ToolbarIdAttribute];
-    if (variant.isValid()) {
-        // map toolbar id from local to global
-        newToolbarId = MToolbarId(variant.toInt(), message().service());
-    }
-
-    // update state
-    d->widgetState = stateInfo;
-
-    if (focusChanged) {
-        foreach (MInputMethodBase *target, targets()) {
-            target->focusChanged(stateInfo[FocusStateAttribute].toBool());
-        }
-
-        updateTransientHint();
-    }
-
-    // call notification methods if needed
-    if (oldVisualization != newVisualization) {
-        foreach (MInputMethodBase *target, targets()) {
-            target->visualizationPriorityChanged(newVisualization);
-        }
-    }
-
-    // compare the toolbar id (global)
-    if (oldToolbarId != newToolbarId) {
-        QString toolbarFile = stateInfo[ToolbarAttribute].toString();
-        if (!MToolbarManager::instance().contains(newToolbarId) && !toolbarFile.isEmpty()) {
-            // register toolbar if toolbar manager does not contain it but
-            // toolbar file is not empty. This can reload the toolbar data
-            // if im-uiserver crashes.
-            variant = stateInfo[ToolbarIdAttribute];
-            if (variant.isValid()) {
-                const int toolbarLocalId = variant.toInt();
-                registerToolbar(toolbarLocalId, toolbarFile);
-            }
-        }
-        emit toolbarIdChanged(newToolbarId);
-        // store the new used toolbar id(global).
-        d->toolbarId = newToolbarId;
-    }
-
-    // general notification last
-    foreach (MInputMethodBase *target, targets()) {
-        target->update();
-    }
-}
-
-
-void MInputContextDBusConnection::appOrientationChanged(int angle)
-{
-    foreach (MInputMethodBase *target, targets()) {
-        target->appOrientationChanged(angle);
-    }
-}
-
-
-void MInputContextDBusConnection::updateInputMethodArea(const QRegion &region)
-{
-    if (d->activeContext) {
-        QList<QVariant> data;
-        data.append(region.boundingRect());
-        d->activeContext->call("updateInputMethodArea", data);
-    }
-}
-
-
-void MInputContextDBusConnection::setCopyPasteState(bool copyAvailable, bool pasteAvailable)
-{
-    foreach (MInputMethodBase *target, targets()) {
-        target->setCopyPasteState(copyAvailable, pasteAvailable);
-    }
-}
-
-
-void MInputContextDBusConnection::processKeyEvent(QEvent::Type keyType, Qt::Key keyCode,
-                                                  Qt::KeyboardModifiers modifiers,
-                                                  const QString &text, bool autoRepeat, int count,
-                                                  quint32 nativeScanCode, quint32 nativeModifiers)
-{
-    foreach (MInputMethodBase *target, targets()) {
-        target->processKeyEvent(keyType, keyCode, modifiers, text, autoRepeat, count,
-                                nativeScanCode, nativeModifiers);
-    }
-}
-
-void MInputContextDBusConnection::registerToolbar(int id, const QString &toolbar)
-{
-    MToolbarId globalId(id, message().service());
-    if (globalId.isValid() && !d->toolbarIds.contains(globalId)) {
-        MToolbarManager::instance().registerToolbar(globalId, toolbar);
-        d->toolbarIds.insert(globalId);
-    }
-}
-
-void MInputContextDBusConnection::unregisterToolbar(int id)
-{
-    MToolbarId globalId(id, message().service());
-    if (globalId.isValid() && d->toolbarIds.contains(globalId)) {
-        MToolbarManager::instance().unregisterToolbar(globalId);
-        d->toolbarIds.remove(globalId);
-    }
-}
-
-void MInputContextDBusConnection::setToolbarItemAttribute(
-    int id, const QString &item, const QString &attribute, const QVariant &value)
-{
-    MToolbarId globalId(id, message().service());
-    if (globalId.isValid() && d->toolbarIds.contains(globalId)) {
-        MToolbarManager::instance().setToolbarItemAttribute(globalId, item, attribute, value);
-    }
-}
-
-void MInputContextDBusConnection::updateTransientHint()
-{
-    bool ok = false;
-    const int appWinId = winId(ok);
-
-    if (ok) {
-        MIMApplication *app = MIMApplication::instance();
-
-        if (app) {
-            app->setTransientHint(appWinId);
-        }
-    }
-}
--- src/minputcontextdbusconnection.h
+++ src/minputcontextdbusconnection.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 MINPUTCONTEXTDBUSCONNECTION_H
-#define MINPUTCONTEXTDBUSCONNECTION_H
-
-#include <QDBusContext>
-#include <QDBusObjectPath>
-#include <QMap>
-#include <QEvent>
-
-#include "minputcontextconnection.h"
-
-class QPoint;
-class QString;
-class QRegion;
-class QVariant;
-
-class MInputContextDBusConnectionPrivate;
-
-Q_DECLARE_METATYPE(QRect);
-
-/*!
-  \brief MInputContextDBusConnection handles input context connection for DBus based
-  input context
- */
-class MInputContextDBusConnection: public MInputContextConnection, protected QDBusContext
-{
-    Q_OBJECT
-    Q_CLASSINFO("D-Bus Interface", "com.meego.inputmethod.uiserver1")
-
-public:
-    MInputContextDBusConnection();
-    virtual ~MInputContextDBusConnection();
-
-    //! Returns true if the connection to D-Bus is valid and the object is properly usable
-    bool isValid();
-
-    //! \reimp
-    virtual void sendPreeditString(const QString &string, PreeditFace preeditFace = PreeditDefault);
-    virtual void sendCommitString(const QString &string);
-    virtual void sendKeyEvent(const QKeyEvent &keyEvent);
-    virtual void notifyImInitiatedHiding();
-
-    virtual int contentType(bool &valid);
-    virtual bool correctionEnabled(bool &valid);
-    virtual bool predictionEnabled(bool &valid);
-    virtual bool autoCapitalizationEnabled(bool &valid);
-    virtual void setGlobalCorrectionEnabled(bool);
-    virtual bool surroundingText(QString &text, int &cursorPosition);
-    virtual bool hasSelection(bool &valid);
-    virtual int inputMethodMode(bool &valid);
-    virtual QRect preeditRectangle(bool &valid);
-    virtual void setRedirectKeys(bool enabled);
-    virtual void setDetectableAutoRepeat(bool enabled);
-    virtual void copy();
-    virtual void paste();
-    //! \reimp_end
-
-public slots:
-    // communication w/ minputcontext
-
-    //void setContextObject(QDBusObjectPath callbackObject);
-    void setContextObject(QString callbackObject);
-
-    //! sets the input to go to calling connection
-    void activateContext();
-
-    //! ipc method provided to the application, shows input method
-    void showInputMethod();
-
-    //! ipc method provided to the application, hides input method
-    void hideInputMethod();
-
-    //! ipc method provided to the application, signals mouse click on preedit
-    void mouseClickedOnPreedit(const QPoint &pos, const QRect &preeditRect);
-
-    //! ipc method provided to the application, sets preedit
-    void setPreedit(const QString &text);
-
-    void updateWidgetInformation(const QMap<QString, QVariant> &stateInformation, bool focusChanged);
-
-    //! ipc method provided to the application, resets the input method
-    void reset();
-
-    /*!
-     * \brief Target application changed orientation
-     */
-    void appOrientationChanged(int angle);
-
-    virtual void updateInputMethodArea(const QRegion &region);
-
-    /*! \brief Set copy/paste state for appropriate UI elements in the input method server
-     *  \param copyAvailable bool TRUE if text is selected
-     *  \param pasteAvailable bool TRUE if clipboard content is not empty
-     */
-    virtual void setCopyPasteState(bool copyAvailable, bool pasteAvailable);
-
-    /*!
-     * \brief Process a key event redirected from hardware keyboard to input method plugin(s).
-     *
-     * This is called only if one has enabled redirection by calling \a setRedirectKeys.
-     */
-    void processKeyEvent(QEvent::Type keyType, Qt::Key keyCode, Qt::KeyboardModifiers modifiers,
-                         const QString &text, bool autoRepeat, int count, quint32 nativeScanCode,
-                         quint32 nativeModifiers);
-
-    /*!
-     * \brief Register an input method toolbar which is defined in \a fileName with the unique identifier \a id.
-     *  The \a id should be unique, and the \a fileName is the absolute file name of the custom toolbar.
-     */
-    void registerToolbar(int id, const QString &fileName);
-
-    /*!
-     * \brief Unregister an input method \a toolbar which unique identifier is \a id.
-     */
-    void unregisterToolbar(int id);
-
-    /*!
-     * \brief Sets the \a attribute for the \a item in the custom toolbar to \a value.
-     */
-    void setToolbarItemAttribute(int id, const QString &item, const QString &attribute, const QVariant &value);
-
-    /*!
-     * \brief get the X window id of the active app window
-     */
-    int winId(bool &valid);
-
-private:
-    //! Updates the transient hint on the framework side to point to the
-    //! current application's window id.
-    void updateTransientHint();
-
-    Q_DISABLE_COPY(MInputContextDBusConnection)
-
-    MInputContextDBusConnectionPrivate *d;
-};
-
-
-#endif
--- src/minputcontextdbusconnection_p.h
+++ src/minputcontextdbusconnection_p.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 MINPUTCONTEXTDBUSCONNECTION_P_H
-#define MINPUTCONTEXTDBUSCONNECTION_P_H
-
-#include "mtoolbarid.h"
-
-#include <QDBusAbstractAdaptor>
-#include <QMap>
-#include <QDBusInterface>
-#include <QString>
-#include <QVariant>
-#include <QSet>
-
-class MInputContextDBusConnection;
-
-class MInputContextDBusAdaptor: public QDBusAbstractAdaptor
-{
-    Q_OBJECT
-    Q_CLASSINFO("D-Bus Interface", "com.meego.inputmethod.uiserver1")
-
-public:
-    MInputContextDBusAdaptor(MInputContextDBusConnection *host);
-    virtual ~MInputContextDBusAdaptor();
-
-public slots:
-    void showInputMethod();
-    void hideInputMethod();
-    void mouseClickedOnPreedit(const QPoint &pos, const QRect &preeditRect);
-    void setPreedit(const QString &text);
-    void updateWidgetInformation(const QMap<QString, QVariant> &stateInformation, bool focusChanged);
-    void reset();
-
-    void setContextObject(QString callbackObject);
-    void activateContext();
-    void appOrientationChanged(int angle);
-    void setCopyPasteState(bool copyAvailable, bool pasteAvailable);
-    void processKeyEvent(int keyType, int keyCode, int modifiers, const QString &text,
-                         bool autoRepeat, int count, int nativeScanCode, int nativeModifiers);
-    void registerToolbar(int id, const QString &toolbar);
-    void unregisterToolbar(int id);
-    void setToolbarItemAttribute(int id, const QString &item, const QString &attribute, const QVariant &values);
-
-private:
-    MInputContextDBusConnection *host;
-};
-
-
-class MInputContextDBusConnectionPrivate
-{
-public:
-    MInputContextDBusConnectionPrivate();
-    ~MInputContextDBusConnectionPrivate();
-
-    QMap<QString, QDBusInterface *> clients; // map of service/interface object
-    QMap<QString, int> clientIds; // map of service/interface identifiers
-    QDBusInterface *activeContext; // currently active context
-    bool valid;
-    QMap<QString, QVariant> widgetState;
-    bool globalCorrectionEnabled;
-    bool redirectionEnabled;
-    bool detectableAutoRepeat;
-    MToolbarId toolbarId; //current toolbar id
-    QSet<MToolbarId> toolbarIds; //all toolbar ids
-};
-
-#endif
--- src/minputcontextglibdbusconnection.cpp
+++ src/minputcontextglibdbusconnection.cpp
@@ -30,7 +30,7 @@
 
 #include <stdlib.h>
 
-#include "minputmethodbase.h"
+#include "mabstractinputmethod.h"
 #include "mimapplication.h"
 
 namespace
@@ -355,8 +355,8 @@
     activeContext = 0;
 
     // notify plugins
-    foreach (MInputMethodBase *target, targets()) {
-        target->clientChanged();
+    foreach (MAbstractInputMethod *target, targets()) {
+        target->handleClientChange();
     }
 }
 
@@ -463,7 +463,7 @@
 // Server -> input context...................................................
 
 void MInputContextGlibDBusConnection::sendPreeditString(const QString &string,
-                                                       PreeditFace preeditFace)
+                                                        MInputMethod::PreeditFace preeditFace)
 {
     if (activeContext) {
         dbus_g_proxy_call_no_reply(activeContext->inputContextProxy, "updatePreedit",
@@ -484,7 +484,8 @@
 }
 
 
-void MInputContextGlibDBusConnection::sendKeyEvent(const QKeyEvent &keyEvent)
+void MInputContextGlibDBusConnection::sendKeyEvent(const QKeyEvent &keyEvent,
+                                                   MInputMethod::EventRequestType requestType)
 {
     if (activeContext) {
         int type = static_cast<int>(keyEvent.type());
@@ -498,6 +499,7 @@
                                    G_TYPE_STRING, keyEvent.text().toUtf8().data(),
                                    G_TYPE_BOOLEAN, keyEvent.isAutoRepeat() ? TRUE : FALSE,
                                    G_TYPE_INT, keyEvent.count(),
+                                   G_TYPE_UCHAR, static_cast<uchar>(requestType),
                                    G_TYPE_INVALID);
     }
 }
@@ -626,8 +628,8 @@
     }
 
     // notify plugins
-    foreach (MInputMethodBase *target, targets()) {
-        target->clientChanged();
+    foreach (MAbstractInputMethod *target, targets()) {
+        target->handleClientChange();
     }
 }
 
@@ -647,15 +649,15 @@
 void MInputContextGlibDBusConnection::mouseClickedOnPreedit(const QPoint &pos,
                                                            const QRect &preeditRect)
 {
-    foreach (MInputMethodBase *target, targets()) {
-        target->mouseClickedOnPreedit(pos, preeditRect);
+    foreach (MAbstractInputMethod *target, targets()) {
+        target->handleMouseClickOnPreedit(pos, preeditRect);
     }
 }
 
 
 void MInputContextGlibDBusConnection::setPreedit(const QString &text)
 {
-    foreach (MInputMethodBase *target, targets()) {
+    foreach (MAbstractInputMethod *target, targets()) {
         target->setPreedit(text);
     }
 }
@@ -663,7 +665,7 @@
 
 void MInputContextGlibDBusConnection::reset()
 {
-    foreach (MInputMethodBase *target, targets()) {
+    foreach (MAbstractInputMethod *target, targets()) {
         target->reset();
     }
 }
@@ -772,8 +774,8 @@
     widgetState = stateInfo;
 
     if (focusChanged) {
-        foreach (MInputMethodBase *target, targets()) {
-            target->focusChanged(stateInfo[FocusStateAttribute].toBool());
+        foreach (MAbstractInputMethod *target, targets()) {
+            target->handleFocusChange(stateInfo[FocusStateAttribute].toBool());
         }
 
         updateTransientHint();
@@ -781,8 +783,8 @@
 
     // call notification methods if needed
     if (oldVisualization != newVisualization) {
-        foreach (MInputMethodBase *target, targets()) {
-            target->visualizationPriorityChanged(newVisualization);
+        foreach (MAbstractInputMethod *target, targets()) {
+            target->handleVisualizationPriorityChange(newVisualization);
         }
     }
 
@@ -805,7 +807,7 @@
     }
 
     // general notification last
-    foreach (MInputMethodBase *target, targets()) {
+    foreach (MAbstractInputMethod *target, targets()) {
         target->update();
     }
 }
@@ -813,8 +815,8 @@
 
 void MInputContextGlibDBusConnection::appOrientationChanged(int angle)
 {
-    foreach (MInputMethodBase *target, targets()) {
-        target->appOrientationChanged(angle);
+    foreach (MAbstractInputMethod *target, targets()) {
+        target->handleAppOrientationChange(angle);
     }
 }
 
@@ -829,7 +831,7 @@
     QEvent::Type keyType, Qt::Key keyCode, Qt::KeyboardModifiers modifiers, const QString &text,
     bool autoRepeat, int count, quint32 nativeScanCode, quint32 nativeModifiers)
 {
-    foreach (MInputMethodBase *target, targets()) {
+    foreach (MAbstractInputMethod *target, targets()) {
         target->processKeyEvent(keyType, keyCode, modifiers, text, autoRepeat, count,
                                 nativeScanCode, nativeModifiers);
     }
--- src/minputcontextglibdbusconnection.h
+++ src/minputcontextglibdbusconnection.h
@@ -50,9 +50,12 @@
     void handleDBusDisconnection(MDBusGlibICConnection *connection);
 
     //! \reimp
-    virtual void sendPreeditString(const QString &string, PreeditFace preeditFace = PreeditDefault);
+    virtual void sendPreeditString(const QString &string,
+                                   MInputMethod::PreeditFace preeditFace
+                                    = MInputMethod::PreeditDefault);
     virtual void sendCommitString(const QString &string);
-    virtual void sendKeyEvent(const QKeyEvent &keyEvent);
+    virtual void sendKeyEvent(const QKeyEvent &keyEvent,
+                              MInputMethod::EventRequestType requestType);
     virtual void notifyImInitiatedHiding();
 
     virtual int contentType(bool &valid);
--- src/minputmethodbase.cpp
+++ src/minputmethodbase.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 "minputmethodbase.h"
-#include "minputcontextconnection.h"
-
-#include <QGraphicsView>
-#include <QDebug>
-#include <QKeyEvent>
-#include <QDBusInterface>
-#include <QDBusServiceWatcher>
-
-namespace {
-    const char * const DBusIndicatorServiceName = "com.meego.core.MInputMethodStatusIndicator";
-    const char * const DBusIndicatorPath = "/inputmethodstatusindicator";
-    const char * const DBusIndicatorInterface = "com.meego.core.MInputMethodStatusIndicator";
-};
-
-class MInputMethodBasePrivate
-{
-public:
-    MInputMethodBasePrivate(MInputContextConnection *icConnection, MInputMethodBase *parent);
-    ~MInputMethodBasePrivate();
-
-    void _q_handleIndicatorServiceChanged(const QString &serviceName, const QString &oldOwner,
-                                          const QString &newOwner);
-    void connectToIndicatorDBus();
-    //! map the InputModeIndicator to icon id
-    QString indicatorIconID(MInputMethodBase::InputModeIndicator mode);
-
-    MInputContextConnection *icConnection;
-    QDBusInterface *indicatorIface; // indicator server interface
-    QDBusServiceWatcher *indicatorServiceWatcher;
-    QMap<MInputMethodBase::InputModeIndicator, QString> indicatorMap;
-};
-
-
-
-MInputMethodBasePrivate::MInputMethodBasePrivate(MInputContextConnection *icConnection, MInputMethodBase *parent)
-    : icConnection(icConnection),
-      indicatorIface(0),
-      indicatorServiceWatcher(new QDBusServiceWatcher(DBusIndicatorServiceName, QDBusConnection::sessionBus(),
-                                                      QDBusServiceWatcher::WatchForOwnerChange, parent))
-{
-    connectToIndicatorDBus();
-    QObject::connect(indicatorServiceWatcher, SIGNAL(serviceOwnerChanged(QString, QString, QString)),
-                     parent, SLOT(_q_handleIndicatorServiceChanged(QString, QString, QString)));
-
-    indicatorMap.insert(MInputMethodBase::NoIndicator, "");
-    indicatorMap.insert(MInputMethodBase::LatinLower, "icon-s-status-latin-lowercase");
-    indicatorMap.insert(MInputMethodBase::LatinUpper, "icon-s-status-latin-uppercase");
-    indicatorMap.insert(MInputMethodBase::LatinLocked, "icon-s-status-latin-caps");
-    indicatorMap.insert(MInputMethodBase::CyrillicLower, "icon-s-status-cyrillic-lowercase");
-    indicatorMap.insert(MInputMethodBase::CyrillicUpper, "icon-s-status-cyrillic-uppercase");
-    indicatorMap.insert(MInputMethodBase::CyrillicLocked, "icon-s-status-cyrillic-caps");
-    indicatorMap.insert(MInputMethodBase::Arabic, "icon-s-status-arabic");
-    indicatorMap.insert(MInputMethodBase::Pinyin, "icon-s-status-pinyin");
-    indicatorMap.insert(MInputMethodBase::Zhuyin, "icon-s-status-zhuyin");
-    indicatorMap.insert(MInputMethodBase::Cangjie, "icon-s-status-cangjie");
-    indicatorMap.insert(MInputMethodBase::NumAndSymLatched, "icon-s-status-number");
-    indicatorMap.insert(MInputMethodBase::NumAndSymLocked, "icon-s-status-number-locked");
-    indicatorMap.insert(MInputMethodBase::DeadKeyAcute, "icon-s-status-acute");
-    indicatorMap.insert(MInputMethodBase::DeadKeyCaron, "icon-s-status-caron");
-    indicatorMap.insert(MInputMethodBase::DeadKeyCircumflex, "icon-s-status-circumflex");
-    indicatorMap.insert(MInputMethodBase::DeadKeyDiaeresis, "icon-s-status-diaeresis");
-    indicatorMap.insert(MInputMethodBase::DeadKeyGrave, "icon-s-status-grave");
-    indicatorMap.insert(MInputMethodBase::DeadKeyTilde, "icon-s-status-tilde");
-}
-
-
-MInputMethodBasePrivate::~MInputMethodBasePrivate()
-{
-    delete indicatorIface;
-}
-
-void MInputMethodBasePrivate::connectToIndicatorDBus()
-{
-    qDebug() << __PRETTY_FUNCTION__;
-    QDBusConnection connection = QDBusConnection::sessionBus();
-
-    if (!connection.isConnected()) {
-        qWarning() << "Cannot connect to the DBus session bus";
-        return;
-    }
-    indicatorIface = new QDBusInterface(DBusIndicatorServiceName, DBusIndicatorPath,
-                                        DBusIndicatorInterface, connection);
-
-    if (!indicatorIface->isValid()) {
-        qWarning() << "MInputContextDBusConnection was unable to connect to indicator server: "
-                   << connection.lastError().message();
-        delete indicatorIface;
-        indicatorIface = 0;
-    }
-}
-
-void MInputMethodBasePrivate::_q_handleIndicatorServiceChanged(const QString &serviceName,
-                                                               const QString &oldOwner,
-                                                               const QString &newOwner)
-{
-    qDebug() << __PRETTY_FUNCTION__;
-    if (serviceName != DBusIndicatorServiceName)
-        return;
-
-    if (indicatorIface && !indicatorIface->isValid()) {
-        delete indicatorIface;
-        indicatorIface = 0;
-    }
-    if (!newOwner.isEmpty()) {
-        connectToIndicatorDBus();
-    }
-}
-
-QString MInputMethodBasePrivate::indicatorIconID(MInputMethodBase::InputModeIndicator mode)
-{
-    return indicatorMap.value(mode);
-}
-
-///////////////
-
-MInputMethodBase::MInputMethodBase(MInputContextConnection *icConnection, QObject *parent)
-    : QObject(parent),
-      d(new MInputMethodBasePrivate(icConnection, this))
-{
-    // nothing
-}
-
-
-MInputMethodBase::~MInputMethodBase()
-{
-    delete d;
-}
-
-
-MInputContextConnection *
-MInputMethodBase::inputContextConnection() const
-{
-    return d->icConnection;
-}
-
-void MInputMethodBase::show()
-{
-    // empty default implementation
-}
-
-void MInputMethodBase::hide()
-{
-    // empty default implementation
-}
-
-void MInputMethodBase::setPreedit(const QString &)
-{
-    // empty default implementation
-}
-
-void MInputMethodBase::update()
-{
-    // empty default implementation
-}
-
-void MInputMethodBase::reset()
-{
-    // empty default implementation
-}
-
-void MInputMethodBase::mouseClickedOnPreedit(const QPoint &pos, const QRect &preeditRect)
-{
-    // empty default implementation
-    Q_UNUSED(pos);
-    Q_UNUSED(preeditRect);
-}
-
-void MInputMethodBase::focusChanged(bool /* focusIn */)
-{
-    // empty default implementation
-}
-
-void MInputMethodBase::visualizationPriorityChanged(bool priority)
-{
-    // empty default implementation
-    Q_UNUSED(priority);
-}
-
-void MInputMethodBase::appOrientationChanged(int angle)
-{
-    // empty default implementation
-    Q_UNUSED(angle);
-}
-
-void MInputMethodBase::setToolbar(QSharedPointer<const MToolbarData> toolbar)
-{
-    // empty default implementation
-    Q_UNUSED(toolbar);
-}
-
-void MInputMethodBase::processKeyEvent(QEvent::Type keyType, Qt::Key keyCode,
-                                       Qt::KeyboardModifiers modifiers,
-                                       const QString &text, bool autoRepeat, int count,
-                                       quint32 /* nativeScanCode */, quint32 /* nativeModifiers */)
-{
-    // default implementation, just sendKeyEvent back
-    inputContextConnection()->sendKeyEvent(QKeyEvent(keyType, keyCode, modifiers, text, autoRepeat,
-                                                     count));
-}
-
-void MInputMethodBase::setState(const QSet<MIMHandlerState> &state)
-{
-    // empty default implementation
-    Q_UNUSED(state);
-}
-
-void MInputMethodBase::clientChanged()
-{
-    // empty default implementation
-}
-
-void MInputMethodBase::switchContext(M::InputMethodSwitchDirection direction, bool enableAnimation)
-{
-    // empty default implementation
-    Q_UNUSED(direction);
-    Q_UNUSED(enableAnimation);
-}
-
-void MInputMethodBase::sendInputModeIndicator(MInputMethodBase::InputModeIndicator mode)
-{
-    if (d->indicatorIface) {
-        d->indicatorIface->call(QDBus::NoBlock, "setIconID", d->indicatorIconID(mode));
-    }
-}
-
-QList<MInputMethodBase::MInputMethodSubView> MInputMethodBase::subViews(MIMHandlerState state) const
-{
-    Q_UNUSED(state);
-    QList<MInputMethodSubView> sVs;
-    return sVs;
-}
-
-void MInputMethodBase::setActiveSubView(const QString &subViewId, MIMHandlerState state)
-{
-    // empty default implementation
-    Q_UNUSED(subViewId);
-    Q_UNUSED(state);
-}
-
-QString MInputMethodBase::activeSubView(MIMHandlerState state) const
-{
-    Q_UNUSED(state);
-    return QString();
-}
-
-#include "moc_minputmethodbase.cpp"
--- src/minputmethodbase.h
+++ src/minputmethodbase.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 MINPUTMETHODBASE_H
-#define MINPUTMETHODBASE_H
-
-#include <QObject>
-#include <QEvent>
-#include <QVariant>
-#include <QMap>
-#include <MNamespace>
-#include "mimhandlerstate.h"
-#include "mimdirection.h"
-#include "minputmethodnamespace.h"
-
-class QRegion;
-class QPoint;
-class QRect;
-class QGraphicsScene;
-class MInputContextConnection;
-class MInputMethodBasePrivate;
-class MToolbarData;
-
-/*!
- * \brief MInputMethodBase is a base class for input method servers.
- * 
- * It defines the interface which input context connection classes can use for
- * passing commands received from the applications
- */
-class MInputMethodBase: public QObject
-{
-    Q_OBJECT
-
-public:
-     /*!
-      * This enum contains possible values for all the modes that are shown in the
-      * Input mode indicator.
-      *
-      * \sa sendInputModeIndicator().
-      */
-    enum InputModeIndicator {
-        NoIndicator,    //!< No indicator should be shown
-        LatinLower,     //!< Latin lower case mode
-        LatinUpper,     //!< Latin upper case mode
-        LatinLocked,    //!< Latin caps locked mode
-        CyrillicLower,  //!< Cyrillic lower case mode
-        CyrillicUpper,  //!< Cyrillic upper case mode
-        CyrillicLocked, //!< Cyrillic caps locked mode
-        Arabic,         //!< Arabic mode
-        Pinyin,         //!< Pinyin mode
-        Zhuyin,         //!< Zhuyin mode
-        Cangjie,        //!< Cangjie mode
-        NumAndSymLatched,   //!< Number and Symbol latched mode
-        NumAndSymLocked,//!< Number and Symbol locked mode
-        DeadKeyAcute,   //!< Dead key acute mode
-        DeadKeyCaron,   //!< Dead key caron mode
-        DeadKeyCircumflex,  //!< Dead key circumflex mode
-        DeadKeyDiaeresis,   //!< Dead key diaeresis mode
-        DeadKeyGrave,   //!< Dead key grave mode
-        DeadKeyTilde    //!< Dead key tilde mode
-    };
-
-     /*!
-     * MInputMethodSubView defines an input method subview with an identifier \a subViewId
-     * and a title \a subViewTitle.
-     *
-     * The subview is a view which provided by this input method. The view could be a view of one
-     * language, or one keyboard, it depends on the input method. Each subview has an identifier
-     * and title.
-     */
-    struct MInputMethodSubView {
-        QString subViewId;
-        QString subViewTitle;
-    };
-
-    /*! Constructor for input method base
-     * \param icConnection input context connection class, not owned by input method base
-     */
-    MInputMethodBase(MInputContextConnection *icConnection, QObject *parent = 0);
-
-    ~MInputMethodBase();
-
-    /*! \brief Returns input context connection associated with this input method base
-     */
-    MInputContextConnection *inputContextConnection() const;
-
-    /*! \brief Shows the input method.
-     */
-    virtual void show();
-
-    /*! \brief Hides the input method
-     */
-    virtual void hide();
-
-    /*! \brief Sets preedit string of the input method server
-     */
-    virtual void setPreedit(const QString &preeditString);
-
-    /*! \brief Update input method server state
-     */
-    virtual void update();
-
-    /*! \brief Resets input method server state
-     */
-    virtual void reset();
-
-    /*! \brief Notifies input method server about mouse click on the preedit string
-     */
-    virtual void mouseClickedOnPreedit(const QPoint &pos, const QRect &preeditRect);
-
-    /*! \brief Notifies input method server about changed focus
-     *  \param focusIn true - focus has entered a widget, false - focus has left a widget
-     */
-    virtual void focusChanged(bool focusIn);
-
-    /*! \brief Notifies that the focus widget in application changed visualization priority
-     */
-    virtual void visualizationPriorityChanged(bool priority);
-
-    /*! \brief Target application changed orientation. Input method usually changes its
-     *         own orientation according to this.
-     */
-    virtual void appOrientationChanged(int angle);
-
-    /*!
-     * \brief Uses a custom toolbar which is defined by given parameter.
-     * \param toolbar Pointer to toolbar definition.
-     */
-    virtual void setToolbar(QSharedPointer<const MToolbarData> toolbar);
-
-    /*!
-     * \brief Process a key event redirected from hardware keyboard to input method.
-     *
-     * This is called only if one has enabled redirection by calling
-     * \a MInputContextConnection::setRedirectKeys.
-     */
-    virtual void processKeyEvent(QEvent::Type keyType, Qt::Key keyCode,
-                                 Qt::KeyboardModifiers modifiers, const QString &text,
-                                 bool autoRepeat, int count, quint32 nativeScanCode,
-                                 quint32 nativeModifiers);
-
-    /* \brief This method is called to inform about keyboard status changes
-     *
-     * That is, hardware keyboard is opened or closed, BT keyboard is connected or
-     * disconnected
-     * \param state set of current states for this plugin
-     */
-    virtual void setState(const QSet<MIMHandlerState> &state);
-
-    /*! \brief This method is called when target client is changed.
-     */
-    virtual void clientChanged();
-
-    /*!
-     * \brief Switch context to given direction
-     * \param direction Switching direction
-     * \param enableAnimation Contains true if swipe should be animated
-     */
-    virtual void switchContext(M::InputMethodSwitchDirection direction, bool enableAnimation);
-
-    /*!
-     * \brief Sends input mode indicate state.
-     * Default implementation is sending the input mode indicate state \a mode to application framework.
-     * \param mode Input mode indicator state.
-     * \sa InputModeIndicator.
-     */
-    void sendInputModeIndicator(InputModeIndicator mode);
-
-    /*! \brief Returns all subviews (IDs and titles) which are supported for \a state.
-     *
-     * Implement this function to return the subviews which are supported by this input
-     * method for the specified state. The subview titles will be shown in the input method settings.
-     */
-    virtual QList<MInputMethodSubView> subViews(MIMHandlerState state = OnScreen) const;
-
-    /*!
-     * \brief Sets \a subViewId as the active subview for \a state.
-     * \param subViewId the identifier of subview.
-     * \param state the state which \a subViewId belongs to.
-     *
-     *  Implement this method to set the active subview. Input method plugins manager will call
-     *  this method when active subview for specified state is changed from the input method
-     *  settings.
-     */
-    virtual void setActiveSubView(const QString &subViewId, MIMHandlerState state = OnScreen);
-
-    /*!
-     * \brief Returns current active subview ID for \a state.
-     *
-     *  Implement this method to inform input method plugins manager about current active subview
-     *  for specified state.
-     */
-    virtual QString activeSubView(MIMHandlerState state = OnScreen) const;
-
-signals:
-    /*!
-     * Inform that the screen area covered by the input method has been changed.
-     *
-     * \param region the new region
-     */
-    void regionUpdated(const QRegion &region);
-
-    /*!
-     * Inform that the part of the screen area covered by the input method that
-     * should be avoided by the screen area receiving input in order not to be
-     * obscured has been changed.
-     *
-     * For now this region must be so simple that its bounding box can be
-     * effectively used as the avoidance area.
-     *
-     * \param region the new region
-     */
-    void inputMethodAreaUpdated(const QRegion &region);
-
-    /*!
-     * Inform that plugin should be switched in according to \a direction.
-     */
-    void pluginSwitchRequired(M::InputMethodSwitchDirection direction);
-
-    /*!
-     * Inform that active plugin should be replaced with specified one.
-     * \param pluginName Name orf plugin which will be activated
-     */
-    void pluginSwitchRequired(const QString &pluginName);
-
-    /*!
-     * Inform that active plugin should be replaced with another one
-     * specified by settings.
-     */
-    void pluginSwitchRequired();
-
-    /*!
-     * Inform that input method settings should be shown.
-     * Emitted when the plugin requires input method settings.
-     */
-    void settingsRequested();
-
-    /*!
-     * Inform that active subview is changed to \a subViewId for \a state.
-     * \param subViewId the identifier of the new subview.
-     * \param state the state which \a subViewId belongs to.
-     * Emitted when plugin changes the active subview for specified state.
-     */
-    void activeSubViewChanged(const QString &subViewId, MIMHandlerState state = OnScreen);
-
-private:
-    Q_DISABLE_COPY(MInputMethodBase)
-    Q_DECLARE_PRIVATE(MInputMethodBase)
-    Q_PRIVATE_SLOT(d_func(), void _q_handleIndicatorServiceChanged(const QString &, const QString &, const QString &));
-
-    MInputMethodBasePrivate *d;
-};
-
-#endif
--- src/minputmethodhost.cpp
+++ src/minputmethodhost.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 "minputmethodhost.h"
+#include "minputcontextconnection.h"
+#include "mimpluginmanager.h"
+#include "mindicatorserviceclient.h"
+#include "mabstractinputmethod.h"
+
+
+MInputMethodHost::MInputMethodHost(MInputContextConnection *inputContextConnection,
+                                   MIMPluginManager *pluginManager,
+                                   MIndicatorServiceClient &indicatorService, QObject *parent)
+    : MAbstractInputMethodHost(parent),
+      connection(inputContextConnection),
+      pluginManager(pluginManager),
+      inputMethod(0),
+      enabled(false),
+      indicatorService(indicatorService)
+{
+    // nothing
+}
+
+
+MInputMethodHost::~MInputMethodHost()
+{
+    // nothing
+}
+
+
+void MInputMethodHost::setEnabled(bool enabled)
+{
+    this->enabled = enabled;
+}
+
+void MInputMethodHost::setInputMethod(MAbstractInputMethod *inputMethod)
+{
+    this->inputMethod = inputMethod;
+}
+
+
+int MInputMethodHost::contentType(bool &valid)
+{
+    return connection->contentType(valid);
+}
+
+bool MInputMethodHost::correctionEnabled(bool &valid)
+{
+    return connection->correctionEnabled(valid);
+}
+
+bool MInputMethodHost::predictionEnabled(bool &valid)
+{
+    return connection->predictionEnabled(valid);
+}
+
+bool MInputMethodHost::autoCapitalizationEnabled(bool &valid)
+{
+    return connection->autoCapitalizationEnabled(valid);
+}
+
+bool MInputMethodHost::surroundingText(QString &text, int &cursorPosition)
+{
+    return connection->surroundingText(text, cursorPosition);
+}
+
+bool MInputMethodHost::hasSelection(bool &valid)
+{
+    return connection->hasSelection(valid);
+}
+
+int MInputMethodHost::inputMethodMode(bool &valid)
+{
+    return connection->inputMethodMode(valid);
+}
+
+QRect MInputMethodHost::preeditRectangle(bool &valid)
+{
+    return connection->preeditRectangle(valid);
+}
+
+void MInputMethodHost::sendPreeditString(const QString &string,
+                                         MInputMethod::PreeditFace preeditFace)
+{
+    if (enabled) {
+        connection->sendPreeditString(string, preeditFace);
+    }
+}
+
+void MInputMethodHost::sendCommitString(const QString &string)
+{
+    if (enabled) {
+        connection->sendCommitString(string);
+    }
+}
+
+void MInputMethodHost::sendKeyEvent(const QKeyEvent &keyEvent,
+                                    MInputMethod::EventRequestType requestType)
+{
+    if (enabled) {
+        connection->sendKeyEvent(keyEvent, requestType);
+    }
+}
+
+void MInputMethodHost::notifyImInitiatedHiding()
+{
+    if (enabled) {
+        connection->notifyImInitiatedHiding();
+    }
+}
+
+void MInputMethodHost::copy()
+{
+    if (enabled) {
+        connection->copy();
+    }
+}
+
+void MInputMethodHost::paste()
+{
+    if (enabled) {        
+        connection->paste();
+    }
+}
+
+void MInputMethodHost::setRedirectKeys(bool redirectEnabled)
+{
+    if (enabled) {
+        connection->setRedirectKeys(redirectEnabled);
+    }
+}
+
+void MInputMethodHost::setDetectableAutoRepeat(bool autoRepeatEnabled)
+{
+    if (enabled) {
+        connection->setDetectableAutoRepeat(autoRepeatEnabled);
+    }
+}
+
+void MInputMethodHost::setGlobalCorrectionEnabled(bool correctionEnabled)
+{
+    if (enabled) {
+        connection->setGlobalCorrectionEnabled(correctionEnabled);
+    }
+}
+
+void MInputMethodHost::setInputModeIndicator(MInputMethod::InputModeIndicator mode)
+{
+    if (enabled) {
+        indicatorService.setInputModeIndicator(mode);
+    }
+}
+
+void MInputMethodHost::switchPlugin(MInputMethod::SwitchDirection direction)
+{    
+    if (enabled) {
+        pluginManager->switchPlugin(direction, inputMethod);
+    }
+}
+
+void MInputMethodHost::switchPlugin(const QString &pluginName)
+{
+    if (enabled) {
+        pluginManager->switchPlugin(pluginName, inputMethod);
+    }
+}
+
+void MInputMethodHost::setScreenRegion(const QRegion &region)
+{
+    if (enabled) {
+        pluginManager->updateRegion(region);
+    }
+}
+
+void MInputMethodHost::setInputMethodArea(const QRegion &region)
+{
+    if (enabled) {
+        connection->updateInputMethodArea(region);
+    }
+}
+
+void MInputMethodHost::showSettings()
+{
+    if (enabled) {
+        pluginManager->showInputMethodSettings();
+    }
+}
--- src/minputmethodhost.h
+++ src/minputmethodhost.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 MINPUTMETHODHOST_H
+#define MINPUTMETHODHOST_H
+
+#include "mabstractinputmethodhost.h"
+
+class MInputContextConnection;
+class MIMPluginManager;
+class MIndicatorServiceClient;
+class MAbstractInputMethod;
+
+class QRegion;
+
+
+//! \internal
+/*!
+ * \brief Interface implementation for connecting input method instances to the environment.
+ */
+class MInputMethodHost: public MAbstractInputMethodHost
+{
+    Q_OBJECT
+
+public:
+    MInputMethodHost(MInputContextConnection *inputContextConnection,
+                     MIMPluginManager *pluginManager, MIndicatorServiceClient &indicatorService,
+                     QObject *parent = 0);
+    virtual ~MInputMethodHost();
+
+    //! if enabled, the plugin associated with this host are allowed to communicate
+    void setEnabled(bool enabled);
+
+    //! associate input method with this host instance.
+    //! Multiple calls is (currently) undefined behavior.
+    void setInputMethod(MAbstractInputMethod *inputMethod);
+
+    // \reimp
+    virtual int contentType(bool &valid);
+    virtual bool correctionEnabled(bool &valid);
+    virtual bool predictionEnabled(bool &valid);
+    virtual bool autoCapitalizationEnabled(bool &valid);
+    virtual bool surroundingText(QString &text, int &cursorPosition);
+    virtual bool hasSelection(bool &valid);
+    virtual int inputMethodMode(bool &valid);
+    virtual QRect preeditRectangle(bool &valid);
+    virtual void sendPreeditString(const QString &string,
+                                   MInputMethod::PreeditFace preeditFace
+                                    = MInputMethod::PreeditDefault);
+    virtual void sendCommitString(const QString &string);
+    virtual void sendKeyEvent(const QKeyEvent &keyEvent,
+                              MInputMethod::EventRequestType requestType
+                               = MInputMethod::EventRequestBoth);
+    virtual void notifyImInitiatedHiding();
+    virtual void copy();
+    virtual void paste();
+    virtual void setRedirectKeys(bool enabled);
+    virtual void setDetectableAutoRepeat(bool enabled);
+    virtual void setGlobalCorrectionEnabled(bool enabled);
+
+    virtual void setInputModeIndicator(MInputMethod::InputModeIndicator mode);
+
+    virtual void switchPlugin(MInputMethod::SwitchDirection direction);
+    virtual void switchPlugin(const QString &pluginName);
+    virtual void setScreenRegion(const QRegion &region);
+    virtual void setInputMethodArea(const QRegion &region);
+    virtual void showSettings();
+    // \reimp_end
+
+
+private:
+    Q_DISABLE_COPY(MInputMethodHost)
+
+    MInputContextConnection *connection;
+    MIMPluginManager *pluginManager;
+    MAbstractInputMethod *inputMethod;
+    bool enabled;
+    MIndicatorServiceClient &indicatorService;
+};
+
+//! \internal_end
+
+#endif
--- src/minputmethodnamespace.h
+++ src/minputmethodnamespace.h
@@ -91,6 +91,60 @@
         //! Paste button is accessible
         InputMethodPaste
     };
+
+    /*!
+     * This enum defines direction of plugin switching
+     */
+    enum SwitchDirection {
+        SwitchUndefined, //!< Special value for uninitialized variables
+        SwitchForward, //!< Activate next plugin
+        SwitchBackward //!< Activate previous plugin
+    };
+
+    enum PreeditFace {
+        PreeditDefault,
+        PreeditNoCandidates,
+        PreeditKeyPress           //! Used for displaying the hwkbd key just pressed
+    };
+
+    enum HandlerState {
+        OnScreen,
+        Hardware,
+        Accessory
+    };
+
+    /// \brief Key event request type for \a MInputContext::keyEvent().
+    enum EventRequestType {
+        EventRequestBoth,         //!< Both a Qt::KeyEvent and a signal
+        EventRequestSignalOnly,   //!< Only a signal
+        EventRequestEventOnly     //!< Only a Qt::KeyEvent
+    };
+
+     /*!
+      * This enum contains possible values for all the modes that are shown in the
+      * Input mode indicator.
+      */
+    enum InputModeIndicator {
+        NoIndicator,                 //!< No indicator should be shown
+        LatinLowerIndicator,         //!< Latin lower case mode
+        LatinUpperIndicator,         //!< Latin upper case mode
+        LatinLockedIndicator,        //!< Latin caps locked mode
+        CyrillicLowerIndicator,      //!< Cyrillic lower case mode
+        CyrillicUpperIndicator,      //!< Cyrillic upper case mode
+        CyrillicLockedIndicator,     //!< Cyrillic caps locked mode
+        ArabicIndicator,             //!< Arabic mode
+        PinyinIndicator,             //!< Pinyin mode
+        ZhuyinIndicator,             //!< Zhuyin mode
+        CangjieIndicator,            //!< Cangjie mode
+        NumAndSymLatchedIndicator,   //!< Number and Symbol latched mode
+        NumAndSymLockedIndicator,    //!< Number and Symbol locked mode
+        DeadKeyAcuteIndicator,       //!< Dead key acute mode
+        DeadKeyCaronIndicator,       //!< Dead key caron mode
+        DeadKeyCircumflexIndicator,  //!< Dead key circumflex mode
+        DeadKeyDiaeresisIndicator,   //!< Dead key diaeresis mode
+        DeadKeyGraveIndicator,       //!< Dead key grave mode
+        DeadKeyTildeIndicator        //!< Dead key tilde mode
+    };
 };
 
 #endif
--- src/minputmethodplugin.h
+++ src/minputmethodplugin.h
@@ -21,11 +21,11 @@
 #include <QtPlugin>
 #include <QSet>
 
-#include "minputmethodbase.h"
-#include "minputmethodsettingsbase.h"
+#include "minputmethodnamespace.h"
 
-class MInputContextConnection;
-class MInputMethodBase;
+class MAbstractInputMethod;
+class MAbstractInputMethodSettings;
+class MAbstractInputMethodHost;
 
 
 /*!
@@ -46,17 +46,17 @@
      */
     virtual QStringList languages() const = 0;
 
-    /*! \brief Creates and returns the MInputMethodBase object for
+    /*! \brief Creates and returns the MAbstractInputMethod object for
      * this plugin. This function will be only called once and the allocated
      * resources will be owned by the input method server.
      */
-    virtual MInputMethodBase *createInputMethod(MInputContextConnection *icConnection) = 0;
+    virtual MAbstractInputMethod *createInputMethod(MAbstractInputMethodHost *host) = 0;
 
-    /*! \brief Creates and returns the MInputMethodSettingsBase object for
+    /*! \brief Creates and returns the MAbstractInputMethodSettings object for
      * this plugin. This function will be only called once and the allocated
      * resources will be owned by the input method server.
      */
-    virtual MInputMethodSettingsBase *createInputMethodSettings() = 0;
+    virtual MAbstractInputMethodSettings *createInputMethodSettings() = 0;
 
     /*!
      * \brief Returns set of states which could be handled by this plugin.
@@ -64,11 +64,11 @@
      * WARNING: If result is empty then this plugin will not be loaded
      * during startup.
      */
-    virtual QSet<MIMHandlerState> supportedStates() const = 0;
+    virtual QSet<MInputMethod::HandlerState> supportedStates() const = 0;
 };
 
 
 Q_DECLARE_INTERFACE(MInputMethodPlugin,
-                    "com.nokia.maemo.MInputMethodPlugin/1.0")
+                    "com.meego.meegoimframework.MInputMethodPlugin/1.0")
 
 #endif
--- src/minputmethodsettingsbase.h
+++ src/minputmethodsettingsbase.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 MINPUTMETHODSETTINGSBASE_H
-#define MINPUTMETHODSETTINGSBASE_H
-
-#include <QString>
-
-class QGraphicsWidget;
-
-/*!
- * \brief MInputMethodSettingsBase is a base class for input method settings.
- *
- * MInputMethodSettingsBase defines the setting of a input method plugin. contentWidget()
- * holds its content.
- * Each input method plugin can implement its own setting by inheriting this class.
- *
- */
-
-class MInputMethodSettingsBase
-{
-public:
-    /*!
-     *\brief Returns the title of the setting.
-     * The title should be already translated according current display language.
-     */
-    virtual QString title() = 0;
-
-    /*!
-     *\brief Returns the icon of the setting.
-     * It is the absolute file name for the icon
-     */
-    virtual QString icon() = 0;
-
-    /*!
-     *\brief Creates and returns the content widget of the setting.
-     * \param parent pointer of QGraphicsWidget, it is set to the parent for content widget.
-     *
-     * WARNING: The return pointer of QGraphicsWidget is owned by the caller, and \parent is set
-     * as its parent. It could be manually deleted outside or together with \a parent.
-     */
-    virtual QGraphicsWidget *createContentWidget(QGraphicsWidget *parent = 0) = 0;
-
-};
-
-#endif
--- src/mplainwindow.cpp
+++ src/mplainwindow.cpp
@@ -18,6 +18,7 @@
 
 #include <MSceneManager>
 #include <MGConfItem>
+#include <MTimestamp>
 #include <QDebug>
 
 namespace
@@ -34,7 +35,7 @@
 }
 
 MPlainWindow::MPlainWindow(QWidget *parent) :
-    MWindow(new MSceneManager, parent)
+    MWindow(parent)
 {
     if (m_instance)
         qFatal("There can be only one instance of MPlainWindow");
@@ -106,3 +107,22 @@
 }
 #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;
+}
+
--- src/mplainwindow.h
+++ src/mplainwindow.h
@@ -27,7 +27,7 @@
     Q_OBJECT
 
 public:
-    MPlainWindow(QWidget *parent = 0);
+    explicit MPlainWindow(QWidget *parent = 0);
     virtual ~MPlainWindow();
     static MPlainWindow *instance();
 
@@ -36,6 +36,11 @@
     void updatePosition(const QRegion &region);
 #endif
 
+protected:
+    //! \reimp
+    virtual bool viewportEvent(QEvent *event);
+    //! \reimp_end
+
 private:
     Q_DISABLE_COPY(MPlainWindow);
 
--- src/mpreeditface.h
+++ src/mpreeditface.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 MPREEDITFACE_H
-#define MPREEDITFACE_H
-
-enum PreeditFace {
-    PreeditDefault,
-    PreeditNoCandidates,
-    PreeditKeyPress           //! Used for displaying the hwkbd key just pressed
-};
-
-#endif
--- src/mtoolbardata.cpp
+++ src/mtoolbardata.cpp
@@ -17,7 +17,6 @@
 
 #include "mtoolbardata.h"
 #include "mtoolbardata_p.h"
-#include "mtoolbarrow.h"
 #include "mtoolbarlayout.h"
 
 #include <QFile>
@@ -27,7 +26,7 @@
 
 namespace
 {
-    const QString ToolbarConfigurationPath   = QString::fromLatin1("/usr/share/meegotouch/imtoolbars/");
+    const QString ToolbarConfigurationPath   = QString::fromLatin1("/usr/share/meegoimframework/imtoolbars/");
 
     const QString ImTagToolbar               = QString::fromLatin1("toolbar");
     const QString ImTagLocked                = QString::fromLatin1("locked");
@@ -51,10 +50,12 @@
     const QString ImTagTextId                = QString::fromLatin1("text_id");
     const QString ImTagToggle                = QString::fromLatin1("toggle");
     const QString ImTagPressed               = QString::fromLatin1("pressed");
+    const QString ImTagEnabled               = QString::fromLatin1("enabled");
     const QString ImTagSelectedText          = QString::fromLatin1("selectedtext");
     const QString ImTagAlways                = QString::fromLatin1("always");
     const QString ImTagLeft                  = QString::fromLatin1("left");
     const QString ImTagRight                 = QString::fromLatin1("right");
+    const QString ImTagCenter                = QString::fromLatin1("center");
     const QString ImTagSendKeySequence       = QString::fromLatin1("sendkeysequence");
     const QString ImTagSendString            = QString::fromLatin1("sendstring");
     const QString ImTagSendCommand           = QString::fromLatin1("sendcommand");
@@ -75,6 +76,10 @@
     const QString ImTagVisible               = QString::fromLatin1("visible");
     const QString ImTagVisibleDefValue       = QString::fromLatin1("true");
     const QString ImTagRefuse                = QString::fromLatin1("refuse");
+    const QString ImTagItems                 = QString::fromLatin1("items");
+    const QString ImTagItem                  = QString::fromLatin1("item");
+    const QString ImTagHighlighted           = QString::fromLatin1("highlighted");
+    const QString ImTagInputMethod           = QString::fromLatin1("input-method");
 
     const QChar NameSeparator(',');
 }
@@ -91,15 +96,14 @@
     int version;
 
     QSharedPointer<MToolbarLayout> currentLayout;
-    QSharedPointer<MToolbarRow>    currentRow;
     QSharedPointer<MToolbarItem>   currentItem;
 };
 
 struct MTBParseStructure {
-    MTBParseStructure(const QString &name, MToolbarData::TagParser p);
+    MTBParseStructure(const QString &name, MToolbarDataPrivate::TagParser p);
 
     QString tagName;
-    MToolbarData::TagParser parser;
+    MToolbarDataPrivate::TagParser parser;
 };
 
 MTBParseParameters::MTBParseParameters()
@@ -108,214 +112,47 @@
 {
 }
 
-MTBParseStructure::MTBParseStructure(const QString &name, MToolbarData::TagParser p)
+MTBParseStructure::MTBParseStructure(const QString &name, MToolbarDataPrivate::TagParser p)
     : tagName(name),
       parser(p)
 {
 }
 
-MToolbarDataPrivate::MToolbarDataPrivate()
-    : locked(false),
-      custom(false),
+MToolbarDataPrivate::MToolbarDataPrivate(MToolbarData *owner)
+    : q_ptr(owner),
       visible(true)
 {
 }
 
-// Actual class implementation
-
-MToolbarData::MToolbarData()
-    : d_ptr(new MToolbarDataPrivate)
-{
-}
-
-MToolbarData::~MToolbarData()
-{
-    delete d_ptr;
-}
-
-bool MToolbarData::loadNokiaToolbarXml(const QString &fileName)
-{
-    Q_D(MToolbarData);
-    QString absoluteFileName = fileName;
-    QFileInfo info(absoluteFileName);
-    if (info.isRelative())
-        absoluteFileName = ToolbarConfigurationPath + info.fileName();
-    if (!QFile::exists(absoluteFileName)) {
-        qDebug() << __PRETTY_FUNCTION__ << "can not find file:" << absoluteFileName;
-        return false;
-    }
-
-    MTBParseParameters params;
-    params.fileName = absoluteFileName;
-    d->toolbarFileName = absoluteFileName;
-    bool valid = true;
-    QFile infile(absoluteFileName);
-    QString errorStr;
-    int errorLine;
-    int errorColumn;
-    QDomDocument doc;
-    if (!infile.open(QIODevice::ReadOnly)) {
-        qWarning() << __PRETTY_FUNCTION__ << "Unable to open toolbar xml file" << absoluteFileName;
-        return false;
-    }
-    if (!doc.setContent((QIODevice *)(&infile), true, &errorStr, &errorLine,
-                        &errorColumn)) {
-        qWarning() << __PRETTY_FUNCTION__ << "can not parse xml" << absoluteFileName
-                   << "error line:" << errorLine << ", column:" << errorColumn;
-        infile.close();
-        return false;
-    }
-
-    const QDomElement root = doc.documentElement();
-    //check the root tag
-    if (!root.isNull() && root.tagName() != ImTagToolbar) {
-        qWarning() << __PRETTY_FUNCTION__
-                   << "wrong format xml" << absoluteFileName << "for virtual keyboard tool bar";
-        valid = false;
-    } else {
-        parseTagToolbar(root, params);
-        valid = params.validTag;
-    }
-
-    infile.close();
-
-    return valid;
-}
-
-QList<QSharedPointer<MToolbarItem> > MToolbarData::items() const
+QSharedPointer<MToolbarItem> MToolbarDataPrivate::getOrCreateItemByName(const QString &name,
+                                                                        MInputMethod::ItemType type)
 {
-    Q_D(const MToolbarData);
-
-    return d->items.values();
-}
-
-QSharedPointer<const MToolbarLayout> MToolbarData::layout(M::Orientation orientation) const
-{
-    Q_D(const MToolbarData);
-
-    switch(orientation) {
-    case M::Landscape:
-        return d->layoutLandscape;
-    case M::Portrait:
-        if (d->layoutPortrait) {
-            return d->layoutPortrait;
-        }
-        return d->layoutLandscape;
-    default:
-        return QSharedPointer<const MToolbarLayout>();
-    }
-}
-
-bool MToolbarData::locked() const
-{
-    Q_D(const MToolbarData);
-
-    return d->locked;
-}
-
-bool MToolbarData::isCustom() const
-{
-    Q_D(const MToolbarData);
-
-    return d->custom;
-}
-
-bool MToolbarData::isVisible() const
-{
-    Q_D(const MToolbarData);
-
-    return d->visible;
-}
-
-bool MToolbarData::append(const QSharedPointer<MToolbarRow> &row,
-                          const QSharedPointer<MToolbarItem> &item)
-{
-    Q_D(MToolbarData);
-
-    if ((!layout(M::Landscape) || !layout(M::Landscape)->rows().contains(row))
-       && (!layout(M::Portrait) || !layout(M::Portrait)->rows().contains(row))) {
-        return false;
-    }
-
-    if (this->item(item->name())) {
-        return false;
-    }
-
-    row->append(item);
-    d->items.insert(item->name(), item);
-
-    return true;
-}
-
-QSharedPointer<MToolbarItem> MToolbarData::item(const QString &name) const
-{
-    Q_D(const MToolbarData);
-
-    return d->items.value(name);
-}
-
-void MToolbarData::sort()
-{
-    Q_D(MToolbarData);
-
-    sort(d->layoutLandscape);
-    sort(d->layoutPortrait);
-}
-
-void MToolbarData::sort(const QSharedPointer<MToolbarLayout> &layout)
-{
-    if (!layout) {
-        return;
-    }
-
-    foreach (QSharedPointer<MToolbarRow> row, layout->rows())
-    {
-        row->sort();
-    }
-}
-
-QStringList MToolbarData::refusedNames() const
-{
-    Q_D(const MToolbarData);
-
-    return d->refusedNames;
-}
-
-void MToolbarData::setCustom(bool custom)
-{
-    Q_D(MToolbarData);
-
-    d->custom = custom;
-}
-
-QSharedPointer<MToolbarItem> MToolbarData::getOrCreateItemByName(const QString &name,
-                                                                 MInputMethod::ItemType type)
-{
-    Q_D(MToolbarData);
-    MToolbarDataPrivate::Items::iterator iterator(d->items.find(name));
+    Items::iterator iterator(items.find(name));
     QSharedPointer<MToolbarItem> result;
 
-    if (iterator != d->items.end()) {
+    if (iterator != items.end()) {
         result = *iterator;
     } else {
         result = QSharedPointer<MToolbarItem>(new MToolbarItem(name, type));
-        d->items.insert(name, result);
+        items.insert(name, result);
     }
 
     return result;
 }
 
-Qt::Alignment MToolbarData::alignment(const QString &alignmentString)
+Qt::Alignment MToolbarDataPrivate::alignment(const QString &alignmentString)
 {
-    Qt::Alignment align = Qt::AlignRight;
+    Qt::Alignment align = Qt::AlignCenter;
     if (alignmentString == ImTagLeft)
         align = Qt::AlignLeft;
     else if (alignmentString == ImTagRight)
         align = Qt::AlignRight;
+    else if (alignmentString == ImTagCenter)
+        align = Qt::AlignCenter;
     return align;
 }
 
-M::Orientation MToolbarData::orientation(const QString &orientationString)
+M::Orientation MToolbarDataPrivate::orientation(const QString &orientationString)
 {
     M::Orientation orient = M::Portrait;
     if (orientationString == ImTagOrientationLandscape)
@@ -323,7 +160,7 @@
     return orient;
 }
 
-MInputMethod::VisibleType MToolbarData::visibleType(const QString &visibleTypeString)
+MInputMethod::VisibleType MToolbarDataPrivate::visibleType(const QString &visibleTypeString)
 {
     MInputMethod::VisibleType type = MInputMethod::VisibleUndefined;
     if (visibleTypeString == ImTagSelectedText)
@@ -333,7 +170,7 @@
     return type;
 }
 
-void MToolbarData::parseAttribute(SetString setter, const QDomElement &element,
+void MToolbarDataPrivate::parseAttribute(SetString setter, const QDomElement &element,
                                   const QString &attributeName, const MTBParseParameters &params)
 {
     if (element.hasAttribute(attributeName)) {
@@ -342,7 +179,7 @@
     }
 }
 
-void MToolbarData::parseAttribute(SetVisibleType setter, const QDomElement &element,
+void MToolbarDataPrivate::parseAttribute(SetVisibleType setter, const QDomElement &element,
                                   const QString &attributeName, const MTBParseParameters &params)
 {
     if (element.hasAttribute(attributeName)) {
@@ -351,7 +188,7 @@
     }
 }
 
-void MToolbarData::parseAttribute(SetBool setter, const QDomElement &element,
+void MToolbarDataPrivate::parseAttribute(SetBool setter, const QDomElement &element,
                                   const QString &attributeName, const MTBParseParameters &params)
 {
     if (element.hasAttribute(attributeName)) {
@@ -361,7 +198,7 @@
     }
 }
 
-void MToolbarData::parseAttribute(SetAlignment setter, const QDomElement &element,
+void MToolbarDataPrivate::parseAttribute(SetAlignment setter, const QDomElement &element,
                                   const QString &attributeName, const MTBParseParameters &params)
 {
     if (element.hasAttribute(attributeName)) {
@@ -370,7 +207,7 @@
     }
 }
 
-void MToolbarData::parseAttribute(SetInt setter, const QDomElement &element,
+void MToolbarDataPrivate::parseAttribute(SetInt setter, const QDomElement &element,
                                   const QString &attributeName, const MTBParseParameters &params)
 {
     if (element.hasAttribute(attributeName)) {
@@ -379,31 +216,46 @@
     }
 }
 
-void MToolbarData::parseTagToolbar(const QDomElement &element, MTBParseParameters &params)
+void MToolbarDataPrivate::parseTagInputMethod(const QDomElement &element, MTBParseParameters &params)
 {
-    Q_D(MToolbarData);
-
-    d->locked = (element.attribute(ImTagLocked, ImTagLockedDefValue) == "true") ? true : false;
-    d->visible = (element.attribute(ImTagVisible, ImTagVisibleDefValue) == "true") ? true : false;
-    d->refusedNames = element.attribute(ImTagRefuse).split(NameSeparator);
+    visible = (element.attribute(ImTagVisible, ImTagVisibleDefValue) == "true") ? true : false;
+    if (element.hasAttribute(ImTagRefuse)) {
+        refusedNames = element.attribute(ImTagRefuse).split(NameSeparator);
+    }
     params.version = element.attribute(ImTagVersion, ImTagVersionDefValue).toInt();
 
+    const MTBParseStructure parser(ImTagToolbar, &MToolbarDataPrivate::parseTagToolbar);
+    parseChildren(element, params, &parser);
+}
+
+void MToolbarDataPrivate::parseTagToolbar(const QDomElement &element, MTBParseParameters &params)
+{
+    if (element.hasAttribute(ImTagVisible)) {
+        visible = (element.attribute(ImTagVisible) == "true") ? true : false;
+    }
+    if (element.hasAttribute(ImTagRefuse)) {
+        refusedNames = element.attribute(ImTagRefuse).split(NameSeparator);
+    }
+    if (element.hasAttribute(ImTagVersion)) {
+        params.version = element.attribute(ImTagVersion).toInt();
+    }
+
     if (params.version == 1) {
-        const MTBParseStructure parser(ImTagLayout, &MToolbarData::parseTagLayout);
-        parseChildren(element, params, &parser);
+        const MTBParseStructure parsers[2] = {
+            MTBParseStructure(ImTagLayout, &MToolbarDataPrivate::parseTagLayout),
+            MTBParseStructure(ImTagItems,  &MToolbarDataPrivate::parseTagItems),
+        };
+
+        parseChildren(element, params, parsers, 2);
     } else if (params.version == 0) {
         QSharedPointer<MToolbarLayout> layout(new MToolbarLayout());
-        QSharedPointer<MToolbarRow> row(new MToolbarRow);
 
-        d->layoutLandscape = layout;
+        layoutLandscape = layout;
         params.currentLayout = layout;
 
-        params.currentLayout->append(row);
-        params.currentRow = row;
-
         const MTBParseStructure parsers[2] = {
-            MTBParseStructure(ImTagButton, &MToolbarData::parseTagButton),
-            MTBParseStructure(ImTagLabel,  &MToolbarData::parseTagLabel),
+            MTBParseStructure(ImTagButton, &MToolbarDataPrivate::parseTagButton),
+            MTBParseStructure(ImTagLabel,  &MToolbarDataPrivate::parseTagLabel),
         };
 
         parseChildren(element, params, parsers, 2);
@@ -413,12 +265,12 @@
     }
 }
 
-void MToolbarData::parseTagLayout(const QDomElement &element, MTBParseParameters &params)
+void MToolbarDataPrivate::parseTagLayout(const QDomElement &element, MTBParseParameters &params)
 {
-    Q_D(MToolbarData);
+    Q_Q(MToolbarData);
     const QString attribute = element.attribute(ImTagOrientation, ImTagOrientationDefValue);
     const M::Orientation orientationData = orientation(attribute);
-    QSharedPointer<MToolbarLayout> layout = this->layout(orientationData).constCast<MToolbarLayout>();
+    QSharedPointer<MToolbarLayout> layout = q->layout(orientationData).constCast<MToolbarLayout>();
 
     if (layout && layout->orientation() == orientationData) {
         qWarning() << __PRETTY_FUNCTION__ << "Duplicated layout for" << attribute;
@@ -429,37 +281,37 @@
     layout = QSharedPointer<MToolbarLayout>(new MToolbarLayout(orientationData));
     switch (orientationData) {
     case M::Landscape:
-        d->layoutLandscape = layout;
+        layoutLandscape = layout;
         break;
     case M::Portrait:
-        d->layoutPortrait = layout;
+        layoutPortrait = layout;
         break;
     default:
         Q_ASSERT(0); // should never happen
     }
     params.currentLayout = layout;
 
-    const MTBParseStructure parser(ImTagRow, &MToolbarData::parseTagRow);
+    const MTBParseStructure parsers[2] = {
+        MTBParseStructure(ImTagItem, &MToolbarDataPrivate::parseTagItem),
+        MTBParseStructure(ImTagRow,  &MToolbarDataPrivate::parseTagRow),
+    };
 
-    parseChildren(element, params, &parser);
+    parseChildren(element, params, parsers, 2);
 }
 
-void MToolbarData::parseTagRow(const QDomElement &element, MTBParseParameters &params)
+void MToolbarDataPrivate::parseTagRow(const QDomElement &element, MTBParseParameters &params)
 {
-    QSharedPointer<MToolbarRow> row(new MToolbarRow);
-
-    params.currentLayout->append(row);
-    params.currentRow = row;
+    qWarning() << __PRETTY_FUNCTION__ << "XML tag 'row' is deprecated and will be removed soon. Do not use it.";
 
     const MTBParseStructure parsers[2] = {
-        MTBParseStructure(ImTagButton, &MToolbarData::parseTagButton),
-        MTBParseStructure(ImTagLabel,  &MToolbarData::parseTagLabel),
+        MTBParseStructure(ImTagButton, &MToolbarDataPrivate::parseTagButton),
+        MTBParseStructure(ImTagLabel,  &MToolbarDataPrivate::parseTagLabel),
     };
 
     parseChildren(element, params, parsers, 2);
 }
 
-void MToolbarData::parseTagButton(const QDomElement &element, MTBParseParameters &params)
+void MToolbarDataPrivate::parseTagButton(const QDomElement &element, MTBParseParameters &params)
 {
     const QString name = element.attribute(ImTagName);
 
@@ -473,20 +325,23 @@
         return;
     }
 
-    setCustom(true);
-    params.currentRow->append(item);
+    if (params.currentLayout) {
+        params.currentLayout->append(item);
+    }
+
     params.currentItem = item;
-    parseAttribute(&MToolbarItem::setText,      element, ImTagText,      params);
-    parseAttribute(&MToolbarItem::setGroup,     element, ImTagGroup,     params);
-    parseAttribute(&MToolbarItem::setShowOn,    element, ImTagShowOn,    params);
-    parseAttribute(&MToolbarItem::setHideOn,    element, ImTagHideOn,    params);
-    parseAttribute(&MToolbarItem::setAlignment, element, ImTagAlignment, params);
-    parseAttribute(&MToolbarItem::setTextId,    element, ImTagTextId,    params);
-    parseAttribute(&MToolbarItem::setIcon,      element, ImTagIcon,      params);
-    parseAttribute(&MToolbarItem::setIconId,    element, ImTagIconId,    params);
-    parseAttribute(&MToolbarItem::setToggle,    element, ImTagToggle,    params);
-    parseAttribute(&MToolbarItem::setPressed,   element, ImTagPressed,   params);
-    parseAttribute(&MToolbarItem::setPriority,  element, ImTagPriority,  params);
+    parseAttribute(&MToolbarItem::setText,        element, ImTagText,        params);
+    parseAttribute(&MToolbarItem::setGroup,       element, ImTagGroup,       params);
+    parseAttribute(&MToolbarItem::setShowOn,      element, ImTagShowOn,      params);
+    parseAttribute(&MToolbarItem::setHideOn,      element, ImTagHideOn,      params);
+    parseAttribute(&MToolbarItem::setAlignment,   element, ImTagAlignment,   params);
+    parseAttribute(&MToolbarItem::setTextId,      element, ImTagTextId,      params);
+    parseAttribute(&MToolbarItem::setIcon,        element, ImTagIcon,        params);
+    parseAttribute(&MToolbarItem::setIconId,      element, ImTagIconId,      params);
+    parseAttribute(&MToolbarItem::setToggle,      element, ImTagToggle,      params);
+    parseAttribute(&MToolbarItem::setPressed,     element, ImTagPressed,     params);
+    parseAttribute(&MToolbarItem::setHighlighted, element, ImTagHighlighted, params);
+    parseAttribute(&MToolbarItem::setEnabled,   element, ImTagEnabled,   params);
 
     if (element.hasAttribute(ImTagSize)) {
         bool ok;
@@ -504,7 +359,7 @@
     tmpItem->clearActions();
     params.currentItem = tmpItem;
 
-    const MTBParseStructure parser(ImTagActions, &MToolbarData::parseTagActions);
+    const MTBParseStructure parser(ImTagActions, &MToolbarDataPrivate::parseTagActions);
     parseChildren(element, params, &parser);
 
     if (!tmpItem->actions().isEmpty()) {
@@ -512,7 +367,7 @@
     }
 }
 
-void MToolbarData::parseTagLabel(const QDomElement &element, MTBParseParameters &params)
+void MToolbarDataPrivate::parseTagLabel(const QDomElement &element, MTBParseParameters &params)
 {
     const QString name = element.attribute(ImTagName);
     QSharedPointer<MToolbarItem> label = getOrCreateItemByName(name, MInputMethod::ItemLabel);
@@ -521,12 +376,13 @@
         return;
     }
 
-    setCustom(true);
-    params.currentRow->append(label);
+    if (params.currentLayout) {
+        params.currentLayout->append(label);
+    }
+
     params.currentItem = label;
 
     parseAttribute(&MToolbarItem::setGroup, element, ImTagGroup, params);
-    parseAttribute(&MToolbarItem::setPriority, element, ImTagPriority, params);
     parseAttribute(&MToolbarItem::setShowOn, element, ImTagShowOn, params);
     parseAttribute(&MToolbarItem::setHideOn, element, ImTagHideOn, params);
     parseAttribute(&MToolbarItem::setAlignment, element, ImTagAlignment, params);
@@ -534,92 +390,112 @@
     parseAttribute(&MToolbarItem::setTextId, element, ImTagTextId, params);
 }
 
-void MToolbarData::parseTagActions(const QDomElement &element, MTBParseParameters &params)
+void MToolbarDataPrivate::parseTagActions(const QDomElement &element, MTBParseParameters &params)
 {
     if (!params.currentItem || (params.currentItem->type() != MInputMethod::ItemButton)) {
         return;
     }
 
     const MTBParseStructure parsers[] = {
-        MTBParseStructure(ImTagSendKeySequence, &MToolbarData::parseTagSendKeySequence),
-        MTBParseStructure(ImTagSendString,      &MToolbarData::parseTagSendString),
-        MTBParseStructure(ImTagSendCommand,     &MToolbarData::parseTagSendCommand),
-        MTBParseStructure(ImTagCopy,            &MToolbarData::parseTagCopy),
-        MTBParseStructure(ImTagPaste,           &MToolbarData::parseTagPaste),
-        MTBParseStructure(ImTagShowGroup,       &MToolbarData::parseTagShowGroup),
-        MTBParseStructure(ImTagHideGroup,       &MToolbarData::parseTagHideGroup),
-        MTBParseStructure(ImTagCopyPaste,       &MToolbarData::parseTagCopyPaste),
-        MTBParseStructure(ImTagClose,           &MToolbarData::parseTagClose),
+        MTBParseStructure(ImTagSendKeySequence, &MToolbarDataPrivate::parseTagSendKeySequence),
+        MTBParseStructure(ImTagSendString,      &MToolbarDataPrivate::parseTagSendString),
+        MTBParseStructure(ImTagSendCommand,     &MToolbarDataPrivate::parseTagSendCommand),
+        MTBParseStructure(ImTagCopy,            &MToolbarDataPrivate::parseTagCopy),
+        MTBParseStructure(ImTagPaste,           &MToolbarDataPrivate::parseTagPaste),
+        MTBParseStructure(ImTagShowGroup,       &MToolbarDataPrivate::parseTagShowGroup),
+        MTBParseStructure(ImTagHideGroup,       &MToolbarDataPrivate::parseTagHideGroup),
+        MTBParseStructure(ImTagCopyPaste,       &MToolbarDataPrivate::parseTagCopyPaste),
+        MTBParseStructure(ImTagClose,           &MToolbarDataPrivate::parseTagClose),
     };
 
     parseChildren(element, params, parsers, sizeof(parsers) / sizeof(parsers[0]));
 }
 
-void MToolbarData::parseTagSendKeySequence(const QDomElement &element, MTBParseParameters &params)
+void MToolbarDataPrivate::parseTagSendKeySequence(const QDomElement &element, MTBParseParameters &params)
 {
     QSharedPointer<MToolbarItemAction> action(new MToolbarItemAction(MInputMethod::ActionSendKeySequence));
     action->setKeys(element.attribute(ImTagKeySequence));
     params.currentItem->append(action);
 }
 
-void MToolbarData::parseTagSendString(const QDomElement &element, MTBParseParameters &params)
+void MToolbarDataPrivate::parseTagSendString(const QDomElement &element, MTBParseParameters &params)
 {
     QSharedPointer<MToolbarItemAction> action(new MToolbarItemAction(MInputMethod::ActionSendString));
     action->setText(element.attribute(ImTagString));
     params.currentItem->append(action);
 }
 
-void MToolbarData::parseTagSendCommand(const QDomElement &element, MTBParseParameters &params)
+void MToolbarDataPrivate::parseTagSendCommand(const QDomElement &element, MTBParseParameters &params)
 {
     QSharedPointer<MToolbarItemAction> action(new MToolbarItemAction(MInputMethod::ActionSendCommand));
     action->setCommand(element.attribute(ImTagCommand));
     params.currentItem->append(action);
 }
 
-void MToolbarData::parseTagCopy(const QDomElement &element, MTBParseParameters &params)
+void MToolbarDataPrivate::parseTagCopy(const QDomElement &element, MTBParseParameters &params)
 {
     Q_UNUSED(element);
     QSharedPointer<MToolbarItemAction> action(new MToolbarItemAction(MInputMethod::ActionCopy));
     params.currentItem->append(action);
 }
 
-void MToolbarData::parseTagPaste(const QDomElement &element, MTBParseParameters &params)
+void MToolbarDataPrivate::parseTagPaste(const QDomElement &element, MTBParseParameters &params)
 {
     Q_UNUSED(element);
     QSharedPointer<MToolbarItemAction> action(new MToolbarItemAction(MInputMethod::ActionPaste));
     params.currentItem->append(action);
 }
 
-void MToolbarData::parseTagCopyPaste(const QDomElement &element, MTBParseParameters &params)
+void MToolbarDataPrivate::parseTagCopyPaste(const QDomElement &element, MTBParseParameters &params)
 {
     Q_UNUSED(element);
     QSharedPointer<MToolbarItemAction> action(new MToolbarItemAction(MInputMethod::ActionCopyPaste));
     params.currentItem->append(action);
 }
 
-void MToolbarData::parseTagClose(const QDomElement &element, MTBParseParameters &params)
+void MToolbarDataPrivate::parseTagClose(const QDomElement &element, MTBParseParameters &params)
 {
     Q_UNUSED(element);
     QSharedPointer<MToolbarItemAction> action(new MToolbarItemAction(MInputMethod::ActionClose));
     params.currentItem->append(action);
 }
 
-void MToolbarData::parseTagShowGroup(const QDomElement &element, MTBParseParameters &params)
+void MToolbarDataPrivate::parseTagShowGroup(const QDomElement &element, MTBParseParameters &params)
 {
     QSharedPointer<MToolbarItemAction> action(new MToolbarItemAction(MInputMethod::ActionShowGroup));
     action->setGroup(element.attribute(ImTagGroup));
     params.currentItem->append(action);
 }
 
-void MToolbarData::parseTagHideGroup(const QDomElement &element, MTBParseParameters &params)
+void MToolbarDataPrivate::parseTagHideGroup(const QDomElement &element, MTBParseParameters &params)
 {
     QSharedPointer<MToolbarItemAction> action(new MToolbarItemAction(MInputMethod::ActionHideGroup));
     action->setGroup(element.attribute(ImTagGroup));
     params.currentItem->append(action);
 }
 
-void MToolbarData::parseChildren(const QDomElement &element, MTBParseParameters &params,
-                                 const MTBParseStructure *parserList, int parserCount)
+void MToolbarDataPrivate::parseTagItems(const QDomElement &element, MTBParseParameters &params)
+{
+    const MTBParseStructure parsers[2] = {
+        MTBParseStructure(ImTagButton, &MToolbarDataPrivate::parseTagButton),
+        MTBParseStructure(ImTagLabel,  &MToolbarDataPrivate::parseTagLabel),
+    };
+
+    parseChildren(element, params, parsers, 2);
+}
+
+void MToolbarDataPrivate::parseTagItem(const QDomElement &element, MTBParseParameters &params)
+{
+    const QString name = element.attribute(ImTagName);
+    MToolbarDataPrivate::Items::iterator iterator(items.find(name));
+
+    if (iterator != items.end() && *iterator) {
+        params.currentLayout->append(*iterator);
+    }
+}
+
+void MToolbarDataPrivate::parseChildren(const QDomElement &element, MTBParseParameters &params,
+                                        const MTBParseStructure *parserList, int parserCount)
 {
     Q_ASSERT(parserCount > 0);
 
@@ -627,21 +503,161 @@
             child = child.nextSibling()) {
         if (child.isElement()) {
             const QDomElement childElement = child.toElement();
-            bool found = false;
-            for (int i = 0; i < parserCount; ++i) {
-                if (childElement.tagName() == parserList[i].tagName) {
-                    (this->*(parserList[i].parser))(childElement, params);
-                    found = true;
-                    break;
-                }
-            }
-            if (!found) {
-                qWarning() << __PRETTY_FUNCTION__ << "Unexpected tag" << childElement.tagName() << "on line"
-                           << childElement.lineNumber() << "column" << childElement.columnNumber()
-                           << "in toolbar file" << params.fileName;
-                params.validTag = false;
-            }
+            parseDomElement(childElement, params, parserList, parserCount);
         }
     }
 }
 
+void MToolbarDataPrivate::parseDomElement(const QDomElement &element, MTBParseParameters &params,
+                                          const MTBParseStructure *parserList, int parserCount)
+{
+    bool found = false;
+    for (int i = 0; i < parserCount; ++i) {
+        if (element.tagName() == parserList[i].tagName) {
+            (this->*(parserList[i].parser))(element, params);
+            found = true;
+            break;
+        }
+    }
+    if (!found) {
+        qWarning() << __PRETTY_FUNCTION__ << "Unexpected tag" << element.tagName() << "on line"
+            << element.lineNumber() << "column" << element.columnNumber()
+            << "in toolbar file" << params.fileName;
+        params.validTag = false;
+    }
+}
+
+
+// Actual class implementation
+
+MToolbarData::MToolbarData()
+    : d_ptr(new MToolbarDataPrivate(this))
+{
+}
+
+MToolbarData::~MToolbarData()
+{
+    delete d_ptr;
+}
+
+bool MToolbarData::loadToolbarXml(const QString &fileName)
+{
+    Q_D(MToolbarData);
+    QString absoluteFileName = fileName;
+    QFileInfo info(absoluteFileName);
+    if (info.isRelative())
+        absoluteFileName = ToolbarConfigurationPath + info.fileName();
+    if (!QFile::exists(absoluteFileName)) {
+        qDebug() << __PRETTY_FUNCTION__ << "can not find file:" << absoluteFileName;
+        return false;
+    }
+
+    MTBParseParameters params;
+    params.fileName = absoluteFileName;
+    d->toolbarFileName = absoluteFileName;
+    bool valid = true;
+    QFile infile(absoluteFileName);
+    QString errorStr;
+    int errorLine;
+    int errorColumn;
+    QDomDocument doc;
+    if (!infile.open(QIODevice::ReadOnly)) {
+        qWarning() << __PRETTY_FUNCTION__ << "Unable to open toolbar xml file" << absoluteFileName;
+        return false;
+    }
+    if (!doc.setContent((QIODevice *)(&infile), true, &errorStr, &errorLine,
+                        &errorColumn)) {
+        qWarning() << __PRETTY_FUNCTION__ << "can not parse xml" << absoluteFileName
+                   << "error line:" << errorLine << ", column:" << errorColumn;
+        infile.close();
+        return false;
+    }
+
+    const QDomElement root = doc.documentElement();
+    //check the root tag
+    if (!root.isNull() && root.tagName() != ImTagToolbar && root.tagName() != ImTagInputMethod) {
+        qWarning() << __PRETTY_FUNCTION__
+                   << "wrong format xml" << absoluteFileName << "for virtual keyboard tool bar";
+        valid = false;
+    } else {
+        const MTBParseStructure parsers[2] = {
+            MTBParseStructure(ImTagToolbar,     &MToolbarDataPrivate::parseTagToolbar),
+            MTBParseStructure(ImTagInputMethod, &MToolbarDataPrivate::parseTagInputMethod),
+        };
+
+        d->parseDomElement(root, params, parsers, 2);
+        valid = params.validTag;
+    }
+
+    infile.close();
+
+    return valid;
+}
+
+QList<QSharedPointer<MToolbarItem> > MToolbarData::items() const
+{
+    Q_D(const MToolbarData);
+
+    return d->items.values();
+}
+
+QSharedPointer<const MToolbarLayout> MToolbarData::layout(M::Orientation orientation) const
+{
+    Q_D(const MToolbarData);
+
+    switch(orientation) {
+    case M::Landscape:
+        return d->layoutLandscape;
+    case M::Portrait:
+        if (d->layoutPortrait) {
+            return d->layoutPortrait;
+        }
+        return d->layoutLandscape;
+    default:
+        return QSharedPointer<const MToolbarLayout>();
+    }
+}
+
+bool MToolbarData::isVisible() const
+{
+    Q_D(const MToolbarData);
+
+    return d->visible;
+}
+
+bool MToolbarData::append(const QSharedPointer<MToolbarLayout> &toolbarLayout,
+                          const QSharedPointer<MToolbarItem> &item)
+{
+    Q_D(MToolbarData);
+
+    if (!toolbarLayout) {
+        return false;
+    }
+
+    if (layout(M::Landscape) != toolbarLayout
+       && layout(M::Portrait) != toolbarLayout) {
+        return false;
+    }
+
+    if (toolbarLayout->append(item)) {
+        d->items.insert(item->name(), item);
+        return true;
+    }
+
+    return false;
+}
+
+QSharedPointer<MToolbarItem> MToolbarData::item(const QString &name) const
+{
+    Q_D(const MToolbarData);
+
+    return d->items.value(name);
+}
+
+QStringList MToolbarData::refusedNames() const
+{
+    Q_D(const MToolbarData);
+
+    return d->refusedNames;
+}
+
--- src/mtoolbardata.h
+++ src/mtoolbardata.h
@@ -26,7 +26,6 @@
 #include <MNamespace>
 
 class MToolbarLayout;
-class MToolbarRow;
 class MToolbarItem;
 
 class QDomElement;
@@ -57,10 +56,10 @@
      * \brief Load a custom toolbar's content from \a fileName xml file.
      * \a fileName is the xml file name (with ".xml" postfix). And \a fileName could have absolute path.
      * If no absolute path specified, then it will be taken from the default path
-     * "/usr/share/meegotouch/imtoolbars/".
+     * "/usr/share/meegoimframework/imtoolbars/".
      * \param fileName Name of the xml file which contains the content of a custom toolbar.
      */
-    bool loadNokiaToolbarXml(const QString &fileName);
+    bool loadToolbarXml(const QString &fileName);
 
     //! Return all items in this toolbar
     QList<QSharedPointer<MToolbarItem> > items() const;
@@ -69,160 +68,28 @@
     QSharedPointer<const MToolbarLayout> layout(M::Orientation orientation) const;
 
     /*!
-     * \brief Return true if toolbar is locked, so user can not
-     * close it manually
-     */
-    bool locked() const;
-
-    /*!
-     * \brief Return true if all conditions are met:
-     * 1) toolbar is provided by application,
-     * 2) toolbar contains at least one custom item.
-     */
-    bool isCustom() const;
-
-    /*!
      * \brief Return true if toolbar should be visible.
      */
     bool isVisible() const;
 
 private:
-    //! Append given \a item to the given \a row.
+    //! Append given \a item to the given layout.
+    //! \param toolbarLayout should point to lanscape or portrait layout of this toolbar.
     //! \return Return false if item could not be added.
-    bool append(const QSharedPointer<MToolbarRow> &row, const QSharedPointer<MToolbarItem> &item);
+    //!
+    //! \sa layout(M::Orientation)
+    bool append(const QSharedPointer<MToolbarLayout> &toolbarLayout,
+                const QSharedPointer<MToolbarItem> &item);
 
     //! Returns pointer to item for given \a name
     QSharedPointer<MToolbarItem> item(const QString &name) const;
 
-    //! Sort toolbar items according to their priorities and alignments
-    void sort();
-
-    //! Sort layout items according to their priorities and alignments
-    void sort(const QSharedPointer<MToolbarLayout> &layout);
-
     /*!
      * \brief Return list of standard item names which should
      * not be inserted into this toolbar.
      */
     QStringList refusedNames() const;
 
-    /*!
-     * \brief Defines whether this toolbar is custom or standard.
-     * \param custom Set this parameter to true if toolbar is custom.
-     * \sa isCustom()
-     */
-    void setCustom(bool custom);
-
-    /*!
-     * \brief Return item state associated with the given \a name and \a type.
-     *
-     * If state with specified name does not exist, then it will be added.
-     */
-    QSharedPointer<MToolbarItem> getOrCreateItemByName(const QString &name,
-                                                       MInputMethod::ItemType type);
-
-    /*!
-     * \brief Translate alignmentString to Qt::Alignment.
-     */
-    static Qt::Alignment alignment(const QString &alignmentString);
-
-    /*!
-    * \brief Translate orientationString to M::Orientation.
-    */
-    static M::Orientation orientation(const QString &orientationString);
-
-    /*!
-     * \brief Translate visibleTypeString to ToolbarWidget::VisibleType.
-     */
-    static MInputMethod::VisibleType visibleType(const QString &visibleTypeString);
-
-    typedef void (MToolbarItem::*SetString)(const QString &);
-    /*!
-     * \brief Read value from given \a attributeName of \a element and call given
-     * \a setter for currentItem in \a params
-     *
-     * \a setter is not called if specified attrubute does not exist.
-     */
-    void parseAttribute(SetString setter, const QDomElement &element,
-                        const QString &attributeName, const MTBParseParameters &params);
-
-    typedef void (MToolbarItem::*SetVisibleType)(MInputMethod::VisibleType);
-    //! This overloaded function is added for convinience
-    void parseAttribute(SetVisibleType setter, const QDomElement &element,
-                        const QString &attributeName, const MTBParseParameters &params);
-
-    typedef void (MToolbarItem::*SetBool)(bool);
-    //! This overloaded function is added for convinience
-    void parseAttribute(SetBool setter, const QDomElement &element,
-                        const QString &attributeName, const MTBParseParameters &params);
-
-    typedef void (MToolbarItem::*SetAlignment)(Qt::Alignment);
-    //! This overloaded function is added for convinience
-    void parseAttribute(SetAlignment setter, const QDomElement &element,
-                        const QString &attributeName, const MTBParseParameters &params);
-
-    typedef void (MToolbarItem::*SetInt)(int);
-    //! This overloaded function is added for convinience
-    void parseAttribute(SetInt setter, const QDomElement &element,
-                        const QString &attributeName, const MTBParseParameters &params);
-
-    //! Parse XML tag for toolbar.
-    void parseTagToolbar(const QDomElement &element, MTBParseParameters &params);
-
-    //! Parse XML tag for layout.
-    void parseTagLayout(const QDomElement &element, MTBParseParameters &params);
-
-    //! Parse XML tag for row.
-    void parseTagRow(const QDomElement &element, MTBParseParameters &params);
-
-    //! Parse XML tag for button.
-    void parseTagButton(const QDomElement &element, MTBParseParameters &params);
-
-    //! Parse XML tag for label.
-    void parseTagLabel(const QDomElement &element, MTBParseParameters &params);
-
-    //! Parse XML tag for action.
-    void parseTagActions(const QDomElement &element, MTBParseParameters &params);
-
-    //! Parse XML tag for SendKeySequence.
-    void parseTagSendKeySequence(const QDomElement &element, MTBParseParameters &params);
-
-    //! Parse XML tag for SendString
-    void parseTagSendString(const QDomElement &element, MTBParseParameters &params);
-
-    //! Parse XML tag for SendCommand
-    void parseTagSendCommand(const QDomElement &element, MTBParseParameters &params);
-
-    //! Parse XML tag for Copy
-    void parseTagCopy(const QDomElement &element, MTBParseParameters &params);
-
-    //! Parse XML tag for Paste
-    void parseTagPaste(const QDomElement &element, MTBParseParameters &params);
-
-    //! Parse XML tag for CopyPaste
-    void parseTagCopyPaste(const QDomElement &element, MTBParseParameters &params);
-
-    //! Parse XML tag for Close
-    void parseTagClose(const QDomElement &element, MTBParseParameters &params);
-
-    //! Parse XML tag for ShowGroup
-    void parseTagShowGroup(const QDomElement &element, MTBParseParameters &params);
-
-    //! Parse XML tag for HideGroup
-    void parseTagHideGroup(const QDomElement &element, MTBParseParameters &params);
-
-    //! Type of tag parser methods
-    typedef void (MToolbarData::*TagParser)(const QDomElement &, MTBParseParameters &);
-
-    /*!
-     * \brief Helper method for parsing children of an element
-     * \param element Element whose children are to be parsed
-     * \param params Parsing state
-     * \param parserList, a TBParseStructure array.
-     * \param parserCount, the number of TBParseStructure in the array.
-     */
-    void parseChildren(const QDomElement &element, MTBParseParameters &params,
-                       const MTBParseStructure *parserList, int parserCount = 1);
 protected:
     Q_DECLARE_PRIVATE(MToolbarData)
 
--- src/mtoolbardata_p.h
+++ src/mtoolbardata_p.h
@@ -26,11 +26,147 @@
 
 #include <mtoolbaritem.h>
 
+class MToolbarData;
+
 class MToolbarDataPrivate
 {
 public:
+    Q_DECLARE_PUBLIC(MToolbarData)
+
     //! Construct new instance.
-    MToolbarDataPrivate();
+    explicit MToolbarDataPrivate(MToolbarData *owner);
+
+    /*!
+     * \brief Return item state associated with the given \a name and \a type.
+     *
+     * If state with specified name does not exist, then it will be added.
+     */
+    QSharedPointer<MToolbarItem> getOrCreateItemByName(const QString &name,
+                                                       MInputMethod::ItemType type);
+
+    /*!
+     * \brief Translate alignmentString to Qt::Alignment.
+     */
+    static Qt::Alignment alignment(const QString &alignmentString);
+
+    /*!
+    * \brief Translate orientationString to M::Orientation.
+    */
+    static M::Orientation orientation(const QString &orientationString);
+
+    /*!
+     * \brief Translate visibleTypeString to ToolbarWidget::VisibleType.
+     */
+    static MInputMethod::VisibleType visibleType(const QString &visibleTypeString);
+
+    typedef void (MToolbarItem::*SetString)(const QString &);
+    /*!
+     * \brief Read value from given \a attributeName of \a element and call given
+     * \a setter for currentItem in \a params
+     *
+     * \a setter is not called if specified attrubute does not exist.
+     */
+    void parseAttribute(SetString setter, const QDomElement &element,
+                        const QString &attributeName, const MTBParseParameters &params);
+
+    typedef void (MToolbarItem::*SetVisibleType)(MInputMethod::VisibleType);
+    //! This overloaded function is added for convinience
+    void parseAttribute(SetVisibleType setter, const QDomElement &element,
+                        const QString &attributeName, const MTBParseParameters &params);
+
+    typedef void (MToolbarItem::*SetBool)(bool);
+    //! This overloaded function is added for convinience
+    void parseAttribute(SetBool setter, const QDomElement &element,
+                        const QString &attributeName, const MTBParseParameters &params);
+
+    typedef void (MToolbarItem::*SetAlignment)(Qt::Alignment);
+    //! This overloaded function is added for convinience
+    void parseAttribute(SetAlignment setter, const QDomElement &element,
+                        const QString &attributeName, const MTBParseParameters &params);
+
+    typedef void (MToolbarItem::*SetInt)(int);
+    //! This overloaded function is added for convinience
+    void parseAttribute(SetInt setter, const QDomElement &element,
+                        const QString &attributeName, const MTBParseParameters &params);
+
+    //! Parse XML tag for input method.
+    void parseTagInputMethod(const QDomElement &element, MTBParseParameters &params);
+
+    //! Parse XML tag for toolbar.
+    void parseTagToolbar(const QDomElement &element, MTBParseParameters &params);
+
+    //! Parse XML tag for layout.
+    void parseTagLayout(const QDomElement &element, MTBParseParameters &params);
+
+    //! Parse XML tag for row.
+    void parseTagRow(const QDomElement &element, MTBParseParameters &params);
+
+    //! Parse XML tag for button.
+    void parseTagButton(const QDomElement &element, MTBParseParameters &params);
+
+    //! Parse XML tag for label.
+    void parseTagLabel(const QDomElement &element, MTBParseParameters &params);
+
+    //! Parse XML tag for action.
+    void parseTagActions(const QDomElement &element, MTBParseParameters &params);
+
+    //! Parse XML tag for SendKeySequence.
+    void parseTagSendKeySequence(const QDomElement &element, MTBParseParameters &params);
+
+    //! Parse XML tag for SendString
+    void parseTagSendString(const QDomElement &element, MTBParseParameters &params);
+
+    //! Parse XML tag for SendCommand
+    void parseTagSendCommand(const QDomElement &element, MTBParseParameters &params);
+
+    //! Parse XML tag for Copy
+    void parseTagCopy(const QDomElement &element, MTBParseParameters &params);
+
+    //! Parse XML tag for Paste
+    void parseTagPaste(const QDomElement &element, MTBParseParameters &params);
+
+    //! Parse XML tag for CopyPaste
+    void parseTagCopyPaste(const QDomElement &element, MTBParseParameters &params);
+
+    //! Parse XML tag for Close
+    void parseTagClose(const QDomElement &element, MTBParseParameters &params);
+
+    //! Parse XML tag for ShowGroup
+    void parseTagShowGroup(const QDomElement &element, MTBParseParameters &params);
+
+    //! Parse XML tag for HideGroup
+    void parseTagHideGroup(const QDomElement &element, MTBParseParameters &params);
+
+    //! Parse XML tag for Items
+    void parseTagItems(const QDomElement &element, MTBParseParameters &params);
+
+    //! Parse XML tag for Item
+    void parseTagItem(const QDomElement &element, MTBParseParameters &params);
+
+    //! Type of tag parser methods
+    typedef void (MToolbarDataPrivate::*TagParser)(const QDomElement &, MTBParseParameters &);
+
+    /*!
+     * \brief Helper method for parsing children of an element
+     * \param element Element whose children are to be parsed
+     * \param params Parsing state
+     * \param parserList, a TBParseStructure array.
+     * \param parserCount, the number of TBParseStructure in the array.
+     */
+    void parseChildren(const QDomElement &element, MTBParseParameters &params,
+                       const MTBParseStructure *parserList, int parserCount = 1);
+
+    /*!
+     * \brief Helper method for parsing DOM element
+     * \param element Element to be parsed
+     * \param params Parsing state
+     * \param parserList, a TBParseStructure array.
+     * \param parserCount, the number of TBParseStructure in the array.
+     */
+    void parseDomElement(const QDomElement &element, MTBParseParameters &params,
+                         const MTBParseStructure *parserList, int parserCount = 1);
+public:
+    MToolbarData *q_ptr;
 
     //! Layout for landscape orientation
     QSharedPointer<MToolbarLayout> layoutLandscape;
@@ -41,14 +177,9 @@
     //! Name of file containing this toolbar
     QString toolbarFileName;
 
-    //! Contains true if toolbar is locked
-    bool locked;
-
     typedef QMap<QString, QSharedPointer<MToolbarItem> > Items;
     Items items;
 
-    bool custom;
-
     bool visible;
 
     QStringList refusedNames;
--- src/mtoolbaritem.cpp
+++ src/mtoolbaritem.cpp
@@ -30,11 +30,14 @@
       priority(0),
       showOn(MInputMethod::VisibleUndefined),
       hideOn(MInputMethod::VisibleUndefined),
-      alignment(Qt::AlignRight),
+      alignment(Qt::AlignCenter),
       visible(true),
       toggle(false),
       pressed(false),
-      size(100)
+      size(100),
+      highlighted(false),
+      custom(true),
+      enabled(true)
 {
 }
 
@@ -54,6 +57,7 @@
     visible   = other.visible;
     toggle    = other.toggle;
     pressed   = other.pressed;
+    enabled   = other.enabled;
     size      = other.size;
     actions   = other.actions;
 }
@@ -266,6 +270,26 @@
     }
 }
 
+void MToolbarItem::setHighlighted(bool highlighted)
+{
+    Q_D(MToolbarItem);
+
+    if (d->highlighted != highlighted) {
+        d->highlighted = highlighted;
+        emit propertyChanged("highlighted");
+    }
+}
+
+void MToolbarItem::setEnabled(bool enabled)
+{
+    Q_D(MToolbarItem);
+
+    if (d->enabled != enabled) {
+        d->enabled = enabled;
+        emit propertyChanged("enabled");
+    }
+}
+
 QString MToolbarItem::icon() const
 {
     Q_D(const MToolbarItem);
@@ -307,13 +331,6 @@
     return d->alignment;
 }
 
-int MToolbarItem::priority() const
-{
-    Q_D(const MToolbarItem);
-
-    return d->priority;
-}
-
 QList<QSharedPointer<const MToolbarItemAction> >
 MToolbarItem::actions() const
 {
@@ -393,18 +410,42 @@
     }
 }
 
-void MToolbarItem::clearActions()
+bool MToolbarItem::highlighted() const
+{
+    Q_D(const MToolbarItem);
+
+    return d->highlighted;
+}
+
+bool MToolbarItem::isCustom() const
+{
+    Q_D(const MToolbarItem);
+
+    return d->custom;
+}
+
+void MToolbarItem::setCustom(bool custom)
 {
     Q_D(MToolbarItem);
 
-    d->actions.clear();
+    if (d->custom != custom) {
+        d->custom = custom;
+        emit propertyChanged("custom");
+    }
 }
 
-void MToolbarItem::setPriority(int priority)
+bool MToolbarItem::enabled() const
+{
+    Q_D(const MToolbarItem);
+
+    return d->enabled;
+}
+
+void MToolbarItem::clearActions()
 {
     Q_D(MToolbarItem);
 
-    d->priority = priority;
+    d->actions.clear();
 }
 
 void MToolbarItem::setAlignment(Qt::Alignment alignment)
--- src/mtoolbaritem.h
+++ src/mtoolbaritem.h
@@ -99,6 +99,7 @@
     Q_PROPERTY(QString icon   READ icon    WRITE setIcon)
     Q_PROPERTY(int size       READ size    WRITE setSize)
     Q_PROPERTY(QString iconId READ iconId  WRITE setIconId)
+    Q_PROPERTY(bool enabled   READ enabled WRITE setEnabled)
 
 public:
     /*!
@@ -183,9 +184,6 @@
 
     Qt::Alignment alignment() const;
 
-    int priority() const;
-
-
     QList<QSharedPointer<const MToolbarItemAction> > actions() const;
 
     QList<QSharedPointer<MToolbarItemAction> > actions();
@@ -206,6 +204,16 @@
 
     void setSize(int size);
 
+    //! Return highlighted state for the item.
+    bool highlighted() const;
+
+    bool isCustom() const;
+
+    void setCustom(bool custom);
+
+    //! Return true if item is enabled; otherwise return false.
+    bool enabled() const;
+
 public slots:
     //! Sets new text for item
     void setText(const QString &text);
@@ -220,6 +228,20 @@
      */
     void setPressed(bool pressed);
 
+    /*!
+     * \brief Set highlighted state for item
+     *
+     * This attribute is applicable for buttons only.
+     */
+    void setHighlighted(bool highlighted);
+
+    /*!
+     * \brief  If \a enabled is true, the item is enabled; otherwise, it is disabled.
+     *
+     * This attribute is applicable for buttons only.
+     */
+    void setEnabled(bool enabled);
+
 signals:
     /*!
      * \brief Emitted when some property is changed
@@ -232,14 +254,6 @@
     void clearActions();
 
     /*!
-     * \brief Set priority for item. Most prioritized items are shown at
-     * borders of the screen.
-     *
-     * Priority could not be changed after toolbar loading.
-     */
-    void setPriority(int priority);
-
-    /*!
      * \brief Set alignment for item.
      *
      * Alignment could not be changed after toolbar loading.
@@ -255,6 +269,7 @@
     MToolbarItemPrivate *const d_ptr;
 
     friend class MToolbarData;
+    friend class MToolbarDataPrivate;
     friend class ParseParameters;
     friend class Ut_MToolbarData;
 };
--- src/mtoolbaritem_p.h
+++ src/mtoolbaritem_p.h
@@ -64,6 +64,16 @@
 
     //! actions when clicking the widget
     QList<QSharedPointer<MToolbarItemAction> > actions;
+
+    bool highlighted;
+
+    //! Contains true if this item is provided by standard toolbar
+    bool custom;
+
+    //! This property holds whether the item is enabled.
+    //!
+    //! An enabled item handles mouse events; a disabled item does not.
+    bool enabled;
 };
 
 #endif
--- src/mtoolbarlayout.cpp
+++ src/mtoolbarlayout.cpp
@@ -29,30 +29,23 @@
     delete d_ptr;
 }
 
-void MToolbarLayout::append(const QSharedPointer<MToolbarRow> &row)
+bool MToolbarLayout::append(const QSharedPointer<MToolbarItem> &item)
 {
     Q_D(MToolbarLayout);
 
-    d->rows.append(row);
-}
-
-QList<QSharedPointer<const MToolbarRow> > MToolbarLayout::rows() const
-{
-    Q_D(const MToolbarLayout);
-    QList<QSharedPointer<const MToolbarRow> > result;
-
-    foreach (const QSharedPointer<const MToolbarRow> row, d->rows) {
-        result.append(row);
+    if (d->items.contains(item)) {
+        return false;
     }
 
-    return result;
+    d->items.append(item);
+    return true;
 }
 
-QList<QSharedPointer<MToolbarRow> > MToolbarLayout::rows()
+QList<QSharedPointer<MToolbarItem> > MToolbarLayout::items() const
 {
-    Q_D(MToolbarLayout);
+    Q_D(const MToolbarLayout);
 
-    return d->rows;
+    return d->items;
 }
 
 M::Orientation MToolbarLayout::orientation() const
--- src/mtoolbarlayout.h
+++ src/mtoolbarlayout.h
@@ -19,11 +19,11 @@
 #ifndef MTOOLBARLAYOUT_H
 #define MTOOLBARLAYOUT_H
 
-//#include <QObject>
 #include <QList>
 #include <QSharedPointer>
+#include <MNamespace>
 
-#include "mtoolbarrow.h"
+#include <mtoolbaritem.h>
 
 class MToolbarLayoutPrivate;
 
@@ -39,13 +39,10 @@
     virtual ~MToolbarLayout();
 
     //! Append row to layout
-    void append(const QSharedPointer<MToolbarRow> &row);
+    bool append(const QSharedPointer<MToolbarItem> &item);
 
     //! Return all items contained by this row
-    QList<QSharedPointer<const MToolbarRow> > rows() const;
-
-    //! Return all items contained by this row
-    QList<QSharedPointer<MToolbarRow> > rows();
+    QList<QSharedPointer<MToolbarItem> > items() const;
 
     //! Return layout's orientation
     M::Orientation orientation() const;
--- src/mtoolbarlayout_p.h
+++ src/mtoolbarlayout_p.h
@@ -27,8 +27,8 @@
 class MToolbarLayoutPrivate
 {
 public:
-    //! Rows contained by this layout
-    QList<QSharedPointer<MToolbarRow> > rows;
+    //! Items contained by this layout.
+    QList<QSharedPointer<MToolbarItem> > items;
 
     //! Orientation
     M::Orientation orientation;
--- src/mtoolbarmanager.cpp
+++ src/mtoolbarmanager.cpp
@@ -24,15 +24,19 @@
 #include <QDebug>
 
 namespace {
-    const QString StandardToolbar = QString::fromLatin1("/usr/share/meegotouch/imtoolbars/imframework/standard.xml");
+    const QString StandardToolbar = QString::fromLatin1("/usr/share/meegoimframework/imtoolbars/standard.xml");
+    const char * const PreferredDomainSettingName("/meegotouch/inputmethods/preferred_domain");
+    const char * const DomainItemName("_domain");
 }
 
 MToolbarManager *MToolbarManager::toolbarMgrInstance = 0;
 
 MToolbarManager::MToolbarManager()
-    : copyPasteStatus(MInputMethod::InputMethodNoCopyPaste)
+    : copyPasteStatus(MInputMethod::InputMethodNoCopyPaste),
+      preferredDomainSetting(PreferredDomainSettingName)
 {
     createStandardObjects();
+    connect(&preferredDomainSetting, SIGNAL(valueChanged()), this, SLOT(handlePreferredDomainUpdate()));
 }
 
 MToolbarManager::~MToolbarManager()
@@ -75,13 +79,13 @@
 
 void MToolbarManager::setCopyPasteState(bool copyAvailable, bool pasteAvailable)
 {
-    MInputMethod::CopyPasteState newStatus = MInputMethod::InputMethodNoCopyPaste;
-    MInputMethod::ActionType actionType = MInputMethod::ActionUndefined;
-
     if (!copyPaste) {
         return;
     }
 
+    MInputMethod::CopyPasteState newStatus = MInputMethod::InputMethodNoCopyPaste;
+    MInputMethod::ActionType actionType = MInputMethod::ActionUndefined;
+
     if (copyAvailable) {
         newStatus = MInputMethod::InputMethodCopy;
     } else if (pasteAvailable) {
@@ -91,26 +95,27 @@
     if (copyPasteStatus == newStatus)
         return;
 
+    bool enabled = false;
+    QString textId("qtn_comm_copy");
+
     copyPasteStatus = newStatus;
     switch (newStatus) {
     case MInputMethod::InputMethodNoCopyPaste:
-        copyPaste->setVisible(false);
         break;
     case MInputMethod::InputMethodCopy:
-        copyPaste->setVisible(true);
-        //% "Copy"
-        copyPaste->setTextId("qtn_comm_copy");
+        enabled = true;
         actionType = MInputMethod::ActionCopy;
         break;
     case MInputMethod::InputMethodPaste:
-        copyPaste->setVisible(true);
-        //% "Paste"
-        copyPaste->setTextId("qtn_comm_paste");
+        enabled = true;
+        textId = "qtn_comm_paste";
         actionType = MInputMethod::ActionPaste;
         break;
     }
+    copyPaste->setTextId(textId);
+    copyPaste->setEnabled(enabled);
     if (!copyPaste->actions().isEmpty()) {
-        copyPaste->actions().at(0)->setType(actionType);
+        copyPaste->actions().first()->setType(actionType);
     }
 }
 
@@ -118,14 +123,12 @@
 {
     // load a toolbar
     QSharedPointer<MToolbarData> toolbar(new MToolbarData);
-    const bool loaded = toolbar->loadNokiaToolbarXml(name);
+    const bool loaded = toolbar->loadToolbarXml(name);
 
     if (!loaded) {
         qWarning() << "ToolbarsManager: toolbar load error: "
                    << name;
         toolbar.clear();
-    } else {
-        toolbar->sort();
     }
 
     return toolbar;
@@ -138,10 +141,10 @@
     standardToolbar = createToolbar(StandardToolbar);
 
     if (standardToolbar) {
-        standardToolbar->setCustom(false);
         toolbars.insert(MToolbarId::standardToolbarId(), standardToolbar);
 
         foreach (QSharedPointer<MToolbarItem> item, standardToolbar->items()) {
+            item->setCustom(false);
             QList<QSharedPointer<MToolbarItemAction> > actions = item->actions();
             if (actions.isEmpty()) {
                 continue; // should never happen
@@ -154,7 +157,9 @@
             case MInputMethod::ActionCopyPaste:
                 copyPaste = item;
                 // set initial state
-                copyPaste->setVisible(false);
+                copyPaste->setVisible(true);
+                copyPaste->setEnabled(false);
+                copyPaste->setTextId("qtn_comm_copy");
                 copyPaste->actions().first()->setType(MInputMethod::ActionUndefined);
                 break;
             default:
@@ -169,6 +174,10 @@
     QSharedPointer<MToolbarLayout> landscape = toolbarData->layout(M::Landscape).constCast<MToolbarLayout>();
     QSharedPointer<MToolbarLayout> portrait = toolbarData->layout(M::Portrait).constCast<MToolbarLayout>();
 
+    if (!toolbarData || !standardToolbar) {
+        return;
+    }
+
     if (landscape) {
         addStandardButtons(landscape, toolbarData);
     }
@@ -181,18 +190,39 @@
 void MToolbarManager::addStandardButtons(const QSharedPointer<MToolbarLayout> &layout,
                                          const QSharedPointer<MToolbarData> &toolbarData)
 {
-    if (layout->rows().isEmpty()) {
+    foreach (const QSharedPointer<MToolbarItem> &item, standardToolbar->items()) {
+        if (!toolbarData->refusedNames().contains(item->name())) {
+            toolbarData->append(layout, item);
+        }
+    }
+}
+
+void MToolbarManager::handlePreferredDomainUpdate()
+{
+    foreach (QSharedPointer<MToolbarData> toolbar, toolbars) {
+        updateDomain(toolbar);
+    }
+}
+
+void MToolbarManager::updateDomain(QSharedPointer<MToolbarData> &toolbar)
+{
+    const QString domain(preferredDomainSetting.value().toString());
+    if (domain.isEmpty()) {
         return;
     }
 
-    QSharedPointer<MToolbarRow> row = layout->rows().last();
+    QSharedPointer<MToolbarItem> item(toolbar->item(DomainItemName));
+    if (!item) {
+        return;
+    }
 
-    foreach (const QSharedPointer<MToolbarItem> &item, standardToolbar->items()) {
-        if (!toolbarData->refusedNames().contains(item->name())) {
-            toolbarData->append(row, item);
-        }
+    QList<QSharedPointer<MToolbarItemAction> > actions(item->actions());
+    if (actions.length() != 1 || actions[0]->type() != MInputMethod::ActionSendString) {
+        return;
     }
-    row->sort();
+
+    actions[0]->setText(domain);
+    item->setText(domain);
 }
 
 void MToolbarManager::registerToolbar(const MToolbarId &id, const QString &fileName)
@@ -204,6 +234,7 @@
     QSharedPointer<MToolbarData> toolbarData = createToolbar(fileName);
     if (toolbarData) {
         addStandardButtons(toolbarData);
+        updateDomain(toolbarData);
     } else {
         toolbarData = standardToolbar;
     }
--- src/mtoolbarmanager.h
+++ src/mtoolbarmanager.h
@@ -22,10 +22,11 @@
 #include <QHash>
 #include <QPointer>
 
+#include <MGConfItem>
+
 #include "mtoolbardata.h"
 #include "minputmethodnamespace.h"
 
-class MGConfItem;
 class MToolbarId;
 
 /*!
@@ -91,6 +92,10 @@
      */
     void setCopyPasteState(bool copyAvailable, bool pasteAvailable);
 
+private slots:
+    //! \brief Handle preferred_domain GConf setting updates.
+    void handlePreferredDomainUpdate();
+
 private:
     /*!
      * \brief Default constructor.
@@ -120,6 +125,9 @@
     void addStandardButtons(const QSharedPointer<MToolbarLayout> &layout,
                             const QSharedPointer<MToolbarData> &toolbarData);
 
+    //! \brief Update the text of a button named _domain in \a toolbar to match the configuration.
+    void updateDomain(QSharedPointer<MToolbarData> &toolbar);
+
     typedef QHash<MToolbarId, QSharedPointer<MToolbarData> > ToolbarContainer;
     //! all registered toolbars
     ToolbarContainer toolbars;
@@ -136,6 +144,9 @@
     //! Copy/paste button status
     MInputMethod::CopyPasteState copyPasteStatus;
 
+    //! Preferred domain for URL and Email toolbar domain buttons.
+    MGConfItem preferredDomainSetting;
+
     //! Singleton instance
     static MToolbarManager *toolbarMgrInstance;
 
--- src/mtoolbarrow.cpp
+++ src/mtoolbarrow.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 "mtoolbarrow.h"
-#include "mtoolbarrow_p.h"
-
-namespace
-{
-    bool lessThanItem(const QSharedPointer<const MToolbarItem> &left,
-                      const QSharedPointer<const MToolbarItem> &right)
-    {
-        if (left->alignment() != right->alignment()) {
-            return left->alignment() < right->alignment();
-        }
-
-        return left->priority() < right->priority();
-    }
-}
-
-MToolbarRow::MToolbarRow()
-    : d_ptr(new MToolbarRowPrivate)
-{
-}
-
-MToolbarRow::~MToolbarRow()
-{
-    delete d_ptr;
-}
-
-QList<QSharedPointer<MToolbarItem> > MToolbarRow::items() const
-{
-    Q_D(const MToolbarRow);
-
-    return d->items;
-}
-
-void MToolbarRow::sort()
-{
-    Q_D(MToolbarRow);
-
-    qSort(d->items.begin(), d->items.end(), &lessThanItem);
-}
-
-void MToolbarRow::append(const QSharedPointer<MToolbarItem> &item)
-{
-    Q_D(MToolbarRow);
-
-    d->items.append(item);
-}
-
--- src/mtoolbarrow.h
+++ src/mtoolbarrow.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 MTOOLBARROW_H
-#define MTOOLBARROW_H
-
-//#include <QObject>
-
-//#include "minputmethodnamespace.h"
-#include "mtoolbaritem.h"
-
-class MToolbarRowPrivate;
-
-/*!
- * \brief MToolbarRow defines content of one row in toolbar
- */
-class MToolbarRow {
-public:
-    //! Constructor.
-    MToolbarRow();
-
-    //! Destructor.
-    virtual ~MToolbarRow();
-
-    //! Return all items contained by this row
-    QList<QSharedPointer<MToolbarItem> > items() const;
-
-    //! Sort items according to their priorities and alignments
-    void sort();
-
-private:
-    Q_DISABLE_COPY(MToolbarRow)
-    Q_DECLARE_PRIVATE(MToolbarRow)
-
-    //! Append item to row
-    void append(const QSharedPointer<MToolbarItem> &item);
-
-    MToolbarRowPrivate *const d_ptr;
-
-    friend class MToolbarData;
-};
-
-#endif
-
--- src/mtoolbarrow_p.h
+++ src/mtoolbarrow_p.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 MTOOLBARROW_P_H
-#define MTOOLBARROW_P_H
-
-#include <QSharedPointer>
-#include <QList>
-
-class MToolbarItem;
-class MToolbarRow;
-
-class MToolbarRowPrivate
-{
-public:
-    QList<QSharedPointer<MToolbarItem> > items;
-};
-
-#endif
-
--- src/src.pro
+++ src/src.pro
@@ -7,33 +7,37 @@
 # Input
 HEADERSINSTALL = \
         minputmethodplugin.h \
-        minputmethodbase.h \
+        mabstractinputmethod.h \
+        mabstractinputmethodhost.h \
         mimpluginmanager.h \
-        minputcontextconnection.h \
         mplainwindow.h \
-        mpreeditface.h \
-        mimhandlerstate.h \
-        mimdirection.h \
         mtoolbaritem.h \
         mtoolbardata.h \
         minputmethodnamespace.h \
-        minputmethodsettingsbase.h \
-        mtoolbarrow.h \
+        mabstractinputmethodsettings.h \
         mtoolbarlayout.h \
 
 HEADERS += $$HEADERSINSTALL \
         mimpluginmanager_p.h \
+        mimpluginmanageradaptor.h \
+        mindicatorserviceclient.h \
         mimapplication.h \
+        minputcontextconnection.h \
+        minputmethodhost.h \
         mtoolbardata_p.h \
         mtoolbaritem_p.h \
         mtoolbarmanager.h \
         mtoolbarid.h \
         mimsettingsdialog.h \
-        mtoolbarrow_p.h \
         mtoolbarlayout_p.h \
+        minputcontextglibdbusconnection.h \
 
 SOURCES += mimpluginmanager.cpp \
-        minputmethodbase.cpp \
+        mimpluginmanageradaptor.cpp \
+        mindicatorserviceclient.cpp \
+        mabstractinputmethod.cpp \
+        mabstractinputmethodhost.cpp \
+        minputmethodhost.cpp \
         minputcontextconnection.cpp \
         mplainwindow.cpp \
         mimapplication.cpp \
@@ -42,21 +46,13 @@
         mtoolbarmanager.cpp \
         mtoolbarid.cpp \
         mimsettingsdialog.cpp \
-        mtoolbarrow.cpp \
         mtoolbarlayout.cpp \
+        minputcontextglibdbusconnection.cpp \
 
-CONFIG += debug meegotouchcore qdbus
+CONFIG += debug meegotouchcore qdbus link_pkgconfig
 QT = core gui xml
 
-contains(DEFINES, QT_DBUS) {
-    SOURCES += minputcontextdbusconnection.cpp
-    HEADERS += minputcontextdbusconnection.h minputcontextdbusconnection_p.h
-} else {
-    CONFIG += link_pkgconfig
-    PKGCONFIG += dbus-glib-1 dbus-1
-    SOURCES += minputcontextglibdbusconnection.cpp
-    HEADERS += minputcontextglibdbusconnection.h
-}
+PKGCONFIG += dbus-glib-1 dbus-1
 
 # coverage flags are off per default, but can be turned on via qmake COV_OPTION=on
 for(OPTION,$$list($$lower($$COV_OPTION))){
@@ -82,7 +78,7 @@
 install_prf.path = $$[QT_INSTALL_DATA]/mkspecs/features
 install_prf.files = meegoimframework.prf
 
-install_xml.path = /usr/share/meegotouch/imtoolbars/imframework
+install_xml.path = /usr/share/meegoimframework/imtoolbars
 install_xml.files = standard.xml
 
 INSTALLS += target \
@@ -114,3 +110,14 @@
 prffilegenerator.depends += Makefile
 QMAKE_EXTRA_COMPILERS += prffilegenerator
 
+QMAKE_EXTRA_TARGETS += mdbusglibicconnectionserviceglue.h
+mdbusglibicconnectionserviceglue.h.commands = \
+    dbus-binding-tool --prefix=m_dbus_glib_ic_connection --mode=glib-server \
+        --output=mdbusglibicconnectionserviceglue.h minputmethodserver1interface.xml
+mdbusglibicconnectionserviceglue.h.depends = minputmethodserver1interface.xml
+
+QMAKE_EXTRA_TARGETS += mimsdbusactivaterserviceglue.h
+mimsdbusactivaterserviceglue.h.commands = \
+    dbus-binding-tool --prefix=m_ims_dbus_activater --mode=glib-server \
+        --output=mimsdbusactivaterserviceglue.h minputmethodserveractivationinterface.xml
+mimsdbusactivaterserviceglue.h.depends = minputmethodserveractivationinterface.xml
--- src/standard.xml
+++ src/standard.xml
@@ -1,19 +1,21 @@
 <?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE DUI_IM_TOOLBAR_WIDGET SYSTEM 'ImToolbarDTD.dtd'>
+<!DOCTYPE MEEGO_IM_TOOLBAR_WIDGET SYSTEM 'ImToolbarDTD.dtd'>
 <toolbar version="1">
+    <items>
+        <button name="_copypaste" alignment="left" text_id="qtn_comm_copy" >
+            <actions>
+                <copypaste />
+            </actions>
+        </button>
+        <button name="_close" showon="always" alignment="right" text_id="qtn_comm_command_done" >
+            <actions>
+                <close />
+            </actions>
+        </button>
+    </items>
     <layout orientation="landscape">
-        <row>
-            <button name="_copypaste" priority="110" alignment="right" text_id="qtn_comm_copy" >
-                <actions>
-                    <copypaste />
-                </actions>
-            </button>
-            <button name="_close" priority="120" showon="always" alignment="right" icon_id="icon-m-framework-close" >
-                <actions>
-                    <close />
-                </actions>
-            </button>
-        </row>
+        <item name="_copypaste" />
+        <item name="_close" />
     </layout>
 </toolbar>
 
--- tests/dummyimplugin/dummyimplugin.cpp
+++ tests/dummyimplugin/dummyimplugin.cpp
@@ -6,7 +6,7 @@
 
 DummyImPlugin::DummyImPlugin()
 {
-    allowedStates << OnScreen << Hardware << Accessory;
+    allowedStates << MInputMethod::OnScreen << MInputMethod::Hardware << MInputMethod::Accessory;
 }
 
 QString DummyImPlugin::name() const
@@ -19,18 +19,18 @@
     return QStringList("EN");
 }
 
-MInputMethodBase *
-DummyImPlugin::createInputMethod(MInputContextConnection *icConnection)
+MAbstractInputMethod *
+DummyImPlugin::createInputMethod(MAbstractInputMethodHost *imHost)
 {
-    return new DummyInputMethod(icConnection);
+    return new DummyInputMethod(imHost);
 }
 
-MInputMethodSettingsBase *DummyImPlugin::createInputMethodSettings()
+MAbstractInputMethodSettings *DummyImPlugin::createInputMethodSettings()
 {
     return 0;
 }
 
-QSet<MIMHandlerState> DummyImPlugin::supportedStates() const
+QSet<MInputMethod::HandlerState> DummyImPlugin::supportedStates() const
 {
     return allowedStates;
 }
--- tests/dummyimplugin/dummyimplugin.h
+++ tests/dummyimplugin/dummyimplugin.h
@@ -20,15 +20,15 @@
 
     virtual QStringList languages() const;
 
-    virtual MInputMethodBase *createInputMethod(MInputContextConnection *icConnection);
+    virtual MAbstractInputMethod *createInputMethod(MAbstractInputMethodHost *imHost);
 
-    virtual MInputMethodSettingsBase *createInputMethodSettings();
+    virtual MAbstractInputMethodSettings *createInputMethodSettings();
 
-    virtual QSet<MIMHandlerState> supportedStates() const;
+    virtual QSet<MInputMethod::HandlerState> supportedStates() const;
     //! \reimp_end
 
 public:
-    QSet<MIMHandlerState> allowedStates;
+    QSet<MInputMethod::HandlerState> allowedStates;
 };
 
 #endif
--- tests/dummyimplugin/dummyinputmethod.cpp
+++ tests/dummyimplugin/dummyinputmethod.cpp
@@ -2,19 +2,21 @@
 #include <QDebug>
 #include <QTimer>
 
-DummyInputMethod::DummyInputMethod(MInputContextConnection *connection)
-    : MInputMethodBase(connection),
+#include "mabstractinputmethodhost.h"
+
+DummyInputMethod::DummyInputMethod(MAbstractInputMethodHost *imHost)
+    : MAbstractInputMethod(imHost),
       setStateCount(0),
       switchContextCallCount(0),
-      directionParam(M::SwitchUndefined),
+      directionParam(MInputMethod::SwitchUndefined),
       enableAnimationParam(false)
 {
-    MInputMethodBase::MInputMethodSubView sv1;
+    MAbstractInputMethod::MInputMethodSubView sv1;
     sv1.subViewId = "dummyimsv1";
     sv1.subViewTitle = "dummimysv1";
     sViews.append(sv1);
 
-    MInputMethodBase::MInputMethodSubView sv2;
+    MAbstractInputMethod::MInputMethodSubView sv2;
     sv2.subViewId = "dummyimsv2";
     sv2.subViewTitle = "dummyimsv2";
     sViews.append(sv2);
@@ -22,7 +24,7 @@
     activeSView = "dummyimsv1";
 }
 
-void DummyInputMethod::setState(const QSet<MIMHandlerState> &state)
+void DummyInputMethod::setState(const QSet<MInputMethod::HandlerState> &state)
 {
     qDebug() << __PRETTY_FUNCTION__ << state;
     ++setStateCount;
@@ -34,38 +36,38 @@
 void DummyInputMethod::switchMe()
 {
     qDebug() << __PRETTY_FUNCTION__;
-    emit pluginSwitchRequired(M::SwitchForward);
+    inputMethodHost()->switchPlugin(MInputMethod::SwitchForward);
 }
 
 void DummyInputMethod::switchMe(const QString &name)
 {
     qDebug() << __PRETTY_FUNCTION__;
-    emit pluginSwitchRequired(name);
+    inputMethodHost()->switchPlugin(name);
 }
 
-void DummyInputMethod::switchContext(M::InputMethodSwitchDirection direction,
-        bool enableAnimation)
+void DummyInputMethod::switchContext(MInputMethod::SwitchDirection direction, bool enableAnimation)
 {
     ++switchContextCallCount;
     directionParam = direction;
     enableAnimationParam = enableAnimation;
 }
 
-QList<MInputMethodBase::MInputMethodSubView> DummyInputMethod::subViews(MIMHandlerState state) const
+QList<MAbstractInputMethod::MInputMethodSubView>
+DummyInputMethod::subViews(MInputMethod::HandlerState state) const
 {
     qDebug() << __PRETTY_FUNCTION__;
-    QList<MInputMethodBase::MInputMethodSubView> svs;
-    if (state == OnScreen) {
+    QList<MAbstractInputMethod::MInputMethodSubView> svs;
+    if (state == MInputMethod::OnScreen) {
         svs = sViews;
     }
     return svs;
 }
 
-void DummyInputMethod::setActiveSubView(const QString &sVId, MIMHandlerState state)
+void DummyInputMethod::setActiveSubView(const QString &sVId, MInputMethod::HandlerState state)
 {
     qDebug() << __PRETTY_FUNCTION__;
-    if (state == OnScreen) {
-        foreach (const MInputMethodBase::MInputMethodSubView &sv, sViews) {
+    if (state == MInputMethod::OnScreen) {
+        foreach (const MAbstractInputMethod::MInputMethodSubView &sv, sViews) {
             if (sv.subViewId == sVId) {
                 activeSView = sVId;
             }
@@ -73,10 +75,10 @@
     }
 }
 
-QString DummyInputMethod::activeSubView(MIMHandlerState state) const
+QString DummyInputMethod::activeSubView(MInputMethod::HandlerState state) const
 {
     qDebug() << __PRETTY_FUNCTION__;
-    if (state == OnScreen)
+    if (state == MInputMethod::OnScreen)
         return activeSView;
     else
         return QString();
--- tests/dummyimplugin/dummyinputmethod.h
+++ tests/dummyimplugin/dummyinputmethod.h
@@ -1,34 +1,38 @@
 #ifndef DUMMYINPUTMETHOD_H
 #define DUMMYINPUTMETHOD_H
 
-#include <minputmethodbase.h>
+#include <mabstractinputmethod.h>
 #include <QSet>
 
 #include "mtoolbardata.h"
+#include "minputmethodnamespace.h"
 
-class DummyInputMethod : public MInputMethodBase
+class DummyInputMethod : public MAbstractInputMethod
 {
     Q_OBJECT
 
 public:
 
-    DummyInputMethod(MInputContextConnection *connection);
+    DummyInputMethod(MAbstractInputMethodHost *imHost);
 
     //! \reimp
-    virtual void setState(const QSet<MIMHandlerState> &state);
-    virtual void switchContext(M::InputMethodSwitchDirection direction, bool enableAnimation);
-    virtual QList<MInputMethodBase::MInputMethodSubView> subViews(MIMHandlerState state = OnScreen) const;
-    virtual void setActiveSubView(const QString &, MIMHandlerState state = OnScreen);
-    virtual QString activeSubView(MIMHandlerState state = OnScreen) const;
+    virtual void setState(const QSet<MInputMethod::HandlerState> &state);
+    virtual void switchContext(MInputMethod::SwitchDirection direction,
+                               bool enableAnimation);
+    virtual QList<MAbstractInputMethod::MInputMethodSubView> subViews(MInputMethod::HandlerState state
+                                                                   = MInputMethod::OnScreen) const;
+    virtual void setActiveSubView(const QString &,
+                                  MInputMethod::HandlerState state = MInputMethod::OnScreen);
+    virtual QString activeSubView(MInputMethod::HandlerState state = MInputMethod::OnScreen) const;
     virtual void setToolbar(QSharedPointer<const MToolbarData> toolbar);
     //! \reimp_end
 
 public:
     int setStateCount;
-    QSet<MIMHandlerState> setStateParam;
+    QSet<MInputMethod::HandlerState> setStateParam;
 
     int switchContextCallCount;
-    M::InputMethodSwitchDirection directionParam;
+    MInputMethod::SwitchDirection directionParam;
     bool enableAnimationParam;
     QSharedPointer<const MToolbarData> toolbarParam;
 
@@ -37,7 +41,7 @@
     void switchMe(const QString &name);
 
 private:
-    QList<MInputMethodBase::MInputMethodSubView> sViews;
+    QList<MAbstractInputMethod::MInputMethodSubView> sViews;
     QString activeSView;
 };
 
--- tests/dummyimplugin2/dummyimplugin2.cpp
+++ tests/dummyimplugin2/dummyimplugin2.cpp
@@ -13,22 +13,22 @@
     return QStringList("EN");
 }
 
-MInputMethodBase *
-DummyImPlugin2::createInputMethod(MInputContextConnection * /* icConnection */)
+MAbstractInputMethod *
+DummyImPlugin2::createInputMethod(MAbstractInputMethodHost * /* imHost */)
 {
     return NULL;
 }
 
-MInputMethodSettingsBase *DummyImPlugin2::createInputMethodSettings()
+MAbstractInputMethodSettings *DummyImPlugin2::createInputMethodSettings()
 {
     return 0;
 }
 
-QSet<MIMHandlerState> DummyImPlugin2::supportedStates() const
+QSet<MInputMethod::HandlerState> DummyImPlugin2::supportedStates() const
 {
-    QSet<MIMHandlerState> result;
+    QSet<MInputMethod::HandlerState> result;
 
-    result << OnScreen << Hardware << Accessory;
+    result << MInputMethod::OnScreen << MInputMethod::Hardware << MInputMethod::Accessory;
     return result;
 }
 
--- tests/dummyimplugin2/dummyimplugin2.h
+++ tests/dummyimplugin2/dummyimplugin2.h
@@ -18,11 +18,11 @@
 
     virtual QStringList languages() const;
 
-    virtual MInputMethodBase *createInputMethod(MInputContextConnection *icConnection);
+    virtual MAbstractInputMethod *createInputMethod(MAbstractInputMethodHost *imHost);
 
-    virtual MInputMethodSettingsBase *createInputMethodSettings();
+    virtual MAbstractInputMethodSettings *createInputMethodSettings();
 
-    virtual QSet<MIMHandlerState> supportedStates() const;
+    virtual QSet<MInputMethod::HandlerState> supportedStates() const;
     //! \reimp_end
 };
 
--- tests/dummyimplugin3/dummyimplugin3.cpp
+++ tests/dummyimplugin3/dummyimplugin3.cpp
@@ -7,7 +7,7 @@
 DummyImPlugin3::DummyImPlugin3()
     : setStateCount(0)
 {
-    allowedStates << OnScreen << Hardware << Accessory;
+    allowedStates << MInputMethod::OnScreen << MInputMethod::Hardware << MInputMethod::Accessory;
 }
 
 QString DummyImPlugin3::name() const
@@ -20,17 +20,17 @@
     return QStringList("EN");
 }
 
-MInputMethodBase *
-DummyImPlugin3::createInputMethod(MInputContextConnection *icConnection)
+MAbstractInputMethod *
+DummyImPlugin3::createInputMethod(MAbstractInputMethodHost *imHost)
 {
-    return new DummyInputMethod3(icConnection);
+    return new DummyInputMethod3(imHost);
 }
 
-MInputMethodSettingsBase *DummyImPlugin3::createInputMethodSettings()
+MAbstractInputMethodSettings *DummyImPlugin3::createInputMethodSettings()
 {
     return 0;
 }
-QSet<MIMHandlerState> DummyImPlugin3::supportedStates() const
+QSet<MInputMethod::HandlerState> DummyImPlugin3::supportedStates() const
 {
     return allowedStates;
 }
--- tests/dummyimplugin3/dummyimplugin3.h
+++ tests/dummyimplugin3/dummyimplugin3.h
@@ -19,17 +19,17 @@
 
     virtual QStringList languages() const;
 
-    virtual MInputMethodBase *createInputMethod(MInputContextConnection *icConnection);
+    virtual MAbstractInputMethod *createInputMethod(MAbstractInputMethodHost *imHost);
 
-    virtual MInputMethodSettingsBase *createInputMethodSettings();
+    virtual MAbstractInputMethodSettings *createInputMethodSettings();
 
-    virtual QSet<MIMHandlerState> supportedStates() const;
+    virtual QSet<MInputMethod::HandlerState> supportedStates() const;
     //! \reimp_end
 
 public:
     int setStateCount;
-    QList<MIMHandlerState> setStateParam;
-    QSet<MIMHandlerState> allowedStates;
+    QList<MInputMethod::HandlerState> setStateParam;
+    QSet<MInputMethod::HandlerState> allowedStates;
 };
 
 #endif
--- tests/dummyimplugin3/dummyinputmethod3.cpp
+++ tests/dummyimplugin3/dummyinputmethod3.cpp
@@ -1,19 +1,21 @@
 #include "dummyinputmethod3.h"
+#include "mabstractinputmethodhost.h"
+
 #include <QDebug>
 
-DummyInputMethod3::DummyInputMethod3(MInputContextConnection *connection)
-    : MInputMethodBase(connection),
+DummyInputMethod3::DummyInputMethod3(MAbstractInputMethodHost *imHost)
+    : MAbstractInputMethod(imHost),
       setStateCount(0),
       switchContextCallCount(0),
-      directionParam(M::SwitchUndefined),
+      directionParam(MInputMethod::SwitchUndefined),
       enableAnimationParam(false)
 {
-    MInputMethodBase::MInputMethodSubView sv1;
+    MAbstractInputMethod::MInputMethodSubView sv1;
     sv1.subViewId = "dummyim3sv1";
     sv1.subViewTitle = "dummyim3sv1";
     sViews.append(sv1);
 
-    MInputMethodBase::MInputMethodSubView sv2;
+    MAbstractInputMethod::MInputMethodSubView sv2;
     sv2.subViewId = "dummyim3sv2";
     sv2.subViewTitle = "dummyim3sv2";
     sViews.append(sv2);
@@ -21,14 +23,14 @@
     activeSView = "dummyim3sv1";
 }
 
-void DummyInputMethod3::setState(const QSet<MIMHandlerState> &state)
+void DummyInputMethod3::setState(const QSet<MInputMethod::HandlerState> &state)
 {
     qDebug() << __PRETTY_FUNCTION__ << state;
     ++setStateCount;
     setStateParam = state;
 }
 
-void DummyInputMethod3::switchContext(M::InputMethodSwitchDirection direction,
+void DummyInputMethod3::switchContext(MInputMethod::SwitchDirection direction,
                               bool enableAnimation)
 {
     ++switchContextCallCount;
@@ -36,21 +38,22 @@
     enableAnimationParam = enableAnimation;
 }
 
-QList<MInputMethodBase::MInputMethodSubView> DummyInputMethod3::subViews(MIMHandlerState state) const
+QList<MAbstractInputMethod::MInputMethodSubView>
+DummyInputMethod3::subViews(MInputMethod::HandlerState state) const
 {
     qDebug() << __PRETTY_FUNCTION__;
-    QList<MInputMethodBase::MInputMethodSubView> svs;
-    if (state == OnScreen) {
+    QList<MAbstractInputMethod::MInputMethodSubView> svs;
+    if (state == MInputMethod::OnScreen) {
         svs = sViews;
     }
     return svs;
 }
 
-void DummyInputMethod3::setActiveSubView(const QString &sVId, MIMHandlerState state)
+void DummyInputMethod3::setActiveSubView(const QString &sVId, MInputMethod::HandlerState state)
 {
     qDebug() << __PRETTY_FUNCTION__;
-    if (state == OnScreen) {
-        foreach (const MInputMethodBase::MInputMethodSubView &sv, sViews) {
+    if (state == MInputMethod::OnScreen) {
+        foreach (const MAbstractInputMethod::MInputMethodSubView &sv, sViews) {
             if (sv.subViewId == sVId) {
                 activeSView = sVId;
             }
@@ -58,10 +61,10 @@
     }
 }
 
-QString DummyInputMethod3::activeSubView(MIMHandlerState state) const
+QString DummyInputMethod3::activeSubView(MInputMethod::HandlerState state) const
 {
     qDebug() << __PRETTY_FUNCTION__;
-    if (state == OnScreen)
+    if (state == MInputMethod::OnScreen)
         return activeSView;
     else
         return QString();
@@ -69,7 +72,7 @@
 
 void DummyInputMethod3::show()
 {
-    emit regionUpdated(QRegion(0, 0, 100, 100));
+    inputMethodHost()->setScreenRegion(QRegion(0, 0, 100, 100));
 }
 
 void DummyInputMethod3::setToolbar(QSharedPointer<const MToolbarData> toolbar)
--- tests/dummyimplugin3/dummyinputmethod3.h
+++ tests/dummyimplugin3/dummyinputmethod3.h
@@ -1,40 +1,42 @@
 #ifndef DUMMYINPUTMETHOD3_H
 #define DUMMYINPUTMETHOD3_H
 
-#include <minputmethodbase.h>
+#include <mabstractinputmethod.h>
 #include <QSet>
 
 #include "mtoolbardata.h"
 
-class DummyInputMethod3 : public MInputMethodBase
+class DummyInputMethod3 : public MAbstractInputMethod
 {
     Q_OBJECT
 
 public:
 
-    DummyInputMethod3(MInputContextConnection *connection);
+    DummyInputMethod3(MAbstractInputMethodHost *imHost);
 
     //! \reimp
-    virtual void setState(const QSet<MIMHandlerState> &state);
-    virtual void switchContext(M::InputMethodSwitchDirection direction, bool enableAnimation);
-    virtual QList<MInputMethodBase::MInputMethodSubView> subViews(MIMHandlerState state = OnScreen) const;
-    virtual void setActiveSubView(const QString &, MIMHandlerState state = OnScreen);
-    virtual QString activeSubView(MIMHandlerState state = OnScreen) const;
+    virtual void setState(const QSet<MInputMethod::HandlerState> &state);
+    virtual void switchContext(MInputMethod::SwitchDirection direction, bool enableAnimation);
+    virtual QList<MAbstractInputMethod::MInputMethodSubView> subViews(MInputMethod::HandlerState state
+                                                                   = MInputMethod::OnScreen) const;
+    virtual void setActiveSubView(const QString &,
+                                  MInputMethod::HandlerState state = MInputMethod::OnScreen);
+    virtual QString activeSubView(MInputMethod::HandlerState state = MInputMethod::OnScreen) const;
     virtual void show();
     virtual void setToolbar(QSharedPointer<const MToolbarData> toolbar);
     //! \reimp_end
 
 public:
     int setStateCount;
-    QSet<MIMHandlerState> setStateParam;
+    QSet<MInputMethod::HandlerState> setStateParam;
 
     int switchContextCallCount;
-    M::InputMethodSwitchDirection directionParam;
+    MInputMethod::SwitchDirection directionParam;
     bool enableAnimationParam;
     QSharedPointer<const MToolbarData> toolbarParam;
 
 private:
-    QList<MInputMethodBase::MInputMethodSubView> sViews;
+    QList<MAbstractInputMethod::MInputMethodSubView> sViews;
     QString activeSView;
 };
 
--- tests/ft_mimpluginmanager/ft_mimpluginmanager.cpp
+++ tests/ft_mimpluginmanager/ft_mimpluginmanager.cpp
@@ -148,7 +148,7 @@
     inputMethod = dynamic_cast<DummyInputMethod *>(subject->d_ptr->plugins[plugin].inputMethod);
     QVERIFY(inputMethod != 0);
 
-    inputMethod->switchMe(); //emit signal to switch plugin
+    inputMethod->switchMe();
 
     QStringList activePlugins = subject->activePluginsNames();
     QCOMPARE(activePlugins.count(), 1);
@@ -173,7 +173,7 @@
     inputMethod = dynamic_cast<DummyInputMethod *>(subject->d_ptr->plugins[plugin].inputMethod);
     QVERIFY(inputMethod != 0);
 
-    inputMethod->switchMe(pluginName3); //emit signal to switch plugin
+    inputMethod->switchMe(pluginName3);
 
     QStringList activePlugins = subject->activePluginsNames();
     QCOMPARE(activePlugins.count(), 1);
--- tests/stubs/minputcontext_stub.h
+++ tests/stubs/minputcontext_stub.h
@@ -45,7 +45,8 @@
     virtual void commitString(const QString &string);
     virtual void updatePreedit(const QString &string, PreeditFace preeditFace);
     virtual void keyEvent(int type, int key, int modifiers, const QString &text,
-                          bool autoRepeat, int count);
+                          bool autoRepeat, int count,
+                          MInputMethod::KeyEventType requestType);
     virtual void updateInputMethodArea(const QList<QVariant> &rectList);
     virtual void setGlobalCorrectionEnabled(bool enable);
 };
@@ -123,7 +124,8 @@
 }
 
 void MInputContextStub::keyEvent(int type, int key, int modifiers, const QString &text,
-                                   bool autoRepeat, int count)
+                                 bool autoRepeat, int count,
+                                 MInputMethod::KeyEventType requestType)
 {
     QList<ParameterBase *> params;
     params.append(new Parameter<int>(type));
@@ -132,6 +134,7 @@
     params.append(new Parameter<QString>(text));
     params.append(new Parameter<bool>(autoRepeat));
     params.append(new Parameter<int>(count));
+    params.append(new Parameter<MInputMethod::KeyEventType>(requestType));
     stubMethodEntered("keyEvent", params);
 }
 
@@ -238,9 +241,10 @@
 }
 
 void MInputContext::keyEvent(int type, int key, int modifiers, const QString &text,
-                               bool autoRepeat, int count)
+                             bool autoRepeat, int count,
+                             MInputMethod::KeyEventType requestType)
 {
-    gMInputContextStub->keyEvent(type, key, modifiers, text, autoRepeat, count);
+    gMInputContextStub->keyEvent(type, key, modifiers, text, autoRepeat, count, requestType);
 }
 
 void MInputContext::updateInputMethodArea(const QList<QVariant> &rectList)
--- tests/stubs/minputcontextadaptor_stub.h
+++ tests/stubs/minputcontextadaptor_stub.h
@@ -44,7 +44,7 @@
     virtual void commitString(const QString &string);
     virtual void updatePreedit(const QString &string, int preeditFace);
     virtual void keyEvent(int type, int key, int modifiers, const QString &text,
-                          bool autoRepeat, int count);
+                          bool autoRepeat, int count, uchar requestType);
     virtual void updateInputMethodArea(const QList<QVariant> &data);
     virtual void setGlobalCorrectionEnabled(bool);
     virtual void setRedirectKeys(bool enabled);
@@ -91,7 +91,8 @@
 }
 
 void MInputContextAdaptorStub::keyEvent(int type, int key, int modifiers,
-        const QString &text, bool autoRepeat, int count)
+                                        const QString &text, bool autoRepeat, int count,
+                                        uchar requestType)
 {
     QList<ParameterBase *> params;
     params.append(new Parameter<int>(type));
@@ -100,6 +101,7 @@
     params.append(new Parameter<QString>(text));
     params.append(new Parameter<bool>(autoRepeat));
     params.append(new Parameter<int>(count));
+    params.append(new Parameter<uchar>(requestType));
     stubMethodEntered("keyEvent", params);
 }
 
@@ -184,9 +186,9 @@
 }
 
 void MInputContextAdaptor::keyEvent(int type, int key, int modifiers, const QString &text,
-                                      bool autoRepeat, int count)
+                                    bool autoRepeat, int count, uchar requestType)
 {
-    gMInputContextAdaptorStub->keyEvent(type, key, modifiers, text, autoRepeat, count);
+    gMInputContextAdaptorStub->keyEvent(type, key, modifiers, text, autoRepeat, count, requestType);
 }
 
 void MInputContextAdaptor::updateInputMethodArea(const QList<QVariant> &data)
--- tests/stubs/minputcontextconnection_stub.cpp
+++ tests/stubs/minputcontextconnection_stub.cpp
@@ -16,7 +16,7 @@
 
 #include "minputcontextconnection_stub.h"
 
-#include "minputmethodbase.h"
+#include "mabstractinputmethod.h"
 
 
 MInputContextConnectionStub::MInputContextConnectionStub()
@@ -30,7 +30,7 @@
 }
 
 void MInputContextConnectionStub::sendPreeditString(const QString &string,
-        PreeditFace preeditFace)
+                                                    MInputMethod::PreeditFace preeditFace)
 {
     Q_UNUSED(string);
     Q_UNUSED(preeditFace);
@@ -41,9 +41,11 @@
     Q_UNUSED(string);
 }
 
-void MInputContextConnectionStub::sendKeyEvent(const QKeyEvent &keyEvent)
+void MInputContextConnectionStub::sendKeyEvent(const QKeyEvent &keyEvent,
+                                               MInputMethod::EventRequestType requestType)
 {
     Q_UNUSED(keyEvent);
+    Q_UNUSED(requestType);
 }
 
 void MInputContextConnectionStub::notifyImInitiatedHiding()
--- tests/stubs/minputcontextconnection_stub.h
+++ tests/stubs/minputcontextconnection_stub.h
@@ -17,7 +17,7 @@
 #ifndef MINPUTCONTEXTCONNECTIONSTUB_H
 #define MINPUTCONTEXTCONNECTIONSTUB_H
 
-#include "mpreeditface.h"
+#include "minputmethodnamespace.h"
 #include "minputcontextconnection.h"
 #include <QRect>
 #include <QObject>
@@ -35,11 +35,13 @@
     virtual ~MInputContextConnectionStub();
 
     virtual void sendPreeditString(const QString &string,
-                                   PreeditFace preeditFace = PreeditDefault);
+                                   MInputMethod::PreeditFace preeditFace
+                                    = MInputMethod::PreeditDefault);
 
     virtual void sendCommitString(const QString &string);
 
-    virtual void sendKeyEvent(const QKeyEvent &keyEvent);
+    virtual void sendKeyEvent(const QKeyEvent &keyEvent,
+                              MInputMethod::EventRequestType requestType);
 
     virtual void notifyImInitiatedHiding();
 
--- tests/tests.pro
+++ tests/tests.pro
@@ -20,10 +20,6 @@
           ut_mimsettingsdialog \
           ut_mimapplication \
 
-contains(DEFINES, QT_DBUS) {
-SUBDIRS += ut_minputcontextdbusconnection
-}
-
 target.commands += $$system(touch tests.xml)
 target.path = /usr/share/meego-im-framework-tests
 target.files += qtestlib2junitxml.xsl runtests.sh tests.xml
--- tests/ut_mimpluginmanager/toolbar1.xml
+++ tests/ut_mimpluginmanager/toolbar1.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE DUI_IM_TOOLBAR_WIDGET SYSTEM 'ImToolbarDTD.dtd'>
+<!DOCTYPE MEEGO_IM_TOOLBAR_WIDGET SYSTEM 'ImToolbarDTD.dtd'>
 <toolbar locked="true" version="1">
     <layout orientation="landscape">
         <row>
--- tests/ut_mimpluginmanager/toolbar2.xml
+++ tests/ut_mimpluginmanager/toolbar2.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE DUI_IM_TOOLBAR_WIDGET SYSTEM 'ImToolbarDTD.dtd'>
+<!DOCTYPE MEEGO_IM_TOOLBAR_WIDGET SYSTEM 'ImToolbarDTD.dtd'>
 <toolbar locked="true" version="1" refuse="_close">
     <layout orientation="landscape">
         <row>
--- tests/ut_mimpluginmanager/ut_mimpluginmanager.cpp
+++ tests/ut_mimpluginmanager/ut_mimpluginmanager.cpp
@@ -20,9 +20,9 @@
 
 #include "mtoolbarmanager.h"
 
-typedef QSet<MIMHandlerState> HandlerStates;
+typedef QSet<MInputMethod::HandlerState> HandlerStates;
 Q_DECLARE_METATYPE(HandlerStates);
-Q_DECLARE_METATYPE(MIMHandlerState);
+Q_DECLARE_METATYPE(MInputMethod::HandlerState);
 
 namespace
 {
@@ -39,9 +39,9 @@
     const QString pluginName2 = "DummyImPlugin2";
     const QString pluginName3 = "DummyImPlugin3";
 
-    const char * const DBusMIMPluginManagerServiceName = "com.maemo.inputmethodpluginmanager1";
-    const char * const DBusMIMPluginManagerPath = "/com/maemo/inputmethodpluginmanager1";
-    const char * const DBusMIMPluginManagerInterface = "com.maemo.inputmethodpluginmanager1";
+    const char * const DBusMIMPluginManagerServiceName = "com.meego.inputmethodpluginmanager1";
+    const char * const DBusMIMPluginManagerPath = "/com/meego/inputmethodpluginmanager1";
+    const char * const DBusMIMPluginManagerInterface = "com.meego.inputmethodpluginmanager1";
 
     QString Toolbar1 = "/toolbar1.xml";
     QString Toolbar2 = "/toolbar2.xml";
@@ -108,10 +108,10 @@
     QVERIFY(plugin != 0);
     QCOMPARE(plugin->name(), pluginName);
     DummyInputMethod  *inputMethod  = 0;
-    MInputMethodBase *inputMethodBase = 0;
-    inputMethodBase = subject->plugins[plugin].inputMethod;
-    QVERIFY(inputMethodBase != 0);
-    inputMethod = dynamic_cast<DummyInputMethod *>(inputMethodBase);
+    MAbstractInputMethod *abstractInputMethod = 0;
+    abstractInputMethod = subject->plugins[plugin].inputMethod;
+    QVERIFY(abstractInputMethod != 0);
+    inputMethod = dynamic_cast<DummyInputMethod *>(abstractInputMethod);
     QVERIFY(inputMethod != 0);
     inputMethod->setStateCount = 0;
 
@@ -201,19 +201,19 @@
 {
     MInputMethodPlugin *plugin = 0;
 
-    subject->addHandlerMap(OnScreen, pluginName);
-    subject->addHandlerMap(Hardware, pluginName);
-    subject->addHandlerMap(Accessory, pluginName3);
+    subject->addHandlerMap(MInputMethod::OnScreen, pluginName);
+    subject->addHandlerMap(MInputMethod::Hardware, pluginName);
+    subject->addHandlerMap(MInputMethod::Accessory, pluginName3);
 
-    plugin = subject->handlerToPlugin[OnScreen];
+    plugin = subject->handlerToPlugin[MInputMethod::OnScreen];
     QVERIFY(plugin != 0);
     QCOMPARE(plugin->name(), pluginName);
 
-    plugin = subject->handlerToPlugin[Hardware];
+    plugin = subject->handlerToPlugin[MInputMethod::Hardware];
     QVERIFY(plugin != 0);
     QCOMPARE(plugin->name(), pluginName);
 
-    plugin = subject->handlerToPlugin[Accessory];
+    plugin = subject->handlerToPlugin[MInputMethod::Accessory];
     QVERIFY(plugin != 0);
     QCOMPARE(plugin->name(), pluginName3);
 }
@@ -224,23 +224,23 @@
     QTest::addColumn<QStringList>("names");
     QTest::addColumn<HandlerStates>("expectedStates");
 
-    for (int n = 0; n <= Accessory; ++n) {
+    for (int n = 0; n <= MInputMethod::Accessory; ++n) {
         QTest::newRow("single state")
                 << (QStringList() << QString::number(n))
-                << (HandlerStates() << MIMHandlerState(n));
+                << (HandlerStates() << MInputMethod::HandlerState(n));
     }
 
     QTest::newRow("0 1")
             << (QStringList() << "0" << "1")
-            << (HandlerStates() << Hardware);
+            << (HandlerStates() << MInputMethod::Hardware);
 
     QTest::newRow("1 2")
             << (QStringList() << "1" << "2")
-            << (HandlerStates() << Accessory << Hardware);
+            << (HandlerStates() << MInputMethod::Accessory << MInputMethod::Hardware);
 
     QTest::newRow("1 1")
             << (QStringList() << "1" << "1")
-            << (HandlerStates() << Hardware);
+            << (HandlerStates() << MInputMethod::Hardware);
 }
 
 
@@ -259,83 +259,83 @@
 
 void Ut_MIMPluginManager::testSwitchPluginState()
 {
-    QSet<MIMHandlerState> actualState;
+    QSet<MInputMethod::HandlerState> actualState;
     DummyImPlugin  *plugin  = 0;
     DummyImPlugin3 *plugin3 = 0;
-    MInputMethodBase *inputMethodBase = 0;
+    MAbstractInputMethod *abstractInputMethod = 0;
     DummyInputMethod  *inputMethod  = 0;
     DummyInputMethod3 *inputMethod3 = 0;
 
-    subject->addHandlerMap(OnScreen, pluginName);
-    subject->addHandlerMap(Hardware, pluginName);
-    subject->addHandlerMap(Accessory, pluginName3);
+    subject->addHandlerMap(MInputMethod::OnScreen, pluginName);
+    subject->addHandlerMap(MInputMethod::Hardware, pluginName);
+    subject->addHandlerMap(MInputMethod::Accessory, pluginName3);
 
-    actualState << OnScreen;
+    actualState << MInputMethod::OnScreen;
     QVERIFY(subject->activePlugins.size() == 1);
     subject->setActiveHandlers(actualState);
     QCOMPARE(subject->activePlugins.size(), 1);
     plugin = dynamic_cast<DummyImPlugin *>(*subject->activePlugins.begin());
     QVERIFY(plugin != 0);
     QCOMPARE(plugin->name(), pluginName);
-    inputMethodBase = subject->plugins[plugin].inputMethod;
-    QVERIFY(inputMethodBase != 0);
-    inputMethod = dynamic_cast<DummyInputMethod *>(inputMethodBase);
+    abstractInputMethod = subject->plugins[plugin].inputMethod;
+    QVERIFY(abstractInputMethod != 0);
+    inputMethod = dynamic_cast<DummyInputMethod *>(abstractInputMethod);
     QVERIFY(inputMethod != 0);
     QCOMPARE(inputMethod->setStateCount, 1);
     inputMethod->setStateCount = 0;
     QCOMPARE(inputMethod->setStateParam.size(), 1);
-    QCOMPARE(*inputMethod->setStateParam.begin(), OnScreen);
+    QCOMPARE(*inputMethod->setStateParam.begin(), MInputMethod::OnScreen);
 
     actualState.clear();
-    actualState << Hardware;
+    actualState << MInputMethod::Hardware;
     subject->setActiveHandlers(actualState);
     QCOMPARE(subject->activePlugins.size(), 1);
     plugin = dynamic_cast<DummyImPlugin *>(*subject->activePlugins.begin());
     QVERIFY(plugin != 0);
     QCOMPARE(plugin->name(), pluginName);
-    inputMethodBase = subject->plugins[plugin].inputMethod;
-    QVERIFY(inputMethodBase != 0);
-    inputMethod = dynamic_cast<DummyInputMethod *>(inputMethodBase);
+    abstractInputMethod = subject->plugins[plugin].inputMethod;
+    QVERIFY(abstractInputMethod != 0);
+    inputMethod = dynamic_cast<DummyInputMethod *>(abstractInputMethod);
     QVERIFY(inputMethod != 0);
     QCOMPARE(inputMethod->setStateCount, 1);
     inputMethod->setStateCount = 0;
     QCOMPARE(inputMethod->setStateParam.size(), 1);
-    QCOMPARE(*inputMethod->setStateParam.begin(), Hardware);
+    QCOMPARE(*inputMethod->setStateParam.begin(), MInputMethod::Hardware);
 
     actualState.clear();
-    actualState << Accessory;
+    actualState << MInputMethod::Accessory;
     subject->setActiveHandlers(actualState);
     QCOMPARE(subject->activePlugins.size(), 1);
     plugin3 = dynamic_cast<DummyImPlugin3 *>(*subject->activePlugins.begin());
     QVERIFY(plugin3 != 0);
     QCOMPARE(plugin3->name(), pluginName3);
-    inputMethodBase = subject->plugins[plugin3].inputMethod;
-    QVERIFY(inputMethodBase != 0);
-    inputMethod3 = dynamic_cast<DummyInputMethod3 *>(inputMethodBase);
+    abstractInputMethod = subject->plugins[plugin3].inputMethod;
+    QVERIFY(abstractInputMethod != 0);
+    inputMethod3 = dynamic_cast<DummyInputMethod3 *>(abstractInputMethod);
     QVERIFY(inputMethod3 != 0);
     QCOMPARE(inputMethod3->setStateCount, 1);
     inputMethod3->setStateCount = 0;
     QCOMPARE(inputMethod3->setStateParam.size(), 1);
-    QCOMPARE(*inputMethod3->setStateParam.begin(), Accessory);
+    QCOMPARE(*inputMethod3->setStateParam.begin(), MInputMethod::Accessory);
 }
 
 
 void Ut_MIMPluginManager::testMultilePlugins()
 {
-    QSet<MIMHandlerState> actualState;
+    QSet<MInputMethod::HandlerState> actualState;
     DummyImPlugin  *plugin  = 0;
     DummyImPlugin3 *plugin3 = 0;
     int pluginCount = 0;
     int plugin3Count = 0;
-    MInputMethodBase *inputMethodBase = 0;
+    MAbstractInputMethod *abstractInputMethod = 0;
     DummyInputMethod  *inputMethod  = 0;
     DummyInputMethod3 *inputMethod3 = 0;
 
-    subject->addHandlerMap(OnScreen, pluginName);
-    subject->addHandlerMap(Hardware, pluginName);
-    subject->addHandlerMap(Accessory, pluginName3);
+    subject->addHandlerMap(MInputMethod::OnScreen, pluginName);
+    subject->addHandlerMap(MInputMethod::Hardware, pluginName);
+    subject->addHandlerMap(MInputMethod::Accessory, pluginName3);
 
-    actualState << Accessory << Hardware;
+    actualState << MInputMethod::Accessory << MInputMethod::Hardware;
     subject->setActiveHandlers(actualState);
     QCOMPARE(subject->activePlugins.size(), 2);
     foreach(MInputMethodPlugin * p, subject->activePlugins) {
@@ -343,27 +343,27 @@
         if (plugin3 != 0) {
             ++plugin3Count;
             QCOMPARE(plugin3->name(), pluginName3);
-            inputMethodBase = subject->plugins[p].inputMethod;
-            QVERIFY(inputMethodBase != 0);
-            inputMethod3 = dynamic_cast<DummyInputMethod3 *>(inputMethodBase);
+            abstractInputMethod = subject->plugins[p].inputMethod;
+            QVERIFY(abstractInputMethod != 0);
+            inputMethod3 = dynamic_cast<DummyInputMethod3 *>(abstractInputMethod);
             QVERIFY(inputMethod3 != 0);
             QCOMPARE(inputMethod3->setStateCount, 1);
             inputMethod3->setStateCount = 0;
             QCOMPARE(inputMethod3->setStateParam.size(), 1);
-            QCOMPARE(*inputMethod3->setStateParam.begin(), Accessory);
+            QCOMPARE(*inputMethod3->setStateParam.begin(), MInputMethod::Accessory);
         }
         plugin = dynamic_cast<DummyImPlugin *>(p);
         if (plugin != 0) {
             ++pluginCount;
             QCOMPARE(plugin->name(), pluginName);
-            inputMethodBase = subject->plugins[p].inputMethod;
-            QVERIFY(inputMethodBase != 0);
-            inputMethod = dynamic_cast<DummyInputMethod *>(inputMethodBase);
+            abstractInputMethod = subject->plugins[p].inputMethod;
+            QVERIFY(abstractInputMethod != 0);
+            inputMethod = dynamic_cast<DummyInputMethod *>(abstractInputMethod);
             QVERIFY(inputMethod != 0);
             QCOMPARE(inputMethod->setStateCount, 1);
             inputMethod->setStateCount = 0;
             QCOMPARE(inputMethod->setStateParam.size(), 1);
-            QCOMPARE(*inputMethod->setStateParam.begin(), Hardware);
+            QCOMPARE(*inputMethod->setStateParam.begin(), MInputMethod::Hardware);
         }
     }
     QCOMPARE(pluginCount, 1);
@@ -373,20 +373,20 @@
 void Ut_MIMPluginManager::testExistInputMethod()
 {
     MIMPluginManagerPrivate::Plugins::iterator iterator;
-    QSet<MIMHandlerState> actualState;
+    QSet<MInputMethod::HandlerState> actualState;
 
-    subject->addHandlerMap(OnScreen, pluginName);
-    subject->addHandlerMap(Hardware, pluginName);
-    subject->addHandlerMap(Accessory, pluginName3);
+    subject->addHandlerMap(MInputMethod::OnScreen, pluginName);
+    subject->addHandlerMap(MInputMethod::Hardware, pluginName);
+    subject->addHandlerMap(MInputMethod::Accessory, pluginName3);
 
-    actualState << OnScreen;
+    actualState << MInputMethod::OnScreen;
     subject->setActiveHandlers(actualState);
     actualState.clear();
-    actualState << Accessory;
+    actualState << MInputMethod::Accessory;
     subject->setActiveHandlers(actualState);
 
     for (iterator = subject->plugins.begin(); iterator != subject->plugins.end(); ++iterator) {
-        // no matter the plugin is active or not, the inputmethodbase object is not empty.
+        // no matter the plugin is active or not, the inputmethod object is not empty.
         if (!iterator.key()->supportedStates().isEmpty()) {
             QVERIFY(iterator.value().inputMethod != 0);
         }
@@ -395,26 +395,26 @@
 
 void Ut_MIMPluginManager::testPluginSwitcher_data()
 {
-    QTest::addColumn<MIMHandlerState>("state");
+    QTest::addColumn<MInputMethod::HandlerState>("state");
 
-    QTest::newRow("OnScreen")  << OnScreen;
-    QTest::newRow("Hardware")  << Hardware;
-    QTest::newRow("Accessory") << Accessory;
+    QTest::newRow("OnScreen")  << MInputMethod::OnScreen;
+    QTest::newRow("Hardware")  << MInputMethod::Hardware;
+    QTest::newRow("Accessory") << MInputMethod::Accessory;
 }
 
 void Ut_MIMPluginManager::testPluginSwitcher()
 {
-    QFETCH(MIMHandlerState, state);
-    QSet<MIMHandlerState> actualState;
+    QFETCH(MInputMethod::HandlerState, state);
+    QSet<MInputMethod::HandlerState> actualState;
     DummyImPlugin  *plugin  = 0;
     DummyImPlugin3 *plugin3 = 0;
-    MInputMethodBase *inputMethodBase = 0;
+    MAbstractInputMethod *abstractInputMethod = 0;
     QPointer<DummyInputMethod > inputMethod  = 0;
     QPointer<DummyInputMethod3> inputMethod3 = 0;
 
-    subject->addHandlerMap(OnScreen, pluginName);
-    subject->addHandlerMap(Hardware, pluginName);
-    subject->addHandlerMap(Accessory, pluginName);
+    subject->addHandlerMap(MInputMethod::OnScreen, pluginName);
+    subject->addHandlerMap(MInputMethod::Hardware, pluginName);
+    subject->addHandlerMap(MInputMethod::Accessory, pluginName);
 
     // find for loaded plugins
     for (MIMPluginManagerPrivate::Plugins::iterator iterator(subject->plugins.begin());
@@ -440,22 +440,22 @@
     subject->setActiveHandlers(actualState);
 
     // nothing should be changed
-    subject->switchPlugin(M::SwitchUndefined, inputMethod);
+    subject->switchPlugin(MInputMethod::SwitchUndefined, inputMethod);
     QVERIFY(inputMethod != 0);
     QCOMPARE(inputMethod->switchContextCallCount, 0);
-    QCOMPARE(subject->plugins[plugin].lastSwitchDirection, M::SwitchUndefined);
+    QCOMPARE(subject->plugins[plugin].lastSwitchDirection, MInputMethod::SwitchUndefined);
     QCOMPARE(subject->activePlugins.count(), 1);
     QVERIFY(plugin == *subject->activePlugins.begin());
 
     // switch forward
-    subject->switchPlugin(M::SwitchForward, inputMethod);
-    QCOMPARE(subject->plugins[plugin].lastSwitchDirection, M::SwitchForward);
+    subject->switchPlugin(MInputMethod::SwitchForward, inputMethod);
+    QCOMPARE(subject->plugins[plugin].lastSwitchDirection, MInputMethod::SwitchForward);
 
     QCOMPARE(subject->activePlugins.count(), 1);
     QVERIFY(plugin3 == *subject->activePlugins.begin());
-    inputMethodBase = subject->plugins[plugin3].inputMethod;
-    QVERIFY(inputMethodBase != 0);
-    inputMethod3 = dynamic_cast<DummyInputMethod3 *>(inputMethodBase);
+    abstractInputMethod = subject->plugins[plugin3].inputMethod;
+    QVERIFY(abstractInputMethod != 0);
+    inputMethod3 = dynamic_cast<DummyInputMethod3 *>(abstractInputMethod);
     QVERIFY(inputMethod3 != 0);
     QCOMPARE(inputMethod3->switchContextCallCount, 0);
     QCOMPARE(inputMethod3->setStateCount, 1);
@@ -466,14 +466,14 @@
 
     //switch backward
     inputMethod->setStateCount = 0;
-    subject->switchPlugin(M::SwitchBackward, inputMethod3);
-    QCOMPARE(subject->plugins[plugin3].lastSwitchDirection, M::SwitchBackward);
+    subject->switchPlugin(MInputMethod::SwitchBackward, inputMethod3);
+    QCOMPARE(subject->plugins[plugin3].lastSwitchDirection, MInputMethod::SwitchBackward);
 
     QCOMPARE(subject->activePlugins.count(), 1);
     QVERIFY(plugin == *subject->activePlugins.begin());
-    inputMethodBase = subject->plugins[plugin].inputMethod;
-    QVERIFY(inputMethodBase != 0);
-    inputMethod = dynamic_cast<DummyInputMethod *>(inputMethodBase);
+    abstractInputMethod = subject->plugins[plugin].inputMethod;
+    QVERIFY(abstractInputMethod != 0);
+    inputMethod = dynamic_cast<DummyInputMethod *>(abstractInputMethod);
     QVERIFY(inputMethod != 0);
     QCOMPARE(inputMethod->switchContextCallCount, 0);
     QCOMPARE(inputMethod->setStateCount, 1);
@@ -483,18 +483,18 @@
     checkHandlerMap(state, pluginName);
 
     // ... again
-    subject->switchPlugin(M::SwitchBackward, inputMethod);
-    QCOMPARE(subject->plugins[plugin].lastSwitchDirection, M::SwitchBackward);
+    subject->switchPlugin(MInputMethod::SwitchBackward, inputMethod);
+    QCOMPARE(subject->plugins[plugin].lastSwitchDirection, MInputMethod::SwitchBackward);
 
     QCOMPARE(subject->activePlugins.count(), 1);
     QVERIFY(plugin3 == *subject->activePlugins.begin());
-    inputMethodBase = subject->plugins[plugin3].inputMethod;
-    QVERIFY(inputMethodBase != 0);
-    inputMethod3 = dynamic_cast<DummyInputMethod3 *>(inputMethodBase);
+    abstractInputMethod = subject->plugins[plugin3].inputMethod;
+    QVERIFY(abstractInputMethod != 0);
+    inputMethod3 = dynamic_cast<DummyInputMethod3 *>(abstractInputMethod);
     QVERIFY(inputMethod3 != 0);
     QCOMPARE(inputMethod3->switchContextCallCount, 1);
     inputMethod3->switchContextCallCount = 0;
-    QCOMPARE(inputMethod3->directionParam, M::SwitchBackward);
+    QCOMPARE(inputMethod3->directionParam, MInputMethod::SwitchBackward);
     QVERIFY(inputMethod3->enableAnimationParam == false);
     QCOMPARE(inputMethod3->setStateCount, 1);
     inputMethod3->setStateCount = 0;
@@ -505,15 +505,16 @@
     // try to switch to plugin which could not support the same state
     // nothing should be changed
     plugin->allowedStates.clear();
-    subject->switchPlugin(M::SwitchBackward, inputMethod3);
-    plugin->allowedStates << OnScreen << Hardware << Accessory; // restore default configuration
-    QCOMPARE(subject->plugins[plugin3].lastSwitchDirection, M::SwitchBackward);
+    subject->switchPlugin(MInputMethod::SwitchBackward, inputMethod3);
+    plugin->allowedStates << MInputMethod::OnScreen << MInputMethod::Hardware
+                          << MInputMethod::Accessory; // restore default configuration
+    QCOMPARE(subject->plugins[plugin3].lastSwitchDirection, MInputMethod::SwitchBackward);
 
     QCOMPARE(subject->activePlugins.count(), 1);
     QVERIFY(plugin3 == *subject->activePlugins.begin());
     QVERIFY(inputMethod3 != 0);
-    inputMethodBase = inputMethod3;
-    QVERIFY(inputMethodBase == subject->plugins[plugin3].inputMethod);
+    abstractInputMethod = inputMethod3;
+    QVERIFY(abstractInputMethod == subject->plugins[plugin3].inputMethod);
     QCOMPARE(inputMethod3->switchContextCallCount, 0);
     QCOMPARE(inputMethod3->setStateCount, 0);
     inputMethod3->setStateCount = 0;
@@ -534,14 +535,14 @@
     QVERIFY(toolbarData1.data() != toolbarData2.data());
 
     manager->setToolbar(toolbarId1);
-    subject->setActivePlugin(plugin->name(), OnScreen);
-    subject->switchPlugin(M::SwitchForward, inputMethod);
+    subject->setActivePlugin(plugin->name(), MInputMethod::OnScreen);
+    subject->switchPlugin(MInputMethod::SwitchForward, inputMethod);
     QVERIFY(inputMethod->toolbarParam == toolbarData1);
     QVERIFY(inputMethod3->toolbarParam == toolbarData1);
 
     manager->setToolbar(toolbarId2);
-    subject->setActivePlugin(plugin3->name(), OnScreen);
-    subject->switchPlugin(M::SwitchBackward, inputMethod3);
+    subject->setActivePlugin(plugin3->name(), MInputMethod::OnScreen);
+    subject->switchPlugin(MInputMethod::SwitchBackward, inputMethod3);
     QVERIFY(inputMethod->toolbarParam == toolbarData2);
     QVERIFY(inputMethod3->toolbarParam == toolbarData2);
 
@@ -551,24 +552,26 @@
 
 void Ut_MIMPluginManager::checkHandlerMap(int handler, const QString &name)
 {
-    const QString key = QString(PluginRoot + subject->inputSourceName(static_cast<MIMHandlerState>(handler)));
+    const QString key
+        = QString(PluginRoot
+                  + subject->inputSourceName(static_cast<MInputMethod::HandlerState>(handler)));
     MGConfItem gconf(key);
     QCOMPARE(gconf.value().toString(), name);
 }
 
 void Ut_MIMPluginManager::testSwitchToSpecifiedPlugin()
 {
-    const MIMHandlerState state = OnScreen;
-    QSet<MIMHandlerState> actualState;
+    const MInputMethod::HandlerState state = MInputMethod::OnScreen;
+    QSet<MInputMethod::HandlerState> actualState;
     DummyImPlugin  *plugin  = 0;
     DummyImPlugin3 *plugin3 = 0;
-    MInputMethodBase *inputMethodBase = 0;
+    MAbstractInputMethod *abstractInputMethod = 0;
     QPointer<DummyInputMethod > inputMethod  = 0;
     QPointer<DummyInputMethod3> inputMethod3 = 0;
 
-    subject->addHandlerMap(OnScreen, pluginName);
-    subject->addHandlerMap(Hardware, pluginName);
-    subject->addHandlerMap(Accessory, pluginName);
+    subject->addHandlerMap(MInputMethod::OnScreen, pluginName);
+    subject->addHandlerMap(MInputMethod::Hardware, pluginName);
+    subject->addHandlerMap(MInputMethod::Accessory, pluginName);
 
     // find for loaded plugins
     for (MIMPluginManagerPrivate::Plugins::iterator iterator(subject->plugins.begin());
@@ -593,7 +596,7 @@
     subject->switchPlugin(pluginName, inputMethod);
     QVERIFY(inputMethod != 0);
     QCOMPARE(inputMethod->switchContextCallCount, 0);
-    QCOMPARE(subject->plugins[plugin].lastSwitchDirection, M::SwitchUndefined);
+    QCOMPARE(subject->plugins[plugin].lastSwitchDirection, MInputMethod::SwitchUndefined);
     QCOMPARE(subject->activePlugins.count(), 1);
     QVERIFY(plugin == *subject->activePlugins.begin());
     foreach (MInputMethodPlugin *handler, subject->handlerToPlugin.values()) {
@@ -602,17 +605,17 @@
 
     // switch to another plugin
     subject->switchPlugin(pluginName3, inputMethod);
-    QCOMPARE(subject->plugins[plugin].lastSwitchDirection, M::SwitchUndefined);
+    QCOMPARE(subject->plugins[plugin].lastSwitchDirection, MInputMethod::SwitchUndefined);
     QVERIFY(inputMethod != 0);
 
     QCOMPARE(subject->activePlugins.count(), 1);
     QVERIFY(plugin3 == *subject->activePlugins.begin());
-    inputMethodBase = subject->plugins[plugin3].inputMethod;
-    QVERIFY(inputMethodBase != 0);
-    inputMethod3 = dynamic_cast<DummyInputMethod3 *>(inputMethodBase);
+    abstractInputMethod = subject->plugins[plugin3].inputMethod;
+    QVERIFY(abstractInputMethod != 0);
+    inputMethod3 = dynamic_cast<DummyInputMethod3 *>(abstractInputMethod);
     QVERIFY(inputMethod3 != 0);
     QCOMPARE(inputMethod3->switchContextCallCount, 1);
-    QCOMPARE(inputMethod3->directionParam, M::SwitchUndefined);
+    QCOMPARE(inputMethod3->directionParam, MInputMethod::SwitchUndefined);
     QCOMPARE(inputMethod3->setStateCount, 1);
     inputMethod3->setStateCount = 0;
     QCOMPARE(inputMethod3->setStateParam.size(), 1);
@@ -630,7 +633,7 @@
     QVERIFY(plugin != 0);
     QCOMPARE(plugin->name(), pluginName);
 
-    subject->setActivePlugin(pluginName3, OnScreen);
+    subject->setActivePlugin(pluginName3, MInputMethod::OnScreen);
 
     // check gconf item
     MGConfItem handlerItem(PluginRoot + "onscreen");
@@ -644,16 +647,16 @@
 
 void Ut_MIMPluginManager::testSubViews()
 {
-    QList<MInputMethodBase::MInputMethodSubView> subViews;
+    QList<MAbstractInputMethod::MInputMethodSubView> subViews;
     foreach (MInputMethodPlugin *plugin, subject->plugins.keys()) {
-        subViews += subject->plugins[plugin].inputMethod->subViews(OnScreen);
+        subViews += subject->plugins[plugin].inputMethod->subViews(MInputMethod::OnScreen);
     }
-    // only has subviews for OnScreen
+    // only has subviews for MInputMethod::OnScreen
     QCOMPARE(subViews.count(), 4);
 
     subViews.clear();
     foreach (MInputMethodPlugin *plugin, subject->plugins.keys()) {
-        subViews += subject->plugins[plugin].inputMethod->subViews(Hardware);
+        subViews += subject->plugins[plugin].inputMethod->subViews(MInputMethod::Hardware);
     }
     // doesn't have subviews for Hardware
     QCOMPARE(subViews.count(), 0);
@@ -667,19 +670,19 @@
     plugin = *subject->activePlugins.begin();
     QVERIFY(plugin != 0);
     QCOMPARE(plugin->name(), pluginName);
-    QCOMPARE(subject->activeSubView(OnScreen), QString("dummyimsv1"));
-    subject->_q_setActiveSubView(QString("dummyimsv2"), OnScreen);
-    QCOMPARE(subject->activeSubView(OnScreen), QString("dummyimsv2"));
+    QCOMPARE(subject->activeSubView(MInputMethod::OnScreen), QString("dummyimsv1"));
+    subject->_q_setActiveSubView(QString("dummyimsv2"), MInputMethod::OnScreen);
+    QCOMPARE(subject->activeSubView(MInputMethod::OnScreen), QString("dummyimsv2"));
 
-    subject->setActivePlugin(pluginName3, OnScreen);
+    subject->setActivePlugin(pluginName3, MInputMethod::OnScreen);
     QVERIFY(subject->activePlugins.size() == 1);
     plugin = *subject->activePlugins.begin();
     QVERIFY(plugin != 0);
     QCOMPARE(plugin->name(), pluginName3);
-    QCOMPARE(subject->activeSubView(OnScreen), QString("dummyim3sv1"));
+    QCOMPARE(subject->activeSubView(MInputMethod::OnScreen), QString("dummyim3sv1"));
 
-    subject->_q_setActiveSubView(QString("dummyim3sv2"), OnScreen);
-    QCOMPARE(subject->activeSubView(OnScreen), QString("dummyim3sv2"));
+    subject->_q_setActiveSubView(QString("dummyim3sv2"), MInputMethod::OnScreen);
+    QCOMPARE(subject->activeSubView(MInputMethod::OnScreen), QString("dummyim3sv2"));
 }
 
 void Ut_MIMPluginManager::testDBusQueryCalls()
@@ -693,29 +696,30 @@
     plugin = *subject->activePlugins.begin();
     QVERIFY(plugin != 0);
     QCOMPARE(plugin->name(), pluginName);
-    QCOMPARE(subject->activeSubView(OnScreen), QString("dummyimsv1"));
+    QCOMPARE(subject->activeSubView(MInputMethod::OnScreen), QString("dummyimsv1"));
 
     QVERIFY(m_clientInterface);
-    QDBusReply<QStringList> AvailablePluginReply = m_clientInterface->call("queryAvailablePlugins", OnScreen);
+    QDBusReply<QStringList> AvailablePluginReply
+        = m_clientInterface->call("queryAvailablePlugins", MInputMethod::OnScreen);
     QVERIFY(AvailablePluginReply.isValid());
     QCOMPARE(AvailablePluginReply.value().count(), 2);
     QVERIFY(AvailablePluginReply.value().contains(pluginName));
     QVERIFY(AvailablePluginReply.value().contains(pluginName3));
 
-    QDBusReply<QString> ActivePluginReply = m_clientInterface->call("queryActivePlugin", OnScreen);
+    QDBusReply<QString> ActivePluginReply = m_clientInterface->call("queryActivePlugin",
+                                                                    MInputMethod::OnScreen);
     QVERIFY(ActivePluginReply.isValid());
     QCOMPARE(ActivePluginReply.value(), pluginName);
 
-    QDBusReply< QMap<QString, QVariant> > activeSubViewReply = m_clientInterface->call("queryActiveSubView",
-                                                                                       OnScreen);
+    QDBusReply< QMap<QString, QVariant> > activeSubViewReply
+        = m_clientInterface->call("queryActiveSubView", MInputMethod::OnScreen);
     QVERIFY(activeSubViewReply.isValid());
     QVERIFY(activeSubViewReply.value().count() > 0);
     QCOMPARE(activeSubViewReply.value().values().at(0).toString(), pluginName);
     QCOMPARE(activeSubViewReply.value().keys().at(0), QString("dummyimsv1"));
 
-    QDBusReply< QMap<QString, QVariant> > subViewsReply = m_clientInterface->call("queryAvailableSubViews",
-                                                                                  pluginName,
-                                                                                  OnScreen);
+    QDBusReply< QMap<QString, QVariant> > subViewsReply
+        = m_clientInterface->call("queryAvailableSubViews", pluginName, MInputMethod::OnScreen);
     QVERIFY(subViewsReply.isValid());
     QCOMPARE(subViewsReply.value().count(), 2);
 }
@@ -731,45 +735,50 @@
     plugin = *subject->activePlugins.begin();
     QVERIFY(plugin != 0);
     QCOMPARE(plugin->name(), pluginName);
-    QCOMPARE(subject->activeSubView(OnScreen), QString("dummyimsv1"));
+    QCOMPARE(subject->activeSubView(MInputMethod::OnScreen), QString("dummyimsv1"));
 
     QVERIFY(m_clientInterface);
 
-    m_clientInterface->call(QDBus::NoBlock, "setActivePlugin", pluginName3, static_cast<int>(OnScreen));
+    m_clientInterface->call(QDBus::NoBlock, "setActivePlugin", pluginName3,
+                            static_cast<int>(MInputMethod::OnScreen));
     handleMessages();
 
     QVERIFY(subject->activePlugins.size() == 1);
     plugin = *subject->activePlugins.begin();
     QVERIFY(plugin != 0);
     QCOMPARE(plugin->name(), pluginName3);
-    QCOMPARE(subject->activeSubView(OnScreen), QString("dummyim3sv1"));
+    QCOMPARE(subject->activeSubView(MInputMethod::OnScreen), QString("dummyim3sv1"));
 
     // try to set a wrong plugin
-    m_clientInterface->call(QDBus::NoBlock, "setActivePlugin", pluginName2, static_cast<int>(OnScreen));
+    m_clientInterface->call(QDBus::NoBlock, "setActivePlugin", pluginName2,
+                            static_cast<int>(MInputMethod::OnScreen));
     handleMessages();
     QVERIFY(subject->activePlugins.size() == 1);
     plugin = *subject->activePlugins.begin();
     QVERIFY(plugin != 0);
     QCOMPARE(plugin->name(), pluginName3);
 
-    m_clientInterface->call(QDBus::NoBlock, "setActiveSubView", QString("dummyim3sv2"), static_cast<int>(OnScreen));
+    m_clientInterface->call(QDBus::NoBlock, "setActiveSubView", QString("dummyim3sv2"),
+                            static_cast<int>(MInputMethod::OnScreen));
     handleMessages();
-    QCOMPARE(subject->activeSubView(OnScreen), QString("dummyim3sv2"));
+    QCOMPARE(subject->activeSubView(MInputMethod::OnScreen), QString("dummyim3sv2"));
 
     // try to set a wrong subview
-    m_clientInterface->call(QDBus::NoBlock, "setActiveSubView", QString("dummyimisv2"), static_cast<int>(OnScreen));
+    m_clientInterface->call(QDBus::NoBlock, "setActiveSubView", QString("dummyimisv2"),
+                            static_cast<int>(MInputMethod::OnScreen));
     handleMessages();
-    QCOMPARE(subject->activeSubView(OnScreen), QString("dummyim3sv2"));
+    QCOMPARE(subject->activeSubView(MInputMethod::OnScreen), QString("dummyim3sv2"));
 
     // try to set both subview id and plugin
-    m_clientInterface->call(QDBus::NoBlock, "setActivePlugin", pluginName, static_cast<int>(OnScreen),
+    m_clientInterface->call(QDBus::NoBlock, "setActivePlugin", pluginName,
+                            static_cast<int>(MInputMethod::OnScreen),
                             QString("dummyimsv1"));
     handleMessages();
     QVERIFY(subject->activePlugins.size() == 1);
     plugin = *subject->activePlugins.begin();
     QVERIFY(plugin != 0);
     QCOMPARE(plugin->name(), pluginName);
-    QCOMPARE(subject->activeSubView(OnScreen), QString("dummyimsv1"));
+    QCOMPARE(subject->activeSubView(MInputMethod::OnScreen), QString("dummyimsv1"));
 }
 
 void Ut_MIMPluginManager::testRegionUpdates()
@@ -831,7 +840,7 @@
     QVERIFY(toolbarData2.data());
     QVERIFY(toolbarData1.data() != toolbarData2.data());
 
-    subject->setActivePlugin(plugin1->name(), OnScreen);
+    subject->setActivePlugin(plugin1->name(), MInputMethod::OnScreen);
     manager->setToolbar(toolbarId1);
     QVERIFY(inputMethod->toolbarParam == toolbarData1);
     manager->setToolbar(toolbarId2);
--- tests/ut_mimsettingsconf/ut_mimsettingsconf.cpp
+++ tests/ut_mimsettingsconf/ut_mimsettingsconf.cpp
@@ -9,7 +9,7 @@
 #include <mimpluginmanager.h>
 #include <minputmethodplugin.h>
 
-Q_DECLARE_METATYPE(MIMHandlerState);
+Q_DECLARE_METATYPE(MInputMethod::HandlerState);
 
 namespace
 {
@@ -85,8 +85,8 @@
     MImSettingsConf::instance().setActivePlugin(pluginName);
     MImSettingsConf::instance().setActiveSubView(QString("dummyimsv1"));
     handleMessages();
-    QCOMPARE(manager->activePluginsName(OnScreen), pluginName);
-    QCOMPARE(manager->activeSubView(OnScreen), QString("dummyimsv1"));
+    QCOMPARE(manager->activePluginsName(MInputMethod::OnScreen), pluginName);
+    QCOMPARE(manager->activeSubView(MInputMethod::OnScreen), QString("dummyimsv1"));
 }
 
 void Ut_MIMSettingsConf::cleanup()
@@ -111,21 +111,21 @@
 void Ut_MIMSettingsConf::testSetActivePlugin()
 {
     QCOMPARE(MImSettingsConf::instance().plugins().size(), 2);
-    QCOMPARE(manager->activePluginsName(OnScreen), pluginName);
+    QCOMPARE(manager->activePluginsName(MInputMethod::OnScreen), pluginName);
 
     MImSettingsConf::instance().setActivePlugin(pluginName3);
     handleMessages();
     MGConfItem handlerItem(PluginRoot + "onscreen");
     QCOMPARE(handlerItem.value().toString(), pluginName3);
     QVERIFY(manager->activePluginsNames().size() == 1);
-    QCOMPARE(manager->activePluginsName(OnScreen), pluginName3);
+    QCOMPARE(manager->activePluginsName(MInputMethod::OnScreen), pluginName3);
 
     MImSettingsConf::instance().setActivePlugin(pluginName, QString("dummyimsv2"));
     handleMessages();
     QCOMPARE(handlerItem.value().toString(), pluginName);
     QVERIFY(manager->activePluginsNames().size() == 1);
-    QCOMPARE(manager->activePluginsName(OnScreen), pluginName);
-    QCOMPARE(manager->activeSubView(OnScreen), QString("dummyimsv2"));
+    QCOMPARE(manager->activePluginsName(MInputMethod::OnScreen), pluginName);
+    QCOMPARE(manager->activeSubView(MInputMethod::OnScreen), QString("dummyimsv2"));
 
 }
 
--- tests/ut_mimsettingsdialog/ut_mimsettingsdialog.cpp
+++ tests/ut_mimsettingsdialog/ut_mimsettingsdialog.cpp
@@ -98,14 +98,15 @@
 
 void Ut_MIMSettingsDialog::testShowAvailableSubViewList()
 {
-    QString activePlugin = pluginMgr->activePluginsName(OnScreen);
+    QString activePlugin = pluginMgr->activePluginsName(MInputMethod::OnScreen);
     QVERIFY(activePlugin == PluginName);
 
-    QMap<QString, QString> availableSubviews = pluginMgr->availableSubViews(activePlugin, OnScreen);
+    QMap<QString, QString> availableSubviews = pluginMgr->availableSubViews(activePlugin,
+                                                                            MInputMethod::OnScreen);
     QCOMPARE(availableSubviews.count(), 2);
 
-    pluginMgr->setActiveSubView(QString("dummyimsv2"), OnScreen);
-    QCOMPARE(pluginMgr->activeSubView(OnScreen), QString("dummyimsv2"));
+    pluginMgr->setActiveSubView(QString("dummyimsv2"), MInputMethod::OnScreen);
+    QCOMPARE(pluginMgr->activeSubView(MInputMethod::OnScreen), QString("dummyimsv2"));
 
     subject->showAvailableSubViewList();
 
@@ -133,7 +134,7 @@
     QCOMPARE(items.count(), 1);
     subject->availableSubViewList->click(items[0]->index());
 
-    QCOMPARE(pluginMgr->activeSubView(OnScreen), QString("dummyimsv2"));
+    QCOMPARE(pluginMgr->activeSubView(MInputMethod::OnScreen), QString("dummyimsv2"));
 }
 
 void Ut_MIMSettingsDialog::testRetranslateUi()
--- tests/ut_minputcontext/ut_minputcontext.cpp
+++ tests/ut_minputcontext/ut_minputcontext.cpp
@@ -273,9 +273,11 @@
     activateContextCallCount++;
 }
 
-void InputMethodServerDBusStub::sendKeyEvent(const QKeyEvent &keyEvent)
+void InputMethodServerDBusStub::sendKeyEvent(const QKeyEvent &keyEvent,
+                                             MInputMethod::EventRequestType requestType)
 {
     Q_UNUSED(keyEvent);
+    Q_UNUSED(requestType)
     keyEventCallCount++;
 }
 
@@ -429,6 +431,13 @@
 
 void Ut_MInputContext::init()
 {
+    // see NB#198630
+    // ut_minputcontext now is using a stub QDBusConnection, while we have
+    // implicit dependency to contextsubscrible, and contenxtsubscrible also
+    // try to use QDBusConnect. Our stub QDbusConnection will lead to the
+    // contenxtsubscrible crash.
+    QSKIP("Stubbed QtDBus makes ut_minputcontext can not really work", SkipAll);
+
     m_stub->resetCallCounts();
 }
 
@@ -551,7 +560,7 @@
     //test preedit with traditional style
     m_subject->setFocusWidget(&widget);
     gFocusedWidget = &widget;
-    m_subject->updatePreedit(updateString, PreeditDefault);
+    m_subject->updatePreedit(updateString, MInputMethod::PreeditDefault);
 
     waitAndProcessEvents(0);
 
@@ -563,7 +572,7 @@
     QVERIFY(attributes.count() > 0);
 
     //test preedit with alternate style
-    m_subject->updatePreedit(updateString, PreeditNoCandidates);
+    m_subject->updatePreedit(updateString, MInputMethod::PreeditNoCandidates);
 
     waitAndProcessEvents(50);
 
@@ -605,12 +614,12 @@
 void Ut_MInputContext::testSendKeyEvent()
 {
     QKeyEvent keyEvent(QEvent::KeyPress, Qt::Key_Backspace, Qt::NoModifier);
-    m_stub->sendKeyEvent(keyEvent);
+    m_stub->sendKeyEvent(keyEvent, MInputMethod::EventRequestBoth);
     QCOMPARE(m_stub->keyEventCount(), 1);
 
     WidgetStub widget(0);
     m_subject->setFocusWidget(&widget);
-    m_stub->sendKeyEvent(keyEvent);
+    m_stub->sendKeyEvent(keyEvent, MInputMethod::EventRequestBoth);
     QCOMPARE(m_stub->keyEventCount(), 2);
 
 }
@@ -651,32 +660,14 @@
 
     QApplication::clipboard()->clear();
 
-    QTest::qWait(500); // just processing pending events is not robust.
-    while (app->hasPendingEvents()) {
-        app->processEvents();
-    }
+    waitAndProcessEvents(100);
 
     int count = m_stub->setCopyPasteStateCount();
     params.clear();
     qDebug() << "No focused widget";
     gFocusedWidget = 0;
     m_subject->setFocusWidget(0);
-    QTest::qWait(500); // just processing pending events is not robust.
-    while (app->hasPendingEvents()) {
-        app->processEvents();
-    }
-    ++count;
-    QCOMPARE(m_stub->setCopyPasteStateCount(), count);
-    QCOMPARE(params.count(), 2);
-    QCOMPARE(params.takeFirst(), false);
-    QCOMPARE(params.takeFirst(), false);
-
-    qDebug() << "Update button state";
-    m_subject->manageCopyPasteState(false);
-    QTest::qWait(500); // just processing pending events is not robust.
-    while (app->hasPendingEvents()) {
-        app->processEvents();
-    }
+    waitAndProcessEvents(100);
     ++count;
     QCOMPARE(m_stub->setCopyPasteStateCount(), count);
     QCOMPARE(params.count(), 2);
@@ -686,10 +677,7 @@
     qDebug() << "Set widget without selection";
     gFocusedWidget = &widget;
     m_subject->setFocusWidget(&widget);
-    QTest::qWait(500); // just processing pending events is not robust.
-    while (app->hasPendingEvents()) {
-        app->processEvents();
-    }
+    waitAndProcessEvents(100);
     ++count;
     QCOMPARE(m_stub->setCopyPasteStateCount(), count);
     QCOMPARE(params.count(), 2);
@@ -698,41 +686,66 @@
 
     qDebug() << "Update button state with empty selection";
     widget.sendCopyAvailable(false);
-    QTest::qWait(500); // just processing pending events is not robust.
-    while (app->hasPendingEvents()) {
-        app->processEvents();
-    }
-    ++count;
+    waitAndProcessEvents(100);
     QCOMPARE(m_stub->setCopyPasteStateCount(), count);
-    QCOMPARE(params.count(), 2);
-    QCOMPARE(params.takeFirst(), false);
-    QCOMPARE(params.takeFirst(), false);
 
+    qDebug() << "Update button state with something selected";
     widget.selectedText = "Some text";
     widget.sendCopyAvailable(true);
     qDebug() << "Text was selected";
-    QTest::qWait(500); // just processing pending events is not robust.
-    while (app->hasPendingEvents()) {
-        app->processEvents();
-    }
+    waitAndProcessEvents(100);
     ++count;
     QVERIFY(m_stub->setCopyPasteStateCount() == count);
     QVERIFY(params.count() == 2);
     QCOMPARE(params.takeFirst(), true);
     QCOMPARE(params.takeFirst(), false);
 
+    qDebug() << "Set some text to clipboard (simulate paste)";
+    QApplication::clipboard()->setText("Some text");
+    waitAndProcessEvents(100);
+    ++count;
+    QCOMPARE(m_stub->setCopyPasteStateCount(), count);
+    QCOMPARE(params.count(), 2);
+    QCOMPARE(params.takeFirst(), true);
+    QCOMPARE(params.takeFirst(), true);
+
+    qDebug() << "Update button state with text unselected";
+    widget.sendCopyAvailable(false);
+    waitAndProcessEvents(100);
+    ++count;
+    QCOMPARE(m_stub->setCopyPasteStateCount(), count);
+    QCOMPARE(params.count(), 2);
+    QCOMPARE(params.takeFirst(), false);
+    QCOMPARE(params.takeFirst(), true);
+
+    qDebug() << "Clear clipboard";
+    QApplication::clipboard()->clear();
+    waitAndProcessEvents(100);
+    ++count;
+    QCOMPARE(m_stub->setCopyPasteStateCount(), count);
+    QCOMPARE(params.count(), 2);
+    QCOMPARE(params.takeFirst(), false);
+    QCOMPARE(params.takeFirst(), false);
+
     qDebug() << "Restore initial state";
     gFocusedWidget = 0;
     m_subject->setFocusWidget(0);
-    QTest::qWait(500); // just processing pending events is not robust.
-    while (app->hasPendingEvents()) {
-        app->processEvents();
-    }
+    waitAndProcessEvents(100);
     ++count;
     QVERIFY(m_stub->setCopyPasteStateCount() == count);
     QCOMPARE(params.count(), 2);
     QCOMPARE(params.takeFirst(), false);
     QCOMPARE(params.takeFirst(), false);
+
+    qDebug() << "Set some text to clipboard (simulate paste)";
+    QApplication::clipboard()->setText("Some text");
+    waitAndProcessEvents(100);
+    QVERIFY(m_stub->setCopyPasteStateCount() == count);
+
+    qDebug() << "Clear clipboard";
+    QApplication::clipboard()->clear();
+    waitAndProcessEvents(100);
+    QVERIFY(m_stub->setCopyPasteStateCount() == count);
 }
 
 void Ut_MInputContext::testSetRedirectKeys()
--- tests/ut_minputcontext/ut_minputcontext.h
+++ tests/ut_minputcontext/ut_minputcontext.h
@@ -55,7 +55,8 @@
 
     void setContextObject(const QString &callbackObject);
     void activateContext();
-    void sendKeyEvent(const QKeyEvent &keyEvent);
+    void sendKeyEvent(const QKeyEvent &keyEvent,
+                      MInputMethod::EventRequestType requestType);
 
     void appOrientationChanged(int angle);
 
--- tests/ut_minputcontextdbusconnection
+++ tests/ut_minputcontextdbusconnection
-(directory)
--- tests/ut_minputcontextdbusconnection/ut_minputcontextdbusconnection.cpp
+++ tests/ut_minputcontextdbusconnection/ut_minputcontextdbusconnection.cpp
-#include "ut_minputcontextdbusconnection.h"
-
-#include <MApplication>
-#include <QDebug>
-#include <QDBusArgument>
-#include <QSignalSpy>
-
-#include "minputcontextadaptor_stub.h"
-#include "mpreeditinjectionevent.h"
-
-
-namespace
-{
-    const char *const DBusServiceName = "com.meego.inputmethod.uiserver1";
-    const char *const DBusPath = "/com/meego/inputmethod/uiserver1";
-    const char *const DBusInterface = "com.meego.inputmethod.uiserver1";
-
-    // note: avoid path specified in MInputContext to avoid problems if it is instantiated
-    const char *const DBusCallbackPath = "/com/meego/inputmethod/inputcontextTEST";
-
-    int DBusWaitTime = 500;
-
-    const QString TestingInSandboxEnvVariable("TESTING_IN_SANDBOX");
-}
-
-
-//////////////////////////////////////
-// Target for input context connection
-
-TargetStub::TargetStub(MInputContextConnection *icConnection, QObject *parent)
-    : MInputMethodBase(icConnection, parent)
-{
-    resetCallCounts();
-}
-
-TargetStub::~TargetStub()
-{
-}
-
-void TargetStub::show()
-{
-    m_showCallCount++;
-}
-
-void TargetStub::hide()
-{
-    m_hideCallCount++;
-}
-
-void TargetStub::setPreedit(const QString &preeditString)
-{
-    Q_UNUSED(preeditString)
-
-    m_setPreeditCallCount++;
-}
-
-void TargetStub::reset()
-{
-    m_resetCallCount++;
-}
-
-void TargetStub::mouseClickedOnPreedit(const QPoint &pos, const QRect &preeditRect)
-{
-    Q_UNUSED(pos);
-    Q_UNUSED(preeditRect);
-
-    m_mouseClickedOnPreeditCallCount++;
-}
-
-void TargetStub::update()
-{
-    m_updateCallCount++;
-}
-
-void TargetStub::visualizationPriorityChanged(bool enabled)
-{
-    Q_UNUSED(enabled);
-    m_visualizationPriorityChangedCallCount++;
-}
-
-void TargetStub::appOrientationChanged(int angle)
-{
-    Q_UNUSED(angle);
-    m_appOrientationChangedCallCount++;
-}
-
-void TargetStub::processKeyEvent(QEvent::Type keyType, Qt::Key keyCode,
-                                 Qt::KeyboardModifiers modifiers, const QString &text,
-                                 bool autoRepeat, int count, quint32 nativeScanCode,
-                                 quint32 nativeModifiers)
-{
-    Q_UNUSED(keyType);
-    Q_UNUSED(keyCode);
-    Q_UNUSED(modifiers);
-    Q_UNUSED(text);
-    Q_UNUSED(autoRepeat);
-    Q_UNUSED(count);
-    Q_UNUSED(nativeScanCode);
-    Q_UNUSED(nativeModifiers);
-
-    m_processKeyEventCallCount++;
-}
-
-void TargetStub::resetCallCounts()
-{
-    m_showCallCount = 0;
-    m_hideCallCount = 0;
-    m_setPreeditCallCount = 0;
-    m_resetCallCount = 0;
-    m_mouseClickedOnPreeditCallCount = 0;
-    m_updateCallCount = 0;
-    m_visualizationPriorityChangedCallCount = 0;
-    m_appOrientationChangedCallCount = 0;
-    m_processKeyEventCallCount = 0;
-}
-
-int TargetStub::showCallCount()
-{
-    return m_showCallCount;
-}
-
-int TargetStub::hideCallCount()
-{
-    return m_hideCallCount;
-}
-
-int TargetStub::setPreeditCallCount()
-{
-    return m_setPreeditCallCount;
-}
-
-int TargetStub::resetCallCount()
-{
-    return m_resetCallCount;
-}
-
-int TargetStub::mouseClickedOnPreeditCallCount()
-{
-    return m_mouseClickedOnPreeditCallCount;
-}
-
-int TargetStub::updateCallCount()
-{
-    return m_updateCallCount;
-}
-
-int TargetStub::visualizationPriorityChangedCallCount()
-{
-    return m_visualizationPriorityChangedCallCount;
-}
-
-int TargetStub::appOrientationChangedCallCount()
-{
-    return m_appOrientationChangedCallCount;
-}
-
-int TargetStub::processKeyEventCallCount()
-{
-    return m_processKeyEventCallCount;
-}
-
-//////////////
-// actual test
-
-void Ut_MInputContextDBusConnection::initTestCase()
-{
-    // This is a hack to prevent Qt from loading the plugin from
-    // /usr/lib/qt4/plugins/inputmethods/ when we are testing in a
-    // sandbox.
-    bool testingInSandbox = false;
-    const QStringList env(QProcess::systemEnvironment());
-    int index = env.indexOf(QRegExp('^' + TestingInSandboxEnvVariable + "=.*", Qt::CaseInsensitive));
-    if (index != -1) {
-        QString statusCandidate = env.at(index);
-        statusCandidate = statusCandidate.remove(
-                              QRegExp('^' + TestingInSandboxEnvVariable + '=', Qt::CaseInsensitive));
-        bool statusOk = false;
-        int status = statusCandidate.toInt(&statusOk);
-        if (statusOk && (status == 0 || status == 1)) {
-            testingInSandbox = (status == 1);
-        } else {
-            qDebug() << "Invalid " << TestingInSandboxEnvVariable << " environment variable.\n";
-            QFAIL("Attempt to execute test incorrectly.");
-        }
-    }
-    if (testingInSandbox)
-        QCoreApplication::setLibraryPaths(QStringList("/tmp"));
-
-    static char *argv[1] = { (char *) "ut_minputcontextdbusconnection" };
-    static int argc = 1;
-
-    MApplication::setLoadMInputContext(false);
-    app = new MApplication(argc, argv);
-
-    m_subject = new MInputContextDBusConnection;
-    m_inputMethod = new TargetStub(m_subject);
-    m_inputContext = new MInputContext(0);
-    m_clientInterface = 0;
-
-    if (!m_subject->isValid()) {
-        QSKIP("MInputContextDBusConnection object not valid. Possibly other program using it running.",
-              SkipAll);
-    }
-
-    m_subject->addTarget(m_inputMethod);
-
-    // init dbus client
-    if (!QDBusConnection::sessionBus().isConnected()) {
-        QFAIL("Cannot connect to the DBus session bus");
-    }
-
-    QDBusConnection connection = QDBusConnection::sessionBus();
-    m_clientInterface = new QDBusInterface(DBusServiceName, DBusPath, DBusInterface, connection, 0);
-
-    if (!m_clientInterface->isValid()) {
-        QFAIL(qPrintable(QDBusConnection::sessionBus().lastError().message()));
-    }
-
-    // connect methods we offer via DBus
-    QString contextObjectName(DBusCallbackPath);
-    new MInputContextAdaptor(m_inputContext);
-    connection.registerObject(contextObjectName, m_inputContext);
-
-    m_clientInterface->call(QDBus::NoBlock, "setContextObject", contextObjectName);
-    m_clientInterface->call(QDBus::NoBlock, "activateContext");
-
-    // make sure dbus calls are handled before continuing to call things on m_subject
-    handleMessages();
-}
-
-
-void Ut_MInputContextDBusConnection::cleanupTestCase()
-{
-    delete m_inputMethod;
-    delete m_subject;
-    delete m_clientInterface;
-    delete app;
-    delete m_inputContext;
-}
-
-
-void Ut_MInputContextDBusConnection::init()
-{
-    m_inputMethod->resetCallCounts();
-    gMInputContextAdaptorStub->stubReset();
-}
-
-
-void Ut_MInputContextDBusConnection::cleanup()
-{
-}
-
-
-
-// test methods:
-
-// tests that calls get through dbus
-void Ut_MInputContextDBusConnection::testNoReplyDBusCalls()
-{
-    QString preedit("preedit string");
-    m_subject->sendPreeditString(preedit, PreeditDefault);
-    handleMessages();
-    QCOMPARE(gMInputContextAdaptorStub->stubCallCount("updatePreedit"), 1);
-    QCOMPARE(gMInputContextAdaptorStub->stubLastCallTo("updatePreedit").parameter<QString>(0, ""), preedit);
-    QCOMPARE(gMInputContextAdaptorStub->stubLastCallTo("updatePreedit").parameter<int>(1, -1), (int)PreeditDefault);
-
-    m_subject->sendPreeditString(preedit, PreeditNoCandidates);
-    handleMessages();
-    QCOMPARE(gMInputContextAdaptorStub->stubCallCount("updatePreedit"), 2);
-    QCOMPARE(gMInputContextAdaptorStub->stubLastCallTo("updatePreedit").parameter<QString>(0, ""), preedit);
-    QCOMPARE(gMInputContextAdaptorStub->stubLastCallTo("updatePreedit").parameter<int>(1, -1), (int)PreeditNoCandidates);
-
-    QString commit("commit string");
-    m_subject->sendCommitString(commit);
-    handleMessages();
-    QCOMPARE(gMInputContextAdaptorStub->stubCallCount("commitString"), 1);
-    QCOMPARE(gMInputContextAdaptorStub->stubLastCallTo("commitString").parameter<QString>(0, ""), commit);
-
-    m_subject->sendKeyEvent(QKeyEvent(QEvent::KeyPress, 0, 0, QString(), false, 0));
-    handleMessages();
-    QCOMPARE(gMInputContextAdaptorStub->stubCallCount("keyEvent"), 1);
-
-    m_subject->notifyImInitiatedHiding();
-    handleMessages();
-    QCOMPARE(gMInputContextAdaptorStub->stubCallCount("imInitiatedHide"), 1);
-
-    QRegion region(0, 0, 10, 10);
-    m_subject->updateInputMethodArea(region);
-    handleMessages();
-    QCOMPARE(gMInputContextAdaptorStub->stubCallCount("updateInputMethodArea"), 1);
-    QList<QVariant> rectList = gMInputContextAdaptorStub->stubLastCallTo("updateInputMethodArea").parameter< QList<QVariant> >(0, QList<QVariant>());
-    QCOMPARE(rectList.length(), 1);
-    QCOMPARE(region.rects().at(0), qdbus_cast<QRect>(rectList.at(0)));
-
-    m_subject->setGlobalCorrectionEnabled(true);
-    handleMessages();
-    QCOMPARE(gMInputContextAdaptorStub->stubCallCount("setGlobalCorrectionEnabled"), 1);
-    QVERIFY(gMInputContextAdaptorStub->stubLastCallTo("setGlobalCorrectionEnabled").parameter<bool>(0, false));
-
-    m_subject->setRedirectKeys(true);
-    handleMessages();
-    QCOMPARE(gMInputContextAdaptorStub->stubCallCount("setRedirectKeys"), 1);
-
-    m_subject->setDetectableAutoRepeat(true);
-    handleMessages();
-    QCOMPARE(gMInputContextAdaptorStub->stubCallCount("setDetectableAutoRepeat"), 1);
-}
-
-
-void Ut_MInputContextDBusConnection::testShowOnFocus()
-{
-    QSignalSpy showSpy(m_subject, SIGNAL(showInputMethodRequest()));
-    m_clientInterface->call(QDBus::NoBlock, "showInputMethod");
-
-    handleMessages();
-
-    QCOMPARE(showSpy.count(), 1);
-}
-
-
-void Ut_MInputContextDBusConnection::testHideOnLostFocus()
-{
-    QSignalSpy hideSpy(m_subject, SIGNAL(hideInputMethodRequest()));
-    m_clientInterface->call(QDBus::NoBlock, "hideInputMethod");
-
-    handleMessages();
-
-    QCOMPARE(hideSpy.count(), 1);
-}
-
-
-void Ut_MInputContextDBusConnection::testMouseClickedOnPreedit()
-{
-    QPoint pos(1, 1);
-    QRect rect;
-    m_clientInterface->call(QDBus::NoBlock, "mouseClickedOnPreedit", pos, rect);
-
-    handleMessages();
-
-    QCOMPARE(m_inputMethod->mouseClickedOnPreeditCallCount(), 1);
-}
-
-
-void Ut_MInputContextDBusConnection::testSetPreedit()
-{
-    QString preedit("preedit string");
-    m_clientInterface->call(QDBus::NoBlock, "setPreedit", preedit);
-
-    handleMessages();
-
-    QCOMPARE(m_inputMethod->setPreeditCallCount(), 1);
-}
-
-
-void Ut_MInputContextDBusConnection::testReset()
-{
-    m_clientInterface->call(QDBus::NoBlock, "reset");
-
-    handleMessages();
-
-    QCOMPARE(m_inputMethod->resetCallCount(), 1);
-}
-
-void Ut_MInputContextDBusConnection::testAppOrientationChanged()
-{
-    m_clientInterface->call(QDBus::NoBlock, "appOrientationChanged", 90);
-
-    handleMessages();
-
-    QCOMPARE(m_inputMethod->appOrientationChangedCallCount(), 1);
-}
-
-void Ut_MInputContextDBusConnection::testProcessKeyEvent()
-{
-    m_clientInterface->call(QDBus::NoBlock, "processKeyEvent", 0, 0, 0, "", false, 0, 0, 0);
-
-    handleMessages();
-
-    QCOMPARE(m_inputMethod->processKeyEventCallCount(), 1);
-}
-
-void Ut_MInputContextDBusConnection::handleMessages()
-{
-    QTest::qWait(DBusWaitTime);
-    while (app->hasPendingEvents()) {
-        app->processEvents();
-    }
-}
-
-
-
-QTEST_APPLESS_MAIN(Ut_MInputContextDBusConnection)
--- tests/ut_minputcontextdbusconnection/ut_minputcontextdbusconnection.h
+++ tests/ut_minputcontextdbusconnection/ut_minputcontextdbusconnection.h
-#ifndef UT_MINPUTCONTEXTDBUSCONNECTION_H
-#define UT_MINPUTCONTEXTDBUSCONNECTION_H
-
-#include <QtTest/QtTest>
-#include <QObject>
-#include <QDBusAbstractAdaptor>
-#include <QDBusInterface>
-
-#include "minputcontextdbusconnection.h"
-#include "minputmethodbase.h"
-
-
-class MApplication;
-class QGraphicsScene;
-class MInputContext;
-
-// input method base stub that dbus connection calls
-class TargetStub: public MInputMethodBase
-{
-public:
-    TargetStub(MInputContextConnection *icConnection, QObject *parent = 0);
-    virtual ~TargetStub();
-
-    virtual void show();
-    virtual void hide();
-    virtual void setPreedit(const QString &preeditString);
-    virtual void reset();
-    virtual void mouseClickedOnPreedit(const QPoint &pos, const QRect &preeditRect);
-    virtual void update();
-    virtual void visualizationPriorityChanged(bool enabled);
-    virtual void appOrientationChanged(int angle);
-    virtual void processKeyEvent(QEvent::Type keyType, Qt::Key keyCode,
-                                 Qt::KeyboardModifiers modifiers, const QString &text,
-                                 bool autoRepeat, int count, quint32 nativeScanCode,
-                                 quint32 nativeModifiers);
-
-    void resetCallCounts();
-    int showCallCount();
-    int hideCallCount();
-    int setPreeditCallCount();
-    int resetCallCount();
-    int mouseClickedOnPreeditCallCount();
-    int updateCallCount();
-    int visualizationPriorityChangedCallCount();
-    int appOrientationChangedCallCount();
-    int processKeyEventCallCount();
-
-private:
-    int m_showCallCount;
-    int m_hideCallCount;
-    int m_setPreeditCallCount;
-    int m_resetCallCount;
-    int m_mouseClickedOnPreeditCallCount;
-    int m_updateCallCount;
-    int m_visualizationPriorityChangedCallCount;
-    int m_appOrientationChangedCallCount;
-    int m_processKeyEventCallCount;
-};
-
-// test class
-class Ut_MInputContextDBusConnection : public QObject
-{
-    Q_OBJECT
-
-private slots:
-    void initTestCase();
-    void cleanupTestCase();
-
-    void init();
-    void cleanup();
-
-    // communication interface to input context
-    void testNoReplyDBusCalls();
-
-    // communication interface exposed to dbus
-    void testShowOnFocus();
-    void testHideOnLostFocus();
-    void testMouseClickedOnPreedit();
-    void testSetPreedit();
-    void testReset();
-    void testAppOrientationChanged();
-    void testProcessKeyEvent();
-
-private:
-    void handleMessages();
-
-private:
-    MApplication *app;
-    MInputContextDBusConnection *m_subject;
-    TargetStub *m_inputMethod;
-    QGraphicsScene *m_scene;
-    QDBusInterface *m_clientInterface;
-    MInputContext *m_inputContext;
-};
-
-
-
-#endif
--- tests/ut_minputcontextdbusconnection/ut_minputcontextdbusconnection.pro
+++ tests/ut_minputcontextdbusconnection/ut_minputcontextdbusconnection.pro
-include(../common_top.pri)
-
-INCLUDEPATH += ../../input-context ../stubs
-LIBS += -L../../input-context/ -lminputcontext ../../src/libmeegoimframework.so \
-
-# Input
-HEADERS += \
-    ut_minputcontextdbusconnection.h \
-    ../stubs/stubbase.h \
-    ../stubs/minputcontextadaptor_stub.h
-
-SOURCES += \
-    ut_minputcontextdbusconnection.cpp \
-    ../stubs/stubbase.cpp
-
-
-CONFIG += debug plugin meegotouch qdbus
-
-include(../common_check.pri)
--- tests/ut_mtoolbardata/toolbar1.xml
+++ tests/ut_mtoolbardata/toolbar1.xml
@@ -1,22 +1,22 @@
 <?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE DUI_IM_TOOLBAR_WIDGET SYSTEM 'ImToolbarDTD.dtd'>
-<toolbar locked="true" version="1" visible="true" refuse="_close">
-    <layout orientation="landscape">
-        <row>
-            <button name="test1" group="group1" priority="0" showon="always" alignment="right" icon="icon1" text="text1" text_id="id1">
+<!DOCTYPE MEEGO_IM_TOOLBAR_WIDGET SYSTEM 'ImToolbarDTD.dtd'>
+<input-method version="1" visible="true" refuse="_close">
+    <toolbar>
+        <items>
+            <button name="test1" group="group1" showon="always" alignment="right" icon="icon1" text="text1" text_id="id1" highlighted="true">
                 <actions>
-                    <sendstring string="sendstring1"> </sendstring>
-                    <hidegroup group="group3"> </hidegroup>
+                    <sendstring string="sendstring1" />
+                    <hidegroup group="group3" />
                 </actions>
             </button>
-            <button name="test2" size="50" group="group2" priority="10" showon="selectedtext" alignment="left" icon="icon2" text="text2" text_id="id2" toggle="true">
+            <button name="test2" size="50" group="group2" showon="selectedtext" alignment="center" icon="icon2" text="text2" text_id="id2" toggle="true">
                 <actions>
                     <copy />
-                    <showgroup group="group3"> </showgroup>
-                    <sendkeysequence keysequence="Ctrl+C"> </sendkeysequence>
+                    <showgroup group="group3" />
+                    <sendkeysequence keysequence="Ctrl+C" />
                 </actions>
             </button>
-            <button name="test3" group="group3" priority="1" showon="always" alignment="left" icon_id="icon3" text="text3" text_id="id3">
+            <button name="test3" group="group3" showon="always" alignment="left" icon_id="icon3" text="text3" text_id="id3"  enabled="false">
                 <actions>
                     <paste />
                 </actions>
@@ -28,24 +28,19 @@
                     <paste />
                 </actions>
             </button>
-        </row>
-    </layout>
-    <layout orientation="portrait">
-        <row>
-            <button name="test1">
-            </button>
-        </row>
-        <row>
-            <button name="test2">
-            </button>
-            <button name="test3" group="group4" priority="2" hideon="selectedtext" alignment="left" icon_id="icon4" text="text4" text_id="id4">
-                <actions>
-                    <sendcommand command="command4" />
-                </actions>
-            </button>
-            <button name="test4" />
-            <label name="test5" />
-        </row>
-    </layout>
-</toolbar>
+        </items>
+        <layout orientation="landscape">
+            <item name="test1" />
+            <item name="test2" />
+            <item name="test3" />
+            <item name="test4" />
+        </layout>
+        <layout orientation="portrait">
+            <item name="test2" />
+            <item name="test3" />
+            <item name="test4" />
+            <item name="test5" />
+        </layout>
+    </toolbar>
+</input-method>
 
--- tests/ut_mtoolbardata/toolbar2.xml
+++ tests/ut_mtoolbardata/toolbar2.xml
@@ -1,31 +1,36 @@
 <?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE DUI_IM_TOOLBAR_WIDGET SYSTEM 'ImToolbarDTD.dtd'>
-<toolbar locked="true" version="1" visible="false">
+<!DOCTYPE MEEGO_IM_TOOLBAR_WIDGET SYSTEM 'ImToolbarDTD.dtd'>
+<toolbar version="1" visible="false">
+    <items>
+        <button name="test1" group="group1" showon="always" alignment="right" icon="icon1" text="text1" text_id="id1">
+            <actions>
+                <sendstring string="sendstring1"> </sendstring>
+            </actions>
+        </button>
+        <button name="test2" group="group2" showon="selectedtext" alignment="center" icon="icon2" text="text2" text_id="id2" toggle="true">
+            <actions>
+                <copy />
+            </actions>
+        </button>
+        <button name="test3" group="group3" showon="always" alignment="left" icon="icon3" text="text3" text_id="id3">
+            <actions>
+                <paste />
+            </actions>
+        </button>
+        <label name="test4" text="text4">
+        </label>
+        <button name="test5" text="test5">
+            <actions>
+                <paste />
+            </actions>
+        </button>
+    </items>
     <layout orientation="landscape">
-        <row>
-            <button name="test1" group="group1" priority="0" showon="always" alignment="right" icon="icon1" text="text1" text_id="id1">
-                <actions>
-                    <sendstring string="sendstring1"> </sendstring>
-                </actions>
-            </button>
-            <button name="test2" group="group2" priority="10" showon="selectedtext" alignment="left" icon="icon2" text="text2" text_id="id2" toggle="true">
-                <actions>
-                    <copy />
-                </actions>
-            </button>
-            <button name="test3" group="group3" priority="1" showon="always" alignment="left" icon="icon3" text="text3" text_id="id3">
-                <actions>
-                    <paste />
-                </actions>
-            </button>
-            <label name="test4" text="text4">
-            </label>
-            <button name="test5" text="test5">
-                <actions>
-                    <paste />
-                </actions>
-            </button>
-        </row>
+        <item name="test1" />
+        <item name="test2" />
+        <item name="test3" />
+        <item name="test4" />
+        <item name="test5" />
     </layout>
 </toolbar>
 
--- tests/ut_mtoolbardata/toolbar3.xml
+++ tests/ut_mtoolbardata/toolbar3.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE DUI_IM_TOOLBAR_WIDGET SYSTEM 'ImToolbarDTD.dtd'>
+<!DOCTYPE MEEGO_IM_TOOLBAR_WIDGET SYSTEM 'ImToolbarDTD.dtd'>
 <toolbar refuse="_close,_copypaste">
     <button name="test1" text="text1" />
     <button name="test2" text="text2" />
--- tests/ut_mtoolbardata/toolbar4.xml
+++ tests/ut_mtoolbardata/toolbar4.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE DUI_IM_TOOLBAR_WIDGET SYSTEM 'ImToolbarDTD.dtd'>
+<!DOCTYPE MEEGO_IM_TOOLBAR_WIDGET SYSTEM 'ImToolbarDTD.dtd'>
 <toolbar version="1" visible="false">
 </toolbar>
 
--- tests/ut_mtoolbardata/ut_mtoolbardata.cpp
+++ tests/ut_mtoolbardata/ut_mtoolbardata.cpp
@@ -1,8 +1,8 @@
 #include "ut_mtoolbardata.h"
 
 #include <mtoolbardata.h>
-#include <mtoolbarrow.h>
 #include <mtoolbarlayout.h>
+#include <mtoolbaritem.h>
 #include <QCoreApplication>
 #include <QFile>
 #include <QDir>
@@ -53,28 +53,23 @@
     qDebug() << "Try to load file" << Toolbar1;
     QVERIFY2(QFile(Toolbar1).exists(), "toolbar1.xml does not exist");
     bool ok;
-    QSharedPointer<const MToolbarRow> row;
     QSharedPointer<MToolbarItem> item;
 
-    ok = subject->loadNokiaToolbarXml(Toolbar1);
+    ok = subject->loadToolbarXml(Toolbar1);
     QVERIFY2(ok, "toolbar1.xml was not loaded correctly");
 
-    QVERIFY(subject->locked() == true);
     QVERIFY(subject->isVisible() == true);
 
-    //test lanscape part
+    //test landscape part
     QSharedPointer<const MToolbarLayout> landscape = subject->layout(M::Landscape);
     QVERIFY(!landscape.isNull());
-    QCOMPARE(landscape->rows().count(), 1);
-    row = landscape->rows().at(0);
-    QCOMPARE(row->items().count(), 5);
+    QCOMPARE(landscape->items().count(), 4);
 
-    item = row->items().at(0);
+    item = landscape->items().at(0);
     QVERIFY(!item.isNull());
     QCOMPARE(item->type(), MInputMethod::ItemButton);
     QCOMPARE(item->name(), QString("test1"));
     QCOMPARE(item->group(), QString("group1"));
-    QCOMPARE(item->priority(), 0);
     QCOMPARE(int(item->showOn()), int(MInputMethod::VisibleAlways));
     QCOMPARE(int(item->hideOn()), int(MInputMethod::VisibleUndefined));
     QCOMPARE(item->alignment(), Qt::AlignRight);
@@ -85,6 +80,8 @@
     QCOMPARE(item->pressed(), false);
     QCOMPARE(item->icon(), QString("icon1"));
     QCOMPARE(item->size(), 100);
+    QVERIFY(item->highlighted());
+    QCOMPARE(item->enabled(), true);
 
     QCOMPARE(item->actions().count(), 2);
     QCOMPARE(item->actions().at(0)->type(), MInputMethod::ActionSendString);
@@ -94,15 +91,14 @@
     QCOMPARE(item->actions().at(0)->group(), QString());
     QCOMPARE(item->actions().at(1)->group(), QString("group3"));
 
-    item = row->items().at(1);
+    item = landscape->items().at(1);
     QVERIFY(!item.isNull());
     QCOMPARE(item->type(), MInputMethod::ItemButton);
     QCOMPARE(item->name(), QString("test2"));
     QCOMPARE(item->group(), QString("group2"));
-    QCOMPARE(item->priority(), 10);
     QCOMPARE(int(item->showOn()), int(MInputMethod::VisibleWhenSelectingText));
     QCOMPARE(int(item->hideOn()), int(MInputMethod::VisibleUndefined));
-    QCOMPARE(item->alignment(), Qt::AlignLeft);
+    QCOMPARE(item->alignment(), Qt::AlignCenter);
     QCOMPARE(item->text(), QString("text2"));
     QCOMPARE(item->textId(), QString("id2"));
     QCOMPARE(item->isVisible(), true);
@@ -110,6 +106,8 @@
     QCOMPARE(item->pressed(), false);
     QCOMPARE(item->icon(), QString("icon2"));
     QCOMPARE(item->size(), 50);
+    QVERIFY(!item->highlighted());
+    QCOMPARE(item->enabled(), true);
 
     QCOMPARE(item->actions().count(), 3);
     QCOMPARE(item->actions().at(0)->type(), MInputMethod::ActionCopy);
@@ -120,45 +118,44 @@
     QCOMPARE(item->actions().at(1)->group(), QString("group3"));
     QCOMPARE(item->actions().at(2)->keys(), QString("Ctrl+C"));
 
-    item = row->items().at(2);
+    item = landscape->items().at(2);
     QVERIFY(!item.isNull());
     QCOMPARE(item->type(), MInputMethod::ItemButton);
     QCOMPARE(item->name(), QString("test3"));
-    QCOMPARE(item->group(), QString("group4"));
-    QCOMPARE(item->priority(), 2);
+    QCOMPARE(item->group(), QString("group3"));
     QCOMPARE(int(item->showOn()), int(MInputMethod::VisibleAlways));
-    QCOMPARE(int(item->hideOn()), int(MInputMethod::VisibleWhenSelectingText));
+    QCOMPARE(int(item->hideOn()), int(MInputMethod::VisibleUndefined));
     QCOMPARE(item->alignment(), Qt::AlignLeft);
-    QCOMPARE(item->text(), QString("text4"));
-    QCOMPARE(item->textId(), QString("id4"));
+    QCOMPARE(item->text(), QString("text3"));
+    QCOMPARE(item->textId(), QString("id3"));
     QCOMPARE(item->isVisible(), true);
     QCOMPARE(item->toggle(), false);
     QCOMPARE(item->pressed(), false);
     QCOMPARE(item->icon(), QString(""));
-    QCOMPARE(item->iconId(), QString("icon4"));
+    QCOMPARE(item->iconId(), QString("icon3"));
+    QCOMPARE(item->enabled(), false);
 
     QCOMPARE(item->actions().count(), 1);
-    QCOMPARE(int(item->actions().at(0)->type()), int(MInputMethod::ActionSendCommand));
+    QCOMPARE(int(item->actions().at(0)->type()), int(MInputMethod::ActionPaste));
     QCOMPARE(item->actions().at(0)->keys(), QString());
     QCOMPARE(item->actions().at(0)->text(), QString());
-    QCOMPARE(item->actions().at(0)->command(), QString("command4"));
+    QCOMPARE(item->actions().at(0)->command(), QString());
     QCOMPARE(item->actions().at(0)->group(), QString());
 
     // test portrait part
     QSharedPointer<const MToolbarLayout> portrait = subject->layout(M::Portrait);
     QVERIFY(!portrait.isNull());
-    QCOMPARE(portrait->rows().count(), 2);
-    row = portrait->rows().at(0);
-    QCOMPARE(row->items().count(), 1);
+    QCOMPARE(portrait->items().count(), 4);
 
-    //itema are shared between layouts
-    QVERIFY(landscape->rows().at(0)->items().at(0) == row->items().at(0));
+    //items are shared between layouts
+    QVERIFY(landscape->items().at(1) == portrait->items().at(0));
+    QVERIFY(landscape->items().at(2) == portrait->items().at(1));
+    QVERIFY(landscape->items().at(3) == portrait->items().at(2));
 
-    row = portrait->rows().at(1);
-    QCOMPARE(row->items().count(), 2);
-
-    QVERIFY(landscape->rows().at(0)->items().at(1) == row->items().at(0));
-    QVERIFY(landscape->rows().at(0)->items().at(2) == row->items().at(1));
+    item = portrait->items().at(3);
+    QVERIFY(!item.isNull());
+    QCOMPARE(item->type(), MInputMethod::ItemButton);
+    QCOMPARE(item->name(), QString("test5"));
 }
 
 void Ut_MToolbarData::testLandspaceOnly()
@@ -166,27 +163,23 @@
     qDebug() << "Try to load file" << Toolbar2;
     QVERIFY2(QFile(Toolbar2).exists(), "toolbar2.xml does not exist");
     bool ok;
-    QSharedPointer<const MToolbarRow> row;
 
-    ok = subject->loadNokiaToolbarXml(Toolbar2);
+    ok = subject->loadToolbarXml(Toolbar2);
     QVERIFY2(ok, "toolbar2.xml was not loaded correctly");
 
-    QVERIFY(subject->locked() == true);
     QVERIFY(subject->isVisible() == false);
 
-    //test lanscape part
+    //test landscape part
     QSharedPointer<const MToolbarLayout> landscape = subject->layout(M::Landscape);
     QVERIFY(!landscape.isNull());
-    QCOMPARE(landscape->rows().count(), 1);
-    row = landscape->rows().at(0);
-    QCOMPARE(row->items().count(), 5);
+    QCOMPARE(landscape->items().count(), 5);
 
     //verify at least some item's attributes
-    QCOMPARE(row->items().at(0)->type(), MInputMethod::ItemButton);
-    QCOMPARE(row->items().at(1)->type(), MInputMethod::ItemButton);
-    QCOMPARE(row->items().at(2)->type(), MInputMethod::ItemButton);
-    QCOMPARE(row->items().at(3)->type(), MInputMethod::ItemLabel);
-    QCOMPARE(row->items().at(4)->type(), MInputMethod::ItemButton);
+    QCOMPARE(landscape->items().at(0)->type(), MInputMethod::ItemButton);
+    QCOMPARE(landscape->items().at(1)->type(), MInputMethod::ItemButton);
+    QCOMPARE(landscape->items().at(2)->type(), MInputMethod::ItemButton);
+    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));
 }
@@ -196,17 +189,15 @@
     QVERIFY2(QFile(Toolbar3).exists(), "toolbar3.xml does not exist");
     bool ok;
 
-    ok = subject->loadNokiaToolbarXml(Toolbar3);
+    ok = subject->loadToolbarXml(Toolbar3);
     QVERIFY2(ok, "toolbar3.xml was not loaded correctly");
 
     QVERIFY(subject->isVisible() == true);
 
-    //test lanscape part
+    //test landscape part
     QSharedPointer<const MToolbarLayout> landscape = subject->layout(M::Landscape);
     QVERIFY(!landscape.isNull());
-    QCOMPARE(landscape->rows().count(), 1);
-    QSharedPointer<const MToolbarRow> row = landscape->rows().at(0);
-    QCOMPARE(row->items().count(), 5);
+    QCOMPARE(landscape->items().count(), 5);
 
     QVERIFY(subject->layout(M::Landscape) == subject->layout(M::Portrait));
 }
@@ -215,7 +206,7 @@
 {
     bool ok;
 
-    ok = subject->loadNokiaToolbarXml(Toolbar4);
+    ok = subject->loadToolbarXml(Toolbar4);
     QVERIFY2(ok, "toolbar4.xml was not loaded correctly");
 
     QVERIFY(subject->isVisible() == false);
@@ -227,7 +218,7 @@
     QTest::addColumn<QStringList>("expectedValue");
 
     QTest::newRow("toolbar1") << Toolbar1 << (QStringList() << "_close");
-    QTest::newRow("toolbar2") << Toolbar2 << (QStringList() << "");
+    QTest::newRow("toolbar2") << Toolbar2 << QStringList();
     QTest::newRow("toolbar3") << Toolbar3 << (QStringList() << "_close" << "_copypaste");
 }
 
@@ -239,7 +230,7 @@
     QVERIFY2(QFile(fileName).exists(), "xml file does not exist");
     bool ok;
 
-    ok = subject->loadNokiaToolbarXml(fileName);
+    ok = subject->loadToolbarXml(fileName);
     QVERIFY2(ok, "toolbar was not loaded correctly");
 
     QCOMPARE(subject->refusedNames(), expectedValue);
@@ -249,34 +240,41 @@
 {
     QVERIFY2(QFile(Toolbar1).exists(), "toolbar1.xml does not exist");
     bool ok;
-    QSharedPointer<MToolbarRow> row;
     QSharedPointer<MToolbarItem> item;
     QSharedPointer<MToolbarItem> button(new MToolbarItem("addItem", MInputMethod::ItemButton));
 
-    button->setPriority(-1);
     button->setAlignment(Qt::AlignLeft);
 
-    ok = subject->append(QSharedPointer<MToolbarRow>(new MToolbarRow), button);
+    ok = subject->append(QSharedPointer<MToolbarLayout>(new MToolbarLayout), button);
     QVERIFY2(!ok, "Item should not be added to non-constructed toolbar");
 
-    ok = subject->loadNokiaToolbarXml(Toolbar1);
+    ok = subject->loadToolbarXml(Toolbar1);
     QVERIFY2(ok, "toolbar1.xml was not loaded correctly");
 
-    QSharedPointer<const MToolbarLayout> landscape = subject->layout(M::Landscape);
+    QSharedPointer<MToolbarLayout> landscape = subject->layout(M::Landscape).constCast<MToolbarLayout>();
     QVERIFY(!landscape.isNull());
-    QCOMPARE(landscape->rows().count(), 1);
-    row = landscape->rows().at(0).constCast<MToolbarRow>();
-    QVERIFY(!row->items().isEmpty());
+    QVERIFY(!landscape->items().isEmpty());
 
-    ok = subject->append(row, button);
+    ok = subject->append(landscape, button);
     QVERIFY2(ok, "Item was not added");
-    QVERIFY(row->items().last() == button);
+    QVERIFY(landscape->items().last() == button);
 
-    ok = subject->append(row, button);
-    QVERIFY2(!ok, "Item should not be added twice");
+    ok = subject->append(landscape, button);
+    QVERIFY2(!ok, "Item should not be added twice to the same row");
 
-    ok = subject->append(QSharedPointer<MToolbarRow>(), button);
+    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>();
+    QVERIFY(!portrait.isNull());
+    QVERIFY(!portrait->items().isEmpty());
+
+    ok = subject->append(portrait, button);
+    QVERIFY2(ok, "Item was not added");
+    QVERIFY(portrait->items().last() == button);
+
+    ok = subject->append(portrait, button);
+    QVERIFY2(!ok, "Item should not be added twice to the same row");
 }
 
 QTEST_APPLESS_MAIN(Ut_MToolbarData)
--- tests/ut_mtoolbardata/ut_mtoolbardata.pro
+++ tests/ut_mtoolbardata/ut_mtoolbardata.pro
@@ -19,13 +19,11 @@
     $$SRC_DIR/mtoolbaritem.h \
     $$SRC_DIR/mtoolbardata.h \
     $$SRC_DIR/minputmethodnamespace.h \
-    $$SRC_DIR/mtoolbarrow.h \
     $$SRC_DIR/mtoolbarlayout.h \
 
 SOURCES += \
     $$SRC_DIR/mtoolbaritem.cpp \
     $$SRC_DIR/mtoolbardata.cpp \
-    $$SRC_DIR/mtoolbarrow.cpp \
     $$SRC_DIR/mtoolbarlayout.cpp \
 }
 
--- tests/ut_mtoolbaritem/ut_mtoolbaritem.cpp
+++ tests/ut_mtoolbaritem/ut_mtoolbaritem.cpp
@@ -96,6 +96,87 @@
 
     subject->setProperty("pressed", QVariant(true));
     QVERIFY(spy.count() == 0);
+    spy.clear();
+
+    subject->setProperty("enabled", QVariant(false));
+    QVERIFY(spy.count() == 1);
+    QVERIFY(spy.first().count() == 1);
+    QCOMPARE(spy.first().first().toString(), QString("enabled"));
+    spy.clear();
+
+    subject->setProperty("enabled", QVariant(false));
+    QVERIFY(spy.count() == 0);
+
+    subject->setProperty("enabled", QVariant(true));
+    QVERIFY(spy.count() == 1);
+    QVERIFY(spy.first().count() == 1);
+    QCOMPARE(spy.first().first().toString(), QString("enabled"));
+    spy.clear();
+}
+
+void Ut_MToolbarItem::testHighlighted()
+{
+    QSignalSpy spy(subject, SIGNAL(propertyChanged(const QString &)));
+
+    QVERIFY(spy.isValid());
+
+    QVERIFY(!subject->highlighted());
+
+    subject->setHighlighted(false);
+    QVERIFY(spy.isEmpty());
+
+    subject->setHighlighted(true);
+    QVERIFY(spy.count() == 1);
+    QVERIFY(spy.first().count() == 1);
+    QCOMPARE(spy.first().first().toString(), QString("highlighted"));
+    spy.clear();
+
+    subject->setHighlighted(true);
+    QVERIFY(spy.isEmpty());
+}
+
+void Ut_MToolbarItem::testCustom()
+{
+    QSignalSpy spy(subject, SIGNAL(propertyChanged(const QString &)));
+
+    QVERIFY(spy.isValid());
+
+    QVERIFY(subject->isCustom());
+
+    subject->setCustom(true);
+    QVERIFY(spy.isEmpty());
+
+    subject->setCustom(false);
+    QVERIFY(spy.count() == 1);
+    QVERIFY(spy.first().count() == 1);
+    QCOMPARE(spy.first().first().toString(), QString("custom"));
+    spy.clear();
+
+    subject->setCustom(false);
+    QVERIFY(spy.isEmpty());
+}
+
+void Ut_MToolbarItem::testEnabled()
+{
+    QSignalSpy spy(subject, SIGNAL(propertyChanged(const QString &)));
+
+    QVERIFY(spy.isValid());
+
+    QVERIFY(subject->enabled());
+
+    subject->setEnabled(true);
+    QVERIFY(spy.isEmpty());
+
+    subject->setEnabled(false);
+    QVERIFY(!subject->enabled());
+    QVERIFY(spy.count() == 1);
+    QVERIFY(spy.first().count() == 1);
+    QCOMPARE(spy.first().first().toString(), QString("enabled"));
+    spy.clear();
+
+    subject->setEnabled(false);
+    QVERIFY(!subject->enabled());
+    QVERIFY(spy.isEmpty());
 }
 
 QTEST_APPLESS_MAIN(Ut_MToolbarItem)
--- tests/ut_mtoolbaritem/ut_mtoolbaritem.h
+++ tests/ut_mtoolbaritem/ut_mtoolbaritem.h
@@ -19,6 +19,9 @@
     void cleanup();
 
     void testSetProperty();
+    void testHighlighted();
+    void testCustom();
+    void testEnabled();
 
 private:
     QCoreApplication *app;
--- tests/ut_mtoolbarmanager/toolbar1.xml
+++ tests/ut_mtoolbarmanager/toolbar1.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE DUI_IM_TOOLBAR_WIDGET SYSTEM 'ImToolbarDTD.dtd'>
+<!DOCTYPE MEEGO_IM_TOOLBAR_WIDGET SYSTEM 'ImToolbarDTD.dtd'>
 <toolbar locked="true" version="1">
     <layout orientation="landscape">
         <row>
--- tests/ut_mtoolbarmanager/toolbar2.xml
+++ tests/ut_mtoolbarmanager/toolbar2.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE DUI_IM_TOOLBAR_WIDGET SYSTEM 'ImToolbarDTD.dtd'>
+<!DOCTYPE MEEGO_IM_TOOLBAR_WIDGET SYSTEM 'ImToolbarDTD.dtd'>
 <toolbar locked="true" version="1" refuse="_close">
     <layout orientation="landscape">
         <row>
--- tests/ut_mtoolbarmanager/ut_mtoolbarmanager.cpp
+++ tests/ut_mtoolbarmanager/ut_mtoolbarmanager.cpp
@@ -19,7 +19,7 @@
 #include "ut_mtoolbarmanager.h"
 #include <mtoolbarmanager.h>
 #include <mtoolbardata.h>
-#include <mtoolbarrow.h>
+#include <mtoolbaritem.h>
 #include <mtoolbarlayout.h>
 #include <mtoolbarid.h>
 #include <QCoreApplication>
@@ -93,10 +93,6 @@
     for (int i = 0; i < toolbarIds.count(); i++) {
         QSharedPointer<MToolbarData> toolbar = subject->toolbarData(toolbarIds.at(i));
         QVERIFY(!toolbar.isNull());
-
-        // toolbar is custom if it is loaded from specified file
-        // otherwise standard toolbar should be provided
-        QVERIFY(toolbar->isCustom() == QFile(toolbars.at(i)).exists());
     }
 
     for (int i = toolbarIds.count() - 1; i >= 0; --i) {
@@ -150,30 +146,30 @@
 void Ut_MToolbarManager::testStandardObjects()
 {
     QVERIFY(subject->standardToolbar != 0);
-    QVERIFY(subject->standardToolbar->isCustom() == false);
     QVERIFY(subject->copyPaste != 0);
     QVERIFY(subject->close != 0);
 
     QSharedPointer<const MToolbarLayout> layout = subject->standardToolbar->layout(M::Landscape);
     QVERIFY(layout);
-    QCOMPARE(layout->rows().count(), 1);
-    QSharedPointer<const MToolbarRow> row = layout->rows().first();
-    QList<QSharedPointer<MToolbarItem> > items = row->items();
+    QList<QSharedPointer<MToolbarItem> > items = layout->items();
     QVERIFY(!items.isEmpty());
 
-    // verify if copy/paste button is placed before close button
-    QVERIFY(items.indexOf(subject->copyPaste) < items.indexOf(subject->close));
+    QVERIFY(items.indexOf(subject->copyPaste) > -1);
+    QVERIFY(items.indexOf(subject->close) > -1);
+
+    QCOMPARE(subject->copyPaste->alignment(), Qt::AlignLeft);
+    QCOMPARE(subject->close->alignment(), Qt::AlignRight);
 }
 
 void Ut_MToolbarManager::testSetCopyPaste_data()
 {
     QTest::addColumn<bool>("copyAvailable");
     QTest::addColumn<bool>("pasteAvailable");
-    QTest::addColumn<bool>("expectedVisible");
+    QTest::addColumn<bool>("expectedEnabled");
     QTest::addColumn<MInputMethod::ActionType>("expectedAction");
     QTest::addColumn<QString>("expectedTextId");
 
-    QTest::newRow("nothing")    << false << false << false << MInputMethod::ActionUndefined << "";
+    QTest::newRow("nothing")    << false << false << false << MInputMethod::ActionUndefined << "qtn_comm_copy";
     QTest::newRow("copy")       << true  << false << true  << MInputMethod::ActionCopy << "qtn_comm_copy";
     QTest::newRow("paste")      << false << true  << true  << MInputMethod::ActionPaste << "qtn_comm_paste";
     QTest::newRow("copy+paste") << true  << true  << true  << MInputMethod::ActionCopy << "qtn_comm_copy";
@@ -183,12 +179,13 @@
 {
     QFETCH(bool, copyAvailable);
     QFETCH(bool, pasteAvailable);
-    QFETCH(bool, expectedVisible);
+    QFETCH(bool, expectedEnabled);
     QFETCH(MInputMethod::ActionType, expectedAction);
     QFETCH(QString, expectedTextId);
 
     subject->setCopyPasteState(copyAvailable, pasteAvailable);
-    QCOMPARE(subject->copyPaste->isVisible(), expectedVisible);
+    QVERIFY(subject->copyPaste->isVisible());
+    QVERIFY(subject->copyPaste->enabled() == expectedEnabled);
     QVERIFY(!subject->copyPaste->actions().isEmpty());
     QCOMPARE(int(subject->copyPaste->actions().first()->type()), int(expectedAction));
     if (!expectedTextId.isEmpty()) {
@@ -220,9 +217,7 @@
     QVERIFY(toolbarData);
     QSharedPointer<const MToolbarLayout> layout = toolbarData->layout(M::Landscape);
     QVERIFY(layout);
-    QCOMPARE(layout->rows().count(), 1);
-    QSharedPointer<const MToolbarRow> row = layout->rows().first();
-    QList<QSharedPointer<MToolbarItem> > items = row->items();
+    QList<QSharedPointer<MToolbarItem> > items = layout->items();
 
     QVERIFY(items.contains(subject->close) == expectClose);
     QVERIFY(items.contains(subject->copyPaste) == expectCopyPaste);
--- tests/ut_mtoolbarmanager/ut_mtoolbarmanager.pro
+++ tests/ut_mtoolbarmanager/ut_mtoolbarmanager.pro
@@ -21,14 +21,12 @@
     $$SRC_DIR/mtoolbardata.h \
     $$SRC_DIR/minputmethodnamespace.h \
     $$SRC_DIR/mtoolbarmanager.h \
-    $$SRC_DIR/mtoolbarrow.h \
     $$SRC_DIR/mtoolbarlayout.h \
 
 SOURCES += \
     $$SRC_DIR/mtoolbaritem.cpp \
     $$SRC_DIR/mtoolbardata.cpp \
     $$SRC_DIR/mtoolbarmanager.cpp \
-    $$SRC_DIR/mtoolbarrow.cpp \
     $$SRC_DIR/mtoolbarlayout.cpp \
 }
 

++++++ meegotouch-inputmethodframework.yaml
--- meegotouch-inputmethodframework.yaml
+++ meegotouch-inputmethodframework.yaml
@@ -1,27 +1,21 @@
 Name: meegotouch-inputmethodframework
 Summary: MeeGo UI Input Method Framework
-Version: 0.19.20
+Version: 0.19.30
 Release: 1
 Group: System/Libraries
-License: LGPL v2.1
-URL: http://www.meego.com
+License: LGPLv2.1
+URL: http://meego.gitorious.org/meegotouch/meegotouch-inputmethodframework
 Sources:
     - "%{name}-%{version}.tar.bz2"
-    - meego-im-uiserver.desktop
-Description: MeeGo UI Input Method Framework
-
-PkgBR:
-    - fdupes
-
+Description: |
+    MeeGo UI Input Method Framework
 PkgConfigBR:
     - QtCore >= 4.6.0
     - QtDBus
-    - QtOpenGL
     - QtNetwork
     - QtGui
     - dbus-1
     - gconf-2.0
-    - gl
     - meegotouch
     - meegotouch-feedback
     - meegotouch-feedbackreactionmaps
@@ -29,16 +23,17 @@
     - x11
     - xfixes
     - xext
-
 Provides:
     - duiimframework >= 0.19.0
     - meegoimframework > 0.19.2
 Obsoletes:
     - duiimframework < 0.19.0
     - meegoimframework <= 0.19.2
-
 Configure: none
 Builder: qmake
+ExtraSources:
+    - meego-im-uiserver.desktop;%{_sysconfdir}/xdg/autostart
+RunFdupes: "%{_libdir}"
 SubPackages:
     - Name: devel
       Summary: MeeGo UI Input Method Development Package
@@ -51,6 +46,6 @@
       Summary: MeeGo UI Input Method Tests Package
       Group: Development/Libraries
       Description: |
-          This package contains the files necessary to test 
+          This package contains the files necessary to test
           the input method framework for MeeGo
 




More information about the MeeGo-commits mailing list