default netmask /32 for Network object

d o not print netmask for ipv4 and ipv6 objects in tooltips and info panel unless
child of an interface

bug 2124804
This commit is contained in:
Vadim Kurland
2008-09-24 13:19:48 +00:00
parent 7c9e837e80
commit d4dfb1ac68
4 changed files with 63 additions and 10 deletions
+17
View File
@@ -1,3 +1,20 @@
2008-09-24 Vadim Kurland <vadim@vk.crocodile.org>
* Network.cpp (Network::Network): (change in libfwbuilder) set
netmask to /32 when new Network object is created. This used to be
the default in fwbuilder v2.1. New default of 0.0.0.0 appears to
be confusing and error-prone, by user's requests changing default
back to /32.
* FWObjectPropertiesFactory.cpp (getObjectProperties): do not
print netmask of the IPv4 and IPv6 objects in tooltips and "info"
panel unless such object is child of an Interface.
* RuleSetView.cpp (RuleSetView::updateGeometries): fixed bug
#2124804: "Policy list "jump" when using groups". Combination of
rule groups and very tall rows in the rule set view caused
problems with vertical scrolling.
2008-09-23 Vadim Kurland <vadim@vk.crocodile.org>
* RuleSetView.cpp (RuleSetView::insertRule): fixed bug #2123150:
+22 -10
View File
@@ -84,20 +84,26 @@ QString FWObjectPropertiesFactory::getObjectProperties(FWObject *obj)
{
QString res;
QTextStream str(&res, QIODevice::WriteOnly);
FWObject *parent_obj = obj->getParent();
try
{
if (IPv4::isA(obj))
{
str << IPv4::cast(obj)->getAddressPtr()->toString().c_str();
str << "/";
str << IPv4::cast(obj)->getNetmaskPtr()->toString().c_str();
if (parent_obj && Interface::isA(parent_obj))
{
str << "/";
str << IPv4::cast(obj)->getNetmaskPtr()->toString().c_str();
}
} else if (IPv6::isA(obj))
{
str << IPv6::cast(obj)->getAddressPtr()->toString().c_str();
str << "/";
str << QString("%1").arg(IPv6::cast(obj)->getNetmaskPtr()->getLength());
if (parent_obj && Interface::isA(parent_obj))
{
str << "/";
str << QString("%1").arg(IPv6::cast(obj)->getNetmaskPtr()->getLength());
}
} else if (physAddress::isA(obj))
{
str << physAddress::cast(obj)->getPhysAddress().c_str();
@@ -253,6 +259,7 @@ QString FWObjectPropertiesFactory::getObjectPropertiesDetailed(FWObject *obj,
bool richText)
{
QString str;
FWObject *parent_obj = obj->getParent();
QString path = obj->getPath().c_str();
path = path.section('/',2,-1);
@@ -285,15 +292,20 @@ QString FWObjectPropertiesFactory::getObjectPropertiesDetailed(FWObject *obj,
{
if (showPath && !tooltip) str += "<b>Path: </b>" + path + "<br>\n";
str += IPv4::cast(obj)->getAddressPtr()->toString().c_str();
str += "/";
str += IPv4::cast(obj)->getNetmaskPtr()->toString().c_str();
if (parent_obj && Interface::isA(parent_obj))
{
str += "/";
str += IPv4::cast(obj)->getNetmaskPtr()->toString().c_str();
}
} else if (IPv6::isA(obj))
{
if (showPath && !tooltip) str += "<b>Path: </b>" + path + "<br>\n";
str += IPv6::cast(obj)->getAddressPtr()->toString().c_str();
str += "/";
str += QString("%1").arg(IPv6::cast(obj)->getNetmaskPtr()->getLength());
if (parent_obj && Interface::isA(parent_obj))
{
str += "/";
str += QString("%1").arg(IPv6::cast(obj)->getNetmaskPtr()->getLength());
}
} else if (physAddress::isA(obj))
{
if (showPath && !tooltip) str += "<b>Path: </b>" + path + "<br>\n";
+22
View File
@@ -98,6 +98,7 @@
#include <qinputdialog.h>
#include <QMdiSubWindow>
#include <QMdiArea>
#include <QScrollBar>
using namespace libfwbuilder;
using namespace std;
@@ -362,6 +363,13 @@ QSize RuleDelegate::sizeHint(const QStyleOptionViewItem &,
return QSize(30, 19);
}
/*****************************************************************
RuleSetView
*****************************************************************/
void RuleSetView::setColumnWidth( const int col, const int width )
{
if (col < 0)
@@ -510,6 +518,7 @@ RuleSetView::RuleSetView(ProjectPanel *project, int , int c, QWidget *parent):
setSelectionMode( QAbstractItemView::ContiguousSelection );
setSelectionBehavior( QAbstractItemView::SelectRows );
setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
int lm, tm, rm, bm;
getContentsMargins(&lm, &tm, &rm, &bm);
@@ -553,6 +562,19 @@ RuleSetView::~RuleSetView()
{
}
/*
* QTableView updates scroll bars (among other things) in this
* virtual slot. We want vertical scroller to be by-pixel but their
* implementation sets step to approximately average row height. This
* causes problems when rows have very different height (some are
* small, some are very tall) because scroll step becomes too big.
*/
void RuleSetView::updateGeometries()
{
QTableView::updateGeometries();
verticalScrollBar()->setSingleStep(20);
}
bool RuleSetView::showCommentTip(QPoint pos, QHelpEvent *he)
{
if (!st->getClipComment())
+2
View File
@@ -232,6 +232,8 @@ public slots:
void horzSectionResized ( int logicalIndex, int oldSize, int newSize );
void vertSectionResized ( int logicalIndex, int oldSize, int newSize );
virtual void updateGeometries();
public:
libfwbuilder::RuleSet *ruleset;