I recommend you to use your distro's BlueProximity Package as this one does not work anymore with KDE4, because of the lack of xscreensaver (not installed as a default).
I use KDE4 with Kubuntu 8.04.1 and BP package is 1.24. You might use these commands to lock and unlock your screen :
lock : qdbus org.kde.screensaver /ScreenSaver Lock
unlock : killall -9 krunner_lock
This works here.
Also you might have a look at kbluelock, which intend to do the same thing as BlueProximity, but with a lack of functionnality and settings I think.
Also kbluemon and kblueplugd will gain your interest.
Good locking/unlocking :-)
Thank you BP team.
Fred. - Sep 12 2008