I've done this, but it only gives you a macro capability. Rangefinder lenses are designed to work much closer to the film plane, whereas SLR lenses have to be spaced further out, to make room for the mirror. So while you can mount these up, they won't focus further than about 200mm.
But you can get a M39 to M42 adapter, and then a M42 to K-mount adapter. If you do this with the CV35/2.5, the rear lens element is too close, and the mirror hits it! But my other M39 lenses work ok.
Mind you the *istDS works really well with all the old K-mount glass, especially the Pentax-A line. You can also use M42 screw mount SLR lenses, but you need to stop down the aperture manually.
I'll post some photos when I get home.