Create the default profile if it doesn't exist
AcceptedPublic

Authored by pedroarthurp on Oct 11 2018, 6:29 PM.

Details

Reviewers
tcanabrava
ngraham
hindenburg
Group Reviewers
Konsole
Summary

When you open konsole for the first time or without a .config/konsolerc, the profile is not persisted to disk and no entry is present in switch profile. This patch will make konsole create a new default profile if it doesn't exist.

Diff Detail

Repository
R319 Konsole
Lint
Lint Skipped
Unit
Unit Tests Skipped
pedroarthurp created this revision.Oct 11 2018, 6:29 PM
Restricted Application added a project: Konsole. · View Herald TranscriptOct 11 2018, 6:29 PM
Restricted Application added a subscriber: konsole-devel. · View Herald Transcript
pedroarthurp requested review of this revision.Oct 11 2018, 6:29 PM
ngraham requested changes to this revision.Oct 11 2018, 10:46 PM
ngraham added a subscriber: ngraham.

This doesn't work for me. If I delete ~/.config/konsolerc* and ~/.local/share/konsole/*.profile, apply the patch, build konsole, and run it clean, I still see no profiles in SettingsConfigure KonsoleProfiles.

Does that work for you, or am I doing it wrong?

This revision now requires changes to proceed.Oct 11 2018, 10:46 PM

I don't recall off-hand what happens w/o these 2 files - most distros include profiles

I don't recall off-hand what happens w/o these 2 files - most distros include profiles

Any profile-related changes you make the first time you run konsole are lost.

About distros, neither Neon or Debian provide default profiles.

This doesn't work for me. If I delete ~/.config/konsolerc* and ~/.local/share/konsole/*.profile, apply the patch, build konsole, and run it clean, I still see no profiles in SettingsConfigure KonsoleProfiles.

Does that work for you, or am I doing it wrong?

No, you got it right. I actually missed that cause was only checking {context menu > Switch Profile} and {context menu > Edit Current Profile}. I must have missed some emit step; I am checking that. The "lost settings" problem seems fixed, however; I have double checked that by i) deleting my settings and ii) creating a new account.

Without this patch, when you change any profile settings, it creates a 'Profile 1.profile'. This is my understanding of how it is suppose to work.

With this patch, when you change any profile settings, it creates a Default.profile and a 'Profile 1.profile'.

I agree the issue of switch-> menu doesn't get updated needs fixed

Without this patch, when you change any profile settings, it creates a 'Profile 1.profile'. This is my understanding of how it is suppose to work.

I consistently lose any settings I make the first time I run konsole (ie, no .config/konsolerc and no files in .local/share/konsole/). I confirmed this with other users.

With this patch, when you change any profile settings, it creates a Default.profile and a 'Profile 1.profile'.

Are you sure? I tested it by removing .config/konsolerc and all profiles in .local/share/konsole/. It only creates one entry named Default.profile (though I expected it to be default.profile as I hardcoded it in the patch).

If you are getting two profiles, you may have a Profile 1.profile that is not set as your default profile in .config/konsolerc; this would cause defaultProfileName.isEmpty() to return true and hence create Default.profile.

I agree the issue of switch-> menu doesn't get updated needs fixed

This bug haunted me. If you test, you will see that the context menu works just fine, but the application menu behaves randomly, even though they are the same QActionGroup, _group member of ProfileList.

The logic to populate _group was a bit complicated (ProfileList::updateEmptyAction), hence I tried to create two QActionGroup: a _fallback for when the user has no favorite profile (with only the default profile in it), and a _populated for when the user has favorite profiles (with all his favorite entries, obviously). Then, I changed ProfileList::actions() to return the correct QActionGroup (_populated->actions() if user has favorites else _fallback->actions()). It worked just fine as a context menu, but still behaves randomly in the application menu. The code got much cleaner, though.

Besides that, the menu is misleading as it says "Switch Profile", while in the code it lists "Favorite" profiles only.

well I'm a bit confused why I don't see your results under the current master branch - I've tried 2 different VMs and verified there are no konsole files anywhere and get the results I mentioned above.

well I'm a bit confused why I don't see your results under the current master branch - I've tried 2 different VMs and verified there are no konsole files anywhere and get the results I mentioned above.

I'll also test those today to verify the results.
Kurt, do you mind telling us what vm's you used so I can replicate?

well I'm a bit confused why I don't see your results under the current master branch - I've tried 2 different VMs and verified there are no konsole files anywhere and get the results I mentioned above.

I'll also test those today to verify the results.
Kurt, do you mind telling us what vm's you used so I can replicate?

I've tried one of my neon desktops twice and a freebsd VM twice.

well I'm a bit confused why I don't see your results under the current master branch - I've tried 2 different VMs and verified there are no konsole files anywhere and get the results I mentioned above.

I'll also test those today to verify the results.
Kurt, do you mind telling us what vm's you used so I can replicate?

I've tried one of my neon desktops twice and a freebsd VM twice.

Has anyone make any further research confirming the original issue?

ngraham accepted this revision.Dec 31 2018, 5:08 AM

As of your latest change, I can no longer reproduce the issue I found the last time I reviewed this patch. I can also not reproduce @hindenburg's issue: changing profile settings doesn't create a new profile for me.

This revision is now accepted and ready to land.Dec 31 2018, 5:08 AM
cfeck added a subscriber: cfeck.Jan 18 2019, 12:42 AM
cfeck added inline comments.
src/ProfileManager.cpp
113

This comment seems wrong.

I consistently lose any settings I make the first time I run konsole (ie, no .config/konsolerc and no files in .local/share/konsole/). I confirmed this with other users.

I thought I fixed this in 2015:

https://cgit.kde.org/konsole.git/commit/?id=4ec5d3092d6cbda5ccfb838e2ef71f6d650b5ac4

Can you try to find out why that isn't enough?

This fix looks wrong anyways, shouldn't clutter up the home directory of users just because we run (IMHO).

Hi, everyone! Sorry for the delay.

I was able to fix all the problems by removing the fallback profile. Now, konsole searches for a default profile in the usual places (konsole's configuration or konsolepart's configuration) and if it is unset, it will create an in-memory profile named "Default". If there is a change in the in-memory profile, it is persisted.

Besides that, the "Switch Profile" menu was renamed to "Favorite Profiles" because is the actual functionality: display all profiles in the favorite list.

This fix looks wrong anyways, shouldn't clutter up the home directory of users just because we run (IMHO).

As a user, I don't mind, but I fixed that in the last patch.

By the way, if creating a file just because we run is a problem, then we should fix konsolerc management as this file is created in the aforementioned condition.

Testing this and a few concerns right off the start

  1. manage profiles doesn't show any of my profiles (should be 5)
  2. The 'Favorite Profiles' doesn't really express the idea that the current session will be changed to the selected profile.
  3. have you tested 'konsole --fallback-profile '

Testing this and a few concerns right off the start

  1. manage profiles doesn't show any of my profiles (should be 5)

A setHidden(false) was missing.

  1. The 'Favorite Profiles' doesn't really express the idea that the current session will be changed to the selected profile.

Agreed. However, switch profile doesn't state that it will show only a subset of my profile.

  1. have you tested 'konsole --fallback-profile '

Yes. It was working as expected.

I figure out that the previous patch was backward-incompatible.

OK, thanks - 19.04 will be split of shortly - I'll test more and look at getting this in after that. It currently doesn't apply cleanly due to other changes.

Do you have time to rebase this? If not, I can still work around it.

I'm still not sure about this.

The current implementation is that until the user changes some option, the internal settings are used. As soon as the user changes some setting, a new file 'Profile 1.profile' is created. If we wanted a default profile, it would be better to just ship one.

Issue I see with the current impl:

  1. Switch->Default profile entry makes no sense
  2. No profiles in Manage Dialogs - which might confuse people

If we wanted a default profile, it would be better to just ship one.

Yeah.

Mind you guys that the internal implementation without a profile is kinda
broken, so this patch makes sense to me.

Em sáb, 20 de abr de 2019 às 03:09, Nathaniel Graham <
noreply@phabricator.kde.org> escreveu:

ngraham added a comment. View Revision
https://phabricator.kde.org/D16138

In D16138#453146 https://phabricator.kde.org/D16138#453146, @hindenburg
https://phabricator.kde.org/p/hindenburg/ wrote:

If we wanted a default profile, it would be better to just ship one.

Yeah.

*REPOSITORY*
R319 Konsole

*REVISION DETAIL*
https://phabricator.kde.org/D16138

*To: *pedroarthurp, tcanabrava, ngraham, Konsole, hindenburg
*Cc: *sandsmark, cfeck, ngraham, konsole-devel, gennad, thsurrel,
maximilianocuria, hindenburg

If the internal fallback profile has issues, let's fix that.