From 38a7b735f50805e1194c22975a678d3f614f208f Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Thu, 29 Sep 2011 23:03:27 +0200 Subject: This commit fixes urlbar suggestions handling, while maintaining QCoreApplication::postEvent fix. Sorry for the noise, guys :) --- src/urlbar/urlbar.cpp | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) (limited to 'src') 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(); } -- cgit v1.2.1