summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2010-06-01 00:14:15 +0200
committerAndrea Diamantini <adjam7@gmail.com>2010-06-01 00:14:15 +0200
commitee31a35db40d3936b592f7e8444b4c83a62fbb49 (patch)
tree408a226c20a5425cce2073e6e799cfa1a26c9d98 /src
parentMerge commit 'refs/merge-requests/128' of git://gitorious.org/rekonq/mainline (diff)
parentkeep the selected engine when the user types (diff)
downloadrekonq-ee31a35db40d3936b592f7e8444b4c83a62fbb49.tar.xz
Merge commit 'refs/merge-requests/109' of git://gitorious.org/rekonq/mainline into SearchItemFixes
Diffstat (limited to 'src')
-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);
}