From d4dfb1ac68688ed35c22d4e2d1ad2ad3fcde8b86 Mon Sep 17 00:00:00 2001 From: Vadim Kurland Date: Wed, 24 Sep 2008 13:19:48 +0000 Subject: [PATCH] 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 --- doc/ChangeLog | 17 ++++++++++++++ src/gui/FWObjectPropertiesFactory.cpp | 32 ++++++++++++++++++--------- src/gui/RuleSetView.cpp | 22 ++++++++++++++++++ src/gui/RuleSetView.h | 2 ++ 4 files changed, 63 insertions(+), 10 deletions(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index cdeff7fa8..ba0904581 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,20 @@ +2008-09-24 Vadim Kurland + + * 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 * RuleSetView.cpp (RuleSetView::insertRule): fixed bug #2123150: diff --git a/src/gui/FWObjectPropertiesFactory.cpp b/src/gui/FWObjectPropertiesFactory.cpp index e2c962020..324972cb8 100644 --- a/src/gui/FWObjectPropertiesFactory.cpp +++ b/src/gui/FWObjectPropertiesFactory.cpp @@ -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 += "Path: " + path + "
\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 += "Path: " + path + "
\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 += "Path: " + path + "
\n"; diff --git a/src/gui/RuleSetView.cpp b/src/gui/RuleSetView.cpp index 0747529a9..1d38219b0 100644 --- a/src/gui/RuleSetView.cpp +++ b/src/gui/RuleSetView.cpp @@ -98,6 +98,7 @@ #include #include #include +#include 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()) diff --git a/src/gui/RuleSetView.h b/src/gui/RuleSetView.h index f1a1a9edf..cd78ee201 100644 --- a/src/gui/RuleSetView.h +++ b/src/gui/RuleSetView.h @@ -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;