summaryrefslogtreecommitdiff
path: root/src/urlbar
diff options
context:
space:
mode:
Diffstat (limited to 'src/urlbar')
-rw-r--r--src/urlbar/urlbar.cpp29
1 files changed, 16 insertions, 13 deletions
diff --git a/src/urlbar/urlbar.cpp b/src/urlbar/urlbar.cpp
index 9d8ba02a..0515f58b 100644
--- a/src/urlbar/urlbar.cpp
+++ b/src/urlbar/urlbar.cpp
@@ -433,22 +433,25 @@ void UrlBar::loadTyped(const QString &text)
void UrlBar::activateSuggestions(bool b)
{
- if (b && _box.isNull())
+ if (b)
{
- _box = new CompletionWidget(this);
- installEventFilter(_box.data());
- connect(_box.data(), SIGNAL(chosenUrl(const KUrl &, Rekonq::OpenType)), this, SLOT(activated(const KUrl &, Rekonq::OpenType)));
-
- // activate suggestions on edit text
- connect(this, SIGNAL(textChanged(const QString &)), this, SLOT(detectTypedString(const QString &)));
+ if (_box.isNull())
+ {
+ _box = new CompletionWidget(this);
+ installEventFilter(_box.data());
+ connect(_box.data(), SIGNAL(chosenUrl(const KUrl &, Rekonq::OpenType)), this, SLOT(activated(const KUrl &, Rekonq::OpenType)));
- return;
+ // activate suggestions on edit text
+ connect(this, SIGNAL(textChanged(const QString &)), this, SLOT(detectTypedString(const QString &)));
+ }
+ }
+ else
+ {
+ disconnect(this, SIGNAL(textChanged(const QString &)), this, SLOT(detectTypedString(const QString &)));
+ removeEventFilter(_box.data());
+ if (!_box.isNull())
+ _box.data()->deleteLater();
}
-
- disconnect(this, SIGNAL(textChanged(const QString &)), this, SLOT(detectTypedString(const QString &)));
- removeEventFilter(_box.data());
- if (!_box.isNull())
- _box.data()->deleteLater();
}