diff options
Diffstat (limited to 'src/urlbar')
-rw-r--r-- | src/urlbar/listitem.cpp | 52 | ||||
-rw-r--r-- | src/urlbar/listitem.h | 16 |
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 |