summaryrefslogtreecommitdiff
path: root/src/urlbar/listitem.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/urlbar/listitem.cpp')
-rw-r--r--src/urlbar/listitem.cpp33
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;
+}
+
// ---------------------------------------------------------------