Handle read-only profile config file
ClosedPublic

Authored by ahmadsamir on Dec 15 2017, 2:50 PM.

Details

Summary

If an existing profile config file is read-only for the user, settings can't be saved, and a message explaining the issue is shown to the user.

Diff Detail

Repository
R319 Konsole
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
ahmadsamir created this revision.Dec 15 2017, 2:50 PM
Restricted Application added a project: Konsole. · View Herald TranscriptDec 15 2017, 2:50 PM
Restricted Application added a subscriber: Konsole. · View Herald Transcript
ahmadsamir requested review of this revision.Dec 15 2017, 2:50 PM

Does this work for you? I can't get the dialog to show up.

  1. rename a ro profile -> creates a new profile with the new name
  2. change a ro profile - > creates a new profile with the same name; adds a new profile each time you change the ro profile

I do see these
org.kde.konsole: Could not delete profile: "/usr/share/konsole/Profile 3a1a.profile" The file is most likely in a directory which is read-only.

Does this work for you? I can't get the dialog to show up.

  1. rename a ro profile -> creates a new profile with the new name
  2. change a ro profile - > creates a new profile with the same name; adds a new profile each time you change the ro profile

    I do see these org.kde.konsole: Could not delete profile: "/usr/share/konsole/Profile 3a1a.profile" The file is most likely in a directory which is read-only.

With the patch, I can't change any setting in a ro profile, not even change the name (sorry about the half-cooked patch :/).

I'll update the review with a new patch, but I'm waiting to test it some more...

ahmadsamir updated this revision to Diff 23991.Dec 16 2017, 8:05 PM
  • Display a warning message if the user tries to save settings to a profile with a read-only config file.
  • Change accept() so that the user can still click OK if he made no changes to a read-only profile.

I hope this one actually works :)

I still can't get the new popup to show - I still get this as before - I'll try to look at in the next week if you are still having issues

rename a ro profile -> creates a new profile with the new name
change a ro profile - > creates a new profile with the same name; adds a new profile each time you change the ro profile

I do see these org.kde.konsole: Could not delete profile: "/usr/share/konsole/Profile 3a1a.profile" The file is most likely in a directory which is read-only.

Please check the permissions of "/usr/share/konsole/Profile 3a1a.profile", I am assuming anything under /usr/share/konsole is owned by root. If the file is owned by the user then the check in the patch will fail.

The only check should be if the profile can be deleted - you can notice the Delete button is grayed on such profiles.

The only check should be if the profile can be deleted - you can notice the Delete button is grayed on such profiles.

I can't write to a ro file, but I can still delete it if I own it. So if the user has a ro .profile in ~/.local/share/konsole/, he can't save the settings but he can delete that profile, or rename it.

ProfileSettings::isProfileDeletable() checks if the dir (i.e. /usr/share/konsole/ or ~/.local/share/konsole/) isWritable, but even with a rw ~/.local/share/konsole/ if a ro .profile exists there, settings can't be saved.

OK, I see what's going on - I was testing the wrong thing. Sorry about that - I'll handle this one and the other patches in the next week.

Thanks.

This revision was automatically updated to reflect the committed changes.