mirror of
https://github.com/fwbuilder/fwbuilder
synced 2026-03-24 12:17:26 +01:00
fixes #473
This commit is contained in:
parent
0e34300584
commit
47a447aab4
@ -579,7 +579,9 @@ void RuleSetView::addChangeColorSubmenu(QMenu *menu) const
|
||||
void RuleSetView::addRowMenuItemsToContextMenu(QMenu *menu, RuleNode* node) const
|
||||
{
|
||||
QString label;
|
||||
int selectionSize = getSelectedRows().size();
|
||||
RuleSetModel* md = ((RuleSetModel*)model());
|
||||
QModelIndexList selectedIndexes = getSelectedRows();
|
||||
int selectionSize = selectedIndexes.size();
|
||||
|
||||
if (node->isInGroup())
|
||||
{
|
||||
@ -587,21 +589,22 @@ void RuleSetView::addRowMenuItemsToContextMenu(QMenu *menu, RuleNode* node) cons
|
||||
if (node->isOutermost())
|
||||
menu->addAction( tr("Remove from the group"), this, SLOT( removeFromGroup() ));
|
||||
}
|
||||
else
|
||||
else if (isOnlyTopLevelRules(selectedIndexes))
|
||||
{
|
||||
menu->addAction( tr("New group"), this, SLOT( newGroup() ));
|
||||
|
||||
QString nn = node->nameOfPredecessorGroup();
|
||||
|
||||
if (!nn.isNull() && !nn.isEmpty())
|
||||
QString nn = md->nodeFromIndex(selectedIndexes.first())->nameOfPredecessorGroup();
|
||||
|
||||
if (!nn.isEmpty())
|
||||
{
|
||||
label = tr("Add to the group ") + nn;
|
||||
menu->addAction( label, this, SLOT( addToGroupAbove() ));
|
||||
}
|
||||
|
||||
nn = node->nameOfSuccessorGroup();
|
||||
nn = md->nodeFromIndex(selectedIndexes.last())->nameOfSuccessorGroup();
|
||||
|
||||
if (!nn.isNull() && !nn.isEmpty())
|
||||
if (!nn.isEmpty())
|
||||
{
|
||||
label = tr("Add to the group ") + nn;
|
||||
menu->addAction( label, this, SLOT( addToGroupBelow() ));
|
||||
@ -1130,7 +1133,7 @@ void RuleSetView::moveRuleDown()
|
||||
}
|
||||
}
|
||||
|
||||
bool RuleSetView::isOnlyTopLevelRules(const QModelIndexList &list)
|
||||
bool RuleSetView::isOnlyTopLevelRules(const QModelIndexList &list) const
|
||||
{
|
||||
foreach (QModelIndex index, list)
|
||||
{
|
||||
|
||||
@ -198,7 +198,7 @@ private:
|
||||
void setEnabledRow(bool flag);
|
||||
|
||||
QModelIndexList getSelectedRows() const;
|
||||
bool isOnlyTopLevelRules(const QModelIndexList &list);
|
||||
bool isOnlyTopLevelRules(const QModelIndexList &list) const;
|
||||
bool isOneLevelRules(const QModelIndexList &list);
|
||||
|
||||
void editSelected(const QModelIndex &index);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user