When an icon failed to load, show the "unknown" icon instead of a gap.
We don't want to check for icon availability in the model for performance reasons but only once the delegate is created (when it comes into view).
Details
GridView doesn't recycle items, so when the item goes out of view and comes back, it will essentially re-evaluate this.
Downside, if we failed to load an icon but have a previewer, we won't show the preview now. I don't think that's a common scenario - how come we can have a previewer for a format that is so exotic that we don't even have an icon for it?
Situations for when this can happen:
- .desktop file with rubbish Icon or not installed icon
- icon for mimetype for which we don't have an icon (some exotic mimetypes, kio iirc always sets icon name to one deduced from the mime type)
Diff Detail
- Repository
- R119 Plasma Desktop
- Lint
Lint Skipped - Unit
Unit Tests Skipped
Yep, then the view caring about complexity like "GridView doesn't recycle items, so when the item goes out of view and comes back, it will essentially re-evaluate this." becomes unneeded, and the preview problem goes away because we don't throw the real source away.
Should this be in IconItem instead? Q_PROPERTY(QString fallbackSource), etc.
Good idea. Back in the days we had KIconLoader always return a "unknown" icon which was changed because it should be the view's responsibility to provide a fallback but now we have gaps in quite a few places (I also have a patch for Dolphin for the same pending).