Skip to content

Commit

Permalink
Merge branch 'fix-menu-ordering-2' of https://github.com/dakcarto/Qua…
Browse files Browse the repository at this point in the history
…ntum-GIS into 5753
  • Loading branch information
timlinux committed Jun 21, 2012
2 parents 02b1324 + de6f642 commit 1d8ed46
Showing 1 changed file with 37 additions and 10 deletions.
47 changes: 37 additions & 10 deletions src/app/qgisapp.cpp
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

0 comments on commit 1d8ed46

Please sign in to comment.