1
0
mirror of https://github.com/fwbuilder/fwbuilder synced 2025-10-17 07:57:43 +02:00

bugfix 2422

This commit is contained in:
2008-04-26 11:00:06 +00:00
parent e690c3627a
commit 6840a50785
5 changed files with 69 additions and 18 deletions

View File

@ -30,11 +30,20 @@ RuleGroupPanel::RuleGroupPanel (QWidget * parent,RuleSetView * rsv, int row) : Q
this->row= row;
this->rsv = rsv;
this->setupUi(this);
setContentsMargins (0,0,0,0);
showHideRuleGroupButton->setText("Collapse Group");
setContentsMargins (3,3,3,3);
//showHideRuleGroupButton->setText("Collapse Group");
connect (showHideRuleGroupButton, SIGNAL(pressed()),this,SLOT(showHideRuleGroup()));
}
void RuleGroupPanel::mousePressEvent ( QMouseEvent * event )
{
if (event->buttons () == Qt::RightButton)
{
rsv->firstSelectedRule = row;
rsv->contextMenu (row,0,event->globalPos ());
}
}
void RuleGroupPanel::showHideRuleGroup()
{
rsv->showHideRuleGroup(this);

View File

@ -38,5 +38,6 @@ public:
RuleGroupPanel (QWidget * parent,RuleSetView * rsv, int row) ;
public slots:
void showHideRuleGroup();
public:
virtual void mousePressEvent ( QMouseEvent * event );
};

View File

@ -888,10 +888,12 @@ void RuleSetView::addRuleGroupPanel (int row)
grouppanel->ruleGroupName->setText(rri->groupName);
if (!hide)
{
grouppanel->showHideRuleGroupButton->setCheckState(Qt::Unchecked);
grouppanel->showHideRuleGroupButton->setText ("Collapse Group");
}
else
{
grouppanel->showHideRuleGroupButton->setCheckState(Qt::Checked);
grouppanel->showHideRuleGroupButton->setText ("Expand Group");
}
setIndexWidget (model()->index(row,1),grouppanel);
@ -2307,15 +2309,44 @@ void RuleSetView::newGroup()
int row = firstSelectedRule;
int count = lastSelectedRule - firstSelectedRule +1;
createGroup(row,count,text+postfix);
}
// SimpleTextEditor * ste = new SimpleTextEditor(this, "New Group", false, "New Group2");
// ste->setModal (true);
// ste->show();
// QString text = ste->text();
}
}
void RuleSetView::renameGroup()
{
bool ok = false ;
QString oldGroup = "";
if (rowsInfo[ firstSelectedRule ] != NULL)
{
oldGroup = rowsInfo[ firstSelectedRule ]->groupName;
}
QString text = QInputDialog::getText(this, "Rename group",
tr("Enter group name:"), QLineEdit::Normal,
oldGroup, &ok);
if (ok && !text.isEmpty())
{
if (oldGroup==""||text=="")
return ;
QString postfix = "";
int counter = 0 ;
for (int i =0 ; i < rowsInfo.size(); i++)
{
Rule * r = Rule::cast(ruleIndex[i]);
if (r!=NULL)
{
if (r->getRuleGroupName ().c_str() == oldGroup)
{
r->setRuleGroupName (text.toAscii().data());
}
}
}
updateGroups();
}
}
void RuleSetView::addToGroupAbove ()
{
int row = firstSelectedRule;
@ -2499,6 +2530,15 @@ void RuleSetView::contextMenu(int row, int col, const QPoint &pos)
}
popup->addSeparator ();
}
else
{
popup->addAction( tr("Rename group"), this, SLOT( renameGroup() ));
popup->exec( pos );
delete popup;
return ;
}

View File

@ -158,6 +158,7 @@ class RuleSetView : public QTableView
void contextMenuRequested ( const QPoint &p );
void newGroup();
void renameGroup();
void addToGroupAbove ();
void addToGroupBelow();
void removeFromGroup();

View File

@ -26,18 +26,11 @@
<number>2</number>
</property>
<property name="horizontalSpacing" >
<number>2</number>
<number>20</number>
</property>
<property name="verticalSpacing" >
<number>2</number>
</property>
<item row="0" column="0" >
<widget class="QPushButton" name="showHideRuleGroupButton" >
<property name="text" >
<string>PushButton</string>
</property>
</widget>
</item>
<item row="0" column="2" >
<widget class="QLabel" name="ruleGroupName" >
<property name="text" >
@ -58,6 +51,13 @@
</property>
</spacer>
</item>
<item row="0" column="0" >
<widget class="QCheckBox" name="showHideRuleGroupButton" >
<property name="text" >
<string/>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>