Commit Graph

121 Commits

Author SHA1 Message Date
Kurt Hindenburg
5bda57405e Fix crashes in testTerminalInterface
Certain user profiles crash here

   from /lib/x86_64-linux-gnu/libQt5Widgets.so.5
    this=0x5555557c8da0, name=..., visible=true)
    at src/konsole/src/session/SessionController.cpp:2206
    mode=1) at src/konsole/src/Screen.cpp:2395
    at src/konsole/src/Vt102Emulation.cpp:1071
    this=0x555555dc2a30, cc=7)
2023-08-18 20:14:16 -04:00
Nicolas Fella
f3a9066dd5 Port away from KNotification::CloseWhenWidgetActivated 2023-08-17 19:45:37 +00:00
Friedrich W. H. Kossebau
451ed33d63 Add explicit moc includes to sources for moc-covered headers
* speeds up incremental builds as changes to a header will not always
  need the full mocs_compilation.cpp for all the target's headers rebuild,
  while having a moc file sourced into a source file only adds minor
  extra costs, due to small own code and the used headers usually
  already covered by the source file, being for the same class/struct
* seems to not slow down clean builds, due to empty mocs_compilation.cpp
  resulting in those quickly processed, while the minor extra cost of the
  sourced moc files does not outweigh that in summary.
  Measured times actually improved by some percent points.
  (ideally CMake would just skip empty mocs_compilation.cpp & its object
  file one day)
* enables compiler to see all methods of a class in same compilation unit
  to do some sanity checks
* potentially more inlining in general, due to more in the compilation unit
* allows to keep using more forward declarations in the header, as with the
  moc code being sourced into the cpp file there definitions can be ensured
  and often are already for the needs of the normal class methods
2023-07-28 12:17:12 +00:00
Theodore Wang
09237ee02f Fixed search bar false positive after clear scrollback (and reset)
To prevent the search bar from continuing to show a match by emitting
green even after clearing scrollback and resetting, search is rerun
whenever the searchbar is opened.

BUG: 407317
2023-06-16 17:10:58 +00:00
Tobias Fella
53d473cff3 Port to KF6 2023-05-29 16:17:23 +00:00
Matan Ziv-Av
b69a2b88ef Add a menu option for monitors to only notify once.
When this option is enabled, the monitors (prompt, activity, silence,
process termination) are disabled automatically after one notification.
2023-05-14 14:15:19 +00:00
Matan Ziv-Av
542a04560d Add "Monitor for Prompt" action
When semantic shell integration is enabled, Konsole will generate a
notification when a shell prompt is displayed.
2023-05-14 14:15:19 +00:00
Luis Javier Merino
6466523141 Use correct kcmshellX for QtX version - Fix typo in d962ae00c 2023-03-27 21:19:23 +00:00
Laurent Montel
d962ae00c3 Use kcmshell6 on kf6 2023-03-26 20:43:39 +02:00
Waqar Ahmed
703e1c0747 Use userTitle on windows for tabTitle
Otherwise its just ": -"
2023-03-09 11:16:35 +05:00
Waqar Ahmed
efb1686e62 Make konsole compile on windows 2023-03-09 11:16:35 +05:00
Magno Lomardo
d3fa26f65b Add the context menu options to split the view left-right and top-bottom
FEATURE: 415724
2023-03-06 22:41:41 +00:00
Matan Ziv-Av
60a534a2e7 codecNameTrigger's parameter is a QString, not QByteArray. 2023-02-26 12:28:35 +00:00
Matan Ziv-Av
0717268d03 Fix a typo in e98a6a19ff
the cases for version >= 5.103 and < 5.103 are reversed
2023-02-26 12:28:35 +00:00
Nicolas Fella
e98a6a19ff Port away from deprecated KCodecAction API 2023-02-24 01:05:24 +00:00
Matan Ziv-Av
7f6f2c1cea Make keyboard selection mode independent of read only mode 2023-02-24 00:18:16 +00:00
Matan Ziv-Av
0375b56d74 Allow pressing Esc to quit keyboard selection mode 2023-02-24 00:18:16 +00:00
Waqar Ahmed
0a78bfe4ac Fix inconsistent dll linkage errors and warnings on windows 2023-02-23 23:53:26 +00:00
Nicolas Fella
f51caadf3e Fix applying default encoding from KCodecAction
Currently selecting 'Default' in the codec selector doesn't do anything

Connect to the relevant signal and apply the profile's default encoding
2023-01-02 14:52:16 +00:00
Aleix Pol
d3c36c3419 Fix crash using yakuake
The hamburger menu seems to be null.

```
/home/apol/devel/frameworks/kconfigwidgets/src/khamburgermenu.h:97
menu=0x5580261dbe80) at
/home/apol/devel/frameworks/kconfigwidgets/src/khamburgermenu.cpp:109
Konsole::SessionController::showDisplayContextMenu (this=0x558025dfa2d0,
position=...) at
/home/apol/devel/frameworks/konsole/src/session/SessionController.cpp:1990
QtPrivate::FunctorCall<QtPrivate::IndexesList<0>, QtPrivate::List<QPoint
const&>, void, void (Konsole::SessionController::*)(QPoint
const&)>::call (f=(void
(Konsole::SessionController::*)(Konsole::SessionController * const,
const QPoint &)) 0x7f728c8a1920
<Konsole::SessionController::showDisplayContextMenu(QPoint const&)>,
o=0x558025dfa2d0, arg=0x7ffdb36086c0) at
/home/apol/devel/kde5/include/QtCore/qobjectdefs_impl.h:152
```
2022-12-04 08:06:39 +00:00
Andrey Butirsky
b8325d2f18 fixup! Adopt KHamburgerMenu 2022-11-29 23:03:54 +04:00
Nate Graham
b04265e9fa Adopt KHamburgerMenu
It's amazing!

BUG: 439895
FIXED-IN: 23.04
2022-11-29 23:03:54 +04:00
Friedrich W. H. Kossebau
3213a17798 Port away from deprecated KMessageBox Yes/No API
Using "Yes" & "No" text labels on dialog buttons is discouraged by not
only the KDE HIG these days. Yet the legacy API of KMessageBox was
using Yes & No as terms in its API, conflicting with what the HIG
recommends and trapping HIG-unaware developers into thinking to use
Yes & No buttons.

New substitute API uses the term "action" instead, matching the concept
proposed by the KDE HIG.

GIT_SILENT
2022-10-16 04:11:14 +00:00
Matan Ziv-Av
f26f71db01 Add keyboard selection mode
Similar to screen copy/scrollback mode it allows browsing the scrollback
and selecting text.

Selection is done either by standard GUI shift+arrows, or `vi` style with
`v` starting/ending selection.

BUG: 100317
2022-10-03 10:46:46 +00:00
Kurt Hindenburg
6ff683d5d2 Spelling fixes 2022-09-30 14:04:38 -04:00
Jose Flores
87e25c62a4 Checks if a profile is editable before showing the edit profile menu action 2022-09-30 16:54:36 +00:00
Laurent Montel
2ddb680bee Remove unused includes 2022-09-28 04:50:24 +00:00
Laurent Montel
fc45802b72 Port away from deprecated KIO code 2022-08-21 21:02:16 +02:00
Friedrich W. H. Kossebau
17796fb8f4 Port away from deprecated KMessageBox::sorry
GIT_SILENT
2022-07-22 18:32:31 +00:00
Friedrich W. H. Kossebau
91b7c1a03b Session close confirm dialog: use action terms instead of Yes/No buttons
Yes/No buttons in dialogs are discouraged (not only) by KDE HIG in favour
of actions terms.
2022-07-11 15:07:21 +00:00
Harald Sitter
87e27eb811 automatic clang-format run (clang 14) 2022-07-11 11:43:02 +02:00
Luis Javier Merino Morán
25f49b723d Support XdgActivation for focus from notification
To support focusing a session from a notification in Wayland, we need to
use the XdgActivation protocol.  This is done by passing to
KWindowSystem an XDG activation token that we get from the notification.
2022-07-05 09:04:52 +00:00
Luis Javier Merino Morán
8fb6899389 Focus session from notification
Adds a "Show session" button to notifications, which, when clicked, will
focus the originating session.

Original patch by Kasper Laudrup at bug 305162, then updated by Martin
T. H. Sandsmark.

Now updated and extended to silence/activity/process termination
notifications, adding support for focusing a TerminalDisplay inside a
hierarchy of ViewSplitters inside a TabbedViewContainer, and using
KWindowSystem::forceActiveWindow() instead of ::activateWindow().

BUG: 305162
BUG: 344208
2022-07-05 09:04:52 +00:00
Luis Javier Merino Morán
416941b714 Snapshot session on focus, key press and output
Before 3d6c839b, sessions were snapshotted every 2 seconds, and also
half a second after the associated view received focus or a key press.
This second timer could theoretically be postponed indefinitely.

Commit 3d6c839b tries to save energy by not taking a snapshot every 2
seconds, and instead has a timer that fires half a second after any
event received by the application.

This commit goes back to the old behavior, but still without the 2
second timer, and also sets the half second timer after receiving the
Emulation::outputChanged signal, which is sent at a maximum 40ms after
the emulation receives data.  It also copies the idea from commit
3d6c839b of not restarting the timer if it's already started, since
otherwise, continuous output could postpone the timer indefinitely.
2022-07-05 08:59:55 +00:00
Matan Ziv-Av
9333d6713a Add semantic integration copy actions
- Selecting Copy (or pressing ctrl-shift-c) when there is no selection
  selects current output if current mode is output, current input if
  current mode is input and input is non-empty, and last output if current
  input is empty.
- Ctrl + mouse triple click selects the pointed input/output/prompt.
- There is also a fix that was missed in previous patch for keeping
  track of current semantic mode through scrolls.
2022-07-04 23:53:48 +03:00
Matan Ziv-Av
5389ec11b0 Fix bugs in semantic shell integration
Bugs reported here:
https://invent.kde.org/utilities/konsole/-/merge_requests/691#note_480025
- Properly ignore OSC parameters for now. (later we'll support some).
- Handle Input end for when command gets shorter.
- Always draw separating line in foreground color
- Don't group characters of different REPL type.
- Don't reset double width/height attributes of erased lines.
2022-07-03 21:40:56 +03:00
Matan Ziv-Av
d67de797b6 Allow filtered copy to clipboard
This adds three copy actions:
- Copy only user input
- Copy only command output
- Copy both (filter out shell prompts).
2022-07-03 07:58:54 +00:00
Laurent Montel
128e7766da Fix compile against qt6 2022-06-24 08:00:17 +02:00
Georg Gadinger
7f41a38371 Improve usability on macOS including altering shortcuts
This change removes some application attributes that are not necessary anymore (like disabling the global menu bar) or make Konsole behave slightly different when used from a KPart (e.g. inside Kate), and changes some keyboard shortcuts around (mainly using Command instead of Ctrl+Shift now.)

Unfortunately this does not resolve the requirement for the special keytab file for macOS; it looks like Qt does something funny with the QKeyEvents here: on Linux these have a `text` attribute set to e.g. `\u0003` for `^C`, that attribute is empty on macOS.

Note this could impact shortcut changes on non-macOS systems.
2022-06-21 00:10:44 +00:00
Ahmad Samir
3b58e4a9ac More Qt6 build fixes
- Port QStringRef to QStringView (using Q5StringRef::toInt() because
  Q5StringView::toInt() uses toString() internally to get a QString
  which defeats the point of using a view)
- Fix creating a QKeySequence from OR'ing Qt::Key and Qt::Modifiers by
  explicitly constructing a QKeySequence; IIUC, this is due to the two
  values coming from two different enums:
  "cannot convert ‘QIncompatibleFlag’ to ‘const QKeySequence&’"
- Implicit cast from int to QChar is gone in Qt6
- Implicit cast of QString to QFileInfo is gone in Qt6
- Create a QByteArray to make QStringBuilder work
- QHash::const_iterator can't be used in place of a
  QMultiHash::const_iterator
2022-06-01 14:35:49 +00:00
Benoît DÉCHAMPS
3d6c839bcd Do not snapshot session when idle
There is no reason for a tab title to change if there is no QT event.
So, instead of snapshoting session regularly, we do it only if there is
some QT events. To catch all QT events an event handler is installed on the
QCoreApplication instance.
2022-05-30 07:13:57 +00:00
ivan tkachenko
fca0f4f9d7 Rename "fallback" profile to Built-in
* Rename everything related to built-in profile both in code and UI.

* Unified style for [Read-only] and [Default] badges in profile
  manager's list model.

* Change --fallback-profile option to --builtin-profile.

* Backward compatibility: yes. If a user happened to name their
  profile "Built-in", it would continue to work as normal, and even
  load with `--profile "Built-in"` command line flag. It will let them
  modify any property including Name; but changing the name back
  to "Built-in" shows a warning and reverts the change as usual.

* Remove "This option is a shortcut for" sentence. While it is still
  technically possible to pass built-in profile's magic path, this
  option is not a shortcut, nor implemented as such.

* Delete extra naming conditions in ProfileManager::changeProfile,
  because they could never be triggered anyway, due to pre-flight
  checks in EditProfileDialog::isProfileNameValid. Automatic unique
  profile names generation has been done even earlier in either
  SessionController or ProfileSettings. Just as before, users will
  continue experiencing a generic "A profile with the name \"%1\"
  already exists." message.

Tests:

* Improve test for uncreatable file name of built-in profile.

* Add backward compatibility test for loading existing profile
  named "Built-in" which also references real built-in as its parent.

BUG: 438309
2022-05-25 11:15:17 +00:00
Ahmad Samir
33b3a1a7a7 Port away from using QObject::sender()
By passing the sender object as an arg to the signal/slot.
2022-05-24 13:02:59 +00:00
Luis Javier Merino Morán
9dadb7b562 Fix regression preserving tcsh command prompt
Commit c3b3ef19 introduced a regression when invoking the
clear-history-and-reset action.  While RIS (Reset to Initial State) is
specified in DEC STD-070 as homing the cursor, konsole has grown some
hacks in the name of usability to preserve the command prompt line.

For a long time, it has sent two SIGWINCH with changed sizes after clear
and reset actions to force the shell to redraw the prompt (see d346a2cc,
temporarily disabled on 5d61b69e and re-added on 82778e87), which works
for bash, zsh, ksh, ...

tcsh doesn't redraw its prompt on SIGWINCH, but commit b8e96bcd modified
Screen::refresh() so instead of clearing the entire screen and homing
the cursor, it scrolled up everything but the last (usually the prompt)
line.

So, keep that last hack when called from clear-history-and-reset, and
behave as specified on DEC STD-070 otherwise.

Note that other ways of clearing the screen don't need hacks, e.g.
Ctrl-L, if handled at all, is handled by the shell, which then redraws
its prompt.  Calling "clear" or invoking "printf '\ec'" will result in
the shell redrawing its prompt in the usual way.

BUG: 453568
2022-05-16 22:51:53 +00:00
Georg Gadinger
45a38cb4b8 SessionController: fix crash when closing a session within a KPart on macOS
otherwise the popup menu will be cleaned up by the QScopedPointer
too early for macOS, apparently...
2022-03-09 07:53:59 +00:00
Tomaz Canabrava
a227af9d6f Remove unused includes 2022-02-05 15:13:58 +00:00
Tomaz Canabrava
913a1acee6 Use KIO::OpenFileManagerWindowJob
This is also not optimal because only two file browsers
implements org.freedesktop.org/FileManager1

Missing filemanagers:
- Konqueror
- Krusader
- Thunar

But at least is freedesktop.org accepted
2022-02-05 15:13:58 +00:00
Tomaz Canabrava
43763804cc Try to launch via DBus - as there is a API for selecting files
If that fails, then manually call dolphin
Currently only Dolphin and Nautilus supports that API call.
2022-02-05 15:13:58 +00:00
Tomaz Canabrava
a158926ae8 Launch dolphin on "Open With File Manager" under a file 2022-02-05 15:13:58 +00:00
Tomaz Canabrava
b3eb91d3f7 Store the current hotspot under mouse
This is important if the actions need to access it later on
2022-02-05 15:13:58 +00:00