summaryrefslogtreecommitdiff
path: root/src
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
parentadd image field to opensearch (diff)
downloadrekonq-2223f0f8a9c01cb8a9769307d2a4e45511ac097f.tar.xz
introduce visual suggestion listitem
Diffstat (limited to 'src')
-rw-r--r--src/urlbar/listitem.cpp52
-rw-r--r--src/urlbar/listitem.h16
2 files changed, 64 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);
-
}
diff --git a/src/urlbar/listitem.h b/src/urlbar/listitem.h
index 975c3724..c662bc24 100644
--- a/src/urlbar/listitem.h
+++ b/src/urlbar/listitem.h
@@ -195,6 +195,22 @@ private:
// -------------------------------------------------------------------------
+class VisualSuggestionListItem : public ListItem
+{
+ Q_OBJECT
+
+public:
+ VisualSuggestionListItem(const UrlSearchItem &item, const QString &text, QWidget *parent = 0);
+ QString text();
+
+private:
+ QString m_text;
+};
+
+
+// -------------------------------------------------------------------------
+
+
class PreviewListItem : public ListItem
{
Q_OBJECT