summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/urlbar/urlbar.cpp35
-rw-r--r--src/urlbar/urlbar.h2
2 files changed, 5 insertions, 32 deletions
diff --git a/src/urlbar/urlbar.cpp b/src/urlbar/urlbar.cpp
index 2b32738d..1bab4ae3 100644
--- a/src/urlbar/urlbar.cpp
+++ b/src/urlbar/urlbar.cpp
@@ -116,6 +116,7 @@ QString guessUrlWithCustomFirstLevel(const QString &str1, const QString &str2)
UrlBar::UrlBar(QWidget *parent)
: KLineEdit(parent)
+ , _box(new CompletionWidget(this))
, _tab(0)
, _icon(new IconButton(this))
, _suggestionTimer(new QTimer(this))
@@ -158,6 +159,10 @@ UrlBar::UrlBar(QWidget *parent)
// bookmark icon
connect(BookmarkManager::self(), SIGNAL(bookmarksUpdated()), this, SLOT(updateRightIcons()));
+ // suggestions
+ connect(_box.data(), SIGNAL(chosenUrl(KUrl, Rekonq::OpenType)), this, SLOT(loadRequestedUrl(KUrl, Rekonq::OpenType)));
+ connect(this, SIGNAL(textEdited(QString)), this, SLOT(detectTypedString(QString)));
+
_suggestionTimer->setSingleShot(true);
connect(_suggestionTimer, SIGNAL(timeout()), this, SLOT(suggest()));
}
@@ -166,7 +171,6 @@ UrlBar::UrlBar(QWidget *parent)
UrlBar::~UrlBar()
{
_suggestionTimer->stop();
- activateSuggestions(false);
_box.clear();
disconnect();
@@ -192,7 +196,6 @@ void UrlBar::setQUrl(const QUrl& url)
void UrlBar::loadRequestedUrl(const KUrl& url, Rekonq::OpenType type)
{
- activateSuggestions(false);
clearFocus();
setUrl(url);
rApp->loadUrl(url, type);
@@ -345,7 +348,6 @@ void UrlBar::keyPressEvent(QKeyEvent *event)
void UrlBar::focusInEvent(QFocusEvent *event)
{
emit focusIn();
- activateSuggestions(true);
KLineEdit::focusInEvent(event);
}
@@ -435,33 +437,6 @@ void UrlBar::updateRightIcons()
}
-void UrlBar::activateSuggestions(bool b)
-{
- if (b)
- {
- if (_box.isNull())
- {
- _box = new CompletionWidget(this);
- connect(_box.data(), SIGNAL(chosenUrl(KUrl, Rekonq::OpenType)), this, SLOT(loadRequestedUrl(KUrl, Rekonq::OpenType)));
-
- // activate suggestions on edit text
- connect(this, SIGNAL(textChanged(QString)), this, SLOT(detectTypedString(QString)));
- }
- }
- else
- {
- disconnect(this, SIGNAL(textChanged(QString)), this, SLOT(detectTypedString(QString)));
-
- if (!_box.isNull())
- {
- // This was just deleted later because of a crash in completionwidget...
- delete _box.data();
- _box.clear();
- }
- }
-}
-
-
void UrlBar::mouseDoubleClickEvent(QMouseEvent *event)
{
Q_UNUSED(event);
diff --git a/src/urlbar/urlbar.h b/src/urlbar/urlbar.h
index b0edc80e..48447975 100644
--- a/src/urlbar/urlbar.h
+++ b/src/urlbar/urlbar.h
@@ -90,8 +90,6 @@ public:
explicit UrlBar(QWidget *parent = 0);
~UrlBar();
- void activateSuggestions(bool);
-
public Q_SLOTS:
void setQUrl(const QUrl &url);