[KCoreDirLister] replace deprecated foreach with range-for
Summary: Also change directoriesForCanonicalPath() to return const
Test Plan:
The code compiles and all tests pass (except kacltest, but that's
probably something on my machine)
Reviewers: kde-frameworks-devel, dfaure
Reviewed By: dfaure
Subscribers: kde-frameworks-devel
Tags: Frameworks
Differential Revision: https://phabricator.kde.org/D23902