From 9665b619d75f9498e2e222c00f145efd23af8468 Mon Sep 17 00:00:00 2001 From: Vadim Kurland Date: Fri, 1 Oct 2010 02:02:30 +0000 Subject: [PATCH] fixed #1760 Search by attribute "name" should search by name or label --- build_num | 2 +- doc/ChangeLog | 3 +++ src/gui/FindObjectWidget.cpp | 19 ++++++++++++++----- src/gui/findobjectwidget_q.ui | 7 +------ src/res/help/en_US/release_notes_4.1.2.html | 10 ++++++++++ 5 files changed, 29 insertions(+), 12 deletions(-) diff --git a/build_num b/build_num index d51a2a4b0..910abe304 100644 --- a/build_num +++ b/build_num @@ -1 +1 @@ -#define BUILD_NUM 3298 +#define BUILD_NUM 3299 diff --git a/doc/ChangeLog b/doc/ChangeLog index 859992d66..715f228c7 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,5 +1,8 @@ 2010-09-30 Vadim Kurland + * FindObjectWidget.cpp (matchAttr): fixed #1760 'Search by + attribute "name" should search by name or label'. + * FindObjectWidget.cpp (objectInserted): fixed #1757 Allow searching by attributes even after an object is dropped into the drop area in search panel. diff --git a/src/gui/FindObjectWidget.cpp b/src/gui/FindObjectWidget.cpp index 1f4166aa2..afdf07896 100644 --- a/src/gui/FindObjectWidget.cpp +++ b/src/gui/FindObjectWidget.cpp @@ -51,6 +51,7 @@ #include "fwbuilder/TCPService.h" #include "fwbuilder/UDPService.h" #include "fwbuilder/MultiAddress.h" +#include "fwbuilder/Interface.h" #include #include @@ -192,13 +193,21 @@ bool FindObjectWidget::matchAttr(libfwbuilder::FWObject *obj) int attrN = m_widget->attribute->currentIndex(); switch (attrN) { - case 0: // Name + case 0: // Name or label { - QString name=QString::fromUtf8( obj->getName().c_str() ); - - if (m_widget->useRegexp->isChecked()) res= ( name.indexOf( QRegExp(s) )!=-1 ); - else res= ( name == s ); + QString name = QString::fromUtf8( obj->getName().c_str() ); + QString label; + if (Interface::isA(obj)) + label = QString::fromUtf8( Interface::cast(obj)->getLabel().c_str() ); + if (m_widget->useRegexp->isChecked()) + { + res = (name.indexOf( QRegExp(s) )!=-1 || + (!label.isEmpty() && label.indexOf( QRegExp(s) )!=-1)); + } else + { + res = (name == s || (!label.isEmpty() && label == s)); + } //res= ( name == s ); break; diff --git a/src/gui/findobjectwidget_q.ui b/src/gui/findobjectwidget_q.ui index 4e46b113a..884430fe7 100644 --- a/src/gui/findobjectwidget_q.ui +++ b/src/gui/findobjectwidget_q.ui @@ -51,7 +51,7 @@ - Name + Name or label @@ -78,11 +78,6 @@ - - - 13 - - true diff --git a/src/res/help/en_US/release_notes_4.1.2.html b/src/res/help/en_US/release_notes_4.1.2.html index bc8d13795..95a344da4 100644 --- a/src/res/help/en_US/release_notes_4.1.2.html +++ b/src/res/help/en_US/release_notes_4.1.2.html @@ -289,6 +289,16 @@

+
  • +

    + fixed #1760 'Search by attribute "name" should search by name or + label'. The first item in the list of attribute types available + for search now reads "Name or label". Searching using this + option matches the name or the label of object instead of just + the name. Label is only defined for Interface objects. +

    +
  • +