Refactor and remove duplicate code in kfileplacesview
Differential Revision: https://phabricator.kde.org/D8619