mirror of
https://github.com/fwbuilder/fwbuilder
synced 2026-09-13 16:39:48 +02:00
fixed #1760 Search by attribute "name" should search by name or label
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user