Deprecate the global [Small|Desktop|Bar]Icon() methods
ClosedPublic

Authored by vkrause on Sep 21 2019, 4:29 PM.

Details

Summary

They are not namespaced and promote the use of pixmaps rather than
icons. Additionally their API allowing to specify a size that differs
from the size suggested by their name leads to bizarre usage like
'SmallIcon("foo", KIconLoader::SizeLarge)'.

Diff Detail

Repository
R302 KIconThemes
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
vkrause created this revision.Sep 21 2019, 4:29 PM
Restricted Application added a project: Frameworks. · View Herald TranscriptSep 21 2019, 4:29 PM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
vkrause requested review of this revision.Sep 21 2019, 4:29 PM
dfaure requested changes to this revision.Sep 22 2019, 12:14 AM
dfaure added a subscriber: dfaure.

LOL I had no idea that one could do SmallIcon("foo", KIconLoader::SizeLarge) ;-)

I think 95% of the uses of these functions only specifies one argument.

Then again, I just grepped for usage of SmallIcons in KF5, and one of the only two hits in non-deprecated modules is....

kio/src/filewidgets/kimagefilepreview.cpp
200:        imageLabel->setPixmap(SmallIcon(QStringLiteral("image-missing"), KIconLoader::SizeLarge,

Can you port KIO?

Also I think you're missing #ifndef KICONTHEMES_NO_DEPRECATED around the newly deprecated methods
(which helps to do a local experimental build with this being set, to catch all users and port them).

This revision now requires changes to proceed.Sep 22 2019, 12:14 AM

kio/src/widgets/ksslinfodialog.cpp also has 7 uses of BarIcon.
(and that's all I can find in all of KF5)

kio/src/widgets/ksslinfodialog.cpp also has 7 uses of BarIcon.
(and that's all I can find in all of KF5)

Right, usage is fortunately not very wide-spread anymore. Before porting the remaining users I just wanted to be sure there are no objections to the general idea.

vkrause updated this revision to Diff 66605.Sep 22 2019, 8:28 AM

Use KICONTHEMES_NO_DEPRECATED.

vkrause updated this revision to Diff 66606.Sep 22 2019, 8:33 AM

Actually use KICONTHEMES_NO_DEPRECATED correctly.

dfaure accepted this revision.Sep 22 2019, 12:49 PM
This revision is now accepted and ready to land.Sep 22 2019, 12:49 PM
This revision was automatically updated to reflect the committed changes.