summaryrefslogtreecommitdiff
path: root/src/urlbar
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2010-09-02 13:00:10 +0200
committerAndrea Diamantini <adjam7@gmail.com>2010-09-02 13:00:10 +0200
commit96330988d6be686ca79776518ac52d59c1848e33 (patch)
treea3d357a81fcc0bb0dea38b187e83d0a7443d7488 /src/urlbar
parentThis commit hopes to definitely fix troubles with HTML encodings. (diff)
downloadrekonq-96330988d6be686ca79776518ac52d59c1848e33.tar.xz
Fix wrong highlights in the search strings
PS: this fix costs a string change, sorry BUG: 249735
Diffstat (limited to 'src/urlbar')
-rw-r--r--src/urlbar/listitem.cpp26
-rw-r--r--src/urlbar/listitem.h5
2 files changed, 23 insertions, 8 deletions
diff --git a/src/urlbar/listitem.cpp b/src/urlbar/listitem.cpp
index 99b2423d..5ff90056 100644
--- a/src/urlbar/listitem.cpp
+++ b/src/urlbar/listitem.cpp
@@ -225,6 +225,19 @@ TextLabel::TextLabel(const QString &text, const QString &textToPointOut, QWidget
}
+TextLabel::TextLabel(QWidget *parent)
+ : QLabel(parent)
+{
+ setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum);
+}
+
+
+void TextLabel::setEngineText(const QString &engine, const QString &text)
+{
+ setText( i18nc("%1=search engine, e.g. Google, Wikipedia %2=text to search for", "Search %1 for <b>%2</b>", engine, Qt::escape(text) ) );
+}
+
+
//--------------------------------------------------------------------------------------------
@@ -291,7 +304,8 @@ SearchListItem::SearchListItem(const UrlSearchItem &item, const QString &text, Q
{
m_iconLabel = new IconLabel(SearchEngine::buildQuery(UrlResolver::searchEngine(), ""), this);
QString query = SearchEngine::extractQuery(text);
- m_titleLabel = new TextLabel(searchItemTitle(item.title, query), query, this);
+ m_titleLabel = new TextLabel(this);
+ m_titleLabel->setEngineText(item.title, query);
m_engineBar = new EngineBar(UrlResolver::searchEngine(), parent);
QHBoxLayout *hLayout = new QHBoxLayout;
@@ -315,15 +329,15 @@ 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 %2", engine, 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 %2", engine, text));
+// }
void SearchListItem::changeSearchEngine(KService::Ptr engine)
{
- m_titleLabel->setText(searchItemTitle(engine->name(), m_text));
+ m_titleLabel->setEngineText(engine->name(), m_text);
m_iconLabel->setPixmap( Application::iconManager()->iconForUrl(KUrl(engine->property("Query").toString())).pixmap(16) );
m_url = SearchEngine::buildQuery(engine, m_text);
UrlResolver::setSearchEngine(engine);
diff --git a/src/urlbar/listitem.h b/src/urlbar/listitem.h
index 37b22f47..be5a2569 100644
--- a/src/urlbar/listitem.h
+++ b/src/urlbar/listitem.h
@@ -121,6 +121,9 @@ class TextLabel : public QLabel
public:
explicit TextLabel(const QString &text, const QString &textToPointOut = QString(), QWidget *parent = 0);
+ explicit TextLabel(QWidget *parent = 0);
+
+ void setEngineText(const QString &engine, const QString &text);
};
@@ -165,8 +168,6 @@ private slots:
void changeSearchEngine(KService::Ptr engine);
private:
- QString searchItemTitle(QString engine, QString text);
-
TextLabel* m_titleLabel;
IconLabel* m_iconLabel;
EngineBar* m_engineBar;