src/hbcore/vkbhosts/hbabstractvkbhost.cpp
changeset 28 b7da29130b0e
parent 23 e6ad4ef83b23
child 30 80e4d18b72f5
equal deleted inserted replaced
23:e6ad4ef83b23 28:b7da29130b0e
    20 **
    20 **
    21 ** If you have questions regarding the use of this file, please contact
    21 ** If you have questions regarding the use of this file, please contact
    22 ** Nokia at developer.feedback@nokia.com.
    22 ** Nokia at developer.feedback@nokia.com.
    23 **
    23 **
    24 ****************************************************************************/
    24 ****************************************************************************/
       
    25 
    25 #include "hbabstractvkbhost.h"
    26 #include "hbabstractvkbhost.h"
    26 #include "hbabstractvkbhost_p.h"
    27 #include "hbabstractvkbhost_p.h"
       
    28 #include "private/hbvkbgeometrylogic_p.h"
    27 #include "hbinputvirtualkeyboard.h"
    29 #include "hbinputvirtualkeyboard.h"
    28 #include "hbinputsettingproxy.h"
    30 #include "hbinputsettingproxy.h"
    29 #include "hbinputvkbhostbridge.h"
    31 #include "hbinputvkbhostbridge.h"
    30 #include "hbinputmethod.h"
    32 #include "hbinputmethod.h"
    31 #include "hbdeviceprofile.h"
    33 #include "hbdeviceprofile.h"
    36 #include "hbinstance.h"
    38 #include "hbinstance.h"
    37 
    39 
    38 #include <QTextEdit>
    40 #include <QTextEdit>
    39 
    41 
    40 const int HbAnimationTime = 200;
    42 const int HbAnimationTime = 200;
    41 const qreal HbEditorExtraMargin = 17.0;
       
    42 const qreal HbCursorLineMargin = 5.0;
       
    43 const qreal HbContainerBorderMargin = 20.0;
       
    44 const qreal HbHeightVerticalFactor = 0.5;
    43 const qreal HbHeightVerticalFactor = 0.5;
    45 const qreal HbHeightHorizFactor = 0.7;
    44 const qreal HbHeightHorizFactor = 0.7;
    46 //Marginal value of the keypad height
       
    47 const qreal HbHeightMarginFactor = 0.6;
       
    48 const qreal HbDeltaHeight = 3.0;
       
    49 
    45 
    50 const QString KHandWritingName("Handwriting");
    46 const QString KHandWritingName("Handwriting");
    51 // see hbpopup.cpp for this
    47 // see hbpopup.cpp for this
    52 extern const char* KPositionManagedByVKB;
    48 extern const char* KPositionManagedByVKB;
    53 
    49 
   216     }
   212     }
   217 
   213 
   218     mScreenSize = screenSize();
   214     mScreenSize = screenSize();
   219 }
   215 }
   220 
   216 
       
   217 // TODO: could be in vkb geometry engine
       
   218 bool HbAbstractVkbHostPrivate::getViewAndFocusObjects(HbView*& currentView, HbInputFocusObject*& focusObject)
       
   219 {    
       
   220     if (!mKeypad || !mInputMethod || !mContainerWidget ) {
       
   221         return false;
       
   222     }
       
   223 
       
   224     HbMainWindow* window = mainWindow();
       
   225     if (!window) {
       
   226         return false;
       
   227     }
       
   228 
       
   229     currentView = window->currentView();
       
   230     if (!currentView) {
       
   231         return false;
       
   232     }
       
   233 
       
   234     focusObject = mInputMethod->focusObject();
       
   235     if (!focusObject) {
       
   236         return false;
       
   237     }
       
   238 
       
   239     return true;
       
   240 }
       
   241 
   221 bool HbAbstractVkbHostPrivate::prepareContainerAnimation(HbVkbHost::HbVkbStatus status)
   242 bool HbAbstractVkbHostPrivate::prepareContainerAnimation(HbVkbHost::HbVkbStatus status)
   222 {
   243 {
   223     if (!mKeypad || !mContainerWidget->widgetObject() || !mInputMethod || !mInputMethod->focusObject()) {
   244     // Init and check main objects
       
   245     HbView* currentView = NULL;
       
   246     HbInputFocusObject* focusObject = NULL;
       
   247     if (!getViewAndFocusObjects(currentView, focusObject)) {
   224         return false;
   248         return false;
   225     }
   249     }
   226 
   250 
       
   251     // Init parameters before calling...
       
   252     QSizeF keypadSize = mKeypad->size();
       
   253     QRectF viewRect = currentView->sceneBoundingRect();
       
   254     bool vkbOpen = mKeypadStatus == HbVkbHost::HbVkbStatusOpened;
       
   255     bool titlebarVisible = currentView->isItemVisible(Hb::TitleBarItem);
       
   256     bool statusbarVisible = currentView->isItemVisible(Hb::StatusBarItem);
       
   257     QRectF containerRect = mContainerWidget->sceneBoundingRect();
       
   258     QRectF editorRect = focusObject->editorGeometry();
       
   259     QRectF cursorRect = focusObject->microFocus();
       
   260 
   227     if (status == HbVkbHost::HbVkbStatusOpened) {
   261     if (status == HbVkbHost::HbVkbStatusOpened) {
   228         // Calculate the area that remains visible when the keypad is open.
   262         // Initialize geometry calculation unit to handle all geometry calculations.
   229         QRectF visibleArea = QRectF(0.0, 0.0, mScreenSize.width(), mScreenSize.height() - mKeypad->size().height());
   263         HbVkbGeometryLogicPrivate unit = HbVkbGeometryLogicPrivate(
   230         // adjust the container position such that the focused object is always visible. This is required in some cases 
   264                 mScreenSize,
   231         // where the actual visible area is very less when the keypad is opened. The cotainer position is automatically adjusted when
   265                 keypadSize,
   232         // the keypad height to screen height ratio exceeds the marginal height value HbHeightMarginFactor. By doing this, we can make
   266                 viewRect,
   233         // sure that some space available for displaying popups like exactword popup in some input methods        
   267                 vkbOpen,
   234         bool adjustContainer = (q_ptr->confirmedKeyboardSize().height() >
   268                 titlebarVisible,
   235             (mScreenSize.height() * HbHeightMarginFactor))? true : false;
   269                 statusbarVisible,
   236         // Find out the container area.
   270                 containerRect,
   237         QRectF containerArea = mContainerWidget->sceneBoundingRect();
   271                 editorRect,
   238         containerArea.adjust(0.0, -HbContainerBorderMargin, 0.0, HbContainerBorderMargin);
   272                 cursorRect);
   239 
   273 
   240         HbMainWindow *mainWin = mainWindow();
   274         return unit.calculateContainerMovement( mContainerMovementVector );
   241         HbView *currentView = mainWin ? mainWin->currentView() : 0;
       
   242 
       
   243         if (!currentView) {
       
   244             return false;
       
   245         }
       
   246         // check whether the title and status bars are hidden or not
       
   247         bool isTitleOrStatusBarVisible = currentView->isItemVisible(
       
   248             Hb::TitleBarItem) | currentView->isItemVisible(Hb::StatusBarItem);
       
   249 
       
   250         // move the container up when hiding the title and status bars
       
   251         if (isTitleOrStatusBarVisible) {
       
   252             mContainerMovementVector.setY(visibleArea.top() - currentView->sceneBoundingRect().top());          
       
   253         }
       
   254 
       
   255         if (visibleArea.contains(containerArea)) {
       
   256             // The whole container is already inside the visible area, nothing to do.
       
   257             return false;
       
   258         }
       
   259 
       
   260         // If it isn't in the visible area yet but fits there. Let's move it there.
       
   261         if (visibleArea.height() >= containerArea.height()) {
       
   262             // calculate the new container area after hiding the bars
       
   263             containerArea.translate(mContainerMovementVector);
       
   264 
       
   265             if (adjustContainer) {
       
   266                 adjustContainerPosition();
       
   267             } else {
       
   268                 mContainerMovementVector += QPointF(0.0, visibleArea.bottom() - containerArea.bottom());
       
   269             }
       
   270             return true;
       
   271         }
       
   272 
       
   273         // Find out the editor bounding box and add a small margin to height.
       
   274         QRectF editorGeometry = mInputMethod->focusObject()->editorGeometry();
       
   275         editorGeometry.adjust(0.0, -HbCursorLineMargin, 0.0, HbCursorLineMargin);
       
   276 
       
   277         // calculate the new editor position after hiding the title bars        
       
   278         editorGeometry.translate(mContainerMovementVector);
       
   279 
       
   280         // Then see if the editor is already inside the visible area.
       
   281         // If it isn't, see if it would fit there.
       
   282         if (!visibleArea.contains(editorGeometry)) {
       
   283             if (editorGeometry.width() <= visibleArea.width() &&
       
   284                 editorGeometry.height() <= visibleArea.height()) {
       
   285                 // first check whether the microfocus rectangle is inside the visible area. In case of
       
   286                 // text or multiline editors, dont change the editor position if cursor is in visible area                
       
   287                 if (adjustContainer) {
       
   288                     if (adjustContainerPosition()) {
       
   289                         return true;
       
   290                     }
       
   291                 }
       
   292                 // Yes, it fits into visible area, let's move it there so that
       
   293                 // the whole editor area is in use right away.
       
   294                 // First check if we want to move it to upper or lower
       
   295                 // part of the visible area.
       
   296                 if (editorGeometry.top() <= visibleArea.top()) {
       
   297                     // It goes to the upper part of the visible area.
       
   298                     mContainerMovementVector += QPointF(0.0, -editorGeometry.top());
       
   299                 } else {
       
   300                     mContainerMovementVector += QPointF(0.0, visibleArea.bottom() - editorGeometry.bottom());
       
   301                 } 
       
   302                 return true;
       
   303             }
       
   304         }
       
   305 
       
   306         // The editor is either already inside the visible area or doesn't fit there.
       
   307         // Let's see if the cursor is visble.
       
   308         // First find out micro focus rectangle and increase the height by a small margin.
       
   309         QRectF microFocus = mInputMethod->focusObject()->microFocus();
       
   310         microFocus.setTop(microFocus.top() - HbEditorExtraMargin);
       
   311         microFocus.setBottom(microFocus.bottom() + HbEditorExtraMargin);
       
   312 
       
   313         // calculate the new cursor position after hiding the title bars
       
   314         microFocus.translate(mContainerMovementVector);
       
   315             
       
   316         // Check whether the cursor rectangle is inside visible area.
       
   317         if (!visibleArea.contains(microFocus)) {
       
   318             QRectF realEditorGeometry = editorGeometry;
       
   319             realEditorGeometry.adjust(0.0, HbCursorLineMargin, 0.0, -HbCursorLineMargin);
       
   320             if (!realEditorGeometry.contains(microFocus)) {
       
   321                 // A sanity check. If the microFocus rectangle is outside the editor
       
   322                 // bounding rect, don't do anything. The situation in editor widget is not
       
   323                 // up to date.
       
   324                 return false;
       
   325             }
       
   326             // The cursor is outside the visible area. Figure out how much and
       
   327             // to which direction the container has to be moved.
       
   328             if (microFocus.bottom() <= visibleArea.top()) {
       
   329                 // First see what would happen if we returned the container to original position.
       
   330                 // Is the cursor visible then?
       
   331                 // This is always preferred, use it if possible.
       
   332                 QPointF toOriginalPos = mOriginalContainerPosition - mContainerWidget->pos();
       
   333                 QRectF translatedMicroFocus = microFocus.translated(toOriginalPos);
       
   334                 if (visibleArea.contains(translatedMicroFocus)) {
       
   335                     mContainerMovementVector += toOriginalPos;
       
   336                 } else {
       
   337                     // It goes to the upper part of the visible area.
       
   338                     mContainerMovementVector += QPointF(0.0, visibleArea.top() - microFocus.top());
       
   339                 }
       
   340             } else {
       
   341                 mContainerMovementVector += QPointF(0.0, visibleArea.bottom() - microFocus.bottom());
       
   342             }       
       
   343             return true;
       
   344         }
       
   345         if (adjustContainer && adjustContainerPosition()) {
       
   346            return true;
       
   347         }          
       
   348     } else {
       
   349         // It is going to be closed or minimized.
       
   350         mContainerMovementVector = mOriginalContainerPosition - mContainerMovementStartingPoint;
       
   351         return true;
       
   352     }
   275     }
   353 
   276 
   354     return false;
   277     return false;
   355 }
   278 }
   356 
   279 
   407     // global signal not specific to any containter widget, can be connected now.
   330     // global signal not specific to any containter widget, can be connected now.
   408     HbMainWindow *mainWindow = this->mainWindow();
   331     HbMainWindow *mainWindow = this->mainWindow();
   409     if (mainWindow) {
   332     if (mainWindow) {
   410         q_ptr->connect(mainWindow, SIGNAL(aboutToChangeOrientation()), q_ptr, SLOT(orientationAboutToChange()));
   333         q_ptr->connect(mainWindow, SIGNAL(aboutToChangeOrientation()), q_ptr, SLOT(orientationAboutToChange()));
   411         q_ptr->connect(mainWindow, SIGNAL(orientationChanged(Qt::Orientation)), q_ptr, SLOT(orientationChanged(Qt::Orientation)));
   334         q_ptr->connect(mainWindow, SIGNAL(orientationChanged(Qt::Orientation)), q_ptr, SLOT(orientationChanged(Qt::Orientation)));
   412         q_ptr->connect(mainWindow, SIGNAL(currentViewChanged(HbView *)), q_ptr, SLOT(currentViewChanged(HbView *)));
   335         q_ptr->connect(mainWindow, SIGNAL(aboutToChangeView(HbView *, HbView *)), q_ptr, SLOT(aboutToChangeView(HbView *, HbView *)));
   413     }
   336     }
   414 }
   337 }
   415 
   338 
   416 void HbAbstractVkbHostPrivate::disconnectSignals()
   339 void HbAbstractVkbHostPrivate::disconnectSignals()
   417 {
   340 {
   420     // global signal not specific to any containter widget, can be connected now.
   343     // global signal not specific to any containter widget, can be connected now.
   421     HbMainWindow *mainWindow = this->mainWindow();
   344     HbMainWindow *mainWindow = this->mainWindow();
   422     if (mainWindow) {
   345     if (mainWindow) {
   423         q_ptr->disconnect(mainWindow, SIGNAL(aboutToChangeOrientation()), q_ptr, SLOT(orientationAboutToChange()));
   346         q_ptr->disconnect(mainWindow, SIGNAL(aboutToChangeOrientation()), q_ptr, SLOT(orientationAboutToChange()));
   424         q_ptr->disconnect(mainWindow, SIGNAL(orientationChanged(Qt::Orientation)), q_ptr, SLOT(orientationChanged(Qt::Orientation)));
   347         q_ptr->disconnect(mainWindow, SIGNAL(orientationChanged(Qt::Orientation)), q_ptr, SLOT(orientationChanged(Qt::Orientation)));
   425         q_ptr->disconnect(mainWindow, SIGNAL(currentViewChanged(HbView *)), q_ptr, SLOT(currentViewChanged(HbView *)));
   348         q_ptr->disconnect(mainWindow, SIGNAL(aboutToChangeView(HbView *, HbView *)), q_ptr, SLOT(aboutToChangeView(HbView *, HbView *)));
   426     }
   349     }
   427 }
   350 }
   428 
   351 
   429 void HbAbstractVkbHostPrivate::openKeypad()
   352 void HbAbstractVkbHostPrivate::openKeypad()
   430 {
   353 {
   677     if (popup) {
   600     if (popup) {
   678         return;
   601         return;
   679     }
   602     }
   680 
   603 
   681     HbMainWindow *mainWin = mainWindow();
   604     HbMainWindow *mainWin = mainWindow();
   682     HbView *currentView;
   605     if (!mainWin) {
   683 
   606         return;
   684     if (mainWin && (currentView = mainWin->currentView())) {
   607     }
       
   608 
       
   609     HbView *currentView = mainWin->currentView();
       
   610     if (currentView) {
   685         HbView::HbViewFlags flags = currentView->viewFlags();
   611         HbView::HbViewFlags flags = currentView->viewFlags();
   686 
   612 
   687         HbView::HbViewFlags setFlags = HbView::ViewFlagNone;
   613         HbView::HbViewFlags setFlags = HbView::ViewFlagNone;
   688         if (!visible) {
   614         if (!visible) {
   689             if (!(flags & HbView::ViewTitleBarHidden)) {
   615             if (!(flags & HbView::ViewTitleBarHidden)) {
   714             currentView->setViewFlags(flags & ~setFlags);
   640             currentView->setViewFlags(flags & ~setFlags);
   715         }
   641         }
   716     }
   642     }
   717 }
   643 }
   718 
   644 
   719 bool HbAbstractVkbHostPrivate::adjustContainerPosition()
       
   720 {
       
   721     bool result = false;
       
   722     if (!mInputMethod || !mInputMethod->focusObject()) {
       
   723         return result;
       
   724     }
       
   725     // Calculate the area that remains visible when the keypad is open. 
       
   726     QRectF visibleArea = QRectF(0.0, 0.0, mScreenSize.width(), mScreenSize.height() - mKeypad->size().height());
       
   727     QRectF microFocus = mInputMethod->focusObject()->microFocus();
       
   728     microFocus.adjust(0.0, -HbEditorExtraMargin, 0.0, HbEditorExtraMargin);
       
   729 
       
   730     // calculate the new cursor position after moving it to the visible area
       
   731     QRectF newCursorRect = microFocus.translated(mContainerMovementVector);
       
   732     if (visibleArea.contains(newCursorRect)) {
       
   733         qreal topArea = newCursorRect.top() - visibleArea.top() - HbDeltaHeight;
       
   734         qreal bottomArea = visibleArea.bottom() - newCursorRect.bottom() - HbDeltaHeight;
       
   735         if (topArea > 0 && bottomArea > 0) {
       
   736             if (topArea >= bottomArea) {
       
   737                 mContainerMovementVector += QPointF(0.0, bottomArea);
       
   738             } else {
       
   739                 mContainerMovementVector += QPointF(0.0, -topArea);
       
   740             }
       
   741         }
       
   742         result = true;  
       
   743     }
       
   744     return result;
       
   745 }
       
   746 
       
   747 /// @endcond
   645 /// @endcond
   748 
   646 
   749 
   647 
   750 HbAbstractVkbHost::HbAbstractVkbHost(HbWidget *containerWidget) : d_ptr(new HbAbstractVkbHostPrivate(this, containerWidget))
   648 HbAbstractVkbHost::HbAbstractVkbHost(HbWidget *containerWidget) : d_ptr(new HbAbstractVkbHostPrivate(this, containerWidget))
   751 {
   649 {
   752     Q_D(HbAbstractVkbHost);
   650     Q_D(HbAbstractVkbHost);
   753 
   651 
   754     setParent(containerWidget);
   652     setParent(containerWidget);
   755     HbVkbHost::attachHost(this, containerWidget);
   653     HbVkbHost::attachHost(this, containerWidget);
       
   654     if (containerWidget) {
       
   655         containerWidget->setFlag(QGraphicsItem::ItemSendsGeometryChanges);
       
   656     }
   756 
   657 
   757     connect(&d->mTimeLine, SIGNAL(finished()), this, SLOT(animationFinished()));
   658     connect(&d->mTimeLine, SIGNAL(finished()), this, SLOT(animationFinished()));
   758     connect(&d->mTimeLine, SIGNAL(valueChanged(qreal)), this, SLOT(animValueChanged(qreal)));
   659     connect(&d->mTimeLine, SIGNAL(valueChanged(qreal)), this, SLOT(animValueChanged(qreal)));
   759 }
   660 }
   760 
   661 
   773 {
   674 {
   774     Q_D(HbAbstractVkbHost);
   675     Q_D(HbAbstractVkbHost);
   775 
   676 
   776     setParent(containerWidget);
   677     setParent(containerWidget);
   777     HbVkbHost::attachHost(this, containerWidget);
   678     HbVkbHost::attachHost(this, containerWidget);
       
   679     if (containerWidget) {
       
   680         containerWidget->setFlag(QGraphicsItem::ItemSendsGeometryChanges);
       
   681     }
   778 
   682 
   779     connect(&d->mTimeLine, SIGNAL(finished()), this, SLOT(animationFinished()));
   683     connect(&d->mTimeLine, SIGNAL(finished()), this, SLOT(animationFinished()));
   780     connect(&d->mTimeLine, SIGNAL(valueChanged(qreal)), this, SLOT(animValueChanged(qreal)));
   684     connect(&d->mTimeLine, SIGNAL(valueChanged(qreal)), this, SLOT(animValueChanged(qreal)));
   781 }
   685 }
   782 
   686 
   784 {
   688 {
   785     Q_D(HbAbstractVkbHost);
   689     Q_D(HbAbstractVkbHost);
   786 
   690 
   787     setParent(containerWidget);
   691     setParent(containerWidget);
   788     HbVkbHost::attachHost(this, containerWidget);
   692     HbVkbHost::attachHost(this, containerWidget);
       
   693     if (containerWidget) {
       
   694         containerWidget->setFlag(QGraphicsItem::ItemSendsGeometryChanges);
       
   695     }
   789 
   696 
   790     connect(&d->mTimeLine, SIGNAL(finished()), this, SLOT(animationFinished()));
   697     connect(&d->mTimeLine, SIGNAL(finished()), this, SLOT(animationFinished()));
   791     connect(&d->mTimeLine, SIGNAL(valueChanged(qreal)), this, SLOT(animValueChanged(qreal)));
   698     connect(&d->mTimeLine, SIGNAL(valueChanged(qreal)), this, SLOT(animValueChanged(qreal)));
   792 }
   699 }
   793 
   700 
   964                 }
   871                 }
   965             }
   872             }
   966 
   873 
   967             // Make sure the keypad never steals focus.
   874             // Make sure the keypad never steals focus.
   968             d->mKeypad->setFlag(QGraphicsItem::ItemIsPanel, true);
   875             d->mKeypad->setFlag(QGraphicsItem::ItemIsPanel, true);
   969             d->mKeypad->setActive(false);
   876             if (d->mKeypad->isActive()) {
       
   877                 d->mKeypad->setActive(false);
       
   878             }
   970             emit keypadOpened();
   879             emit keypadOpened();
   971         } else if (d->mKeypadStatus == HbVkbHost::HbVkbStatusMinimized) {
   880         } else if (d->mKeypadStatus == HbVkbHost::HbVkbStatusMinimized) {
   972             d->mCallback->keyboardMinimized(this);
   881             d->mCallback->keyboardMinimized(this);
   973             emit keypadClosed();
   882             emit keypadClosed();
   974         } else {
   883         } else {
   977             // Return the container where it was.
   886             // Return the container where it was.
   978             d->mContainerWidget->setPos(d->mOriginalContainerPosition);
   887             d->mContainerWidget->setPos(d->mOriginalContainerPosition);
   979             d->mContainerWidget->widgetObject()->setProperty(KPositionManagedByVKB, false );
   888             d->mContainerWidget->widgetObject()->setProperty(KPositionManagedByVKB, false );
   980             d->mCallback->keyboardClosed(this);
   889             d->mCallback->keyboardClosed(this);
   981             emit keypadClosed();
   890             emit keypadClosed();
   982             HbVkbHostBridge::instance()->connectHost(0);
   891 
       
   892             // Keyboard might be opened again due to pending open call
       
   893             if (d->mKeypadStatus == HbVkbHost::HbVkbStatusClosed) {
       
   894                 HbVkbHostBridge::instance()->connectHost(0);
       
   895             }
   983         }
   896         }
   984     }
   897     }
   985 }
   898 }
   986 
   899 
   987 /*!
   900 /*!
  1197 /*!
  1110 /*!
  1198 This slot is called when active HbView changes.
  1111 This slot is called when active HbView changes.
  1199 */
  1112 */
  1200 void HbAbstractVkbHost::currentViewChanged(HbView *view)
  1113 void HbAbstractVkbHost::currentViewChanged(HbView *view)
  1201 {
  1114 {
  1202     Q_D(HbAbstractVkbHost);
  1115     Q_UNUSED(view);
  1203 
  1116 
  1204     if (view != d->mContainerWidget->widgetObject()) {
       
  1205         if (d->mTimeLine.state() == QTimeLine::Running) {
       
  1206             d->cancelAnimationAndHideVkbWidget();
       
  1207             if (d->mCallback) {
       
  1208                 d->mCallback->keyboardClosed(this);
       
  1209             }
       
  1210         } else if (d->mKeypadStatus != HbVkbStatusClosed) {
       
  1211             d->closeKeypadWithoutAnimation();
       
  1212             emit keypadClosed();
       
  1213         }
       
  1214     }
       
  1215 }
  1117 }
  1216 
  1118 
  1217 /*!
  1119 /*!
  1218 \reimp
  1120 \reimp
  1219 */
  1121 */
  1255         HbVirtualKeyboard *vkb = d->mPendingCall.vkb;
  1157         HbVirtualKeyboard *vkb = d->mPendingCall.vkb;
  1256         d->mPendingCall.vkb = 0;
  1158         d->mPendingCall.vkb = 0;
  1257         openKeypad(vkb, d->mInputMethod, d->mPendingCall.animationAllowed);
  1159         openKeypad(vkb, d->mInputMethod, d->mPendingCall.animationAllowed);
  1258     }
  1160     }
  1259 }
  1161 }
  1260 
  1162 /*!
       
  1163 This slot is called when change in active HbView starts.
       
  1164 */
       
  1165 
       
  1166 void HbAbstractVkbHost::aboutToChangeView(HbView *oldView, HbView *newView)
       
  1167 {
       
  1168     Q_D(HbAbstractVkbHost);
       
  1169     if (oldView != newView) {
       
  1170         if (d->mTimeLine.state() == QTimeLine::Running) {
       
  1171             d->cancelAnimationAndHideVkbWidget();
       
  1172             if (d->mCallback) {
       
  1173                 d->mCallback->keyboardClosed(this);
       
  1174             }
       
  1175         } else if (d->mKeypadStatus != HbVkbStatusClosed) {
       
  1176             d->closeKeypadWithoutAnimation();
       
  1177             emit keypadClosed();
       
  1178         }
       
  1179     }
       
  1180 }
  1261 // End of file
  1181 // End of file