summaryrefslogtreecommitdiff
path: root/src/urlbar/urlbar.cpp
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2010-04-17 18:03:19 +0200
committerAndrea Diamantini <adjam7@gmail.com>2010-04-17 18:03:19 +0200
commitdbb6991b2fd9a2b76fd954d214e9c907c8123ea6 (patch)
treebba75847ba1901aa44bb4838a265851b23fc3ece /src/urlbar/urlbar.cpp
parentMerge commit 'refs/merge-requests/81' of git://gitorious.org/rekonq/mainline ... (diff)
downloadrekonq-dbb6991b2fd9a2b76fd954d214e9c907c8123ea6.tar.xz
Based on Lionel's merge request #80:
letting CompletionWidget being independent from the Urlbar
Diffstat (limited to 'src/urlbar/urlbar.cpp')
-rw-r--r--src/urlbar/urlbar.cpp40
1 files changed, 5 insertions, 35 deletions
diff --git a/src/urlbar/urlbar.cpp b/src/urlbar/urlbar.cpp
index 4e7310bf..a4c7a0e0 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 &)));
@@ -103,7 +104,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 +153,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 +186,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);
}