Fix removing first item in languages list
ClosedPublic

Authored by hein on Nov 28 2018, 3:05 PM.

Details

Summary

Instead, we want to disallow removing when the count drops to 1.

BUG:401473

Diff Detail

Repository
R119 Plasma Desktop
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
hein created this revision.Nov 28 2018, 3:05 PM
Restricted Application added a project: Plasma. · View Herald TranscriptNov 28 2018, 3:05 PM
hein requested review of this revision.Nov 28 2018, 3:05 PM
davidedmundson accepted this revision.Jan 2 2019, 8:20 AM
davidedmundson added inline comments.
kcms/translations/translationsmodel.cpp
216

Changing from index < 1 to checking count makes sense, but I would still check

if (index < 0) {return;}

in addition to the count to catch out-of-sync erorrs. I think then you wouldn't need to complicate the QML side.

This revision is now accepted and ready to land.Jan 2 2019, 8:20 AM
hein added inline comments.Jan 2 2019, 8:28 AM
kcms/translations/translationsmodel.cpp
216

I'll add the check (it's nice for sanity anyways), but the changes to the QML are actually unrelated - it's simply the delegate crashing in the Qt Quick runtime when the expression bound to enabled is re-evaluated while the delegate is being destroyed. I didn't find any better fix.

This revision was automatically updated to reflect the committed changes.