summaryrefslogtreecommitdiff
path: root/src/urlbar/listitem.cpp
diff options
context:
space:
mode:
authorLionel Chauvin <megabigbug@yahoo.fr>2010-10-09 18:22:19 +0200
committerAndrea Diamantini <adjam7@gmail.com>2010-10-30 11:41:25 +0200
commit2223f0f8a9c01cb8a9769307d2a4e45511ac097f (patch)
treebb6deb320c94eeda73c1795f9bd3493e6881f228 /src/urlbar/listitem.cpp
parentadd image field to opensearch (diff)
downloadrekonq-2223f0f8a9c01cb8a9769307d2a4e45511ac097f.tar.xz
introduce visual suggestion listitem
Diffstat (limited to 'src/urlbar/listitem.cpp')
-rw-r--r--src/urlbar/listitem.cpp52
1 files changed, 48 insertions, 4 deletions
diff --git a/src/urlbar/listitem.cpp b/src/urlbar/listitem.cpp
index 8406c792..374d9cca 100644
--- a/src/urlbar/listitem.cpp
+++ b/src/urlbar/listitem.cpp
@@ -477,6 +477,45 @@ QString SuggestionListItem::text()
return m_text;
}
+
+// ---------------------------------------------------------------
+
+
+VisualSuggestionListItem::VisualSuggestionListItem(const UrlSearchItem &item, const QString &text, QWidget *parent)
+ : ListItem(item, parent)
+ , m_text(item.title)
+{
+
+ QHBoxLayout *hLayout = new QHBoxLayout;
+ hLayout->setSpacing(4);
+
+ QLabel *previewLabelIcon = new QLabel(this);
+ previewLabelIcon->setFixedSize(45, 33);
+ new PreviewLabel(item.image, 38, 29, previewLabelIcon);
+ IconLabel* icon = new IconLabel(item.url, previewLabelIcon);
+ icon->move(27, 16);
+ hLayout->addWidget(previewLabelIcon);
+
+ QVBoxLayout *vLayout = new QVBoxLayout;
+ vLayout->setMargin(0);
+
+ QString query = SearchEngine::extractQuery(text);
+ vLayout->addWidget(new TextLabel(item.title, query, this));
+ vLayout->addWidget(new TextLabel("aaa aa", query, this));
+
+ hLayout->addLayout(vLayout);
+
+ hLayout->addWidget(new TypeIconLabel(item.type, this));
+
+ setLayout(hLayout);
+}
+
+
+QString VisualSuggestionListItem::text()
+{
+ return m_text;
+}
+
// ---------------------------------------------------------------
@@ -530,11 +569,16 @@ ListItem *ListItemFactory::create(const UrlSearchItem &item, const QString &text
if (item.type & UrlSearchItem::Suggestion)
{
- kDebug() << "Suggestion";
- return new SuggestionListItem(item, text, parent);
+ if (item.description.isEmpty())
+ {
+ kDebug() << "Suggestion";
+ return new SuggestionListItem(item, text, parent);
+ }
+
+ kDebug() << "Visual Suggestion";
+ return new VisualSuggestionListItem(item, text, parent);
}
-
+
kDebug() << "Undefined";
return new PreviewListItem(item, text, parent);
-
}