From 4ed299b019a36b2df0c3f4238243e1146d3410b6 Mon Sep 17 00:00:00 2001 From: Vadim Kurland Date: Fri, 6 Jun 2008 00:06:39 +0000 Subject: [PATCH] clean-up: using methods PolicyRule::setBranch and PolicyRule::setTagObject --- src/gui/ActionsDialog.cpp | 53 +++++++++------------------------------ 1 file changed, 12 insertions(+), 41 deletions(-) diff --git a/src/gui/ActionsDialog.cpp b/src/gui/ActionsDialog.cpp index 43e83d9c0..a42a481c2 100644 --- a/src/gui/ActionsDialog.cpp +++ b/src/gui/ActionsDialog.cpp @@ -185,66 +185,37 @@ void ActionsDialog::applyChanges() if (editor=="TagInt") { - if (TagIntArea!=NULL) - { - QString id ; - if (TagIntArea->getObject()!=NULL) - id = TagIntArea->getObject()->getId().c_str(); - else - id = ""; - ropt->setStr("tagobject_id",id.toAscii().data()); - } + FWObject *tag_object = TagIntArea->getObject(); + // if tag_object==NULL, setTagObject clears setting in the rule + rule->setTagObject(tag_object); } if (editor=="TagStr") { - if (TagStrArea!=NULL) - { - QString id ; - if (TagStrArea->getObject()!=NULL) - id = TagStrArea->getObject()->getId().c_str(); - else - id = ""; - ropt->setStr("tagobject_id",id.toAscii().data()); - } + FWObject *tag_object = TagStrArea->getObject(); + // if tag_object==NULL, setTagObject clears setting in the rule + rule->setTagObject(tag_object); } if (editor=="BranchChain") { - if (BranchChainArea!=NULL) - { - QString id ; - if (BranchChainArea->getObject()!=NULL) - id = BranchChainArea->getObject()->getId().c_str(); - else - id = ""; - ropt->setStr("branch_id",id.toAscii().data()); - mw->setPolicyBranchTabName(rule->getBranch()); - } + RuleSet *ruleset = RuleSet::cast(BranchChainArea->getObject()); + // if ruleset==NULL, setBranch clears setting in the rule + rule->setBranch(ruleset); } if (editor=="BranchAnchor") { - if (BranchAnchorArea!=NULL) - { - QString id ; - if (BranchAnchorArea->getObject()!=NULL) - id = BranchAnchorArea->getObject()->getId().c_str(); - else - id = ""; - ropt->setStr("branch_id",id.toAscii().data()); - mw->setPolicyBranchTabName(rule->getBranch()); - } + RuleSet *ruleset = RuleSet::cast(BranchAnchorArea->getObject()); + // if ruleset==NULL, setBranch clears setting in the rule + rule->setBranch(ruleset); } - if (m_dialog->useDummyNetPipe->isChecked()) ropt->setInt("ipfw_classify_method",DUMMYNETPIPE); else ropt->setInt("ipfw_classify_method",DUMMYNETQUEUE); - - mw->updateLastModifiedTimestampForAllFirewalls(rule); }