restore removing the entries which are not enabled currently
Change-Id: If24474e362aa80a3a0240a6ab899aa9e71066aef Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100389 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
This commit is contained in:
parent
dd0ee0ccf7
commit
6ad2f46378
2 changed files with 20 additions and 8 deletions
|
@ -51,10 +51,11 @@ using namespace ::com::sun::star::beans;
|
|||
using ::com::sun::star::util::URL;
|
||||
using ::com::sun::star::sdb::application::NamedDatabaseObject;
|
||||
|
||||
TaskEntry::TaskEntry( const char* _pAsciiUNOCommand, const char* _pHelpID, const char* pTitleResourceID )
|
||||
TaskEntry::TaskEntry( const char* _pAsciiUNOCommand, const char* _pHelpID, const char* pTitleResourceID, bool _bHideWhenDisabled )
|
||||
:sUNOCommand( OUString::createFromAscii( _pAsciiUNOCommand ) )
|
||||
,pHelpID( _pHelpID )
|
||||
,sTitle( DBA_RES(pTitleResourceID) )
|
||||
,bHideWhenDisabled( _bHideWhenDisabled )
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -341,9 +342,7 @@ void OApplicationDetailView::impl_createPage( ElementType _eType, const Referenc
|
|||
Resize();
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
void impl_fillTaskPaneData(ElementType _eType, TaskPaneData& _rData)
|
||||
void OApplicationDetailView::impl_fillTaskPaneData(ElementType _eType, TaskPaneData& _rData) const
|
||||
{
|
||||
TaskEntryList& rList( _rData.aTasks );
|
||||
rList.clear(); rList.reserve( 4 );
|
||||
|
@ -353,7 +352,7 @@ void impl_fillTaskPaneData(ElementType _eType, TaskPaneData& _rData)
|
|||
case E_TABLE:
|
||||
rList.emplace_back( ".uno:DBNewTable", RID_STR_TABLES_HELP_TEXT_DESIGN, RID_STR_NEW_TABLE );
|
||||
rList.emplace_back( ".uno:DBNewTableAutoPilot", RID_STR_TABLES_HELP_TEXT_WIZARD, RID_STR_NEW_TABLE_AUTO );
|
||||
rList.emplace_back( ".uno:DBNewView", RID_STR_VIEWS_HELP_TEXT_DESIGN, RID_STR_NEW_VIEW );
|
||||
rList.emplace_back( ".uno:DBNewView", RID_STR_VIEWS_HELP_TEXT_DESIGN, RID_STR_NEW_VIEW, true );
|
||||
_rData.pTitleId = RID_STR_TABLES_CONTAINER;
|
||||
break;
|
||||
|
||||
|
@ -364,7 +363,7 @@ void impl_fillTaskPaneData(ElementType _eType, TaskPaneData& _rData)
|
|||
break;
|
||||
|
||||
case E_REPORT:
|
||||
rList.emplace_back( ".uno:DBNewReport", RID_STR_REPORT_HELP_TEXT, RID_STR_NEW_REPORT );
|
||||
rList.emplace_back( ".uno:DBNewReport", RID_STR_REPORT_HELP_TEXT, RID_STR_NEW_REPORT, true );
|
||||
rList.emplace_back( ".uno:DBNewReportAutoPilot", RID_STR_REPORTS_HELP_TEXT_WIZARD, RID_STR_NEW_REPORT_AUTO );
|
||||
_rData.pTitleId = RID_STR_REPORTS_CONTAINER;
|
||||
break;
|
||||
|
@ -379,8 +378,19 @@ void impl_fillTaskPaneData(ElementType _eType, TaskPaneData& _rData)
|
|||
default:
|
||||
OSL_FAIL( "OApplicationDetailView::impl_fillTaskPaneData: illegal element type!" );
|
||||
}
|
||||
}
|
||||
|
||||
// remove the entries which are not enabled currently
|
||||
for (TaskEntryList::iterator pTask = rList.begin(); pTask != rList.end();)
|
||||
{
|
||||
if ( pTask->bHideWhenDisabled
|
||||
&& !getBorderWin().getView()->getCommandController().isCommandEnabled( pTask->sUNOCommand )
|
||||
)
|
||||
pTask = rList.erase( pTask );
|
||||
else
|
||||
{
|
||||
++pTask;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const TaskPaneData& OApplicationDetailView::impl_getTaskPaneData( ElementType _eType )
|
||||
|
|
|
@ -47,11 +47,12 @@ namespace dbaui
|
|||
OUString sUNOCommand;
|
||||
const char* pHelpID;
|
||||
OUString sTitle;
|
||||
bool bHideWhenDisabled;
|
||||
// TODO: we should be consistent in the task pane and the menus/toolbars:
|
||||
// If an entry is disabled in the latter, it should also be disabled in the former.
|
||||
// If an entry is *hidden* in the former, it should also be hidden in the latter.
|
||||
|
||||
TaskEntry( const char* _pAsciiUNOCommand, const char* pHelpID, const char* pTitleResourceID );
|
||||
TaskEntry( const char* _pAsciiUNOCommand, const char* pHelpID, const char* pTitleResourceID, bool _bHideWhenDisabled = false );
|
||||
};
|
||||
typedef std::vector< TaskEntry > TaskEntryList;
|
||||
|
||||
|
@ -313,6 +314,7 @@ namespace dbaui
|
|||
);
|
||||
|
||||
const TaskPaneData& impl_getTaskPaneData( ElementType _eType );
|
||||
void impl_fillTaskPaneData( ElementType _eType, TaskPaneData& _rData ) const;
|
||||
};
|
||||
}
|
||||
#endif // INCLUDED_DBACCESS_SOURCE_UI_APP_APPDETAILVIEW_HXX
|
||||
|
|
Loading…
Reference in a new issue