Prevent occasional empty Save button when upgrading from earlier version

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

Description

Prevent occasional empty Save button when upgrading from earlier version

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.

Reviewers: Spectacle, ngraham

Reviewed By: Spectacle, ngraham

Subscribers: ngraham

Differential Revision: https://phabricator.kde.org/D10682