ubports/ubuntu-ui-toolkit

popupUtils.open() 'caller' is deprecated for Dialog

Closed this issue · 6 comments

When I want to open a Dialog and I want to pass some params to it, I need to call PopupUtils.open() passing a caller in addition to my Dialog and to the params I want to pass. However, I get a log line saying

'caller' is DEPRECATED. It has no effect.

can we get rid of the caller parameter without breaking all the existing apps?

I think the only use I found for the caller is here: https://gitlab.com/bhdouglass/dice-roller/-/blob/master/qml/MainPage.qml#L424

Do we have a workaround?

Setting parent first?

I found out caller is deprecated only with the Dialog component (see code) while it is still needed for others, like the Popover that is placed near the caller if possible (docs)

@cibersheep in the code you linked the caller is useless, but you have to put it if you want to pass some parameters to the Dialog...

I see... I remember I had to specify the caller but I don't remember why :) sounds like to pass the parameters as you say.

Would be save to remove it then? How can be done and not breaking the existing code? Parsing caller as optional? So, if it's more than 2 parameters, take the last one as parameter for the Dialog?

balcy commented

for some popup requests in morph without the caller parameter the dialogs were shown in the wrong window, see:
ubports/morph-browser#167
ubports/morph-browser#173
(ubports/morph-browser@1cd46e9)
So I think it should still be supported and not be removed, unless issues like that with morph can be solved differently.

Yeah, I think we can do nothing about it because popupUtils.open() is used for different components while the caller parameter is deprecated only if passed to a Dialog. We can update the docs to say to puss null as caller when opening a Dialog to not get the warning line in the logs, and well, because it has no effects.

Ubuntu UI Toolkit has moved to https://gitlab.com/ubports/core/lomiri-ui-toolkit. If this issue is still relevant, please file it again at https://gitlab.com/ubports/core/lomiri-ui-toolkit/-/issues.