diff options
author | Andrea Diamantini <adjam7@gmail.com> | 2010-08-26 20:46:55 +0200 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2010-08-26 20:46:55 +0200 |
commit | 303c4d1d267f8b53a2604b51314ea79053e62635 (patch) | |
tree | f8870d92d221ba9d746375351cb502172af87975 /src/urlbar | |
parent | SVN_SILENT made messages (.desktop file) (diff) | |
parent | Merge commit 'refs/merge-requests/191' of git://gitorious.org/rekonq/mainline... (diff) | |
download | rekonq-303c4d1d267f8b53a2604b51314ea79053e62635.tar.xz |
Merge branch 'm2_191'
Diffstat (limited to 'src/urlbar')
-rw-r--r-- | src/urlbar/listitem.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/urlbar/listitem.cpp b/src/urlbar/listitem.cpp index e9bb6fbb..5bd2253f 100644 --- a/src/urlbar/listitem.cpp +++ b/src/urlbar/listitem.cpp @@ -200,8 +200,17 @@ TextLabel::TextLabel(const QString &text, const QString &textToPointOut, QWidget : QLabel(parent) { QString t = text; - if (!textToPointOut.isEmpty()) - t = t.replace(QRegExp('(' + textToPointOut + ')', Qt::CaseInsensitive), "<b>\\1</b>"); + const bool wasItalic = t.startsWith("<i>"); + if (wasItalic) + t.remove(QRegExp("<[/ib]*>")); + t = Qt::escape(t); + QStringList words = textToPointOut.split(" "); + foreach (const QString &wordToPointOut, words) { + if (!wordToPointOut.isEmpty()) + t.replace(QRegExp('(' + wordToPointOut + ')', Qt::CaseInsensitive), "<b>\\1</b>"); + } + if (wasItalic) + t = QL1S("<i>") + t + QL1S("</i>"); setText(t); setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum); @@ -286,7 +295,7 @@ SearchListItem::SearchListItem(const UrlSearchItem &item, const QString &text, Q m_url = SearchEngine::buildQuery(engine, query); m_iconLabel = new IconLabel("edit-find", this); //TODO: get the default engine icon (will be easy in KDE SC 4.5) - m_titleLabel = new TextLabel(searchItemTitle(engine->name(), query), QString(), this); + m_titleLabel = new TextLabel(searchItemTitle(engine->name(), query), query, this); m_engineBar = new EngineBar(engine, parent); QHBoxLayout *hLayout = new QHBoxLayout; @@ -312,7 +321,7 @@ QString SearchListItem::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))); + return QString(i18nc("%1=search engine, e.g. Google, Wikipedia %2=text to search for", "Search %1 for %2", engine, Qt::escape(text))); } |