diff -r b7da29130b0e -r 80e4d18b72f5 src/hbcore/vkbhosts/hbabstractvkbhost.cpp --- a/src/hbcore/vkbhosts/hbabstractvkbhost.cpp Fri Sep 17 08:32:10 2010 +0300 +++ b/src/hbcore/vkbhosts/hbabstractvkbhost.cpp Mon Oct 04 00:38:12 2010 +0300 @@ -31,6 +31,7 @@ #include "hbinputvkbhostbridge.h" #include "hbinputmethod.h" #include "hbdeviceprofile.h" +#include "hbscrollarea.h" #include "hbmainwindow.h" #include "hbpopup.h" #include "hbview.h" @@ -42,6 +43,7 @@ const int HbAnimationTime = 200; const qreal HbHeightVerticalFactor = 0.5; const qreal HbHeightHorizFactor = 0.7; +const qreal HbEditorExtraMargin = 17.0; const QString KHandWritingName("Handwriting"); // see hbpopup.cpp for this @@ -49,110 +51,116 @@ /// @cond -HbVkbHostContainerWidget::HbVkbHostContainerWidget(QObject *containterWidget) - : mContainerWidget(containterWidget) -{ -} - -// sets container widgets position to new position. -void HbVkbHostContainerWidget::setPos(QPointF newPosition) +HbVkbHostContainerWidget::HbVkbHostContainerWidget(QObject *containerWidget) { - if (mContainerWidget) { - QGraphicsObject *graphicsObject = qobject_cast(mContainerWidget); - if (graphicsObject) { - graphicsObject->setPos(newPosition); - return; - } - - QWidget *qWidget = qobject_cast(mContainerWidget); - if (qWidget) { -#ifdef Q_WS_WIN - QPoint finalPosition = newPosition.toPoint(); - finalPosition -= qWidget->geometry().topLeft() - qWidget->frameGeometry().topLeft(); - qWidget->move(finalPosition); -#else - qWidget->move(newPosition.toPoint()); -#endif - return; - } + mGraphicsObject = qobject_cast(containerWidget); + if (!mGraphicsObject) { + mWidget = qobject_cast(containerWidget); } } -// returns the global position, if container widget is a QGraphicsObject, it returns -// scene position. In case the widget is QWidget it returns global co-ordinates +/*! +\internal +Sets container widgets position to new position. +*/ +void HbVkbHostContainerWidget::setPos(QPointF newPosition) +{ + if (mGraphicsObject) { + mGraphicsObject->setPos(newPosition); + return; + } + + if (mWidget) { +#ifdef Q_WS_WIN + QPoint finalPosition = newPosition.toPoint(); + finalPosition -= mWidget->geometry().topLeft() - mWidget->frameGeometry().topLeft(); + mWidget->move(finalPosition); +#else + mWidget->move(newPosition.toPoint()); +#endif + return; + } +} + +/*! +\internal +Returns the global position, if container widget is a QGraphicsObject, it returns +scene position. In case the widget is QWidget it returns global co-ordinates +*/ QPointF HbVkbHostContainerWidget::pos() { - if (mContainerWidget) { - QGraphicsObject *graphicsObject = qobject_cast(mContainerWidget); - if (graphicsObject) { - return graphicsObject->pos();; - } + if (mGraphicsObject) { + return mGraphicsObject->pos(); + } - QWidget *qWidget = qobject_cast(mContainerWidget); - if (qWidget) { - return qWidget->mapToGlobal(QPoint(0, 0)); - } + if (mWidget) { + return mWidget->mapToGlobal(QPoint(0, 0)); } return QPointF(0, 0); } -// returns the bounding rect in global co-ordinate, if container widget is a QGraphicsObject -// it returns in scene co-ordinate, incase widget is QWidget it returns in global co-ordinate +/*! +\internal +Returns the bounding rect in global co-ordinate, if container widget is a QGraphicsObject +it returns in scene co-ordinate, incase widget is QWidget it returns in global co-ordinate +*/ QRectF HbVkbHostContainerWidget::sceneBoundingRect() { - if (mContainerWidget) { - QGraphicsObject *graphicsObject = qobject_cast(mContainerWidget); - if (graphicsObject) { - return graphicsObject->sceneBoundingRect();; - } + if (mGraphicsObject) { + return mGraphicsObject->sceneBoundingRect(); + } - QWidget *qWidget = qobject_cast(mContainerWidget); - if (qWidget) { - return QRectF(qWidget->mapToGlobal(QPoint(0, 0)), qWidget->size()); - } + if (mWidget) { + return QRectF(mWidget->mapToGlobal(QPoint(0, 0)), mWidget->size()); } return QRectF(0, 0, 0, 0); } -// connect container specific signals here. +/*! +\internal +Connects ontainer specific signals. +*/ void HbVkbHostContainerWidget::connectSignals(QObject *receiver) { - if (qobject_cast (mContainerWidget)) { - QObject::connect(mContainerWidget, SIGNAL(yChanged()), + if (mGraphicsObject) { + QObject::connect(mGraphicsObject, SIGNAL(yChanged()), receiver, SLOT(ensureCursorVisibility())); } - HbPopup *popup = qobject_cast(mContainerWidget); + HbPopup *popup = qobject_cast(mGraphicsObject); if (popup) { - QObject::connect(popup, SIGNAL(aboutToHide()), receiver, SLOT(containerAboutToClose())); + QObject::connect(popup, SIGNAL(aboutToHide()), receiver, SLOT(_q_containerAboutToClose())); } - HbView *view = qobject_cast(mContainerWidget); + HbView *view = qobject_cast(mGraphicsObject); if (view) { QObject::connect(view->mainWindow(), SIGNAL(currentViewChanged(HbView *)), - receiver, SLOT(currentViewChanged(HbView *))); + receiver, SLOT(_q_containerAboutToClose())); } } -// disconnect container specific signals here. +/*! +\internal +Disconnects container specific signals. +*/ void HbVkbHostContainerWidget::disconnectSignals(QObject *receiver) { - if (qobject_cast (mContainerWidget)) { - QObject::disconnect(mContainerWidget, SIGNAL(yChanged()), + if (mGraphicsObject) { + QObject::disconnect(mGraphicsObject, SIGNAL(yChanged()), receiver, SLOT(ensureCursorVisibility())); } - HbPopup *popup = qobject_cast(mContainerWidget); + HbPopup *popup = qobject_cast(mGraphicsObject); if (popup) { - QObject::disconnect(popup, SIGNAL(aboutToHide()), receiver, SLOT(containerAboutToClose())); + QObject::disconnect(popup, SIGNAL(aboutToHide()), receiver, SLOT(_q_containerAboutToClose())); } - HbPopup *view = qobject_cast(mContainerWidget); + HbPopup *view = qobject_cast(mGraphicsObject); if (view) { QObject::disconnect(view->mainWindow(), SIGNAL(currentViewChanged(HbView *)), - receiver, SLOT(currentViewChanged(HbView *))); + receiver, SLOT(_q_containerAboutToClose())); } } @@ -160,6 +168,7 @@ /*! \proto +@hbcore \class HbAbstractVkbHost \brief Base class for HbCore's virtual keyboard hosts. @@ -194,9 +203,14 @@ delete mContainerWidget; } +/*! +\internal +Initializes starting values to parameters needed for running the keypad and +container widget animation effects. +*/ void HbAbstractVkbHostPrivate::prepareAnimationsCommon() { - if (mContainerWidget->widgetObject() && mKeypad) { + if (mContainerWidget && mContainerWidget->widgetObject() && mKeypad) { // If the keyboard is not already open, remember the original position. // That is where the container will eventually be returned to. if (mKeypadStatus == HbVkbHost::HbVkbStatusClosed) { @@ -212,11 +226,17 @@ } mScreenSize = screenSize(); + + // Make sure that the editor is completely visible inside a scrol area. + ensureVisibilityInsideScrollArea(); } -// TODO: could be in vkb geometry engine +/*! +\internal +Sets up view and focus object variables. +*/ bool HbAbstractVkbHostPrivate::getViewAndFocusObjects(HbView*& currentView, HbInputFocusObject*& focusObject) -{ +{ if (!mKeypad || !mInputMethod || !mContainerWidget ) { return false; } @@ -239,11 +259,15 @@ return true; } +/*! +\internal +Sets up the container widget animation effect. +*/ bool HbAbstractVkbHostPrivate::prepareContainerAnimation(HbVkbHost::HbVkbStatus status) { // Init and check main objects - HbView* currentView = NULL; - HbInputFocusObject* focusObject = NULL; + HbView* currentView = 0; + HbInputFocusObject* focusObject = 0; if (!getViewAndFocusObjects(currentView, focusObject)) { return false; } @@ -251,6 +275,7 @@ // Init parameters before calling... QSizeF keypadSize = mKeypad->size(); QRectF viewRect = currentView->sceneBoundingRect(); + bool isPopupType = qobject_cast(mContainerWidget->widgetObject()) != NULL; bool vkbOpen = mKeypadStatus == HbVkbHost::HbVkbStatusOpened; bool titlebarVisible = currentView->isItemVisible(Hb::TitleBarItem); bool statusbarVisible = currentView->isItemVisible(Hb::StatusBarItem); @@ -264,6 +289,7 @@ mScreenSize, keypadSize, viewRect, + isPopupType, vkbOpen, titlebarVisible, statusbarVisible, @@ -277,34 +303,41 @@ return false; } +/*! +\internal +Sets up the keypad widget animation effect. +*/ bool HbAbstractVkbHostPrivate::prepareKeypadAnimation(HbVkbHost::HbVkbStatus status) { - if (status == HbVkbHost::HbVkbStatusOpened) { - if (mKeypadStatus == HbVkbHost::HbVkbStatusClosed) { - // Set up keyboard open animation. - mKeypadMovementStartingPoint.setY(mScreenSize.height()); - mKeypadMovementVector.setY(-mKeypad->size().height()); - if (!disableCursorShift()) { - // Initialize keypad position - mKeypad->setPos(mKeypadMovementStartingPoint); + if (mKeypad) { + if (status == HbVkbHost::HbVkbStatusOpened) { + if (mKeypadStatus == HbVkbHost::HbVkbStatusClosed) { + // Set up keyboard open animation. + mKeypadMovementStartingPoint.setY(mScreenSize.height()); + mKeypadMovementVector.setY(-mKeypad->size().height()); + if (!disableCursorShift()) { + // Initialize keypad position + mKeypad->setPos(mKeypadMovementStartingPoint); + } + return true; + } else if (mKeypadStatus == HbVkbHost::HbVkbStatusMinimized && mCallback) { + mKeypadMovementVector.setY(-(mKeypad->size().height() - mCallback->minimizedKeyboardSize().height())); + return true; } - return true; - } else if (mKeypadStatus == HbVkbHost::HbVkbStatusMinimized && mCallback) { - mKeypadMovementVector.setY(-(mKeypad->size().height() - mCallback->minimizedKeyboardSize().height())); + } else { + // It is going to be closed. + mKeypadMovementVector = QPointF(0, mKeypad->size().height()); return true; } - } else if (status == HbVkbHost::HbVkbStatusMinimized && mCallback) { - mKeypadMovementVector = QPointF(0, mKeypad->size().height() - mCallback->minimizedKeyboardSize().height()); - return true; - } else { - // It is going to be closed. - mKeypadMovementVector = QPointF(0, mKeypad->size().height()); - return true; } return false; } +/*! +\internal +Sets up all the animation effects. +*/ bool HbAbstractVkbHostPrivate::prepareAnimations(HbVkbHost::HbVkbStatus status) { prepareAnimationsCommon(); @@ -323,6 +356,10 @@ return (containerResult | prepareKeypadAnimation(status)); } +/*! +\internal +Connects orientation change, view switching and possible other related signals. +*/ void HbAbstractVkbHostPrivate::connectSignals() { mContainerWidget->connectSignals(q_ptr); @@ -336,6 +373,10 @@ } } +/*! +\internal +Disconnects orientation change, view switching and possible other related signals. +*/ void HbAbstractVkbHostPrivate::disconnectSignals() { mContainerWidget->disconnectSignals(q_ptr); @@ -349,6 +390,10 @@ } } +/*! +\internal +Opens the keypad widget with animation effect. +*/ void HbAbstractVkbHostPrivate::openKeypad() { if (mContainerWidget->widgetObject()) { @@ -360,7 +405,9 @@ } if (mKeypadStatus != HbVkbHost::HbVkbStatusOpened) { - mCallback->aboutToOpen(q_ptr); + if (mCallback) { + mCallback->aboutToOpen(q_ptr); + } q_ptr->resizeKeyboard(); // Make sure that the keyboard doesn't exceed given boundaries. } @@ -376,15 +423,16 @@ } } +/*! +\internal +Closes the keypad with animation effect. +*/ void HbAbstractVkbHostPrivate::closeKeypad() -{ - // Since the keypad is already in a minimized state we should not play animation. - if (mKeypadStatus == HbVkbHost::HbVkbStatusMinimized) { - closeKeypadWithoutAnimation(); - } - +{ if (mKeypadStatus != HbVkbHost::HbVkbStatusClosed) { - mCallback->aboutToClose(q_ptr); + if (mCallback) { + mCallback->aboutToClose(q_ptr); + } if (prepareAnimations(HbVkbHost::HbVkbStatusClosed)) { // show the title bar and status bar when closing the vkb @@ -396,22 +444,10 @@ } } -void HbAbstractVkbHostPrivate::minimizeKeypad() -{ - if (mCallback && mKeypadStatus != HbVkbHost::HbVkbStatusMinimized) { - mCallback->aboutToClose(q_ptr); - if (mContainerWidget->widgetObject()) { - if (prepareAnimations(HbVkbHost::HbVkbStatusMinimized)) { - //show the title bar and status bar when minimizing the vkb - setTitleAndStatusBarVisible(true); - - mKeypadStatus = HbVkbHost::HbVkbStatusMinimized; - mTimeLine.start(); - } - } - } -} - +/*! +\internal +Opens the keypad widget without animation effect. +*/ void HbAbstractVkbHostPrivate::openKeypadWithoutAnimation() { HbMainWindow *mainWin = mainWindow(); @@ -422,7 +458,9 @@ } if (mKeypadStatus != HbVkbHost::HbVkbStatusOpened) { - mCallback->aboutToOpen(q_ptr); + if (mCallback) { + mCallback->aboutToOpen(q_ptr); + } q_ptr->resizeKeyboard(); // Make sure that the keyboard doesn't exceed given boundaries. } if (prepareAnimations(HbVkbHost::HbVkbStatusOpened)) { @@ -438,41 +476,22 @@ } mKeypadStatus = HbVkbHost::HbVkbStatusOpened; - mCallback->keyboardOpened(q_ptr); + if (mCallback) { + mCallback->keyboardOpened(q_ptr); + } } } } -void HbAbstractVkbHostPrivate::openMinimizedKeypad() -{ - // No need of any animation as this minimized keypad is very small to be a candidate for an - // animation. - HbMainWindow *mainWin = mainWindow(); - if (mainWin && mKeypad && mContainerWidget->widgetObject()) { - if (mKeypad->scene() != mainWin->scene()) { - // Add item to scene if it is not already in there. - mainWin->scene()->addItem(mKeypad); - } - - if (mKeypadStatus != HbVkbHost::HbVkbStatusMinimized) { - mCallback->aboutToOpen(q_ptr); - q_ptr->resizeKeyboard(); // Make sure that the keyboard doesn't exceed given boundaries. - } - - if (prepareAnimations(HbVkbHost::HbVkbStatusMinimized)) { - if (!disableCursorShift()) { - mKeypad->setPos(0.0, mScreenSize.height() - mCallback->minimizedKeyboardSize().height()); - } - mKeypadStatus = HbVkbHost::HbVkbStatusMinimized; - mCallback->keyboardMinimized(q_ptr); - } - } -} - +/*! +\internal +Closes the keypad widget without animating it. +*/ void HbAbstractVkbHostPrivate::closeKeypadWithoutAnimation() { - if (mKeypadStatus != HbVkbHost::HbVkbStatusClosed && mKeypad) { + if (mKeypadStatus != HbVkbHost::HbVkbStatusClosed && mKeypad && mCallback) { mCallback->aboutToClose(q_ptr); + // show the title bar and status bar when closing the vkb setTitleAndStatusBarVisible(true); @@ -486,41 +505,22 @@ } // Hide the keypad - mKeypad->hide(); + mKeypad->hide(); mCallback->keyboardClosed(q_ptr); mCallback = 0; } } -void HbAbstractVkbHostPrivate::minimizeKeypadWithoutAnimation() -{ - HbMainWindow *mainWin = mainWindow(); - if (mKeypadStatus != HbVkbHost::HbVkbStatusMinimized && mKeypad && mainWin) { - mCallback->aboutToClose(q_ptr); - if (mKeypad->scene() != mainWin->scene()) { - // Add item to scene if it is not already in there. - mainWin->scene()->addItem(mKeypad); - } - // show the title bar and status bar when minimizing the vkb - setTitleAndStatusBarVisible(true); - - mKeypadStatus = HbVkbHost::HbVkbStatusMinimized; - if (!disableCursorShift()) { - // Return the container widget to original position. - mContainerWidget->setPos(mOriginalContainerPosition); - - // Set the keypad to minimized position. - mKeypad->setPos(QPointF(0.0, mScreenSize.height() - mCallback->minimizedKeyboardSize().height())); - } - } -} - +/*! +\internal +Cancels the ongoing keypad animation and resets the timeline timer. +*/ void HbAbstractVkbHostPrivate::cancelAnimationAndHideVkbWidget() { if (mTimeLine.state() == QTimeLine::Running) { mTimeLine.stop(); - if (!disableCursorShift()) { + if (!disableCursorShift() && mContainerWidget && mContainerWidget->widgetObject()) { mContainerWidget->setPos(mOriginalContainerPosition); mContainerWidget->widgetObject()->setProperty(KPositionManagedByVKB, false ); } @@ -538,6 +538,10 @@ } } +/*! +\internal +Returns pointer to container's main window (if one exists). +*/ HbMainWindow *HbAbstractVkbHostPrivate::mainWindow() const { HbWidget *hbWidget = qobject_cast(mContainerWidget->widgetObject()); @@ -555,6 +559,10 @@ return 0; } +/*! +\internal +Returns screen size. +*/ QSizeF HbAbstractVkbHostPrivate::screenSize() const { HbMainWindow *mainWin = mainWindow(); @@ -593,6 +601,11 @@ } return false; } + +/*! +\internal +Sets title and status bar visibility. +*/ void HbAbstractVkbHostPrivate::setTitleAndStatusBarVisible(bool visible) { // should not change the title bar and status bar visibility when the keypad is opened from a popup @@ -601,44 +614,136 @@ return; } + // Set flags to control view behaviour when visibility is changed HbMainWindow *mainWin = mainWindow(); - if (!mainWin) { + HbView *currentView; + + if (mainWin && (currentView = mainWin->currentView())) { + // Get view flags to use + HbView::HbViewFlags viewFlags = HbView::ViewFlagNone; + getViewFlagsForVisibilityChange(viewFlags, visible, currentView); + // Set the flags + currentView->setViewFlags(viewFlags); + } +} + +/*! +\internal +Specifies view flags to use when Title/Statusbar visibility changes. +Derived classes should override as appropriate +*/ +void HbAbstractVkbHostPrivate::getViewFlagsForVisibilityChange(HbView::HbViewFlags &viewFlags, bool visible, HbView *view) +{ + if (!view) { return; } - HbView *currentView = mainWin->currentView(); - if (currentView) { - HbView::HbViewFlags flags = currentView->viewFlags(); + HbView::HbViewFlags flags = view->viewFlags(); + HbView::HbViewFlags setFlags = HbView::ViewFlagNone; - HbView::HbViewFlags setFlags = HbView::ViewFlagNone; - if (!visible) { - if (!(flags & HbView::ViewTitleBarHidden)) { - setFlags |= HbView::ViewTitleBarHidden; - mTitleBarHiddenByVkbHost = true; - } - if (!(flags & HbView::ViewStatusBarHidden)) { - setFlags |= HbView::ViewStatusBarHidden; - mStatusBarHiddenByVkbHost = true; + if (!visible) { + // Should set title and statur bar to not visible. + // Check if they were visible before, and set a variable + // to remember it was us who hid them. + if (!(flags & HbView::ViewTitleBarHidden)) { + setFlags |= HbView::ViewTitleBarHidden; + mTitleBarHiddenByVkbHost = true; + } + if (!(flags & HbView::ViewStatusBarHidden)) { + setFlags |= HbView::ViewStatusBarHidden; + mStatusBarHiddenByVkbHost = true; + } + if (mTitleBarHiddenByVkbHost || mStatusBarHiddenByVkbHost) { + setFlags |= HbView::ViewDisableRelayout; + } + // Return the original flags plus the ones we may have set + viewFlags = (flags | setFlags); + } else { + // Title and status bar should become visible. + // Check if we hid them and clear any flags we might have set before. + if ((flags & HbView::ViewDisableRelayout) && + (mTitleBarHiddenByVkbHost || mStatusBarHiddenByVkbHost)) { + setFlags |= HbView::ViewDisableRelayout; + } + if ((flags & HbView::ViewTitleBarHidden) && mTitleBarHiddenByVkbHost) { + setFlags |= HbView::ViewTitleBarHidden; + mTitleBarHiddenByVkbHost = false; + } + if ((flags & HbView::ViewStatusBarHidden) && mStatusBarHiddenByVkbHost) { + setFlags |= HbView::ViewStatusBarHidden; + mStatusBarHiddenByVkbHost = false; + } + // Return the original flags, clear the ones we have set before + viewFlags = (flags & ~setFlags); + } +} + +/*! +\internal +Closes the keypad. This slot is connected to various signals from +different container classes. +*/ +void HbAbstractVkbHostPrivate::_q_containerAboutToClose() +{ + Q_Q(HbAbstractVkbHost); + + q->closeKeypad(); +} + +/*! +\internal +Finds out if given editor is inside a scroll area and makes sure the cursor position is visible inside the +scroll area. +*/ +void HbAbstractVkbHostPrivate::ensureVisibilityInsideScrollArea() const +{ + if (mInputMethod && mInputMethod->focusObject()) { + HbInputFocusObject *fo = mInputMethod->focusObject(); + HbScrollArea *scrollArea = 0; + + QGraphicsObject *graphicsObject = qobject_cast(fo->object()); + if (graphicsObject) { + for (QGraphicsWidget *parent = graphicsObject->parentWidget(); parent; parent = parent->parentWidget()) { + scrollArea = qobject_cast(parent); + if (scrollArea) { + break; + } } - if (mTitleBarHiddenByVkbHost || mStatusBarHiddenByVkbHost) { - setFlags |= HbView::ViewDisableRelayout; - } - currentView->setViewFlags(flags | setFlags); - } else { - if ((flags & HbView::ViewDisableRelayout) && (mTitleBarHiddenByVkbHost || - mStatusBarHiddenByVkbHost)) { - setFlags |= HbView::ViewDisableRelayout; - } - if ((flags & HbView::ViewTitleBarHidden) && mTitleBarHiddenByVkbHost) { - setFlags |= HbView::ViewTitleBarHidden; - mTitleBarHiddenByVkbHost = false; - } - if ((flags & HbView::ViewStatusBarHidden) && mStatusBarHiddenByVkbHost) { - setFlags |= HbView::ViewStatusBarHidden; - mStatusBarHiddenByVkbHost = false; - } - currentView->setViewFlags(flags & ~setFlags); } + + if (scrollArea && scrollArea->contentWidget()) { + QRectF scrollRect = scrollArea->sceneBoundingRect(); + QRectF editorRect = fo->editorGeometry(); + if (!scrollRect.contains(editorRect) && + scrollRect.intersects(editorRect)) { + // The editor is half visible inside a scroll area. + // Calculate how much the area needs to be scrolled + // to make the cursor line visible inside the scroll + // area. The call scroll area's ensure visibility and + // return the calculated value (it needs to be factored in + // to container animation calculations). + if (editorRect.height() < scrollRect.height()) { + // Whole editor rect fits into scroll area. Move it there. + if (editorRect.bottom() > scrollRect.bottom()) { + // Scroll upwards. + scrollArea->ensureVisible(scrollArea->contentWidget()->mapFromScene(editorRect.bottomLeft()), 0.0, HbEditorExtraMargin); + } else { + // Scroll downwards. + scrollArea->ensureVisible(scrollArea->contentWidget()->mapFromScene(editorRect.topLeft()), 0.0, HbEditorExtraMargin); + } + } else { + // Whole editor doesn't fit into scroll area. Used micro focus position instead. + QRectF microFocus = fo->microFocus(); + if (microFocus.bottom() > scrollRect.bottom()) { + // Scroll upwards. + scrollArea->ensureVisible(scrollArea->contentWidget()->mapFromScene(microFocus.bottomLeft()), 0.0, HbEditorExtraMargin); + } else { + // Scroll downwards. + scrollArea->ensureVisible(scrollArea->contentWidget()->mapFromScene(microFocus.topLeft()), 0.0, HbEditorExtraMargin); + } + } + } + } } } @@ -1053,18 +1158,7 @@ */ void HbAbstractVkbHost::minimizeKeypad(bool animationAllowed) { - Q_D(HbAbstractVkbHost); - if (d->mKeypadStatus != HbVkbStatusClosed && !d->mKeypadOperationOngoing) { - d->mKeypadOperationOngoing = true; - - if (animationAllowed) { - d->minimizeKeypad(); - } else { - d->minimizeKeypadWithoutAnimation(); - } - - d->mKeypadOperationOngoing = false; - } + Q_UNUSED(animationAllowed); } /*! @@ -1073,29 +1167,8 @@ */ void HbAbstractVkbHost::openMinimizedKeypad(HbVirtualKeyboard *vkb, HbInputMethod *owner) { - Q_D(HbAbstractVkbHost); - d->mInputMethod = owner; - - if (!d->mKeypadOperationOngoing) { - d->mKeypadOperationOngoing = true; - - if (d->mCallback != vkb || !d->mKeypad) { - // This keypad is opened for the first time or it was opened before but some other keypad - // was opened in between. - d->mCallback = vkb; - d->mKeypad = vkb->asGraphicsWidget(); - } - - if (!d->mKeypad) { - // Keyboard widget creation failed for some reason, can't go on. - d->mCallback = 0; - return; - } - - d->openMinimizedKeypad(); - d->connectSignals(); - d->mKeypadOperationOngoing = false; - } + Q_UNUSED(vkb); + Q_UNUSED(owner); } /*! @@ -1178,4 +1251,6 @@ } } } +#include "moc_hbabstractvkbhost.cpp" + // End of file