dbusmenuqt and left-click

Christian Esken esken at kde.org
Fri Aug 20 20:37:26 BST 2010


Hello Andriy,

I tried your hint to not set associatedWidget for KMix, as KMix has comparable 
requirements.

My problem is now: When I don't set an associated widget, the 
"mimimizeRestore" won't show up in the context menu. Also i cannot call the 
mimimizeRestore() functionality from the KMix dock area popup window, which I 
need.
(It doesn't work, as the KStatusNotifierItemPrivate code operates on the 
associatedWidget Object, which is now undefined).

I am currently considering to copy a lot of code, e.g. from 
minimizeRestore(bool show), but would like to avoid it, as it contains a lot 
of sophisticated #ifdef Q_WS_X11. Copying that code seems so wrong to me, so 
hopefully there is a better way.  See below for more detail.

Any idea is very welcome.

  Christian

-----------------------------------------------------------------------------
So what I need is:
- Right-click should show menu with mimimizeRestore
- Left-click should "show popup" or "show main window"

And that means
1) I need to do my own left-click handling, even though there is already is an 
associatedWidget.
2) Define own context menu entries, but I still also need the original 
minimizeRestore action in there. I can't do it right now, as i can neither 
call KStatusNotifierItemPrivate::contextMenuAboutToShow(), nor do I have 
access to the essential checkVisibility() method [or possibly 
minimizeRestore(bool show)].
3) I need to execute the regular "left-click = show main window" action
  [something like minimizeRestore(bool show)].

Because of the implmentation details of KStatusNotifierItem(Private), I think 
copying code would currently be neccesary. (It could help, if left-click would 
not be hardcoded to do a minimizeRestore of the associatedWidget object).
-----------------------------------------------------------------------------



On Aug 5, 2010, at 5:10, Marco Martin <notmart at xxxxxxxxx> wrote:

> On Thursday 05 August 2010, Andriy Rysin wrote:
>> In keyboard layout indicator module I have a reaction to left-click via
>> activateRequested(), which is to toggle the layout to the next one (as
>> opposed to right-click which brings menu). Though currently (with latest
>> dbusmenuqt) no matter whether I click left or right button it's always
>> context menu that appears.
>>
>> Is this a bug or something else is needed to make activateRequested() work?
>
> yes, it was a bug.
> i did fix it yesterday for another problem (korgac showing the same problem)
>
> now if you -don't- set an associatedwidget the signal will work.
> if you set the menu, you'll get the menu with both mouse buttons.
> the keyboard layout indicator seems to work after the fix.
Works now, thanks!

Andriy




More information about the kde-core-devel mailing list