Fix toolbar button text hiding opt
Review Request #130047 - Created March 24, 2017 and discarded - Latest diff uploaded
There is a bug with toolbar button's text. If you open toolbar's context menu you'll be able to hide button caption for each button separately. You can disable all of them which is very convinient if you enabled a lot of plugins that add new buttons to toolbar.
But when KTorrent is relaunched it forgets this setting for very first subpanel (by default it contains 2 buttons: torrents & plugins). All other buttons keep their text hidden.
This fix allows KT to save and load these buttons state properly.
The list of actions usually save\restore its state (Priority property) automatically if created from *ui.rc file. But these actions are added dynamically into it. And it looks like their state isn't automatically saved even if I fill in objectName property for them (objectName is used as key for configuration file). So I've added required code.
objectNamefor dynamically created actions (default
objectNameis empty) because their
i18n()'ed just before
Actionobject constructed. Ideally I would change
Actionconstructor and require additional non-internationalized string parameter as
objectName, but this breaks plugin's binary compatibility which is unwanted. I could also move
Action's constructor and copy
namebefore localization. Or I could add
Actionand its derived objects creation in each plugin's code. But this would not be obvious for other plugins developers and require some warnings in documentation.
weight> pair is used. Currently all plugins have different icons and weights (weights are hardcoded), but in theory they could match. So pair is used for more robustness.