mirror of
https://github.com/fwbuilder/fwbuilder
synced 2026-09-11 15:41:41 +02:00
bugfix 2663,2571
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
#include "ObjectListViewItem.h"
|
||||
|
||||
#include "fwbuilder/TCPUDPService.h"
|
||||
#include "fwbuilder/FWObject.h"
|
||||
#include "fwbuilder/IPService.h"
|
||||
#include "fwbuilder/ICMPService.h"
|
||||
#include <QTreeWidget>
|
||||
using namespace libfwbuilder;
|
||||
|
||||
bool ObjectListViewItem::operator< ( const QTreeWidgetItem & other ) const
|
||||
{
|
||||
QTreeWidget * widget = treeWidget () ;
|
||||
if (widget!=NULL)
|
||||
{
|
||||
int col = widget->sortColumn ();
|
||||
if (col==1)
|
||||
{
|
||||
FWObject *right = ((ObjectListViewItem*)(&other))->getFWObject();
|
||||
FWObject *left = this->getFWObject();
|
||||
TCPUDPService * rtcpudp = TCPUDPService::cast(right);
|
||||
TCPUDPService * ltcpudp = TCPUDPService::cast(left);
|
||||
|
||||
IPService * rip = IPService::cast(right);
|
||||
IPService * lip = IPService::cast(left);
|
||||
|
||||
ICMPService * ricmp = ICMPService::cast(right);
|
||||
ICMPService * licmp = ICMPService::cast(left);
|
||||
if (rtcpudp != NULL && ltcpudp != NULL)
|
||||
{
|
||||
int ls = ltcpudp->getSrcRangeStart();
|
||||
int rs = rtcpudp->getSrcRangeStart();
|
||||
if (ls<rs)
|
||||
return true ;
|
||||
else
|
||||
{
|
||||
if (ls==rs)
|
||||
{
|
||||
int le = ltcpudp->getSrcRangeEnd();
|
||||
int re = rtcpudp->getSrcRangeEnd();
|
||||
if (le<re)
|
||||
return true ;
|
||||
else
|
||||
return false ;
|
||||
}
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
if (rip != NULL && lip != NULL)
|
||||
{
|
||||
int lpn = lip->getProtocolNumber();
|
||||
int rpn = rip->getProtocolNumber();
|
||||
return (lpn < rpn);
|
||||
}
|
||||
if (ricmp != NULL & licmp != NULL)
|
||||
{
|
||||
int lpn = licmp->getInt("code");
|
||||
int rpn = ricmp->getInt("code");
|
||||
return (lpn < rpn);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
return QTreeWidgetItem::operator < (other);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user