diff --git a/src/gui/FWObjectPropertiesFactory.cpp b/src/gui/FWObjectPropertiesFactory.cpp index a80b83222..1ee2eea84 100644 --- a/src/gui/FWObjectPropertiesFactory.cpp +++ b/src/gui/FWObjectPropertiesFactory.cpp @@ -571,7 +571,7 @@ QString FWObjectPropertiesFactory::getRuleActionProperties(PolicyRule *rule) par = ropt->getStr("custom_str").c_str(); break; case PolicyRule::Branch : - par = ropt->getStr("branch_name").c_str(); + par = rule->getBranch()->getName().c_str();//ropt->getStr("branch_name").c_str(); break; case PolicyRule::Classify : if (platform=="ipfw") diff --git a/src/gui/FindWhereUsedWidget.cpp b/src/gui/FindWhereUsedWidget.cpp index 163747188..bef61be13 100644 --- a/src/gui/FindWhereUsedWidget.cpp +++ b/src/gui/FindWhereUsedWidget.cpp @@ -40,6 +40,7 @@ #include "FWBSettings.h" #include "ObjectTreeView.h" #include "RuleSetView.h" +#include "ProjectPanel.h" #include "fwbuilder/FWObjectDatabase.h" #include "fwbuilder/FWReference.h" @@ -253,10 +254,10 @@ void FindWhereUsedWidget::showObject(FWObject* o) { ref=findRef(object,o); if (ref==NULL) return; - + mw->activeProject()->openRuleSet(o->getParent()->getParent()); mw->clearManipulatorFocus(); mw->ensureObjectVisibleInRules( ref ); - mw->selectRules(); +// mw->selectRules(); if (mw->isEditorVisible()) { mw->editObject( object ); diff --git a/src/gui/ObjectManipulator.cpp b/src/gui/ObjectManipulator.cpp index 89744e329..e1abbc4e2 100644 --- a/src/gui/ObjectManipulator.cpp +++ b/src/gui/ObjectManipulator.cpp @@ -2321,7 +2321,7 @@ bool ObjectManipulator::switchObjectInEditor(FWObject *obj) // qDebug("!2"); if (obj!=m_project->getCurrentRuleSet()) { - if (m_project->getCurrentRuleSet()!=NULL) +// if (m_project->getCurrentRuleSet()!=NULL) m_project->openRuleSet(obj); } diff --git a/src/gui/ObjectTreeView.cpp b/src/gui/ObjectTreeView.cpp index e335e6ad7..9d174fab0 100644 --- a/src/gui/ObjectTreeView.cpp +++ b/src/gui/ObjectTreeView.cpp @@ -151,6 +151,7 @@ ObjectTreeView::ObjectTreeView(ProjectPanel* project, QWidget* parent, const cha setAcceptDrops( true ); setDragDropMode( QAbstractItemView::DragDrop ); setRootIsDecorated( TRUE ); + setSortingEnabled(false); } bool ObjectTreeView::event( QEvent *event ) diff --git a/src/gui/ProjectPanel.cpp b/src/gui/ProjectPanel.cpp index a1683d316..2b89d8b52 100644 --- a/src/gui/ProjectPanel.cpp +++ b/src/gui/ProjectPanel.cpp @@ -3622,7 +3622,8 @@ void ProjectPanel::scheduleRuleSetRedraw() if (!ruleSetRedrawPending) { ruleSetRedrawPending = true; - QTimer::singleShot( 0, this, SLOT(redrawRuleSets()) ); + redrawRuleSets(); + //QTimer::singleShot( 0, this, SLOT(redrawRuleSets()) ); } } diff --git a/src/gui/RuleSetView.cpp b/src/gui/RuleSetView.cpp index 612203069..43d5a4e86 100644 --- a/src/gui/RuleSetView.cpp +++ b/src/gui/RuleSetView.cpp @@ -2165,6 +2165,12 @@ void RuleSetView::insertRule() mw->updateLastModifiedTimestampForOneFirewall(getFirewall()); } +void RuleSetView::insertRuleAboveFirstGroup() +{ + insertRule(0,NULL); + updateGroups(); +} + FWObject* RuleSetView::getSelectedObject() { return selectedObject; @@ -2705,42 +2711,42 @@ void RuleSetView::contextMenu(int row, int col, const QPoint &pos) } else { + if (row==0) + popup->addAction( tr("Insert Rule Above"), this, SLOT( insertRuleAboveFirstGroup() )); + popup->addAction( tr("Rename group"), this, SLOT( renameGroup() )); - popup->addSeparator(); + popup->addSeparator(); - QMenu *subcolor = popup->addMenu( tr("Change color") ); + QMenu *subcolor = popup->addMenu( tr("Change color") ); - QPixmap pcolor(16,16); - pcolor.fill(QColor(255,255,255)); - subcolor->addAction( QIcon(pcolor), tr("No color"), this, SLOT ( setColorEmpty() )); + QPixmap pcolor(16,16); + pcolor.fill(QColor(255,255,255)); + subcolor->addAction( QIcon(pcolor), tr("No color"), this, SLOT ( setColorEmpty() )); - pcolor.fill(st->getLabelColor(FWBSettings::RED)); - subcolor->addAction( QIcon(pcolor), tr("Red"), this, SLOT ( setColorRed() )); + pcolor.fill(st->getLabelColor(FWBSettings::RED)); + subcolor->addAction( QIcon(pcolor), tr("Red"), this, SLOT ( setColorRed() )); - pcolor.fill(st->getLabelColor(FWBSettings::ORANGE)); - subcolor->addAction( QIcon(pcolor), tr("Orange"), this, SLOT ( setColorOrange() )); + pcolor.fill(st->getLabelColor(FWBSettings::ORANGE)); + subcolor->addAction( QIcon(pcolor), tr("Orange"), this, SLOT ( setColorOrange() )); - pcolor.fill(st->getLabelColor(FWBSettings::YELLOW)); - subcolor->addAction( QIcon(pcolor), tr("Yellow"), this, SLOT ( setColorYellow() )); + pcolor.fill(st->getLabelColor(FWBSettings::YELLOW)); + subcolor->addAction( QIcon(pcolor), tr("Yellow"), this, SLOT ( setColorYellow() )); - pcolor.fill(st->getLabelColor(FWBSettings::GREEN)); - subcolor->addAction( QIcon(pcolor), tr("Green"), this, SLOT ( setColorGreen() )); + pcolor.fill(st->getLabelColor(FWBSettings::GREEN)); + subcolor->addAction( QIcon(pcolor), tr("Green"), this, SLOT ( setColorGreen() )); - pcolor.fill(st->getLabelColor(FWBSettings::BLUE)); - subcolor->addAction( QIcon(pcolor), tr("Blue"), this, SLOT ( setColorBlue() )); + pcolor.fill(st->getLabelColor(FWBSettings::BLUE)); + subcolor->addAction( QIcon(pcolor), tr("Blue"), this, SLOT ( setColorBlue() )); - pcolor.fill(st->getLabelColor(FWBSettings::PURPLE)); - subcolor->addAction( QIcon(pcolor), tr("Purple"), this, SLOT ( setColorPurple() )); + pcolor.fill(st->getLabelColor(FWBSettings::PURPLE)); + subcolor->addAction( QIcon(pcolor), tr("Purple"), this, SLOT ( setColorPurple() )); - pcolor.fill(st->getLabelColor(FWBSettings::GRAY)); - subcolor->addAction( QIcon(pcolor), tr("Gray"), this, SLOT ( setColorGray() )); + pcolor.fill(st->getLabelColor(FWBSettings::GRAY)); + subcolor->addAction( QIcon(pcolor), tr("Gray"), this, SLOT ( setColorGray() )); + popup->exec( pos ); - - - popup->exec( pos ); - - delete popup; + delete popup; return ; } diff --git a/src/gui/RuleSetView.h b/src/gui/RuleSetView.h index 8808a1dbf..8ba18479b 100644 --- a/src/gui/RuleSetView.h +++ b/src/gui/RuleSetView.h @@ -162,7 +162,7 @@ class RuleSetView : public QTableView void addToGroupAbove (); void addToGroupBelow(); void removeFromGroup(); - + void insertRuleAboveFirstGroup(); void showHideRuleGroup (RuleGroupPanel * rgp); void editSelected(); diff --git a/src/gui/UserDialog.cpp b/src/gui/UserDialog.cpp index 3753136e2..d0ac70242 100644 --- a/src/gui/UserDialog.cpp +++ b/src/gui/UserDialog.cpp @@ -126,9 +126,9 @@ void UserDialog::applyChanges() assert(s!=NULL); s->dump(false,false); string oldname=obj->getName(); - obj->setName( string(m_dialog->obj_name->text().toUtf8().constData()) ); - obj->setComment( string(m_dialog->comment->toPlainText().toUtf8().constData()) ); - obj->setName( string(m_dialog->userid->text().toUtf8().constData()) ); + s->setName( string(m_dialog->obj_name->text().toUtf8().constData()) ); + s->setComment( string(m_dialog->comment->toPlainText().toUtf8().constData()) ); + s->setUserId( string(m_dialog->userid->text().toUtf8().constData()) ); mw->updateObjName(obj,QString::fromUtf8(oldname.c_str()));