src/hbcore/inputfw/hbinputpredictionengine.cpp
changeset 6 c3690ec91ef8
parent 1 f7ac710697a9
child 30 80e4d18b72f5
child 34 ed14f46c0e55
equal deleted inserted replaced
5:627c4a0fd0e7 6:c3690ec91ef8
    44 Returns a list of languages the engine supports.
    44 Returns a list of languages the engine supports.
    45 */
    45 */
    46 
    46 
    47 /*!
    47 /*!
    48 \fn virtual void HbPredictionBase::setWord(const QString& word, HbPredictionCallback* callback = 0)
    48 \fn virtual void HbPredictionBase::setWord(const QString& word, HbPredictionCallback* callback = 0)
    49 Sets current word. Given word will be the active word.  
    49 Sets current word. Given word will be the active word.
    50 */
    50 */
    51 
    51 
    52 /*!
    52 /*!
    53 \deprecated HbPredictionBase::updateCandidates(int&, bool&)
    53 \deprecated HbPredictionBase::updateCandidates(int&, bool&)
    54     is deprecated. Use bool updateCandidates(int&) instead.
    54     is deprecated. Use bool updateCandidates(int&) instead.
    57 
    57 
    58 /*!
    58 /*!
    59 \fn bool HbPredictionBase::updateCandidates(int& bestGuessLocation)
    59 \fn bool HbPredictionBase::updateCandidates(int& bestGuessLocation)
    60 Updates the candidate list to match active input sequence. Typically appendKeyPress and deleteKeyPress
    60 Updates the candidate list to match active input sequence. Typically appendKeyPress and deleteKeyPress
    61 do that automatically but in same cases it may be required to update the situation explicitly.
    61 do that automatically but in same cases it may be required to update the situation explicitly.
    62 Paramter bestGuessLocation specifies the best match index in the candidate list. Typically it is
    62 Parameter bestGuessLocation specifies the best match index in the candidate list. Typically it is
    63 the first location but with some engines it may vary.
    63 the first location but with some engines it may vary.
    64 Returns true if active input sequence produces valid candidates. Otherwise returns false and
    64 Returns true if active input sequence produces valid candidates. Otherwise returns false and
    65 doesn not update the existing candidate list (in other words HbPredictionEngine::candidates() will
    65 doesn not update the existing candidate list (in other words HbPredictionEngine::candidates() will
    66 still return same set of candidates as it did before calling this method unsuccesfully).
    66 still return same set of candidates as it did before calling this method unsuccesfully).
    67 */
    67 */
    69 /*!
    69 /*!
    70 \fn virtual void HbPredictionBase::appendKeyPress(const int keycode, const Qt::KeyboardModifiers modifiers, const HbTextCase textCase = HbTextCaseNone, HbPredictionCallback* callback = 0)
    70 \fn virtual void HbPredictionBase::appendKeyPress(const int keycode, const Qt::KeyboardModifiers modifiers, const HbTextCase textCase = HbTextCaseNone, HbPredictionCallback* callback = 0)
    71 Handles a key press event.
    71 Handles a key press event.
    72 
    72 
    73 \sa appendCharacter
    73 \sa appendCharacter
    74 */ 
    74 */
    75 
    75 
    76 /*!
    76 /*!
    77 \fn virtual void HbPredictionBase::deleteKeyPress(HbPredictionCallback* callback = 0)
    77 \fn virtual void HbPredictionBase::deleteKeyPress(HbPredictionCallback* callback = 0)
    78 Deletes one key press from the active input sequence.
    78 Deletes one key press from the active input sequence.
    79 */
    79 */
    84 the result is same as after calling setWord(word) and commit().
    84 the result is same as after calling setWord(word) and commit().
    85 */
    85 */
    86 
    86 
    87 /*!
    87 /*!
    88 \fn virtual void HbPredictionBase::clear()
    88 \fn virtual void HbPredictionBase::clear()
    89 Clears the active word without commiting it.
    89 Clears the active word without committing it.
    90 */
    90 */
    91 
    91 
    92 /*!
    92 /*!
    93 \fn virtual void HbPredictionBase::addUsedWord(const QString& word)
    93 \fn virtual void HbPredictionBase::addUsedWord(const QString& word)
    94 Notifies the engine that a given word was used as part of the text. Commit
    94 Notifies the engine that a given word was used as part of the text. Commit
   113 Returns engine version. The format of the returned string depends on the
   113 Returns engine version. The format of the returned string depends on the
   114 engine.
   114 engine.
   115 */
   115 */
   116 
   116 
   117 /*!
   117 /*!
   118 \fn virtual bool HbPredictionBase::supportsKeyboardType(const HbInputLanguage &language, HbKeyboardType keyboard)
   118 \fn virtual bool HbPredictionBase::supportsKeyboardType(const HbInputLanguage& language, HbKeyboardType keyboard) const
   119 Returns true if the engine supports given combination of language and keyboard type.
   119 Returns true if the engine supports given combination of language and keyboard type.
   120 */
   120 */
   121 
   121 
   122 HbPredictionBase::HbPredictionBase()
   122 HbPredictionBase::HbPredictionBase()
   123 {
   123 {
   153     Q_UNUSED(idList)
   153     Q_UNUSED(idList)
   154 }
   154 }
   155 
   155 
   156 /*!
   156 /*!
   157 Returns pointer to active user dictionary. There are two kind of user dictionaries, default and
   157 Returns pointer to active user dictionary. There are two kind of user dictionaries, default and
   158 extra. This one returns the default user dictionary. Default implementation of this method is empty, 
   158 extra. This one returns the default user dictionary. Default implementation of this method is empty,
   159 override if the engine supports user dictionaries.
   159 override if the engine supports user dictionaries.
   160 
   160 
   161 \sa setExtraUserDictionary
   161 \sa setExtraUserDictionary
   162 \sa HbExtraUserDictionary
   162 \sa HbExtraUserDictionary
   163 */
   163 */
   164 HbUserDictionary* HbPredictionBase::userDictionary() const
   164 HbUserDictionary *HbPredictionBase::userDictionary() const
   165 {
   165 {
   166     return 0;
   166     return 0;
   167 }
   167 }
   168 
   168 
   169 /*!
   169 /*!
   170 Sets active prediction language. Returns true if given language is recognized
   170 Sets active prediction language. Returns true if given language is recognized
   171 by the engine and was succesfully activated. 
   171 by the engine and was successfully activated.
   172 */
   172 */
   173 bool HbPredictionBase::setLanguage(const HbInputLanguage &language, HbInputModeType inputMode)
   173 bool HbPredictionBase::setLanguage(const HbInputLanguage &language, HbInputModeType inputMode)
   174 {
   174 {
   175     Q_UNUSED(language); 
   175     Q_UNUSED(language);
   176     Q_UNUSED(inputMode);
   176     Q_UNUSED(inputMode);
   177 
   177 
   178     return false;
   178     return false;
   179 }
   179 }
   180 
   180 
   181 /*!
   181 /*!
   182 Returns active prediction language.  
   182 Returns active prediction language.
   183 */
   183 */
   184 HbInputLanguage HbPredictionBase::language() const
   184 HbInputLanguage HbPredictionBase::language() const
   185 {
   185 {
   186     return HbInputLanguage();
   186     return HbInputLanguage();
   187 }
   187 }
   196 
   196 
   197 /*!
   197 /*!
   198 \class HbPredictionEngine
   198 \class HbPredictionEngine
   199 \brief Prediction API for latin based langauges.
   199 \brief Prediction API for latin based langauges.
   200 
   200 
   201 This interface defines abstract prediction API for latin-based languages. 
   201 This interface defines abstract prediction API for latin-based languages.
   202 Also some non-latin languages whose prediction features are functionally similar to
   202 Also some non-latin languages whose prediction features are functionally similar to
   203 latin-based languages use this API. Those are for example Arabic and Hebrew.
   203 latin-based languages use this API. Those are for example Arabic and Hebrew.
   204 */
   204 */
   205 
   205 
   206 
   206 
   265     return HbErrorCorrectionLevelNone;
   265     return HbErrorCorrectionLevelNone;
   266 }
   266 }
   267 
   267 
   268 /*!
   268 /*!
   269 Sets active secondary language for prediction engine. Returns true if given language is recognized
   269 Sets active secondary language for prediction engine. Returns true if given language is recognized
   270 by the engine and was succesfully activated. 
   270 by the engine and was successfully activated.
   271 */
   271 */
   272 bool HbPredictionEngine::setSecondaryLanguage(const HbInputLanguage& language)
   272 bool HbPredictionEngine::setSecondaryLanguage(const HbInputLanguage &language)
   273 {
   273 {
   274     Q_UNUSED(language);
   274     Q_UNUSED(language);
   275     return false;
   275     return false;
   276 }
   276 }
   277 
   277 
   278 /*!
   278 /*!
   279 Returns active secondary prediction language.  
   279 Returns active secondary prediction language.
   280 */
   280 */
   281 HbInputLanguage HbPredictionEngine::secondaryLanguage() const
   281 HbInputLanguage HbPredictionEngine::secondaryLanguage() const
   282 {
   282 {
   283     return HbInputLanguage(QLocale::Language(0), QLocale::AnyCountry);
   283     return HbInputLanguage(QLocale::Language(0), QLocale::AnyCountry);
   284 }
   284 }
   292 {
   292 {
   293     return QString("");
   293     return QString("");
   294 }
   294 }
   295 
   295 
   296 /*!
   296 /*!
   297 Enables a specified feature for the prediction engine. 
   297 Enables a specified feature for the prediction engine.
   298 Returns true if the engine supports the feature and is able to enable the feature,
   298 Returns true if the engine supports the feature and is able to enable the feature,
   299 otherwise, returns false.
   299 otherwise, returns false.
   300 
   300 
   301 \sa HbPredictionEngine::isFeatureEnabled()
   301 \sa HbPredictionEngine::isFeatureEnabled()
   302 \sa HbPredictionEngine::disableFeature()
   302 \sa HbPredictionEngine::disableFeature()
   319     Q_UNUSED(feature);
   319     Q_UNUSED(feature);
   320     return false;
   320     return false;
   321 }
   321 }
   322 
   322 
   323 /*!
   323 /*!
   324 Disables a specified feature for the prediction engine. 
   324 Disables a specified feature for the prediction engine.
   325 Returns true if the engine supports the feature and is able to disable the feature,
   325 Returns true if the engine supports the feature and is able to disable the feature,
   326 otherwise, returns false.
   326 otherwise, returns false.
   327 Note: There is temporary default implementation for this method. It will be made
   327 Note: There is temporary default implementation for this method. It will be made
   328 pure virtual after suitable transition period.
   328 pure virtual after suitable transition period.
   329 
   329 
   341 written so far. This method will return candidates only if the engine
   341 written so far. This method will return candidates only if the engine
   342 supports next word prediction.
   342 supports next word prediction.
   343 
   343 
   344 \sa supportedFeatures
   344 \sa supportedFeatures
   345 */
   345 */
   346 QStringList HbPredictionEngine::nextWordCandidateList(HbPredictionCallback* callback)
   346 QStringList HbPredictionEngine::nextWordCandidateList(HbPredictionCallback *callback)
   347 {
   347 {
   348     Q_UNUSED(callback);
   348     Q_UNUSED(callback);
   349     return QStringList();
   349     return QStringList();
   350 }
   350 }
   351 
   351