Bug 154970

Summary: Launcher Menu starts application twice
Product: [Unmaintained] plasma4 Reporter: Unknown <null>
Component: generalAssignee: Plasma Bugs List <plasma-bugs>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Unknown 2008-01-02 14:04:19 UTC
Version:           revision 755889 (using KDE Devel)
Installed from:    Compiled sources
Compiler:          gcc (GCC) 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2) 
OS:                Linux

When I use the "application launcher menu" (the one that looks like KDE3 KMenu) to open my "Personal Folder", it starts dolphin twice. For many other apps (like systemsettings), there appear two taskbar entries, but one closes after the app completely loaded (perhaps this is related to https://bugs.kde.org/show_bug.cgi?id=153806 - however there it says it's fixed). However, for the personal folder there are really two dolphin windows popping up.
Comment 1 Jason Stubbs 2008-01-02 16:12:51 UTC
Confirmed with "Personal Folder" but I can't reproduce it anywhere else.
Comment 2 Jason Stubbs 2008-01-02 17:48:32 UTC
Also confirmed with "Find Files/Folders" and "Help", both of which are in the top-level menu. Tracing it out, it appears to be an issue with KToolInvocation::startServiceByDesktopPath(). It is only called once with the desktop file that the menu iterm corresponds to but the application is started twice.
Comment 3 Sebastian Sauer 2008-01-03 00:29:44 UTC
I assume the bug is somewhere located at MenuLauncherApplet::actionTriggered() and the way the activation is redirected to the model. Unfortunately I have no clue how to put items into the top-level and here there are no "Personal Items", "System Settings", "Help" or "Find Files" displayed at all. Not at the top-level nor somewhere else.

But if I remove in the $INSTALLDIR/share/applications/kde4/systemsettings.desktop the line
Categories=Qt;KDE;Settings;
it's at least displayed at the "Others" category but still not at the top-level.

Probably does anybody have a hint here how to manipulate a desktop-file to have it in the top-level? Would make testing it much easier :)

p.s. digging through techbase doesn't helped either to understand how that works.
Comment 4 Gabriel C 2008-01-03 00:49:08 UTC
Is simply :)

Replace the Categories=.*  in that desktop file with :

Categories=Qt;KDE;Core;

Comment 5 Sebastian Sauer 2008-01-03 05:03:31 UTC
Thanks Gabriel :)

Seems something on my setup doesn't like that at all. Every desktop-file which has the core-category isn't displayed within any of the launchers. Even hard-coding an item doesn't seem to work for me :-/

Anyway, to provide some more input in the hope somebody got it fixed before I was able to find a way to reproduce it;

Within the file http://websvn.kde.org/trunk/KDE/kdebase/workspace/plasma/applets/kickoff/simpleapplet/simpleapplet.cpp?view=markup the method
MenuLauncherApplet::actionTriggered(QAction *action)
does handle the "menuitem got executed" event. For that it just tries to redirect the call to the proper view (the kmenu may display multiple MenuView instances where we use e.g. one view for the ApplicationModel and another view for the FavoritesModel - all of them got them merged together into the single KMenu Launcher). The MenuView itself is located at http://websvn.kde.org/trunk/KDE/kdebase/workspace/plasma/applets/kickoff/simpleapplet/menuview.cpp?view=markup and there we call the MenuView::actionTriggered method.
Now I can imagine that the problem is, that within the constructor of that class we do connect(this,SIGNAL(triggered(QAction*)),this,SLOT(actionTriggered(QAction*)));

Without testing all that, I could imagine that following patch fixes the problem. But I don't know if it really does nor am I able to check if it introduces any sideeffects :-/

Index: simpleapplet/menuview.cpp
===================================================================
--- simpleapplet/menuview.cpp   (revision 755671)
+++ simpleapplet/menuview.cpp   (working copy)
@@ -75,7 +75,7 @@
     : KMenu(parent)
     , d(new Private(this))
 {
-    connect(this,SIGNAL(triggered(QAction*)),this,SLOT(actionTriggered(QAction*)));
+    //connect(this,SIGNAL(triggered(QAction*)),this,SLOT(actionTriggered(QAction*)));
 }
 MenuView::~MenuView()
 {

More next days once I got my local prob sorted out.
Comment 6 Unknown 2008-01-03 10:16:16 UTC
I just tested your patch, Sebastian, and it fixed the problems for me (both Dolphin starting twice and the other applications appearing twice). So far I didn't notice that anything else was broken, but I did only a very brief testing.
Comment 7 Jason Stubbs 2008-01-03 10:52:21 UTC
Yep, works here too.

I don't understand why my debugging showed that KToolInvocation was only being called once, why commenting it out caused no instances to be executed or why apps that aren't single-instance such as Konsole didn't open multiple times... But being fixed is enough for me. :)
Comment 8 Sebastian Sauer 2008-01-05 06:06:51 UTC
fix got committed with r757491 in trunk and r757497 in 4.0 branch, so should be part of 4.0.1