# HG changeset patch # User Chris Cannam # Date 1330512274 0 # Node ID 1e76d100916749c0fa70346561198b6ac7e26f8c # Parent c2e212ab00683280f55a0599400deb119b196abd Show matching branch names in search results as well as matching on comment diff -r c2e212ab0068 -r 1e76d1009167 src/changesetitem.cpp --- a/src/changesetitem.cpp Wed Feb 29 10:38:28 2012 +0000 +++ b/src/changesetitem.cpp Wed Feb 29 10:44:34 2012 +0000 @@ -92,11 +92,18 @@ } bool -ChangesetItem::setSearchText(QString text) +ChangesetItem::matchSearchText(QString text) { m_searchText = text; - m_searchMatches = (m_changeset->comment().contains - (text, Qt::CaseInsensitive)); + m_searchMatches = false; + if (m_showBranch) { + m_searchMatches = (m_changeset->branch().contains + (text, Qt::CaseInsensitive)); + } + if (!m_searchMatches) { + m_searchMatches = (m_changeset->comment().contains + (text, Qt::CaseInsensitive)); + } return m_searchMatches; } diff -r c2e212ab0068 -r 1e76d1009167 src/changesetitem.h --- a/src/changesetitem.h Wed Feb 29 10:38:28 2012 +0000 +++ b/src/changesetitem.h Wed Feb 29 10:44:34 2012 +0000 @@ -65,7 +65,7 @@ bool showBranch() const { return m_showBranch; } void setShowBranch(bool s) { m_showBranch = s; } - bool setSearchText(QString text); // return true if it matches + bool matchSearchText(QString text); // return true and records the match if it matches signals: void detailShown(); diff -r c2e212ab0068 -r 1e76d1009167 src/historywidget.cpp --- a/src/historywidget.cpp Wed Feb 29 10:38:28 2012 +0000 +++ b/src/historywidget.cpp Wed Feb 29 10:44:34 2012 +0000 @@ -326,7 +326,7 @@ ChangesetItem *csit = dynamic_cast(it); if (!csit) continue; - bool matched = csit->setSearchText(m_searchText); + bool matched = csit->matchSearchText(m_searchText); if (matched && (!toFocus || csit->row() < toFocus->row())) { toFocus = csit; }