From 5d91b70d2fafde96bd978b65724a770ff22390b4 Mon Sep 17 00:00:00 2001 From: megabigbug Date: Fri, 21 May 2010 22:34:23 +0200 Subject: listitem: when the title of an item is empty fallback to domain name of the url. --- src/urlbar/listitem.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/urlbar/listitem.cpp b/src/urlbar/listitem.cpp index f91840d2..5254c7dc 100644 --- a/src/urlbar/listitem.cpp +++ b/src/urlbar/listitem.cpp @@ -220,7 +220,16 @@ PreviewListItem::PreviewListItem(const UrlSearchItem &item, const QString &text, QVBoxLayout *vLayout = new QVBoxLayout; vLayout->setMargin(0); - vLayout->addWidget(new TextLabel(item.title, text, this)); + + QString title = item.title; + if (title.isEmpty()) + { + title = item.url.url(); + title = title.remove("http://"); + title.truncate(title.indexOf("/")); + } + + vLayout->addWidget(new TextLabel(title, text, this)); vLayout->addWidget(new TextLabel("" + item.url.url() + "", text, this)); hLayout->addLayout(vLayout); -- cgit v1.2.1