src/hbplugins/inputmethods/common/hbinputpredictionhandler.cpp
changeset 21 4633027730f5
parent 7 923ff622b8b9
child 23 e6ad4ef83b23
equal deleted inserted replaced
7:923ff622b8b9 21:4633027730f5
    32 #include <hbaction.h>
    32 #include <hbaction.h>
    33 #include <hbinputvkbhost.h>
    33 #include <hbinputvkbhost.h>
    34 #include <hbcolorscheme.h>
    34 #include <hbcolorscheme.h>
    35 #include <hbinpututils.h>
    35 #include <hbinpututils.h>
    36 #include <hbinputbutton.h>
    36 #include <hbinputbutton.h>
       
    37 #include <hbmainwindow.h>
       
    38 
    37 #include "../touchinput/virtualqwerty.h"
    39 #include "../touchinput/virtualqwerty.h"
    38 
    40 
    39 #include "hbinputpredictionhandler_p.h"
    41 #include "hbinputpredictionhandler_p.h"
    40 #include "hbinputabstractbase.h"
    42 #include "hbinputabstractbase.h"
    41 
    43 
   553 {
   555 {
   554     //update the editor with pre-edit text
   556     //update the editor with pre-edit text
   555     mEngine->setWord(string);
   557     mEngine->setWord(string);
   556     bool used = false;	 
   558     bool used = false;	 
   557     mEngine->updateCandidates(mBestGuessLocation, used);
   559     mEngine->updateCandidates(mBestGuessLocation, used);
   558     if(showAutocompletionPart) {
   560     if(showAutocompletionPart && mShowTail) {
   559         mShowTail = true;
   561         mShowTail = true;
   560     } else {
   562     } else {
   561         mShowTail =  false;
   563         mShowTail =  false;
   562     }
   564     }
   563     updateEditor();
   565     updateEditor();
   617             }
   619             }
   618         }
   620         }
   619         break;
   621         break;
   620         case HbInputModeActionSetKeypad: {
   622         case HbInputModeActionSetKeypad: {
   621             if (d->mEngine) {
   623             if (d->mEngine) {
   622                 d->mEngine->setKeyboard(d->mInputMethod->inputState().keyboard());
   624                 d->mEngine->setKeyboard(d->mInputMethod->currentKeyboardType());
   623             } else {
   625             } else {
   624                 ret = false;;
   626                 ret = false;;
   625             }
   627             }
   626         }
   628         }
   627         break;
   629         break;
   649             d->mShowTail = false;
   651             d->mShowTail = false;
   650             break;
   652             break;
   651         case HbInputModeActionCloseSpellQuery:
   653         case HbInputModeActionCloseSpellQuery:
   652             closeSpellQueryDialog();
   654             closeSpellQueryDialog();
   653             break;
   655             break;
       
   656         case HbInputModeActionRestorePreviousState:
       
   657             showExactWordPopupIfNeeded();
       
   658             break;
   654         default:
   659         default:
   655             ret = HbInputModeHandler::actionHandler(action);
   660             ret = HbInputModeHandler::actionHandler(action);
   656             break;
   661             break;
   657     }
   662     }
   658     
   663     
   800     QString string;
   805     QString string;
   801     if(d->mCandidates && (*(d->mCandidates)).size() >= d->mBestGuessLocation + 1) {
   806     if(d->mCandidates && (*(d->mCandidates)).size() >= d->mBestGuessLocation + 1) {
   802         string = (*(d->mCandidates))[d->mBestGuessLocation].left(d->mEngine->inputLength());
   807         string = (*(d->mCandidates))[d->mBestGuessLocation].left(d->mEngine->inputLength());
   803     }
   808     }
   804     d->reset();
   809     d->reset();
       
   810     
       
   811     QObject::connect(d->mSpellQueryDialog->mainWindow(), SIGNAL(orientationChanged(Qt::Orientation)),
       
   812                     this, SLOT(closeSpellQueryDialog()));
       
   813     
   805     d->mSpellQueryDialog->launch(string);
   814     d->mSpellQueryDialog->launch(string);
   806 
   815 
   807 }
   816 }
   808 
   817 
   809 // To force the spell query dialog to close.
   818 // To force the spell query dialog to close.
   830     newFocusObject->setFocus();
   839     newFocusObject->setFocus();
   831     HbAbstractEdit *abstractEdit = qobject_cast<HbAbstractEdit*>(savedFocusObject);
   840     HbAbstractEdit *abstractEdit = qobject_cast<HbAbstractEdit*>(savedFocusObject);
   832     if(abstractEdit) {
   841     if(abstractEdit) {
   833         abstractEdit->setCursorPosition(abstractEdit->cursorPosition());
   842         abstractEdit->setCursorPosition(abstractEdit->cursorPosition());
   834     }
   843     }
   835     d->mInputMethod->setFocusObject(newFocusObject);
   844 	HbInputMethod::activeInputMethod()->setFocusObject(newFocusObject);
   836 
   845 
   837     if (closeReason == HbInputSpellQuery::HbOkPressed) {
   846     if (closeReason == HbInputSpellQuery::HbOkPressed) {
   838         d->commit(string,true);
   847         d->commit(string,true);
   839     } else if(closeReason == HbInputSpellQuery::HbCancelPressed) {
   848     } else if(closeReason == HbInputSpellQuery::HbCancelPressed) {
   840         //update the editor with pre-edit text
   849         //update the editor with pre-edit text