1
0
mirror of https://github.com/fwbuilder/fwbuilder synced 2026-03-22 19:27:13 +01:00

more checks for printing from command line, See #1533

This commit is contained in:
Vadim Kurland 2010-07-03 16:02:24 +00:00
parent 9bfb5c30f4
commit f8918cbb9a
4 changed files with 83 additions and 55 deletions

View File

@ -1 +1 @@
#define BUILD_NUM 3039
#define BUILD_NUM 3049

View File

@ -1,3 +1,9 @@
2010-07-03 Vadim Kurland <vadim@vk.crocodile.org>
* RuleSetView.cpp (RuleSetView::restoreCollapsedGroups): fixed
SourceForge bug 3020761 "printing from command line causes
Segmentation fault". Fixes #1533
2010-06-28 Vadim Kurland <vadim@vk.crocodile.org>
* utils.cpp (parseCommandLine): See #1542 since now user can enter

View File

@ -2355,68 +2355,84 @@ void RuleSetView::updateCurrentCell()
updateColumnSizeForIndex(fwosm->index);
}
/*
* looks like this method can be called when we print from the command
* line. Variable project==NULL at that time.
*/
void RuleSetView::saveCollapsedGroups()
{
QStringList collapsed_groups;
QString filename = project->getRCS()->getFileName();
RuleSetModel* md = ((RuleSetModel*)model());
QList<QModelIndex> groups;
md->getGroups(groups);
foreach (QModelIndex index, groups)
if (project)
{
if (!isExpanded(index))
QStringList collapsed_groups;
QString filename = project->getRCS()->getFileName();
RuleSetModel* md = ((RuleSetModel*)model());
QList<QModelIndex> groups;
md->getGroups(groups);
foreach (QModelIndex index, groups)
{
RuleNode* node = static_cast<RuleNode *>(index.internalPointer());
collapsed_groups.push_back(node->name);
if (!isExpanded(index))
{
RuleNode* node = static_cast<RuleNode *>(index.internalPointer());
collapsed_groups.push_back(node->name);
}
}
Firewall *f = md->getFirewall();
if (f)
st->setCollapsedRuleGroups(
filename,
f->getName().c_str(),
md->getRuleSet()->getName().c_str(),
collapsed_groups);
}
Firewall *f = md->getFirewall();
if (f)
st->setCollapsedRuleGroups(
filename,
f->getName().c_str(),
md->getRuleSet()->getName().c_str(),
collapsed_groups);
}
/*
* looks like this method can be called when we print from the command
* line. Variable project==NULL at that time.
*/
void RuleSetView::restoreCollapsedGroups()
{
QTime t;
t.start();
RuleSetModel* md = ((RuleSetModel*)model());
QStringList collapsed_groups;
QString filename;
if (project != NULL)
if (project)
{
QTime t;
t.start();
RuleSetModel* md = ((RuleSetModel*)model());
QStringList collapsed_groups;
QString filename;
filename = project->getRCS()->getFileName();
else filename = "";
if (fwbdebug)
qDebug("restoreCollapsedGroups begin: %d ms", t.restart());
Firewall *f = md->getFirewall();
if (f)
st->getCollapsedRuleGroups(
filename,
f->getName().c_str(),
md->getRuleSet()->getName().c_str(),
collapsed_groups);
if (fwbdebug)
qDebug("restoreCollapsedGroups getCollapsedRuleGroups: %d ms", t.restart());
QList<QModelIndex> groups;
md->getGroups(groups);
if (fwbdebug)
{
qDebug("restoreCollapsedGroups getGroups: %d ms", t.restart());
qDebug() << "Groups:" << groups.size();
if (fwbdebug)
qDebug("restoreCollapsedGroups begin: %d ms", t.restart());
Firewall *f = md->getFirewall();
if (f)
st->getCollapsedRuleGroups(
filename,
f->getName().c_str(),
md->getRuleSet()->getName().c_str(),
collapsed_groups);
if (fwbdebug)
qDebug("restoreCollapsedGroups getCollapsedRuleGroups: %d ms", t.restart());
QList<QModelIndex> groups;
md->getGroups(groups);
if (fwbdebug)
{
qDebug("restoreCollapsedGroups getGroups: %d ms", t.restart());
qDebug() << "Groups:" << groups.size();
}
foreach (QModelIndex index, groups)
{
RuleNode* node = static_cast<RuleNode *>(index.internalPointer());
setExpanded(index, !collapsed_groups.contains(node->name) );
}
if (fwbdebug)
qDebug("restoreCollapsedGroups foreach setExpanded: %d ms", t.restart());
}
foreach (QModelIndex index, groups)
{
RuleNode* node = static_cast<RuleNode *>(index.internalPointer());
setExpanded(index, !collapsed_groups.contains(node->name) );
}
if (fwbdebug)
qDebug("restoreCollapsedGroups foreach setExpanded: %d ms", t.restart());
}
int RuleSetView::rowHeight(const QModelIndex& index) const

View File

@ -182,11 +182,10 @@
<li>
<p>
See #1346. Mostly completed implementation of the viewer panel
that can be used to inspect generated firewall configuration files
from within the GUI. The panel can be opened using a button in the
mini-toolbar above firewall rules or as a page in the compile and
install wizard.
See #1346. Viewer panel that can be used to inspect generated
firewall configuration files from within the GUI. The panel can
be opened using a button in the mini-toolbar above firewall
rules or as a page in the compile and install wizard.
</p>
</li>
@ -235,6 +234,13 @@
</li>
<li>
<p>
fixed SourceForge bug 3020761 "printing from command line causes
Segmentation fault". Fixes #1533
</p>
</li>
</ul>