From 9655db5745914b95bc60c791e9a9faaab5074ed8 Mon Sep 17 00:00:00 2001 From: megabigbug Date: Sat, 22 May 2010 08:34:57 +0200 Subject: select the correct engine in the engine bar when a webshortcut is typed --- src/urlbar/listitem.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/urlbar/listitem.cpp b/src/urlbar/listitem.cpp index f91840d2..e3af638c 100644 --- a/src/urlbar/listitem.cpp +++ b/src/urlbar/listitem.cpp @@ -274,7 +274,7 @@ SearchListItem::SearchListItem(const UrlSearchItem &item, const QString &text, Q 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); -- cgit v1.2.1 From e7ae1cc2dfc43cf4e6cc902434b769d120958b93 Mon Sep 17 00:00:00 2001 From: megabigbug Date: Sat, 22 May 2010 11:40:24 +0200 Subject: keep the selected engine when the user types reset to default engine when the completionwidget is shown --- src/urlbar/completionwidget.cpp | 5 +++++ src/urlbar/completionwidget.h | 2 +- src/urlbar/listitem.cpp | 8 ++------ 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/urlbar/completionwidget.cpp b/src/urlbar/completionwidget.cpp index 9a5c9432..acec2d4f 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 2d33b59f..90cd2b23 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 e3af638c..13535a74 100644 --- a/src/urlbar/listitem.cpp +++ b/src/urlbar/listitem.cpp @@ -257,8 +257,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) @@ -267,7 +265,7 @@ SearchListItem::SearchListItem(const UrlSearchItem &item, const QString &text, Q } else { - engine = currentEngine; + engine = qobject_cast(parent)->searchEngine(); } m_url = SearchEngine::buildQuery(engine, query); @@ -302,9 +300,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(parent()); - w->setCurrentEngine(engine); + qobject_cast(parent())->setSearchEngine(engine); } -- cgit v1.2.1