From 23b9a17bbcf8a9a1a33678aa49354bba53c3f417 Mon Sep 17 00:00:00 2001 From: stv Date: Fri, 20 Apr 2007 09:01:01 +0000 Subject: [PATCH] *** empty log message *** --- src/Qtx/QtxWorkstack.cxx | 26 ++++++++++++++++++++++---- src/Qtx/QtxWorkstack.h | 3 +++ 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/src/Qtx/QtxWorkstack.cxx b/src/Qtx/QtxWorkstack.cxx index e1e7cbd18..e98cd5123 100644 --- a/src/Qtx/QtxWorkstack.cxx +++ b/src/Qtx/QtxWorkstack.cxx @@ -458,6 +458,20 @@ int QtxWorkstack::accel( const int id ) const return res; } +bool QtxWorkstack::isActionEnabled( const int id ) const +{ + bool res = false; + if ( myActionsMap.contains( id ) ) + res = myActionsMap[id]->isEnabled(); + return res; +} + +void QtxWorkstack::setActionEnabled( const int id, const bool on ) +{ + if ( myActionsMap.contains( id ) ) + myActionsMap[id]->setEnabled( on ); +} + static int positionSimple (QIntList& szList, const int nb, const int splitter_size, const int item_ind, const int item_rel_pos, const int need_pos, const int splitter_pos) @@ -932,15 +946,19 @@ void QtxWorkstack::onContextMenuRequested( QWidget* w, QPoint p ) if ( lst.count() > 1 ) { - pm->addAction( myActionsMap[SplitVertical] ); - pm->addAction( myActionsMap[SplitHorizontal] ); + if ( myActionsMap[SplitVertical]->isEnabled() ) + pm->addAction( myActionsMap[SplitVertical] ); + if ( myActionsMap[SplitHorizontal]->isEnabled() ) + pm->addAction( myActionsMap[SplitHorizontal] ); pm->addSeparator(); } if ( w ) { - pm->addAction( myActionsMap[Close] ); - pm->addAction( myActionsMap[Rename] ); + if ( myActionsMap[Close]->isEnabled() ) + pm->addAction( myActionsMap[Close] ); + if ( myActionsMap[Rename]->isEnabled() ) + pm->addAction( myActionsMap[Rename] ); } Qtx::simplifySeparators( pm ); diff --git a/src/Qtx/QtxWorkstack.h b/src/Qtx/QtxWorkstack.h index 7ad6221ea..767127530 100644 --- a/src/Qtx/QtxWorkstack.h +++ b/src/Qtx/QtxWorkstack.h @@ -72,6 +72,9 @@ public: int accel( const int ) const; void setAccel( const int, const int ); + bool isActionEnabled( const int ) const; + void setActionEnabled( const int, const bool ); + void split( const int ); QWidget* addWindow( QWidget*, Qt::WindowFlags = 0 ); -- 2.39.2