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.

Implementation notes:
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.

I'm using icon-id+"wght"+weight as objectNamefor dynamically created actions (default objectName is empty) because their name property is i18n()'ed just before Action object constructed. Ideally I would change Action constructor and require additional non-internationalized string parameter as objectName, but this breaks plugin's binary compatibility which is unwanted. I could also move i18n() inside Action's constructor and copy name before localization. Or I could add setObjectName() after Action and 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.
So <icon-id, 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.

Testing Done

Screenshots

Files

Change Summary:

spellcheck

Description:

~

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 enable lot of plugins that adds new buttons to toolbar.

~

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 relaunches it forgets this setting for very first subpanel (by default it contains 2 buttons: torrents & plugins). All other buttons keep their text hidden.

~

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.

Implementation notes:

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.

~

I'm using icon-id text as objectName for dynamically created actions because their name is i18n()'ed just before Action object constructed. Ideally I would change Action constructor and require additional non-internationalized string parameter as objectName, but this breaks plugin's binary compatibility which is uwanted. I could also move i18n() inside constructor and copy name before localization. Or I could add setObjectName() after Action and its derived objects creation in plugin's code. But this is not obvious for developers and require some warnings in documentation.

~

I'm using icon-id text as objectNamefor dynamically created actions in case it's missing because their name property is i18n()'ed just before Action object constructed. Ideally I would change Action constructor and require additional non-internationalized string parameter as objectName, but this breaks plugin's binary compatibility which is unwanted. I could also move i18n() inside constructor and copy name before localization. Or I could add setObjectName() after Action and its derived objects creation in plugin's code. But this would not be obvious for plugin developers and require some warnings in documentation.

So icon-id is currently used and this means buttons of first subpanel should has different icons or they'll share same priority setting.

~

Another option would be save/load state just by action number in list, but..

~

Another option would be save/load state just by action number in list, but it may change

Review request changed

April 12, 2017, 1:09 p.m.

Change Summary:

add weight to object name in case icon name is same

Diff:

Description:

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.

Implementation notes:

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.

~

I'm using icon-id text as objectNamefor dynamically created actions in case it's missing because their name property is i18n()'ed just before Action object constructed. Ideally I would change Action constructor and require additional non-internationalized string parameter as objectName, but this breaks plugin's binary compatibility which is unwanted. I could also move i18n() inside constructor and copy name before localization. Or I could add setObjectName() after Action and its derived objects creation in plugin's code. But this would not be obvious for plugin developers and require some warnings in documentation.

~

So icon-id is currently used and this means buttons of first subpanel should has different icons or they'll share same priority setting.

~

I'm using icon-id+"wght"+weight as objectNamefor dynamically created actions (default objectName is empty) because their name property is i18n()'ed just before Action object constructed. Ideally I would change Action constructor and require additional non-internationalized string parameter as objectName, but this breaks plugin's binary compatibility which is unwanted. I could also move i18n() inside Action's constructor and copy name before localization. Or I could add setObjectName() after Action and 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.

~

So <icon-id, 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.

-

Another option would be save/load state just by action number in list, but it may change