From ea1b115cf95aa158c3f6d54c617c28e2ca32cf96 Mon Sep 17 00:00:00 2001 From: Date: Mon, 23 Jun 2008 05:16:08 +0000 Subject: [PATCH] bugfix 2663,2571 --- src/gui/ObjectListViewItem.cpp | 67 ++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 src/gui/ObjectListViewItem.cpp diff --git a/src/gui/ObjectListViewItem.cpp b/src/gui/ObjectListViewItem.cpp new file mode 100644 index 000000000..de8960e4a --- /dev/null +++ b/src/gui/ObjectListViewItem.cpp @@ -0,0 +1,67 @@ +#include "ObjectListViewItem.h" + +#include "fwbuilder/TCPUDPService.h" +#include "fwbuilder/FWObject.h" +#include "fwbuilder/IPService.h" +#include "fwbuilder/ICMPService.h" +#include +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 (lsgetSrcRangeEnd(); + int re = rtcpudp->getSrcRangeEnd(); + if (legetProtocolNumber(); + 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); + } + } +} \ No newline at end of file