Home ยท API Reference |
RPC functions prefixed with im:: are defined on the input method side, whereas functions prefixed with app:: are defined on the widget side.
The application calls (via the MInputContext instance) the following RPC functions on the input method side:
Then input method reports to the MInputContext instance whether the input method wants to compose all raw key event from hardware keyboard or not. A common use case is input method support for non-latin languages. Here, the input method calls app::setComposingTextInput(bool). This function could be called again if required by the input method, e.g., when an input method plugin was changed.
Additionally, if the application gains a visualization priority higher than the input method, the input method is hidden temporarily. A use case of this is a long-pressed MTextEdit widget, which triggers a zoom-in. The input method will be hidden for the duration of that zoom-in. When the MTextEdit widget enters the release state, a zoom-out is triggered and the input method becomes visible again.
To gain such a visualization priority, the application sets the M::VisualizationPriorityQuery property in its inputMethodQuery() function. The MInputContext instance queries the property during setFocusWidget() and update(). Depending on the current value of the property, it then calls im::visualizationPriorityChanged on the input method side. The input method can then decide about its visibility.
Upon interception of a key event, the MInputContext instance may cancel the event and redirect it back to input method. It can also choose to construct another key event and use the stored modifier state, then sending the event back to the widget - regardless of the actual modifier key state in the hardware - using QApplication::sendEvent().
In DirectUI, all modifier keys are sticky, meaning that the key state is kept even when the key is released.
There are three modifier key states:
The diagram below describes the transitions of the modifier key states:
+-------------------------------------+ | | | ^ V | NORMAL +-(pressed)-> LATCHED -(non-modifier key is pressed+released) ^ | ^ | | | | | | | | | | +-(pressed+released) -> LATCHED -+ | | | V | | | (same modifier key is pressed+released) | | | V | LOCKED | | | | | (same modifier key is pressed+released) | | | | +-------------------------------------+
For certain widget content types, modifier keys may be activated when the widget receives the input focus. For example, given a number content type, the Fn modifier is LATCHED initially.
The MInputContext instance keeps the modifier key states (Ctrl, Shift, Sym and Fn) until the widget loses the input focus again.
The input method calls the app::updatePreedit RPC function when updating the pre-edit string. The receiver of the call, a MInputContext instance, constructs a QInputMethodEvent event, along with the formatting attributes of the pre-edit string. It then forwards the event to the currently focused widget (obtained via focusWidget()), using QApplication::sendEvent(). The emission of the widget's changed signal shall be blocked temporarily.
The input method calls the app::commitString() RPC function to send a commit string. The receiver of this call, a MInputContext instance, constructs a QInputMethodEvent event and sends the commit string with that event. It then forwards the event to the currently focused widget (obtained via focusWidget()), using QApplication::sendEvent(). The widget may now emit a textChanged signalThe event is then sent to current focusWidget() with QApplication::sendEvent. The widget may now emits an event telling that the content is changed.
If current input method mode is M::InputMethodModeDirect, then the input method sends key event instead of sending pre-edit or commit string.
When the Copy button is clicked, input method calls app::copy RPC function. Upon receiving this call, MInputContext calls widget's "copy" function if available, otherwise it just sends ctrl-c combination key event to the widget.
When the Paste button is clicked, input method calls app::paste RPC function. Upon receiving this call, MInputContext calls widget's "paste" function if available, otherwise it just sends ctrl-v combination key event to the widget.
The widget can set the mode by answering the M::ImModeQuery query with the value according to the current mode when asked in inputMethodQuery method. [MTextEdit has the following properties: inputMethodCorrectionEnabled, inputMethodPredictionEnabled, inputMethodAutoCapitalizationEnabled - there is no inputMethodQuery] The input method obtains the current widget's mode by calling app::inputMethodMode RPC function.
In widget's inputMethodQuery method, the widget returns the status of this feature when asked with M::ImAutoCapitalizationEnabledQuery.
The input method can get the widget's autocapitalization state by calling app::autoCapitalizationEnabled RPC function [MTextEdit::inputMethodAutoCapitalizationEnabled].
In widget's inputMethodQuery method, the widget returns the status of this feature when asked with M::ImCorrectionEnabledQuery.
The input method can get the widget's autocapitalization state by calling app::correctionEnabled RPC function [MTextEdit::inputMethodCorrectionEnabled].
This feature can be disabled/enabled globally according to setting [which?]. The input method can override the state of this feature on the widget side by calling app::setGlobalCorrectionEnabled RPC function.
In widget's inputMethodQuery method, the widget returns the status of this feature when asked with M::ImPredictionEnabledQuery.
Input method can get the widget's autocapitalization state by calling app::predictionEnabled RPC function [MTextEdit::inputMethodPredictionEnabled].
The input method shows/hides the toolbar widgets upon receiving events as defined in the toolbar widget's XML data.
When an event takes place on a toolbar widget, the input method sends a sequence of actions defined as defined in the XML data. The list below describes the actions and how it is handled by input method:
The widget can change the attributes of an item in toolbar. Except the NAME attribute, all others attributes can be changed by the widget in runtime. To change an attribute, a widget call im::setToolbarItemAttribute() RPC function.
The widget can also get the attribute on an item in toolbar by calling im::toolbarItemAttribute() RPC function.
Copyright © 2010 Nokia Corporation | MeeGo Touch |