-rw-r--r-- | core/launcher/startmenu.cpp | 13 |
1 files changed, 12 insertions, 1 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 ) | |||
64 | pm.convertFromImage(Resource::loadImage( startButtonPixmap).smoothScale( sz,sz) ); | 64 | pm.convertFromImage(Resource::loadImage( startButtonPixmap).smoothScale( sz,sz) ); |
65 | setPixmap(pm); | 65 | setPixmap(pm); |
66 | setFocusPolicy( NoFocus ); | 66 | setFocusPolicy( NoFocus ); |
67 | 67 | ||
68 | useWidePopupMenu = true; | 68 | useWidePopupMenu = true; |
69 | launchMenu = 0; | 69 | launchMenu = 0; |
70 | currentItem = 0; | ||
70 | refreshMenu(); | 71 | refreshMenu(); |
71 | } | 72 | } |
72 | 73 | ||
73 | 74 | ||
74 | void StartMenu::mousePressEvent( QMouseEvent * ) | 75 | void StartMenu::mousePressEvent( QMouseEvent * ) |
75 | { | 76 | { |
@@ -148,14 +149,24 @@ void StartMenu::createAppEntry( QPopupMenu *menu, QDir dir, QString file ) | |||
148 | QImage img = Resource::loadImage( applnk->icon() ); | 149 | QImage img = Resource::loadImage( applnk->icon() ); |
149 | if(!img.isNull() ) | 150 | if(!img.isNull() ) |
150 | test.convertFromImage( | 151 | test.convertFromImage( |
151 | img.smoothScale( | 152 | img.smoothScale( |
152 | AppLnk::smallIconSize(), AppLnk::smallIconSize() ), 0 ); | 153 | AppLnk::smallIconSize(), AppLnk::smallIconSize() ), 0 ); |
153 | 154 | ||
155 | // Insert items ordered lexically | ||
156 | int current, left = 0, right = currentItem; | ||
157 | while( left != right ) { | ||
158 | current = ( left + right ) / 2; | ||
159 | if ( menu->text(menu->idAt( ( current ) ) ) < applnk->name() ) | ||
160 | left = ++current; | ||
161 | else | ||
162 | right = current; | ||
163 | } | ||
164 | |||
154 | menu->insertItem( test, applnk->name(), | 165 | menu->insertItem( test, applnk->name(), |
155 | currentItem + APPLNK_ID_OFFSET ); | 166 | currentItem + APPLNK_ID_OFFSET, current ); |
156 | appLnks.insert( currentItem + APPLNK_ID_OFFSET, applnk ); | 167 | appLnks.insert( currentItem + APPLNK_ID_OFFSET, applnk ); |
157 | currentItem++; | 168 | currentItem++; |
158 | } | 169 | } |
159 | } | 170 | } |
160 | 171 | ||
161 | } | 172 | } |