Prevent occasional empty Save button when upgrading from earlier version
ClosedPublic

Authored by rkflx on Feb 20 2018, 2:40 PM.

Details

Summary

63bc26c66565 introduced a regression, where when upgrading from
Spectacle 17.12 with Save As used last to 18.04 the Save
button would show no text at all and clicking would be a no-op (the down
arrow menu still worked, though).

The reason is the removal of a default case, however the root problem
has been there before: lastUsedSaveMode() could pass invalid values.
This can be fixed by properly refactoring the latter method too and
trading meticulosity for compactness when converting from int to
enum, i.e. adding the default to the correct place. If Spectacle
used KConfigXT this would not have been a problem in the first place…

Test Plan
  • rm ~/.config/spectaclerc
  • Start Spectacle 17.12, Save As, Quit
  • Start Spectacle from master

Save button now correctly shows the default text instead of
nothing at all. Button state still remembered after restart.

Diff Detail

Repository
R166 Spectacle
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
rkflx requested review of this revision.Feb 20 2018, 2:40 PM
rkflx created this revision.
rkflx added a comment.Feb 20 2018, 2:40 PM

…and that's why the refactoring was only committed to master, because even with code review mistakes slip through…

ngraham accepted this revision.Feb 21 2018, 5:15 AM
ngraham added a subscriber: ngraham.

Thanks @rkflx, great catch. Can reproduce the issue, and your patch fixes it. Nicely done.

This revision is now accepted and ready to land.Feb 21 2018, 5:15 AM
This revision was automatically updated to reflect the committed changes.