Fix for the issue where the focus goes to the location bar when opening a link

in new foreground tab.

BUG: 304865
BUG: 304933
FIXED-IN: 4.9.1
REVIEW: 105984
This commit is contained in:
Dawit Alemayehu 2012-08-26 19:40:25 -04:00
parent 265b1a5118
commit a2ae800335
2 changed files with 11 additions and 1 deletions

View file

@ -223,7 +223,8 @@ void KonqFrame::activateChild()
if (m_pView && !m_pView->isPassiveMode() ) {
m_pView->mainWindow()->viewManager()->setActivePart( part() );
if (m_pView->url().isEmpty() || m_pView->url() == "about:blank") {
if (!m_pView->isLoading() && (m_pView->url().isEmpty() || m_pView->url() == "about:blank")) {
//kDebug() << "SET FOCUS on the location bar";
m_pView->mainWindow()->focusLocationBar(); // #84867 usability improvement
}
}

View file

@ -514,6 +514,15 @@ void KonqView::slotRequestFocus( KParts::ReadOnlyPart * )
void KonqView::setLoading( bool loading, bool hasPending /*= false*/)
{
//kDebug() << "loading=" << loading << "hasPending=" << hasPending;
if (loading) {
// Make sure the focus is restored on the part's widget and not the combo
// box if it starts loading a request. See #304933.
QWidget* partWidget = (m_pPart ? m_pPart->widget() : 0);
if (partWidget && !partWidget->hasFocus()) {
//kDebug() << "SET FOCUS on the widget";
partWidget->setFocus();
}
}
m_bLoading = loading;
m_bPendingRedirection = hasPending;
if ( m_pMainWindow->currentView() == this )