Meego Wiki
Views

Input Method Engine Plug-in for MeeGo

From MeeGo wiki
Revision as of 07:35, 16 September 2011 by Bkalinga (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This guide describes how to develop an input method engine plug-in for MeeGo input method framework.
This input method engine plug-in is the implementation for the MImEngineWordsInterface( MImEngineWordsInterface
is the abstract driver class for all prediction/correction engine plug-ins for MeeGo input method framework.)

Step by step approach to develop an input method engine plug-in for MeeGo input method framework.

Contents

Create your plug-in

  1. Create your own Class by deriving from QObject and MImEngineWordsInterface.
  2. Try giving dummy implementation to the all the virtual functions of MImEngineWordsInterface.
  3. While implementing virtual QString driver(); Please return a valid string, that you want to name your plug-in.
  4. Place the below statement at the end of your .cpp file
    Q_EXPORT_PLUGIN2(plug-in-TARGET-name in your .pro file , Class name that is derived from MImEngineWordsInterface);
  5. Add these two lines in your plug-in .pro file so that the plug-in is installed to the right path
    target.path += /usr/lib/meego-imengines/drivers/words
    INSTALLS += target
  6. Now compile your project and deploy it. Below link can be referred.
building-meego-applications

Make your plug-in known to framework

Until now, we have created the plug-in and deployed it to the target (QEMU this case).Now we need to tell
the input method framework to start using this plug-in.This could be easily done through a VKB settings page,
as this settings page is not available at present; we need to do it through QEMU console.

  1. Access QEMU console is by below command:
    ssh -p 6666 meego@127.0.0.1
  2. Once you get the console of the target, check for output of
    gconftool-2 -R /meegotouch
  3. If there is some error related to DISPLAY, you might have to export DISPLAY=:0.0 (In case of QEMU)
  4. If there are still some errors related DBUS then you have to set DBUS_SESSION_BUS_ADDRESS variable correctly.
    Search for the pid of mthemedaemon in your process list
    ps ux | awk '/mthemedaemon/ && !/awk/ {print $2}'
    get DBUS_SESSION_BUS_ADDRESS value by
    cat /proc/$themepid/environ | tr '\0' '\n' | grep DBUS_SESSION_BUS_ADDRESS
    Now export the DBUS_SESSION_BUS_ADDRESS value got in the above step
    export DBUS_SESSION_BUS_ADDRESS=<<DBUS_SESSION_BUS_ADDRESS value>>
    Note: You might not have to do these steps in hardware. These steps I followed while working with QEMU.
  5. After these steps, you should be able to get the output of
    gconftool-2 -R /meegotouch
  6. Now set your plug-in name to the below gconf key
    gconftool-2 -s -t string /meegotouch/inputmethods/correctionengine "your-plug-in-name"
  7. Next, kill the already running meego-im-uiserver process and restart it by
    /usr/bin/meego-im-uiserver -remote-theme -software -output-level debug
    Restarting of the meego-im-uiserver is required, so that the recently modified gconf value is read and the
    plug-in is picked by the input method framework. Now taping on any text field should show the VKB.

VKBText Entries.png
[Screen shot taken from netbook QEMU]

Real Implementation

  1. Check whether your plug-in is picked by the framework or not.
  2. Once you are sure that the plug-in is picked by the framework, start giving real implementation to the rest of virtual methods.
    Note:Few of them are obsolete and some of them are kept for future usage. Try giving the implementation that suits your requirement.

Test your plug-in

Once you are done with the implementation and want to check for the predictive suggestion/error corrective suggestions,
revisit the gconf settings, which you can set from console.

  1. Set below gconf key to true if not yet set to true.
    gconftool-2 -s -t bool /meegotouch/inputmethods/virtualkeyboard/correctionenabled true
  2. Set below gconf key to true, if you wish to correct the preedit with the spacebar
    gconftool-2 -s -t bool /meegotouch/inputmethods/virtualkeyboard/correctwithspace true
    Suggestion wordTracker.png
    [Screen shot taken from tablet QEMU while editing]
  3. If you want to see multiple keyboard layout which can be easily switched by swipe right-to-left/left-to-right on the VKB.
    gconftool-2 --type list --list-type string -s /meegotouch/inputmethods/virtualkeyboard/layouts
    [en_gb.xml,de.xml,en_gb.xml,ar.xml,cs.xml,da.xml,es.xml,fi.xml,fr.xml]

Ideally for QEMU; below gconf key should be set false. Same holds true if any device does not support multitouch.

gconftool-2 -s -t bool /meegotouch/inputmethods/multitouch/enabled false

Hope this step by step post will help those, who want to write an input method plug-in for MeeGo input method framework.

Source code reference

Source code for an input method plug-in for MeeGo input method framework can be found at http://openadaptxt.svn.sourceforge.net/viewvc/openadaptxt/Branches/Current/OpenAdaptxt2.6/Plugins/Meego/

OpenAdaptxt is an open source community project focused on the development of an open, next-generation text input platform supporting 50+ languages. OpenAdaptxt has been ported to MeeGo.
Personal tools