@@ -541,26 +541,26 @@ void ResultsTree::contextMenuEvent(QContextMenuEvent * e)
541541 QSignalMapper *signalMapper = new QSignalMapper (this );
542542
543543 if (mContextItem && mApplications ->GetApplicationCount () > 0 && mContextItem ->parent ()) {
544- // Go through all applications and add them to the context menu
545- for (int i = 0 ; i < mApplications ->GetApplicationCount (); i++) {
546- // Create an action for the application
547- const Application& app = mApplications ->GetApplication (i);
548- QAction *start = new QAction (app.getName (), &menu);
549- if (multipleSelection)
550- start->setDisabled (true );
544+ // Create an action for the application
545+ int defaultApplicationIndex = mApplications ->GetDefaultApplication ();
546+ if (defaultApplicationIndex < 0 )
547+ defaultApplicationIndex = 0 ;
548+ const Application& app = mApplications ->GetApplication (defaultApplicationIndex);
549+ QAction *start = new QAction (app.getName (), &menu);
550+ if (multipleSelection)
551+ start->setDisabled (true );
551552
552- // Add it to our list so we can disconnect later on
553- actions << start;
553+ // Add it to our list so we can disconnect later on
554+ actions << start;
554555
555- // Add it to context menu
556- menu.addAction (start);
556+ // Add it to context menu
557+ menu.addAction (start);
557558
558- // Connect the signal to signal mapper
559- connect (start, SIGNAL (triggered ()), signalMapper, SLOT (map ()));
559+ // Connect the signal to signal mapper
560+ connect (start, SIGNAL (triggered ()), signalMapper, SLOT (map ()));
560561
561- // Add a new mapping
562- signalMapper->setMapping (start, i);
563- }
562+ // Add a new mapping
563+ signalMapper->setMapping (start, defaultApplicationIndex);
564564
565565 connect (signalMapper, SIGNAL (mapped (int )),
566566 this , SLOT (Context (int )));
0 commit comments