summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/startmenu.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/core/launcher/startmenu.cpp b/core/launcher/startmenu.cpp
index 2871233..28c8b97 100644
--- a/core/launcher/startmenu.cpp
+++ b/core/launcher/startmenu.cpp
@@ -194,65 +194,73 @@ bool StartMenu::loadMenu( AppLnkSet *folder, QPopupMenu *menu )
} else {
new_menu = (QPopupMenu*)1;
}
typpop.insert(*tit, new_menu);
}
if ( tit == typs. begin ( ))
break;
}
QListIterator<AppLnk> it( folder->children() );
bool f=TRUE;
for ( ; it.current(); ++it ) {
AppLnk *app = it.current();
if ( app->type() == "Separator" ) { // No tr
if ( lot ) {
menu->insertSeparator();
}
} else {
f = FALSE;
QString t = app->type();
QPopupMenu* pmenu = typpop.find(t);
if ( ltabs ) {
if ( !pmenu && lot )
pmenu = menu;
} else {
if ( !pmenu )
pmenu = menu;
else
pmenu = 0;
}
if ( pmenu ) {
QString t = app->name();
t.replace(QRegExp("&"),"&&"); // escape shortcut character
- pmenu->insertItem( app->pixmap(), t, app->id() );
+
+ int index = -1;
+
+ for ( index = 0; index < pmenu-> count ( ); index++ ) {
+ if ( pmenu-> text ( pmenu-> idAt ( index )). compare ( t ) > 0 )
+ break;
+ }
+
+ pmenu->insertItem( app->pixmap(), t, app->id(), index );
}
result=TRUE;
}
}
}
if ( sepId && ( menu-> idAt ( 0 ) == sepId )) { // no tabs entries
menu-> removeItem ( sepId );
sepId = 0;
}
if ( !menu-> count ( )) // if we don't do this QPopupMenu will insert a dummy Separator, which won't go away later
sepId = menu-> insertSeparator ( );
return result;
}
void StartMenu::launch ( )
{
int y = mapToGlobal ( QPoint ( )). y ( ) - launchMenu-> sizeHint ( ). height ( );
if ( launchMenu-> isVisible ( )) {
launchMenu-> hide ( );
}
else {
QWidget *active = qApp-> activeWindow ( );
if ( active && active-> isPopup ( ))
active-> close ( );
launchMenu-> popup ( QPoint ( 1, y ));
}
}