summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/urlbar/completionwidget.cpp5
-rw-r--r--src/urlbar/completionwidget.h2
-rw-r--r--src/urlbar/listitem.cpp10
3 files changed, 9 insertions, 8 deletions
diff --git a/src/urlbar/completionwidget.cpp b/src/urlbar/completionwidget.cpp
index af9bdc45..a71e9611 100644
--- a/src/urlbar/completionwidget.cpp
+++ b/src/urlbar/completionwidget.cpp
@@ -68,6 +68,11 @@ CompletionWidget::CompletionWidget(QWidget *parent)
void CompletionWidget::insertSearchList(const UrlSearchList &list, const QString& text)
{
+ if (!isVisible())
+ {
+ _searchEngine = SearchEngine::defaultEngine();
+ }
+
_list = list;
int i = 0;
foreach(const UrlSearchItem &item, _list)
diff --git a/src/urlbar/completionwidget.h b/src/urlbar/completionwidget.h
index 423499fe..18212d0f 100644
--- a/src/urlbar/completionwidget.h
+++ b/src/urlbar/completionwidget.h
@@ -56,7 +56,7 @@ public:
return _searchEngine;
};
- void setCurrentEngine(KService::Ptr engine)
+ void setSearchEngine(KService::Ptr engine)
{
_searchEngine = engine;
};
diff --git a/src/urlbar/listitem.cpp b/src/urlbar/listitem.cpp
index 3114c16a..78a929a8 100644
--- a/src/urlbar/listitem.cpp
+++ b/src/urlbar/listitem.cpp
@@ -266,8 +266,6 @@ SearchListItem::SearchListItem(const UrlSearchItem &item, const QString &text, Q
: ListItem(item, parent)
, m_text(text)
{
- KService::Ptr currentEngine = SearchEngine::defaultEngine();
-
QString query = text;
KService::Ptr engine = SearchEngine::fromString(text);
if (engine)
@@ -276,14 +274,14 @@ SearchListItem::SearchListItem(const UrlSearchItem &item, const QString &text, Q
}
else
{
- engine = currentEngine;
+ engine = qobject_cast<CompletionWidget *>(parent)->searchEngine();
}
m_url = SearchEngine::buildQuery(engine, query);
m_iconLabel = new IconLabel("edit-find", this); //TODO: get the default engine icon
m_titleLabel = new TextLabel(searchItemTitle(engine->name(), query), QString(), this);
- m_engineBar = new EngineBar(currentEngine, parent);
+ m_engineBar = new EngineBar(engine, parent);
QHBoxLayout *hLayout = new QHBoxLayout;
hLayout->setSpacing(4);
@@ -311,9 +309,7 @@ void SearchListItem::changeSearchEngine(KService::Ptr engine)
m_titleLabel->setText(searchItemTitle(engine->name(), m_text));
m_iconLabel->setPixmap(Application::icon(KUrl(engine->property("Query").toString())).pixmap(16));
m_url = SearchEngine::buildQuery(engine, m_text);
-
- CompletionWidget *w = qobject_cast<CompletionWidget *>(parent());
- w->setCurrentEngine(engine);
+ qobject_cast<CompletionWidget *>(parent())->setSearchEngine(engine);
}