Patch: New KRunner for places.

Sebastian Kügler sebas at kde.org
Sun Aug 31 22:49:39 CEST 2008


Hi David, welcome to Plasma development :)

(Michael is correct, please use plasma-devel for plasma development issues, 
CC:)

On Sunday 31 August 2008 20:03:09 David Edmundson wrote:
> I've written a new KRunner for KDE. It looks at the bookmarks list for
> dolphin, the folders in the Places panel, and includes them in the krunner
> search. Nothing exciting or amazing, I wrote it because I went to use the
> functionality and was surprised that it didn't do it already.
>
> I'm posting here so it can be reviewed and committed, or so I can receive
> some constructive abuse about my code so it can be committed later.
>
> Code is attached.
>
> Part 2
>
> I imagine the follow up question I'm going to get asked is "does it also
> list devices like Dolphin does in the places bar?".
>
> I've tried doing this but I keep making Krunner crash, I've attached my
> code file for this. I think, though I may be wrong. That I get a crash when
> krunner runs my code to find a device matching the search term, I call
> solid, then krunner tells me to search for a new term. This means the Solid
> objects are removed mid-way through it's dbus magic, which causes it to
> explode wildly. I've spent a while on this and I can't figure out how to
> fix it.

You shouldn't be doing all that in the match() method, as this is run very 
often. If you look at other runners, they fill the list of possible matches in 
the constructor, have some mechanism to update this internal datastructure 
(often just a QStringList), preferably by a signal so it doesn't get triggered 
when not possible. You can have a look at how other runners solve this for 
examples, for example the recent document runner.

The match function is run very often, so it should be as short and efficient 
as possible. It's basically executed at every char that is being typed by the 
users (most runners restrict this to only trigger the matching when there are 
more than 3 chars typed).

I'd suggest to first rewrite it in this way, if your crashes (which, if I 
understand correctly happen in match()) persist, look deeper into that.

Ow, and your code doesn't match Plasma's (kdelibs) coding style, please fix 
that as well. ( http://techbase.kde.org/Policies/Kdelibs_Coding_Style for 
details.)

Cheers,
-- 
sebas

 http://www.kde.org | http://vizZzion.org |  GPG Key ID: 9119 0EF9 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 481 bytes
Desc: This is a digitally signed message part.
Url : http://mail.kde.org/pipermail/plasma-devel/attachments/20080831/ad76e79b/attachment.sig 


More information about the Plasma-devel mailing list