[Semi-PATCH] Dolphin - Previews in Tooltips

Simon St James kdedevel at etotheipiplusone.com
Sun Aug 17 15:29:21 BST 2008


May as well forward this to the list to get some more brains on it while 
Fredrik recovers from flu :)

I've tried to duplicate the KDE3 behaviour of using a very large image for the 
actual preview, and a small one for when no preview is available: a small 
preview is, in my experience, not very useful, and nor is a large 
not-preview ;)

This of course causes an issue with the tooltip possibly changing size during 
its lifespan, which can cause it to go out of screen bounds (or worse - 
appear under the cursor - try it and see what happens! ;)) as it is currently 
simply re-drawn at the point at which it was originally requested. 

There's a bunch of different strategies one could employ to get around it: 
a "bounds" setting could be sent to KToolTip by the client to provide 
re-positioning hints; the change to setData could be undone and we could add 
a moveTooltip(...) to the KToolTip API so that the client decides when to 
refresh/ reposition the tooltip when it gets resized; etc.

A few other odds and ends:

- DolphinBalloonTooltipDelegate is a bit naughty: it's basically a way of 
re-using KFormattedBalloonTipDelegate but adding the feature that the size of 
the icon depends on whether we have a preview or not. 

- DolphinBalloonTooltipDelegate currently re-implements some methods by just 
sending them back down to the base-class as when I started I wasn't sure if I 
needed to change their behaviour or not ;)

- The dolphintooltips.* are actually quite small and could probably be folded 
into tooltipmanager.cpp, if need be.

----------  Forwarded Message  ----------

Subject: [PATCH] Dolphin - Previews in Tooltips
Date: Thursday 14 Aug 2008
From: Simon St James <simon at etotheipiplusone.com>
To: fredrik at kde.org

... blah ... blah ... snipped ...

Since KToolTip will likely end up in kdelibs, I've  taken care to avoid any 
API changes and kept most of the preview logic in the Dolphin codebase as I'm 
not sure if you want KFileItem-related stuff in the KToolTip API.  I have 
made a few KToolTip behavioural changes, though:

- KToolTip::setData(...) now triggers an internal method called update(...), 
which re-draws the tooltip at its original location.

- KFormattedBalloonTipDelegate now deals more elegantly with the case where 
the icon is larger than the formatted text.  This probably qualifies as a bug 
fix, so you might want to include this one change, regardless :)

When you get a chance, any feedback on general approach (or even nitpicking 
coding style/ variable naming etc) would be very much appreciated!

Best Wishes,
Simon
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dolphin-previews-in-tooltip.patch
Type: text/x-diff
Size: 9732 bytes
Desc: not available
URL: <https://mail.kde.org/mailman/private/kfm-devel/attachments/20080817/cf4e9fe8/attachment.patch>


More information about the kfm-devel mailing list