Middle Clicking on Bookmarks - KAction integration

David Faure faure at kde.org
Fri Dec 17 21:27:31 GMT 2004


On Friday 17 December 2004 02:44, Daniel Teske wrote:
> this is the second version of the middle click patch. It adds KAction
> integration and the KToolbarButton change is a better fit for the
> existing interface.

Hello,
Thanks for the improved patch.
I finally had some time to think a bit more about this, and to work on it.

> KAction:
> I added two additional bits to KAction::ActivationReason, namely:
> MiddleClick and DoubleClick.

On hindsight, this would be a difficult-to-extend design - we want more
info, like whether Shift was pressed (to make Shift+"Trash" delete the file,
which is why we added activationReason in the first place).

So the mouse button, and keyboard modifiers, should be emitted separately
from ActivationReason. And neither should be stored in KAction, to save memory.
So this leads to a new signal from KAction:
    void activated( KAction::ActivationReason reason, Qt::ButtonState state );
emitted before activated(), to ship out the info without a need to store it.

To implement it, I basically merged some of your patch with some of 
Stefan Nikolaus' patch :-)

> There are two problems with this code:
> a) slotActivated is virtual, due to BC constraints slotMiddleClick and
> slotDoubleClick aren't. That means, derived classes can't change the
> behauviour of middle clicks on toolbar buttons.

That is true (until kde4). But of course it's not a big deal since applications
don't listen to the new signal yet. So for all unpatched apps and actions,
MMB does like LMB.

> b) emitting activated() for DoubleClicking might break apps, who think
> KAction ignores those.
OK I left that one out.

I still need to adapt the kio/bookmarks and konqueror code to this
(I'm first adapting the code which called activationReason(), since
it doesn't exist anymore). This is just to let you know that I'm working
on this and to get some feedback if you have any.

-- 
David Faure, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kdeui.patch
Type: text/x-diff
Size: 14297 bytes
Desc: not available
URL: <https://mail.kde.org/mailman/private/kfm-devel/attachments/20041217/efa7712a/attachment.patch>


More information about the kfm-devel mailing list