summaryrefslogtreecommitdiff
path: root/src/urlbar/completionwidget.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/urlbar/completionwidget.cpp')
-rw-r--r--src/urlbar/completionwidget.cpp42
1 files changed, 36 insertions, 6 deletions
diff --git a/src/urlbar/completionwidget.cpp b/src/urlbar/completionwidget.cpp
index 83e99f9d..be86238d 100644
--- a/src/urlbar/completionwidget.cpp
+++ b/src/urlbar/completionwidget.cpp
@@ -30,6 +30,7 @@
// Local Includes
#include "application.h"
+#include "urlresolver.h"
// KDE Includes
#include <KGlobalSettings>
@@ -173,6 +174,8 @@ bool CompletionWidget::eventFilter( QObject *o, QEvent *e )
//actions on the CompletionWidget
if (wid && wid->isAncestorOf(_parent) && isVisible())
{
+ ListItem *child;
+
if ( type == QEvent::KeyPress )
{
QKeyEvent *ev = static_cast<QKeyEvent *>( e );
@@ -196,7 +199,7 @@ bool CompletionWidget::eventFilter( QObject *o, QEvent *e )
ev->accept();
return true;
}
- else if (ev->modifiers() & Qt::ControlModifier)
+ if (ev->modifiers() & Qt::ControlModifier)
{
emit nextItemSubChoice();
ev->accept();
@@ -206,18 +209,19 @@ bool CompletionWidget::eventFilter( QObject *o, QEvent *e )
case Qt::Key_Enter:
case Qt::Key_Return:
-
- // need this to let ListItem magic work..
- ListItem *child = findChild<ListItem *>( QString::number(_currentIndex) );
+ child = findChild<ListItem *>( QString::number(_currentIndex) );
emit chosenUrl( child->url(), Rekonq::CurrentTab);
ev->accept();
hide();
return true;
- break;
+
+ case Qt::Key_Escape:
+ hide();
+ return true;
}
}
}
-
+
return QFrame::eventFilter(o,e);
}
@@ -246,3 +250,29 @@ void CompletionWidget::itemChosen(ListItem *item, Qt::MouseButton button)
emit chosenUrl( item->url(), Rekonq::CurrentTab);
hide();
}
+
+
+
+
+void CompletionWidget::suggestUrls(const QString &text)
+{
+ QWidget *w = qobject_cast<QWidget *>(parent());
+ if(!w->hasFocus())
+ return;
+
+ if(text.isEmpty())
+ {
+ hide();
+ return;
+ }
+
+ UrlResolver res(text);
+ UrlSearchList list = res.orderedSearchItems();
+
+ if(list.count() > 0)
+ {
+ clear();
+ insertSearchList(list, text);
+ popup();
+ }
+}