fixed #1760 Search by attribute "name" should search by name or label

This commit is contained in:
Vadim Kurland
2010-10-01 02:02:30 +00:00
parent 5ba94e3b3b
commit 9665b619d7
5 changed files with 29 additions and 12 deletions
+1 -1
View File
@@ -1 +1 @@
#define BUILD_NUM 3298
#define BUILD_NUM 3299
+3
View File
@@ -1,5 +1,8 @@
2010-09-30 Vadim Kurland <vadim@vk.crocodile.org>
* 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.
+14 -5
View File
@@ -51,6 +51,7 @@
#include "fwbuilder/TCPService.h"
#include "fwbuilder/UDPService.h"
#include "fwbuilder/MultiAddress.h"
#include "fwbuilder/Interface.h"
#include <QLineEdit>
#include <QStackedWidget>
@@ -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;
+1 -6
View File
@@ -51,7 +51,7 @@
<widget class="QComboBox" name="attribute">
<item>
<property name="text">
<string>Name</string>
<string>Name or label</string>
</property>
</item>
<item>
@@ -78,11 +78,6 @@
</item>
<item row="1" column="0">
<widget class="QComboBox" name="findAttr">
<property name="font">
<font>
<pointsize>13</pointsize>
</font>
</property>
<property name="editable">
<bool>true</bool>
</property>
@@ -289,6 +289,16 @@
</p>
</li>
<li>
<p>
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.
</p>
</li>
</ul>