mirror of
https://github.com/fwbuilder/fwbuilder
synced 2026-09-13 16:39:48 +02:00
fixed #1778 "main menu Rules should have the same items that
context RuleSetView menu when no rules are selected"
This commit is contained in:
@@ -1,3 +1,9 @@
|
||||
2010-10-05 Vadim Kurland <vadim@vk.crocodile.org>
|
||||
|
||||
* FWWindow.cpp (prepareRulesMenu): fixed #1778 "main menu Rules
|
||||
should have the same items that context RuleSetView menu when no
|
||||
rules are selected"
|
||||
|
||||
2010-10-04 Vadim Kurland <vadim@vk.crocodile.org>
|
||||
|
||||
* ObjectManipulator.cpp (showObjectInTree): fixed #1777 "scroll
|
||||
|
||||
+11
-2
@@ -1594,6 +1594,8 @@ void FWWindow::setupGlobalToolbar()
|
||||
*/
|
||||
void FWWindow::prepareRulesMenu()
|
||||
{
|
||||
if (fwbdebug) qDebug() << "FWWindow::prepareRulesMenu()";
|
||||
|
||||
cleanRulesMenu();
|
||||
|
||||
ProjectPanel* pp = activeProject();
|
||||
@@ -1601,9 +1603,14 @@ void FWWindow::prepareRulesMenu()
|
||||
{
|
||||
RuleSetView* rsv = activeProject()->getCurrentRuleSetView();
|
||||
|
||||
if (fwbdebug) qDebug() << "FWWindow::prepareRulesMenu() rsv=" << rsv;
|
||||
|
||||
if(rsv)
|
||||
{
|
||||
rsv->addRowMenuItemsToMenu(m_mainWindow->RulesMenu);
|
||||
if (rsv->selectedRulesCount() == 0)
|
||||
rsv->addGenericMenuItemsToContextMenu(m_mainWindow->RulesMenu);
|
||||
else
|
||||
rsv->addRowMenuItemsToMenu(m_mainWindow->RulesMenu);
|
||||
}
|
||||
m_mainWindow->RulesMenu->addSeparator();
|
||||
m_mainWindow->RulesMenu->addActions(ruleStaticActions);
|
||||
@@ -1614,8 +1621,10 @@ void FWWindow::prepareRulesMenu()
|
||||
}
|
||||
}
|
||||
|
||||
void FWWindow::cleanRulesMenu ()
|
||||
void FWWindow::cleanRulesMenu()
|
||||
{
|
||||
if (fwbdebug) qDebug() << "FWWindow::cleanRulesMenu()";
|
||||
|
||||
m_mainWindow->RulesMenu->actions().clear();
|
||||
m_mainWindow->RulesMenu->clear();
|
||||
}
|
||||
|
||||
@@ -746,8 +746,10 @@ void RuleSetView::addGenericMenuItemsToContextMenu(QMenu *menu) const
|
||||
menu->addAction(tr("Insert Rule"), this, SLOT( insertRule() ));
|
||||
else
|
||||
{
|
||||
menu->addAction(tr("Add new rule on top"), this, SLOT( insertNewRuleOnTop()));
|
||||
menu->addAction(tr("Add new rule at the bottom"), this, SLOT( insertNewRuleAtBottom()));
|
||||
menu->addAction(tr("Add new rule on top"), this,
|
||||
SLOT( insertNewRuleOnTop()));
|
||||
menu->addAction(tr("Add new rule at the bottom"), this,
|
||||
SLOT( insertNewRuleAtBottom()));
|
||||
}
|
||||
menu->addSeparator();
|
||||
menu->addAction(tr("Paste Rule"), this, SLOT( pasteRuleBelow()));
|
||||
@@ -772,11 +774,11 @@ void RuleSetView::addChangeColorSubmenu(QMenu *menu) const
|
||||
subcolor->addAction(setColorBlueAction);
|
||||
subcolor->addAction(setColorPurpleAction);
|
||||
subcolor->addAction(setColorGrayAction);
|
||||
|
||||
}
|
||||
|
||||
void RuleSetView::addRowMenuItemsToMenu(QMenu *menu) const
|
||||
{
|
||||
if (fwbdebug) qDebug() << "RuleSetView::addRowMenuItemsToMenu menu=" << menu;
|
||||
|
||||
menu->addAction(removeFromGroupAction);
|
||||
menu->addAction(newGroupAction);
|
||||
@@ -809,7 +811,6 @@ void RuleSetView::addRowMenuItemsToMenu(QMenu *menu) const
|
||||
|
||||
menu->addAction(enableRuleAction);
|
||||
menu->addAction(disableRuleAction);
|
||||
|
||||
}
|
||||
|
||||
void RuleSetView::itemDoubleClicked(const QModelIndex& index)
|
||||
|
||||
+11
-5
@@ -121,7 +121,10 @@ public:
|
||||
void addToGroup(bool isAbove);
|
||||
|
||||
void addRowMenuItemsToMenu(QMenu *menu) const;
|
||||
void addGenericMenuItemsToContextMenu(QMenu *menu) const;
|
||||
|
||||
int selectedRulesCount() { return getSelectedRows().size(); }
|
||||
|
||||
public slots:
|
||||
|
||||
void showContextMenu(const QPoint&);
|
||||
@@ -200,7 +203,8 @@ public slots:
|
||||
void compileCurrentRule();
|
||||
void updateSelectionSensitiveActions();
|
||||
|
||||
void setSelectedRows(const QModelIndex firstIndex, const QModelIndex lastIndex);
|
||||
void setSelectedRows(const QModelIndex firstIndex,
|
||||
const QModelIndex lastIndex);
|
||||
|
||||
protected:
|
||||
|
||||
@@ -220,15 +224,18 @@ protected:
|
||||
virtual void keyPressEvent( QKeyEvent* ev );
|
||||
|
||||
bool validateForInsertion(QModelIndex index, libfwbuilder::FWObject *obj);
|
||||
void deleteObject(QModelIndex index, libfwbuilder::FWObject *obj, QString text, QUndoCommand* makro = 0);
|
||||
bool insertObject(QModelIndex index, libfwbuilder::FWObject *obj, QString text, QUndoCommand* makro = 0);
|
||||
void deleteObject(QModelIndex index, libfwbuilder::FWObject *obj,
|
||||
QString text, QUndoCommand* makro = 0);
|
||||
bool insertObject(QModelIndex index, libfwbuilder::FWObject *obj,
|
||||
QString text, QUndoCommand* makro = 0);
|
||||
|
||||
bool validateForInsertion(libfwbuilder::RuleElement *re,
|
||||
libfwbuilder::FWObject *obj, bool quiet=false);
|
||||
bool validateForInsertionToInterfaceRE(libfwbuilder::RuleElementItf *re,
|
||||
libfwbuilder::FWObject *obj);
|
||||
|
||||
QAction* createAction(QString label, const char* member, const QKeySequence &shortcut = 0);
|
||||
QAction* createAction(QString label, const char* member,
|
||||
const QKeySequence &shortcut = 0);
|
||||
|
||||
|
||||
private:
|
||||
@@ -272,7 +279,6 @@ private:
|
||||
void selectObject(libfwbuilder::FWObject *object, const QModelIndex &index);
|
||||
ProjectPanel* project;
|
||||
|
||||
void addGenericMenuItemsToContextMenu(QMenu *menu) const;
|
||||
void addGroupMenuItemsToContextMenu(QMenu *menu) const;
|
||||
|
||||
void addChangeColorSubmenu(QMenu *menu) const;
|
||||
|
||||
@@ -372,6 +372,12 @@
|
||||
</p>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<p>
|
||||
fixed #1778 "main menu Rules should have the same items that
|
||||
context RuleSetView menu when no rules are selected"
|
||||
</p>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user