There will be some changes to MInputMethodState class in libmeegotouch.
The reason for these changes is a recent requirement from applications
to be able to change the look of the Enter key in a keyboard.
The request is implemented by replacing old toolbar setting API with a
new API that allows a wider range of keyboard attributes to be set on
a text input widget.
CHANGES IN MINPUTMETHODSTATE
The change consists two parts. First, old toolbar API is deprecated.
The deprecated MInputMethodState methods are:
* registerToolbar(const QString &fileName)
* unregisterToolbar(int id)
* setToolbarItemAttribute(int id, const QString &item, const QString
&attribute, const QVariant &value)
* toolbar(int id)
* toolbarIds()
* toolbarState(int id)
Also the following MInputMethodState signals are deprecated:
* toolbarRegistered(int id, const QString &fileName)
* toolbarUnregistered(int id);
* toolbarItemAttributeChanged(int id, const QString &item, const
String &attribute, const QVariant &value);
The second part of the change is defining a new API for setting
attribute extensions for a text input field. The mechanism is analogous
to the old toolbar API, but covers a wider area of attributes. There's
an API to register attribute extension and to unregister it:
* int MInputMethodState::registerAttributeExtension(const QString
&fileName = QString());
* void MinputMethodState::unregisterAttributeExtension(int id);
These methods will cause the following signals to be emitted:
* attributeExtensionRegistered(int id, const QString &fileName);
* attributeExtensionUnregistered(int id);
The ID returned from registerAttributeExtension can be used as a
toolbar ID (i.e., reported on a the InputMethodToolbarIdQuery IM Query,
or through the MTextedit::attachToolbar(int id) API).
To set extended attributes a new method is defined:
* void MInputMethodState::setExtendedAttribute(int id, const QString
&target, const QString &targetItem, const QString &attribute, const
QVariant &value)
This method needs five parameters:
* The attributeExtension ID (from registerAttributeExtension)
* The target name (currently either "/toolbar" or "/keys")
* The item name (inside target, depends on the target)
* The attribute name inside the item
* The actual new value for the attribute.
CHANGES NEEDED TO APPLICATIONS:
Even though the old API will still work for now, the applications
should do the following changes in order to be prepared for the future:
1. Replace all calls to MInputMethodState::registerToolbar with calls to
MInputMethodState::registerAttributeExtension using the same
parameters.
2. Replace all calls to MInputMethodState::unregisterToolbar with calls
to MInputMethodState::unregisterAttributeExtension using the same
parameters.
3. Replace all connections to MInputMethodState::toolbarRegistered with
connections to MInputMethodState::attributeExtensionRegistered.
4. Replace all connections to MInputMethodState::toolbarUnregistered
with connections to MInputMethodState::attributeExtensionUnregistered
5. Replace all calls
'setToolbarItemAttribute(id, item, attribute, value)' with calls
'setExtendedAttribute(id, "/toolbar", item, attribute, value)'
NEW FUNCTIONALITY:
Input method framework will provide a way to change the appearance of
the Enter key in the virtual keyboard. Applications can set the Enter
key to be highlighted or disabled and change the key's label or
replace the label with an icon.
First, application needs to register an attribute extension:
id = MInputMethod::instance().registerAttributeExtension();
Then, the extension needs to be assigned to a text input field:
mtextedit1.attachToolbar(id);
Now, application can:
* Set the Enter key to HIGHLIGHTED:
MInputMethod::instance().
setExtendedAttribute(id,
"/keys", "actionKey",
"highlighted", QVariant(true) );
* Set the Enter key to DISABLED:
MInputMethod::instance().
setExtendedAttribute(id,
"/keys", "actionKey",
"enabled", QVariant(false) );
* Change the Enter key LABEL:
MInputMethod::instance().
setExtendedAttribute(id,
"/keys", "actionKey",
"label",
QVariant(QString("New Label")) );
* Replace the Enter key's label with an ICON:
MInputMethod::instance().
setExtendedAttribute(id,
"/keys", "actionKey",
"icon",
QVariant(QString("/path/to/icon.ext")) );
SCHEDULE FOR THE CHANGES:
The MInputMethodState API change is already implemented and will be
merged into libmeegotouch during this week. After that, the old
toolbar functionality is available through the new API.
The Enter key change is still ongoing. We expect to finalize the
change during this and next week. Another message will be sent to
harmattan-changes when this functionality should work.
In the meanwhile, applications can already call this API but it
won't do anything.
_______________________________________________
MeeGo-dev mailing list
[email protected]
http://lists.meego.com/listinfo/meego-dev
http://wiki.meego.com/Mailing_list_guidelines