Cache directory entries when collecting item prototypes.

The file system access is expensive. As a result, the "UiImport" visitor
function showed up prominently on callgrind's heat map. Now it doesn't.

Change-Id: I3a37fa2b6d4abc29bb9c25776b86a485f647afce
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>