diff options
author | Andrea Diamantini <adjam7@gmail.com> | 2010-08-20 15:37:21 +0200 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2010-08-20 15:37:21 +0200 |
commit | c39497cca6a6fb80a4658572d45bec53d561f1ed (patch) | |
tree | a1cb9c4781f92e7450e353efcf1e349fbcc31d7e /src/urlbar/listitem.cpp | |
parent | OpenSearch review (diff) | |
parent | fix suggestion item: use the correct search engine (diff) | |
download | rekonq-c39497cca6a6fb80a4658572d45bec53d561f1ed.tar.xz |
Merge commit 'refs/merge-requests/169' of git://gitorious.org/rekonq/mainline into opensearch
Diffstat (limited to 'src/urlbar/listitem.cpp')
-rw-r--r-- | src/urlbar/listitem.cpp | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/src/urlbar/listitem.cpp b/src/urlbar/listitem.cpp index 791ad2fa..e9bb6fbb 100644 --- a/src/urlbar/listitem.cpp +++ b/src/urlbar/listitem.cpp @@ -139,6 +139,12 @@ KUrl ListItem::url() } +QString ListItem::text() +{ + return m_url.url(); +} + + void ListItem::nextItemSubChoice() { //will be override @@ -298,6 +304,12 @@ SearchListItem::SearchListItem(const UrlSearchItem &item, const QString &text, Q } +QString SearchListItem::text() +{ + return m_text; +} + + QString SearchListItem::searchItemTitle(QString engine, QString text) { return QString(i18nc("%1=search engine, e.g. Google, Wikipedia %2=text to search for", "Search %1 for <b>%2</b>", engine, Qt::escape(text))); @@ -393,11 +405,25 @@ void EngineBar::selectNextEngine() SuggestionListItem::SuggestionListItem(const UrlSearchItem &item, const QString &text, QWidget *parent) : ListItem(item, parent) + , m_text(item.title) { QHBoxLayout *hLayout = new QHBoxLayout; hLayout->setSpacing(4); - hLayout->addWidget(new IconLabel(item.url, this)); + QString query = item.title; + KService::Ptr engine = SearchEngine::fromString(query); + if (engine) + { + query = query.remove(0, text.indexOf(SearchEngine::delimiter()) + 1); + } + else + { + engine = qobject_cast<CompletionWidget *>(parent)->searchEngine(); + } + + m_url = SearchEngine::buildQuery(engine, query); + + hLayout->addWidget(new IconLabel(SearchEngine::buildQuery(engine, ""), this)); hLayout->addWidget(new TextLabel(item.title, text, this)); hLayout->addWidget(new TypeIconLabel(item.type, this)); @@ -405,6 +431,11 @@ SuggestionListItem::SuggestionListItem(const UrlSearchItem &item, const QString } +QString SuggestionListItem::text() +{ + return m_text; +} + // --------------------------------------------------------------- |