It's been a while since this thread was active, but I was having the same problem as spikey, and I stumbled on it from Google.
pitonyak, your idea absolutely worked. Hook a slot up to the directoryEntered signal, and then check whether the new directory startsWith whatever path you want to restrict them to. If so, update an sCurrentDir variable. If not, setDirectory to sCurrentDir.
One important caveat: You also have to check the final file the user chooses, to make sure it's where you expect. Otherwise, the user can type something like "../../restrictedDir/restrictedFile.txt", and the dialog will even give them a drop-down of file completion to help them! Be aware that users can still see files outside your restricted directory area, too, so if viewing files outside is a concern, this might not be a complete solution for you.
Also, when you check the final file, make sure you do it with a "/" at the end of your path. Otherwise, instead of something like "/acceptableDir/acceptableFile.txt", the user could manually type in a file like "../acceptableDirWhoopsNoItsNot/restrictedFile.txt".
Bookmarks