Those Classes are not QObject, so most of it's pointers could be changed
to smart pointers with no problems.
Problem found when using QList<std::unique_ptr>: it wasn't possible to
use it. I'm using std containers instead.
This should prevent opening two instance of the EditProfileDialog in the
same process, i.e. if "run all konsole windows in a single process" option is:
- Enabled, then opening the dialog will block user interaction with all
other konsole windows (including tabs).
- Disabled, then open the dialog will block user interactin with all
other tabs in the same window
This simplifies the code since it checked if such a dialog was open
somewhere else to prevent crashes.
exec() creates a nested eventloop, which could lead to some nasty
crashes ...etc.
ProfileSettings::editSelected(): since the dialog is modal, the user
can't interact with the konsole window at all, so no chance of opening
another instance of the EditProfileDialog.
- If there is no selection only enable the "New" button, this fixes a
crash if you select a profile, then Ctrl+Click to unselect it, the set
as default button would still be enabled and clicking it caused a crash
- If a profile is selected, clone its properties, otherwise the fallback
profile properties will be used, this more expected
This is a first step in simplifying the code; since the Fallback profile
doesn't have a file on disk, it's basically a corner-case that we have to
babysit in various places in the code.
Now when the user tries to "Edit current profile", if it's the Fallback
profile, a new profile is created, with a unique name "Profile 1",
"Profile 2" ...etc. This is similar to using the "New" button in the
ProfileSettings dialog.
- Since the favourite profile feature was removed in commit 28ba920c82,
there is no need to sort profiles by menu index, this simlifies the code
some more.
- Remove Profile::menuIndexAsInt() method, now it's not used anywhere
- This also fixes an issue with sorting the the Default/fallback profile,
since commit ce31d0e235 it would be always sorted at the top of the
list (to signify that it's a special, read-only profile...etc), sorting
by menu index breaks that behaviour:
- create a new profile by editing the Defualt/fallback profile, and give
the new profile a name (Defualt is reserved of course)
- open the profile manager dialog, you'll find the Default/fallback
profile not at the top of the list, until you restart Konsole
This issue was reported by Kurt in
https://invent.kde.org/utilities/konsole/-/merge_requests/351#note_197432
Let the Default/fallback profile be shown in the Profile Manager dialog,
and disable the Edit and Delete buttons for it, it can be "cloned" by
using the New button.
BUG: 433210
FIXED-IN: 21.04
- Differentiate between a profile being deleteable and writable:
- Disable the Edit key for read-only profiles, i.e. a '.profile' that
doesn't have write permissions for the user
- Disable the Delete key for a '.profile' that is in a directory that
isn't writable for the user (i.e. a .profile can be read-only, but
still deleteable by the user)
- Change the model selection mode to single selection, that simplifies
the code, besides it looks like editing more than one profile at the
same time hasn't worked for a while, and there are no complaints AFAICS;
remove the now redundant selectedProfiles() method.
- Show profile path as tooltip, for the fallback profile show
"Built-in/hardcoded"
- Add " [Read-only]" to the Default/fallback profile name
- Make the font of the current default profile bold to match the menu
in 'File -> New Tab'
- Change the text added to the current default profile to " default", i.e.
lowercase, to differentiate between it and the fallback profile, which
is called Default
Fix indentation in switch/case statements.
Now the 'File->New Tab' menu is updated when the default profile is
changed, i.e. the action font is made bold and the favourites icon
emblem is added to the profile icon.
A call to menu()->setDefaultAction() has been removed, as I don't see
what it serves exactly in the current code.
Reported by khindenburg in:
https://invent.kde.org/utilities/konsole/-/merge_requests/351
This happens because in ViewManager::sessionFinished(),
the 'view' is delayed deleted which means that it is not removed
from its containing splitter until the next event. However,
toggleActionsBasedOnState() is called immediately which makes its
decisions based on the current splitter state with the view still
present.
In order to avoid any possible object lifetime issues caused by
changing the way the view is deleted, or trying to remove it from the
view immediately, the call of toggleActionsBasedOnState() is instead
delayed until the view has been destroyed (and therefore removed from
its splitter).
This will fix most of the zsh themes reflow, still working on other
themes.
zsh command line position is different from other shells, it is not
where the cursor line is. Konsole is correcting this position.
If it does, then a random letter or number in the font name is underlined
and acts as an accelerator. There is no need for the "Font:" label to
have a buddy either, because the "Choose..." button will already have
one of its own.
- When we match child files/dirs of the current dir, either the item name
is the "filename", or if it's a child-dir/somefile, then filename starts
with "child-dir + '/'".
To test create a file foo and a dir bar with a bar-file inside it then:
- `ls`, foo and bar should be underlined
- `ls bar/*`, bar/bar-file should be underlined
- type bar..., before it would be underlined, after it won't be
- Capture QString by reference in lambda.
Only '.' and '..' could be valid hotspots, but '..........' isn't. The
latter is used by some CLI tools to indicate progress ...etc.
To test, in any dir use `ls -a`, Ctrl + clicking '.' and '..' should
open the current dir and parent of the current dir respectively.
Type .......... at the prompt, before it would get underlined, after no
hotspot will be created for it.
BUG: 432779
It seems there is no way around checking for the extension then falling
back to letting QMimeDataBase examine the file contents; e.g. a file
named konsolerc, doesn't have an extension, but it is still a text file.
We can just remove the files on disk and with the RemoveDeadEntries
option set to true KNS will check if the files still exist. If
not the entry will be marked as not installed.