If 'when' means 'kiedy/gdy' then it is used in the time clause. If 'when' means only 'kiedy' then it is not in the time clause that 'when' is used. Cf.
I'll phone you when I get back home.
Przedzwonię do ciebie kiedy/gdy wrócę do domu.
I wonder when he will pay me back.
Zastanawiam się, kiedy (NOT gdy) mi odda kasę.