From kde-devel Sun Aug 31 20:49:39 2008 From: Sebastian =?iso-8859-15?q?K=FCgler?= Date: Sun, 31 Aug 2008 20:49:39 +0000 To: kde-devel Subject: Re: Patch: New KRunner for places. Message-Id: <200808312249.39992.sebas () kde ! org> X-MARC-Message: https://marc.info/?l=kde-devel&m=122021586030221 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--===============0659511247==" --===============0659511247== Content-Type: multipart/signed; boundary="nextPart1737786.UhP7EFFhoW"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit --nextPart1737786.UhP7EFFhoW Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi David, welcome to Plasma development :) (Michael is correct, please use plasma-devel for plasma development issues,= =20 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 wh= en > 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 Sol= id > 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= =20 often. If you look at other runners, they fill the list of possible matches= in=20 the constructor, have some mechanism to update this internal datastructure= =20 (often just a QStringList), preferably by a signal so it doesn't get trigge= red=20 when not possible. You can have a look at how other runners solve this for= =20 examples, for example the recent document runner. The match function is run very often, so it should be as short and efficien= t=20 as possible. It's basically executed at every char that is being typed by t= he=20 users (most runners restrict this to only trigger the matching when there a= re=20 more than 3 chars typed). I'd suggest to first rewrite it in this way, if your crashes (which, if I=20 understand correctly happen in match()) persist, look deeper into that. Ow, and your code doesn't match Plasma's (kdelibs) coding style, please fix= =20 that as well. ( http://techbase.kde.org/Policies/Kdelibs_Coding_Style for=20 details.) Cheers, =2D-=20 sebas http://www.kde.org | http://vizZzion.org | GPG Key ID: 9119 0EF9=20 --nextPart1737786.UhP7EFFhoW Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iQEVAwUASLsD42dNh9WRGQ75AQLn5wf/WDs+Z4Do4OuZzmQKI9YMwR1ERSu+cila jcUncpesDsHCh/kFV2u7dIcQpF+WQ8wyN8cP0ZyoBmJOMLD1v0cT9WifJqtw1e0n AF4PCXwMrIuU1jFrXZ+GhpZQ/pEKuFlHbwjBqFnJV7IVr9kgGDHeTxkNRmM6387K TcryapPYIbIegtzXOO+GeFtZePdFKuy29fS9VxiZz5X9m33uQ0JforWgmDRHkAzG jv4uy1SYe/v/u1EWO+9TH8FfUSKjoXGHPEPvDBr/JL92f3viIgk0wpN19Fe5H6Q4 HAcbURIBxyC455i8CwTisriBDxVexUF9a0yjPttSwTKGpxomkPzhVg== =BUdg -----END PGP SIGNATURE----- --nextPart1737786.UhP7EFFhoW-- --===============0659511247== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline >> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe << --===============0659511247==--