diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/urlbar/urlbar.cpp | 26 | 
1 files changed, 12 insertions, 14 deletions
| diff --git a/src/urlbar/urlbar.cpp b/src/urlbar/urlbar.cpp index 04e48d1b..ed00c84c 100644 --- a/src/urlbar/urlbar.cpp +++ b/src/urlbar/urlbar.cpp @@ -433,24 +433,22 @@ void UrlBar::loadTyped(const QString &text)  void UrlBar::activateSuggestions(bool b)  { -    if (b) +    if (b && _box.isNull())      { -        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))); +        _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 &))); -        } +        // activate suggestions on edit text +        connect(this, SIGNAL(textChanged(const QString &)), this, SLOT(detectTypedString(const QString &))); + +        return;      } -    else -    { -        disconnect(this, SIGNAL(textChanged(const QString &)), this, SLOT(detectTypedString(const QString &))); -        removeEventFilter(_box.data()); + +    disconnect(this, SIGNAL(textChanged(const QString &)), this, SLOT(detectTypedString(const QString &))); +    removeEventFilter(_box.data()); +    if (!_box.isNull())          _box.data()->deleteLater(); -    }  } | 
