Add a way to reset changes to system-wide color schemes
ClosedPublic

Authored by ahmadsamir on Dec 30 2017, 7:46 PM.

Details

Summary

At the moment when a user edits a system-wide color scheme the changes are save in ~/.local/share/konsole; if the user wishes to reset the changes to that scheme and restore the original settings of the scheme in /usr/share/konsole he would have to "remove" the color scheme and restart konsole for the original color scheme to show in the ColorSchemeManager. Now there's a "Defaults" button in the ColorSchemeManager to reset a color scheme to the default values.

This fixes bug 369481 [1]

[1] https://bugs.kde.org/show_bug.cgi?id=369481

Diff Detail

Repository
R319 Konsole
Lint
Lint Skipped
Unit
Unit Tests Skipped
ahmadsamir created this revision.Dec 30 2017, 7:46 PM
Restricted Application added a project: Konsole. · View Herald TranscriptDec 30 2017, 7:46 PM
Restricted Application added a subscriber: Konsole. · View Herald Transcript
ahmadsamir requested review of this revision.Dec 30 2017, 7:46 PM

Any news about this patch?

Thanks.

Sorry, didn't notice this before - let me check it out. Thanks

Can you update the patch fixing my comments and updating your master branch - I've made some changes since this patch - although it applies cleanly

src/ColorSchemeManager.cpp
226 ↗(On Diff #24498)

minor - align indents

src/ColorSchemeManager.h
95 ↗(On Diff #24498)

If possible, use API doxygen labels - here for example use @p name to explain how name is used.

src/EditProfileDialog.h
135 ↗(On Diff #24498)

You're actually deleting the file in .local/share - not overriding it.

ahmadsamir updated this revision to Diff 25758.Jan 22 2018, 1:03 PM

I've addressed all the issues you pointed out (and one more comment issue in ColorSchemeManager.cpp, I used delete instead of overwrite as it indeed explains what's going on in a more accurate way).

GenericDataLocation "~/.local/share", "/usr/local/share", "/usr/share"

For the comments, I think you can use something like "user's home location" and "system locations"

Also, can you "close/mark done" the 3 comments I made earlier that you fixed?

Thanks

src/ColorSchemeManager.cpp
240

I don't think you need to check the isEmpty(), just use the .count

ahmadsamir updated this revision to Diff 25770.Jan 22 2018, 4:40 PM
  • Don't check if paths isEmpty, as that's redundant
  • Use more generic names in the comments, e.g. "user's home dir location" and "system-wide location" instead of ~/.local/share/konsole/ and /usr/share/konsole resppectively.
ahmadsamir marked 3 inline comments as done.Jan 22 2018, 4:41 PM

Thanks for working on this

src/ColorSchemeManager.cpp
224 ↗(On Diff #24498)

I'm not sure I understand this - how can the colorscheme file not exist? and why return true when it does not exist?

can't you just return dirInfo.isWritable(); ?

240 ↗(On Diff #24498)

actually you could use return (paths.count() > 1)

src/EditProfileDialog.cpp
958 ↗(On Diff #24498)

can you name this better than on? isResetable?

I'm not sure the "Reset" is the best way to describe what we're doing. Nothing comes to mind though.

ahmadsamir marked 4 inline comments as done.Jan 23 2018, 12:01 PM
ahmadsamir added inline comments.
src/ColorSchemeManager.cpp
224 ↗(On Diff #24498)

Right. (I was over-engineering apparently).

240 ↗(On Diff #24498)

OK. Done.

src/EditProfileDialog.cpp
958 ↗(On Diff #24498)

I changed it to use isResettable.

About the name, "Reset", it's either that or DiscardColorschemeChanges, which sort of means the same thing...

ahmadsamir marked 3 inline comments as done.

Addressed the issues in the inline comments.

This revision is now accepted and ready to land.Jan 23 2018, 2:06 PM
This revision was automatically updated to reflect the committed changes.