summaryrefslogtreecommitdiff
path: root/src/urlbar/urlbar.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/urlbar/urlbar.cpp')
-rw-r--r--src/urlbar/urlbar.cpp41
1 files changed, 6 insertions, 35 deletions
diff --git a/src/urlbar/urlbar.cpp b/src/urlbar/urlbar.cpp
index 4e7310bf..8c6c0749 100644
--- a/src/urlbar/urlbar.cpp
+++ b/src/urlbar/urlbar.cpp
@@ -38,8 +38,9 @@
#include "application.h"
#include "lineedit.h"
#include "mainwindow.h"
+#include "webtab.h"
#include "webview.h"
-#include "urlresolver.h"
+#include "completionwidget.h"
// KDE Includes
#include <KDebug>
@@ -71,7 +72,7 @@ UrlBar::UrlBar(QWidget *parent)
// suggestions
installEventFilter(_box);
- connect(_box, SIGNAL(chosenUrl(const KUrl &, Rekonq::OpenType)), SLOT(activated(const KUrl &, Rekonq::OpenType)));
+ connect(_box, SIGNAL(chosenUrl(const KUrl &, Rekonq::OpenType)), this, SLOT(activated(const KUrl &, Rekonq::OpenType)));
// load typed urls
connect(this, SIGNAL(returnPressed(const QString &)), this, SLOT(loadTyped(const QString &)));
@@ -94,6 +95,7 @@ void UrlBar::setQUrl(const QUrl& url)
}
else
{
+ clearFocus();
LineEdit::setUrl(url);
setCursorPosition(0);
iconButton()->setIcon( Application::icon(url) );
@@ -103,7 +105,7 @@ void UrlBar::setQUrl(const QUrl& url)
void UrlBar::activated(const KUrl& url, Rekonq::OpenType type)
{
- disconnect(this, SIGNAL(textChanged(const QString &)), this, SLOT(suggestUrls(const QString &)));
+ disconnect(this, SIGNAL(textChanged(const QString &)), _box, SLOT(suggestUrls(const QString &)));
clearFocus();
setUrl(url);
@@ -152,12 +154,6 @@ void UrlBar::paintEvent(QPaintEvent *event)
void UrlBar::keyPressEvent(QKeyEvent *event)
{
- if(event->key() == Qt::Key_Escape)
- {
- _box->hide();
- return;
- }
-
// this handles the Modifiers + Return key combinations
QString currentText = text().trimmed();
if ((event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return)
@@ -191,35 +187,10 @@ void UrlBar::keyPressEvent(QKeyEvent *event)
}
-void UrlBar::suggestUrls(const QString &text)
-{
- if (!hasFocus())
- {
- return;
- }
-
- if(text.isEmpty())
- {
- _box->hide();
- return;
- }
-
- UrlResolver res(text);
- UrlSearchList list = res.orderedSearchItems();
-
- if(list.count() > 0)
- {
- _box->clear();
- _box->insertSearchList(list, text);
- _box->popup();
- }
-}
-
-
void UrlBar::focusInEvent(QFocusEvent *event)
{
// activate suggestions on edit text
- connect(this, SIGNAL(textChanged(const QString &)), this, SLOT(suggestUrls(const QString &)));
+ connect(this, SIGNAL(textChanged(const QString &)), _box, SLOT(suggestUrls(const QString &)));
LineEdit::focusInEvent(event);
}