summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorlionelc <lionelc@lionelc.(none)>2010-08-10 17:32:57 +0200
committerAndrea Diamantini <adjam7@gmail.com>2010-08-11 00:23:31 +0200
commit55e0a976e5e6eec92985cb5d24a2e7ac2939396e (patch)
tree263ce7fea86e9830e1d0a686731c4c48376a02e0 /src
parentselect first item (diff)
downloadrekonq-55e0a976e5e6eec92985cb5d24a2e7ac2939396e.tar.xz
don't replace the type text by the url of the listitem when this listitem is a searchlistitem
Diffstat (limited to 'src')
-rw-r--r--src/urlbar/completionwidget.cpp37
-rw-r--r--src/urlbar/completionwidget.h6
2 files changed, 18 insertions, 25 deletions
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<ListItem *>(QString::number(_currentIndex));
- widget->deactivate();
+ findChild<ListItem *>(QString::number(_currentIndex))->deactivate(); // deactivate previous
if (_currentIndex > 0)
_currentIndex--;
else
_currentIndex = layout()->count() - 1;
- kDebug() << _currentIndex;
- kDebug() << _typedString;
- UrlBar *bar = qobject_cast<UrlBar *>(_parent);
-
- // activate "new" current
- widget = findChild<ListItem *>(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<ListItem *>(QString::number(_currentIndex));
- widget->deactivate();
+ findChild<ListItem *>(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<UrlBar *>(_parent);
// activate "new" current
- widget = findChild<ListItem *>(QString::number(_currentIndex));
+ ListItem *widget = findChild<ListItem *>(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() );
diff --git a/src/urlbar/completionwidget.h b/src/urlbar/completionwidget.h
index fbca5b81..e14535f4 100644
--- a/src/urlbar/completionwidget.h
+++ b/src/urlbar/completionwidget.h
@@ -78,16 +78,12 @@ private:
void sizeAndPosition();
void up();
void down();
+ void activateCurrentListItem();
QWidget *_parent;
UrlSearchList _list;
- /**
- * The current index of the pointed out item
- *
- * -1 means no item, so the actual typed text is considered
- */
int _currentIndex;
KService::Ptr _searchEngine;