Skip to content

Commit

Permalink
ignore '&' when ordering the plugin menu
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk@13393 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Apr 26, 2010
1 parent ac96dcc commit 2cf2df9
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/app/qgisapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5261,7 +5261,6 @@ QMenu* QgisApp::getPluginMenu( QString menuName )

#ifdef Q_WS_MAC
// Mac doesn't have '&' keyboard shortcuts.
// Other platforms ignore the prefix char when comparing strings.
menuName.remove( QChar( '&' ) );
#endif
QAction *before = mActionPluginSeparator2; // python separator or end of list
Expand All @@ -5272,12 +5271,18 @@ QMenu* QgisApp::getPluginMenu( QString menuName )
}
else
{
QString dst = menuName;
dst.remove( QChar( '&' ) );

// Plugins exist - search between plugin separator and python separator or end of list
QList<QAction*> actions = mPluginMenu->actions();
int end = mActionPluginSeparator2 ? actions.indexOf( mActionPluginSeparator2 ) : actions.count();
for ( int i = actions.indexOf( mActionPluginSeparator1 ) + 1; i < end; i++ )
{
int comp = menuName.localeAwareCompare( actions.at( i )->text() );
QString src = actions.at( i )->text();
src.remove( QChar( '&' ) );

int comp = dst.localeAwareCompare( src );
if ( comp < 0 )
{
// Add item before this one
Expand All @@ -5292,7 +5297,7 @@ QMenu* QgisApp::getPluginMenu( QString menuName )
}
}
// It doesn't exist, so create
QMenu* menu = new QMenu( menuName, this );
QMenu *menu = new QMenu( menuName, this );
// Where to put it? - we worked that out above...
mPluginMenu->insertMenu( before, menu );

Expand Down

0 comments on commit 2cf2df9

Please sign in to comment.