-rw-r--r-- | core/launcher/startmenu.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/core/launcher/startmenu.cpp b/core/launcher/startmenu.cpp index 88c6219..39e07c8 100644 --- a/core/launcher/startmenu.cpp +++ b/core/launcher/startmenu.cpp | |||
@@ -196,108 +196,109 @@ bool StartMenu::loadMenu( AppLnkSet *folder, QPopupMenu *menu ) | |||
196 | } | 196 | } |
197 | typpop.insert(*tit, new_menu); | 197 | typpop.insert(*tit, new_menu); |
198 | } | 198 | } |
199 | if ( tit == typs. begin ( )) | 199 | if ( tit == typs. begin ( )) |
200 | break; | 200 | break; |
201 | } | 201 | } |
202 | QListIterator<AppLnk> it( folder->children() ); | 202 | QListIterator<AppLnk> it( folder->children() ); |
203 | bool f=TRUE; | 203 | bool f=TRUE; |
204 | for ( ; it.current(); ++it ) { | 204 | for ( ; it.current(); ++it ) { |
205 | AppLnk *app = it.current(); | 205 | AppLnk *app = it.current(); |
206 | if ( app->type() == "Separator" ) { // No tr | 206 | if ( app->type() == "Separator" ) { // No tr |
207 | if ( lot ) { | 207 | if ( lot ) { |
208 | menu->insertSeparator(); | 208 | menu->insertSeparator(); |
209 | } | 209 | } |
210 | } else { | 210 | } else { |
211 | f = FALSE; | 211 | f = FALSE; |
212 | QString t = app->type(); | 212 | QString t = app->type(); |
213 | QPopupMenu* pmenu = typpop.find(t); | 213 | QPopupMenu* pmenu = typpop.find(t); |
214 | if ( ltabs ) { | 214 | if ( ltabs ) { |
215 | if ( !pmenu && lot ) | 215 | if ( !pmenu && lot ) |
216 | pmenu = menu; | 216 | pmenu = menu; |
217 | } else { | 217 | } else { |
218 | if ( !pmenu ) | 218 | if ( !pmenu ) |
219 | pmenu = menu; | 219 | pmenu = menu; |
220 | else | 220 | else |
221 | pmenu = 0; | 221 | pmenu = 0; |
222 | } | 222 | } |
223 | if ( pmenu ) { | 223 | if ( pmenu ) { |
224 | QString t = app->name(); | 224 | QString t = app->name(); |
225 | t.replace(QRegExp("&"),"&&"); // escape shortcut character | 225 | t.replace(QRegExp("&"),"&&"); // escape shortcut character |
226 | pmenu->insertItem( app->pixmap(), t, app->id() ); | 226 | pmenu->insertItem( app->pixmap(), t, app->id() ); |
227 | } | 227 | } |
228 | result=TRUE; | 228 | result=TRUE; |
229 | } | 229 | } |
230 | } | 230 | } |
231 | } | 231 | } |
232 | 232 | ||
233 | if ( sepId && ( menu-> idAt ( 0 ) == sepId )) { // no tabs entries | 233 | if ( sepId && ( menu-> idAt ( 0 ) == sepId )) { // no tabs entries |
234 | menu-> removeItem ( sepId ); | 234 | menu-> removeItem ( sepId ); |
235 | sepId = 0; | 235 | sepId = 0; |
236 | } | 236 | } |
237 | if ( !menu-> count ( )) // if we don't do this QPopupMenu will insert a dummy Separator, which won't go away later | 237 | if ( !menu-> count ( )) // if we don't do this QPopupMenu will insert a dummy Separator, which won't go away later |
238 | sepId = menu-> insertSeparator ( ); | 238 | sepId = menu-> insertSeparator ( ); |
239 | 239 | ||
240 | return result; | 240 | return result; |
241 | } | 241 | } |
242 | 242 | ||
243 | 243 | ||
244 | void StartMenu::launch() | 244 | void StartMenu::launch ( ) |
245 | { | 245 | { |
246 | int y = mapToGlobal( QPoint() ).y() - launchMenu->sizeHint().height(); | 246 | int y = mapToGlobal ( QPoint ( )). y ( ) - launchMenu-> sizeHint ( ). height ( ); |
247 | 247 | ||
248 | if ( launchMenu->isVisible() ) | 248 | if ( launchMenu-> isVisible ( )) { |
249 | launchMenu->hide(); | 249 | launchMenu-> hide ( ); |
250 | } | ||
250 | else { | 251 | else { |
251 | QWidget *active = qApp->activeWindow(); | 252 | QWidget *active = qApp-> activeWindow ( ); |
252 | if ( active && active->isPopup() ) | 253 | if ( active && active-> isPopup ( )) |
253 | active->close(); | 254 | active-> close ( ); |
254 | 255 | ||
255 | launchMenu->popup( QPoint( 1, y ) ); | 256 | launchMenu-> popup ( QPoint ( 1, y )); |
256 | } | 257 | } |
257 | } | 258 | } |
258 | 259 | ||
259 | const AppLnk* StartMenu::execToLink(const QString& appname) | 260 | const AppLnk* StartMenu::execToLink(const QString& appname) |
260 | { | 261 | { |
261 | const AppLnk* a = apps->findExec( appname ); | 262 | const AppLnk* a = apps->findExec( appname ); |
262 | return a; | 263 | return a; |
263 | } | 264 | } |
264 | 265 | ||
265 | void StartPopupMenu::keyPressEvent( QKeyEvent *e ) | 266 | void StartPopupMenu::keyPressEvent( QKeyEvent *e ) |
266 | { | 267 | { |
267 | if ( e->key() == Key_F33 || e->key() == Key_Space ) { | 268 | if ( e->key() == Key_F33 || e->key() == Key_Space ) { |
268 | // "OK" button, little hacky | 269 | // "OK" button, little hacky |
269 | QKeyEvent ke(QEvent::KeyPress, Key_Enter, 13, 0); | 270 | QKeyEvent ke(QEvent::KeyPress, Key_Enter, 13, 0); |
270 | QPopupMenu::keyPressEvent( &ke ); | 271 | QPopupMenu::keyPressEvent( &ke ); |
271 | } else { | 272 | } else { |
272 | QPopupMenu::keyPressEvent( e ); | 273 | QPopupMenu::keyPressEvent( e ); |
273 | } | 274 | } |
274 | } | 275 | } |
275 | 276 | ||
276 | static int compareAppletPositions(const void *a, const void *b) | 277 | static int compareAppletPositions(const void *a, const void *b) |
277 | { | 278 | { |
278 | const MenuApplet* aa = *(const MenuApplet**)a; | 279 | const MenuApplet* aa = *(const MenuApplet**)a; |
279 | const MenuApplet* ab = *(const MenuApplet**)b; | 280 | const MenuApplet* ab = *(const MenuApplet**)b; |
280 | int d = aa->iface->position() - ab->iface->position(); | 281 | int d = aa->iface->position() - ab->iface->position(); |
281 | if ( d ) return d; | 282 | if ( d ) return d; |
282 | return QString::compare(aa->library->library(),ab->library->library()); | 283 | return QString::compare(aa->library->library(),ab->library->library()); |
283 | } | 284 | } |
284 | 285 | ||
285 | void StartMenu::clearApplets() | 286 | void StartMenu::clearApplets() |
286 | { | 287 | { |
287 | launchMenu-> hide(); | 288 | launchMenu-> hide(); |
288 | 289 | ||
289 | for ( QIntDictIterator<MenuApplet> it ( applets ); it. current ( ); ++it ) { | 290 | for ( QIntDictIterator<MenuApplet> it ( applets ); it. current ( ); ++it ) { |
290 | MenuApplet *applet = it. current ( ); | 291 | MenuApplet *applet = it. current ( ); |
291 | if ( launchMenu ) { | 292 | if ( launchMenu ) { |
292 | launchMenu-> removeItem ( applet-> id ); | 293 | launchMenu-> removeItem ( applet-> id ); |
293 | delete applet-> popup; | 294 | delete applet-> popup; |
294 | } | 295 | } |
295 | 296 | ||
296 | applet-> iface-> release(); | 297 | applet-> iface-> release(); |
297 | applet-> library-> unload(); | 298 | applet-> library-> unload(); |
298 | delete applet-> library; | 299 | delete applet-> library; |
299 | } | 300 | } |
300 | applets.clear(); | 301 | applets.clear(); |
301 | } | 302 | } |
302 | 303 | ||
303 | 304 | ||