diff options
author | lionelc <lionelc@lionelc.(none)> | 2010-04-15 18:36:07 +0200 |
---|---|---|
committer | lionelc <lionelc@lionelc.(none)> | 2010-04-15 18:36:07 +0200 |
commit | ee9fc135d6ee214e999aebebb59459fce9147b38 (patch) | |
tree | 0974172232b487ea996b33cd1b9bef99e297d12f /src/urlbar/completionwidget.cpp | |
parent | SVN_SILENT made messages (.desktop file) (diff) | |
download | rekonq-ee9fc135d6ee214e999aebebb59459fce9147b38.tar.xz |
introduce search listitem
Diffstat (limited to 'src/urlbar/completionwidget.cpp')
-rw-r--r-- | src/urlbar/completionwidget.cpp | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/src/urlbar/completionwidget.cpp b/src/urlbar/completionwidget.cpp index 311694b3..42824af9 100644 --- a/src/urlbar/completionwidget.cpp +++ b/src/urlbar/completionwidget.cpp @@ -59,18 +59,18 @@ CompletionWidget::CompletionWidget( QWidget *parent) } -void CompletionWidget::insertSearchList(const UrlSearchList &list) +void CompletionWidget::insertSearchList(const UrlSearchList &list, const QString& text) { _list = list; int i = 0; foreach(UrlSearchItem item, _list) { - ListItem *suggestion = new ListItem(item); - suggestion->setBackgroundRole(i%2 ? QPalette::AlternateBase : QPalette::Base); + ListItem *suggestion = ListItemFactory::create(item, text); + suggestion->setBackgroundRole(i%2 ? QPalette::AlternateBase: QPalette::Base); connect(suggestion, SIGNAL(itemClicked(ListItem *, Qt::MouseButton)), this, SLOT(itemChosen(ListItem *, Qt::MouseButton))); - suggestion->setObjectName( QString::number(i) ); + connect(this, SIGNAL(nextItemSubChoice()), suggestion, SLOT(nextItemSubChoice())); + suggestion->setObjectName( QString::number(i++) ); layout()->addWidget( suggestion ); - i++; } } @@ -88,8 +88,9 @@ void CompletionWidget::sizeAndPosition() void CompletionWidget::popup() { + down(); sizeAndPosition(); - if (!isVisible()) + if (!isVisible()) show(); } @@ -195,17 +196,23 @@ bool CompletionWidget::eventFilter( QObject *o, QEvent *e ) ev->accept(); return true; } + else if (ev->modifiers() & Qt::ControlModifier) + { + emit nextItemSubChoice(); + ev->accept(); + return true; + } break; - + case Qt::Key_Enter: case Qt::Key_Return: - hide(); - if(_currentIndex >= 0) - emit chosenUrl(_list.at(_currentIndex).url, Rekonq::CurrentTab); - else - emit loadTypedUrl(); - ev->accept(); - return true; + hide(); + if(_currentIndex >= 0) + emit chosenUrl(_list.at(_currentIndex).url, Rekonq::CurrentTab); + else + emit loadTypedUrl(); + ev->accept(); + return true; break; } } |