summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/startmenu.cpp19
1 files changed, 15 insertions, 4 deletions
diff --git a/core/launcher/startmenu.cpp b/core/launcher/startmenu.cpp
index 66f665f..ce7840e 100644
--- a/core/launcher/startmenu.cpp
+++ b/core/launcher/startmenu.cpp
@@ -64,12 +64,13 @@ StartMenu::StartMenu(QWidget *parent) : QLabel( parent )
pm.convertFromImage(Resource::loadImage( startButtonPixmap).smoothScale( sz,sz) );
setPixmap(pm);
setFocusPolicy( NoFocus );
useWidePopupMenu = true;
launchMenu = 0;
+ currentItem = 0;
refreshMenu();
}
void StartMenu::mousePressEvent( QMouseEvent * )
{
@@ -147,17 +148,27 @@ void StartMenu::createAppEntry( QPopupMenu *menu, QDir dir, QString file )
QPixmap test;
QImage img = Resource::loadImage( applnk->icon() );
if(!img.isNull() )
test.convertFromImage(
img.smoothScale(
AppLnk::smallIconSize(), AppLnk::smallIconSize() ), 0 );
-
+
+ // Insert items ordered lexically
+ int current, left = 0, right = currentItem;
+ while( left != right ) {
+ current = ( left + right ) / 2;
+ if ( menu->text(menu->idAt( ( current ) ) ) < applnk->name() )
+ left = ++current;
+ else
+ right = current;
+ }
+
menu->insertItem( test, applnk->name(),
- currentItem + APPLNK_ID_OFFSET );
- appLnks.insert( currentItem + APPLNK_ID_OFFSET, applnk );
- currentItem++;
+ currentItem + APPLNK_ID_OFFSET, current );
+ appLnks.insert( currentItem + APPLNK_ID_OFFSET, applnk );
+ currentItem++;
}
}
}
void StartMenu::createDirEntry( QPopupMenu *menu, QDir dir, QString file, bool lot )