From 55e0a976e5e6eec92985cb5d24a2e7ac2939396e Mon Sep 17 00:00:00 2001 From: lionelc Date: Tue, 10 Aug 2010 17:32:57 +0200 Subject: don't replace the type text by the url of the listitem when this listitem is a searchlistitem --- src/urlbar/completionwidget.cpp | 37 +++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 20 deletions(-) (limited to 'src/urlbar/completionwidget.cpp') diff --git a/src/urlbar/completionwidget.cpp b/src/urlbar/completionwidget.cpp index b5e06a27..b77e2d7c 100644 --- a/src/urlbar/completionwidget.cpp +++ b/src/urlbar/completionwidget.cpp @@ -117,49 +117,46 @@ void CompletionWidget::popup() void CompletionWidget::up() { // deactivate previous - ListItem *widget = findChild(QString::number(_currentIndex)); - widget->deactivate(); + findChild(QString::number(_currentIndex))->deactivate(); // deactivate previous if (_currentIndex > 0) _currentIndex--; else _currentIndex = layout()->count() - 1; - kDebug() << _currentIndex; - kDebug() << _typedString; - UrlBar *bar = qobject_cast(_parent); - - // activate "new" current - widget = findChild(QString::number(_currentIndex)); - widget->activate(); - bar->blockSignals(true); - bar->setQUrl( widget->url() ); - bar->blockSignals(false); - bar->setFocus(); - bar->setCursorPosition( bar->text().length() ); + activateCurrentListItem(); } void CompletionWidget::down() { - ListItem *widget = findChild(QString::number(_currentIndex)); - widget->deactivate(); + findChild(QString::number(_currentIndex))->deactivate(); // deactivate previous if (_currentIndex < _list.count() - 1) _currentIndex++; else _currentIndex = 0; - + activateCurrentListItem(); +} + + +void CompletionWidget::activateCurrentListItem() +{ kDebug() << _currentIndex; kDebug() << _typedString; UrlBar *bar = qobject_cast(_parent); // activate "new" current - widget = findChild(QString::number(_currentIndex)); + ListItem *widget = findChild(QString::number(_currentIndex)); widget->activate(); - bar->blockSignals(true); - bar->setQUrl( widget->url() ); + + //update text of the url bar + bar->blockSignals(true); //without compute suggestions + if (!widget->inherits("SearchListItem")) + bar->setQUrl( widget->url() ); + else + bar->setQUrl( _typedString ); bar->blockSignals(false); bar->setFocus(); bar->setCursorPosition( bar->text().length() ); -- cgit v1.2.1