diff options
Diffstat (limited to 'src/urlbar/completionwidget.cpp')
-rw-r--r-- | src/urlbar/completionwidget.cpp | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/src/urlbar/completionwidget.cpp b/src/urlbar/completionwidget.cpp index 42abcb73..3a54f890 100644 --- a/src/urlbar/completionwidget.cpp +++ b/src/urlbar/completionwidget.cpp @@ -72,7 +72,7 @@ void CompletionWidget::insertSearchList(const UrlSearchList &list) { UrlSearchItem item = list.at(i); ListItem *suggestion = new ListItem(item); - connect(suggestion, SIGNAL(itemClicked(ListItem *)), this, SLOT(itemChosen(ListItem *))); + connect(suggestion, SIGNAL(itemClicked(ListItem *, Qt::MouseButton)), this, SLOT(itemChosen(ListItem *, Qt::MouseButton))); suggestion->setObjectName( QString::number(i) ); layout()->addWidget( suggestion ); } @@ -82,7 +82,14 @@ void CompletionWidget::insertSearchList(const UrlSearchList &list) void CompletionWidget::sizeAndPosition() { // size - setFixedHeight(layout()->count() * 44 ); + int h = 34; + ListItem *widget; + for(int i = 0; i < layout()->count(); ++i) + { + widget = findChild<ListItem *>( QString::number(i) ); + h = qMax(widget->sizeHint().height(), h); + } + setFixedHeight(layout()->count() * (h + 10) ); setFixedWidth( _parent->width() ); // position @@ -206,9 +213,10 @@ bool CompletionWidget::eventFilter( QObject *o, QEvent *e ) } break; + case Qt::Key_Enter: case Qt::Key_Return: hide(); - emit chosenUrl(currentUrl().url()); + emit chosenUrl(currentUrl().url(), Rekonq::CurrentTab); ev->accept(); return true; break; @@ -235,8 +243,11 @@ void CompletionWidget::setVisible( bool visible ) } -void CompletionWidget::itemChosen(ListItem *item) +void CompletionWidget::itemChosen(ListItem *item, Qt::MouseButton button) { - emit chosenUrl(_list.at(layout()->indexOf(item)).url); + if(button == Qt::MidButton) + emit chosenUrl(_list.at(layout()->indexOf(item)).url, Rekonq::NewCurrentTab); + else + emit chosenUrl(_list.at(layout()->indexOf(item)).url, Rekonq::CurrentTab); hide(); -}
\ No newline at end of file +} |