[Panel-devel] bookmark runner

Aaron J. Seigo aseigo at kde.org
Thu Nov 1 20:12:42 CET 2007


On Thursday 01 November 2007, Glenn Ergeerts wrote:
> I had a spare couple of hours and after reading Aaron's blog about krunner
> i decided to give it a try to implement one. Attached is a patch which
> contains a bookmark runner. I have not yet looked into performance
> optimization and the code probably misses some checks but it seems to work
> fine here. Any feedback is welcome!

cool; other than the comments of the others here, i'd suggest putting sth like 
this at the start of match():

if (search->term().length() < 3) {
    return;
}

this will prevent searching for 1 or 2 letters, which is likely to return lots 
of crud in this case. this is a somewhat common pattern for free text 
searching runns, btw. not sure if there should be some sort of generic 
support in AbstractRunner for this... probably not =) 

also, if you don't mind overly much ... if this goes into kdebase, and i think 
it probably should be there eventually, i'd personally appreciate it if the 
code adhered to the plasma coding style, so that this:

+    while(!currentBookmark.isNull())
+    {
+        if(currentBookmark.isGroup()) //recurse
+            matchingBookmarks += searchBookmarks(currentBookmark.toGroup(), 
query);
+        else
+        {
+            if(currentBookmark.text().contains(query, Qt::CaseInsensitive))
+                matchingBookmarks.append(currentBookmark);
+        }
+        currentBookmark = bookmarkGrp.next(currentBookmark);
+    }

would become this:

+    while (!currentBookmark.isNull()) {
+        if (currentBookmark.isGroup()) { //recurse
+            matchingBookmarks += searchBookmarks(currentBookmark.toGroup(), 
query);
+        } else {
+            if (currentBookmark.text().contains(query, Qt::CaseInsensitive)) 
{
+                matchingBookmarks.append(currentBookmark);
+            }
+        }
+        currentBookmark = bookmarkGrp.next(currentBookmark);
+    }


i'm pretty relaxed when it comes to plugins, but it would be great to see some 
greater general consistency in workspace/plasma ...

otherwise, i'm all for this addition ...

-- 
Aaron J. Seigo
humru othro a kohnu se
GPG Fingerprint: 8B8B 2209 0C6F 7C47 B1EA  EE75 D6B7 2EB1 A7F1 DB43

KDE core developer sponsored by Trolltech
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/panel-devel/attachments/20071101/43e8c989/attachment-0001.pgp 


More information about the Panel-devel mailing list