src/hbcore/inputfw/hbinputmethod.cpp
changeset 28 b7da29130b0e
parent 23 e6ad4ef83b23
equal deleted inserted replaced
23:e6ad4ef83b23 28:b7da29130b0e
   187     connect(&app, SIGNAL(aboutToQuit()), HbInputModeCache::instance(), SLOT(shutdown()));
   187     connect(&app, SIGNAL(aboutToQuit()), HbInputModeCache::instance(), SLOT(shutdown()));
   188     connect(&app, SIGNAL(aboutToQuit()), HbInputSettingProxy::instance(), SLOT(shutdown()));
   188     connect(&app, SIGNAL(aboutToQuit()), HbInputSettingProxy::instance(), SLOT(shutdown()));
   189     connect(&app, SIGNAL(aboutToQuit()), HbPredictionFactory::instance(), SLOT(shutDown()));
   189     connect(&app, SIGNAL(aboutToQuit()), HbPredictionFactory::instance(), SLOT(shutDown()));
   190     connect(&app, SIGNAL(aboutToQuit()), HbExtraDictionaryFactory::instance(), SLOT(shutdown()));
   190     connect(&app, SIGNAL(aboutToQuit()), HbExtraDictionaryFactory::instance(), SLOT(shutdown()));
   191 
   191 
   192     HbInputMethod *master = HbInputMethodNull::Instance();
   192     HbInputMethodNull *master = HbInputMethodNull::Instance();
   193 
   193 
   194     if (!master) {
   194     if (!master) {
   195         return false;
   195         return false;
   196     }
   196     }
   197 
   197 
   201     QInputContext *proxy = master->d_ptr->proxy();
   201     QInputContext *proxy = master->d_ptr->proxy();
   202     // A check required so that Qt does not delete inputcontext
   202     // A check required so that Qt does not delete inputcontext
   203     // which we are passing.
   203     // which we are passing.
   204     if (proxy != app.inputContext()) {
   204     if (proxy != app.inputContext()) {
   205         app.setInputContext(proxy);
   205         app.setInputContext(proxy);
       
   206     }
       
   207 
       
   208     if (master->delayedPanelRequest()) {
       
   209         master->setDelayedPanelRequest(false);
       
   210         QInputContext* ic = qApp->inputContext();
       
   211         if (ic) {
       
   212             QEvent *openEvent = new QEvent(QEvent::RequestSoftwareInputPanel);
       
   213             ic->filterEvent(openEvent);
       
   214             delete openEvent;
       
   215         }
   206     }
   216     }
   207 
   217 
   208     return true;
   218     return true;
   209 }
   219 }
   210 
   220 
   448     bool refreshHost = false;
   458     bool refreshHost = false;
   449 
   459 
   450     // Delete previous focus object.
   460     // Delete previous focus object.
   451     if (d->mFocusObject) {
   461     if (d->mFocusObject) {
   452         refreshHost = true;
   462         refreshHost = true;
   453         disconnect(d->mFocusObject, SIGNAL(editorDeleted()), this, SLOT(editorDeleted()));
   463         disconnect(d->mFocusObject->object(), SIGNAL(destroyed(QObject *)), this, SLOT(editorDeleted(QObject *)));
   454     }
   464     }
   455     delete d->mFocusObject;
   465     delete d->mFocusObject;
   456     d->mFocusObject = 0;
   466     d->mFocusObject = 0;
   457 
   467 
   458     // Attach focus.
   468     // Attach focus.
   479 */
   489 */
   480 void HbInputMethod::widgetDestroyed(QWidget *widget)
   490 void HbInputMethod::widgetDestroyed(QWidget *widget)
   481 {
   491 {
   482     Q_D(HbInputMethod);
   492     Q_D(HbInputMethod);
   483 
   493 
   484     if (d->mFocusObject && d->mFocusObject->object() == widget) {
   494     if (d->proxy()->focusWidget() == widget) {
   485         delete d->mFocusObject;
   495         delete d->mFocusObject;
   486         d->mFocusObject = 0;
   496         d->mFocusObject = 0;
   487         // passing to actual QInputContext which is attached to Qt framework.
   497         // update QInputContext internal focusWidget pointer.
   488         // which will internally set QInputContext::focusWidget to Null.
       
   489         d->proxy()->QInputContext::widgetDestroyed(widget);
   498         d->proxy()->QInputContext::widgetDestroyed(widget);
   490         d->proxy()->QInputContext::setFocusWidget(0);
   499         d->proxy()->QInputContext::setFocusWidget(0);
   491     }
   500     }
   492 }
   501 }
   493 
   502 
   784     Q_D(HbInputMethod);
   793     Q_D(HbInputMethod);
   785     d->mFocusLocked = false;
   794     d->mFocusLocked = false;
   786 }
   795 }
   787 
   796 
   788 /*!
   797 /*!
       
   798 Returns true if focus is locked. If focus is locked, input framework will ignore 
       
   799 all the incoming focus events completely until focus is unlocked.
       
   800 
       
   801 \sa lockFocus
       
   802 \sa unlockFocus
       
   803 */
       
   804 bool HbInputMethod::isFocusLocked()
       
   805 {
       
   806     Q_D(HbInputMethod);
       
   807     return d->mFocusLocked;
       
   808 }
       
   809 
       
   810 /*!
   789 Removes input method focus and asks active input plugin to close its active UI-components
   811 Removes input method focus and asks active input plugin to close its active UI-components
   790 (such as touch keypads). This may be needed in some special cases where the underlying
   812 (such as touch keypads). This may be needed in some special cases where the underlying
   791 application wants to make sure that there are no input related elements on the screen.
   813 application wants to make sure that there are no input related elements on the screen.
   792 
   814 
   793 This is a if-all-else fails backup method. Same can be done by doing
   815 This is a if-all-else fails backup method. Same can be done by doing