ubports / ubuntu-ui-toolkit

Moved to https://gitlab.com/ubports/core/lomiri-ui-toolkit
https://gitlab.com/ubports/core/lomiri-ui-toolkit
GNU Lesser General Public License v3.0
13 stars 21 forks source link

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

Closed mymike00 closed 3 years ago

mymike00 commented 4 years ago

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?

cibersheep commented 4 years ago

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?

mymike00 commented 4 years ago

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...

cibersheep commented 4 years ago

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 4 years ago

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

mymike00 commented 4 years ago

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.

UniversalSuperBox commented 3 years ago

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.