Showing with 37 additions and 10 deletions.
  1. +37 −10 src/app/qgisapp.cpp
47 changes: 37 additions & 10 deletions src/app/qgisapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5953,22 +5953,31 @@ void QgisApp::addPluginToDatabaseMenu( QString name, QAction* action )
{
if ( actions.at( i )->menu() == mDatabaseMenu )
return;

// goes before Web menu, if present
if ( actions.at( i )->menu() == mWebMenu )
{
before = actions.at( i );
break;
}
else if ( actions.at( i )->menu() == firstRightStandardMenu() )
}
for ( int i = 0; i < actions.count(); i++ )
{
// defaults to after Raster menu, which is already in qgisapp.ui
if ( actions.at( i )->menu() == mRasterMenu )
{
before = actions.at( i );
break;
if ( !before )
{
before = actions.at( i += 1 );
break;
}
}
}

if ( before )
menuBar()->insertMenu( before, mDatabaseMenu );
else
menuBar()->addMenu( mDatabaseMenu );
// fallback insert
menuBar()->insertMenu( firstRightStandardMenu()->menuAction(), mDatabaseMenu );
}

void QgisApp::addPluginToRasterMenu( QString name, QAction* action )
Expand All @@ -5992,6 +6001,8 @@ void QgisApp::addPluginToVectorMenu( QString name, QAction* action )
{
if ( actions.at( i )->menu() == mVectorMenu )
return;

// goes before Raster menu, which is already in qgisapp.ui
if ( actions.at( i )->menu() == mRasterMenu )
{
before = actions.at( i );
Expand All @@ -6002,7 +6013,8 @@ void QgisApp::addPluginToVectorMenu( QString name, QAction* action )
if ( before )
menuBar()->insertMenu( before, mVectorMenu );
else
menuBar()->addMenu( mVectorMenu );
// fallback insert
menuBar()->insertMenu( firstRightStandardMenu()->menuAction(), mVectorMenu );
}

void QgisApp::addPluginToWebMenu( QString name, QAction* action )
Expand All @@ -6018,19 +6030,34 @@ void QgisApp::addPluginToWebMenu( QString name, QAction* action )
QList<QAction*> actions = menuBar()->actions();
for ( int i = 0; i < actions.count(); i++ )
{
// goes after Database menu, if present
if ( actions.at( i )->menu() == mDatabaseMenu )
{
before = actions.at( i += 1 );
// don't break here
}

if ( actions.at( i )->menu() == mWebMenu )
return;
if ( actions.at( i )->menu() == firstRightStandardMenu() )
}
for ( int i = 0; i < actions.count(); i++ )
{
// defaults to after Raster menu, which is already in qgisapp.ui
if ( actions.at( i )->menu() == mRasterMenu )
{
before = actions.at( i );
break;
if ( !before )
{
before = actions.at( i += 1 );
break;
}
}
}

if ( before )
menuBar()->insertMenu( before, mWebMenu );
else
menuBar()->addMenu( mWebMenu );
// fallback insert
menuBar()->insertMenu( firstRightStandardMenu()->menuAction(), mWebMenu );
}

void QgisApp::removePluginDatabaseMenu( QString name, QAction* action )
Expand Down