Commit Graph

58 Commits

Author SHA1 Message Date
Ahmad Samir
e3a5c10bb6 Make HotSpot::setupMenu() return a list of the added actions
Useful when removing the open-with actions from the session menu before
adding new ones.
2021-09-02 22:32:36 +02:00
Ahmad Samir
40cf8519d7 For the fallback profile change the menu text to "Create New Profile"
This is less confusing; also matches what the code actually does.

BUG: 440885
FIXED-IN: 21.12
2021-08-31 23:47:11 +00:00
Ahmad Samir
4cab54d2bb Don't connect more slots to EditProfileDialog::accepted() signal
This is similar to commit c413d543c1, EditProfileDialog's base class
(KPageDialog) already connects OK button clicked signal to accepted() signal;
creating another connection to accepted() in SessionController (which
creates the EditProfileDialog object), means the code will be run twice, not
ideal. Instead put the logic in EditProfileDialog::save() which is called by
the EditProfileDialog::accept() slot.

The same goes when ProfileSettings creates an EditProfileDialog.
2021-08-02 15:47:29 +00:00
Jonah Brüchert
4a5e7a5644 Revert "TerminalDisplay: Move out common pasting related code"
This reverts commit 8e8b924353.
2021-07-06 21:15:06 +02:00
Jonah Brüchert
8e8b924353 TerminalDisplay: Move out common pasting related code 2021-06-24 08:39:46 +00:00
Ahmad Samir
4ef7296b94 General code cleanup
- Add a type alias for QPointer<Session>
- Use TerminalDisplay::setSessionController() as early as possible
- Use Screen::setCurrentTerminalDisplay() in TerminalDisplay::mousePressEvent(),
  this matches what's being done in keyPressEvent()
- Add convenience function TerminalDisplay::currentSession()
- More const
2021-06-22 11:52:06 +02:00
Ahmad Samir
e805f086fe Change EditProfileDialog window title when creating a new profile
Now when creating a new profile, the title will be "Create new profile",
this is less confusing when the user tries to edit e.g. the Fallback profile,
which in effect will create a new profile as the Fallback one is immutable.
2021-04-04 14:40:30 +00:00
Ahmad Samir
94505d94d4 Make the "Edit Current Profile" dialog modal
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.
2021-03-23 16:55:35 +00:00
Ahmad Samir
61a7947adb Show dialogs with show() rather than exec()
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.
2021-03-23 16:55:35 +00:00
Ahmad Samir
5ab8423139 Don't edit the Fallback profile, instead create a new one
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.
2021-03-18 02:47:57 +00:00
Ahmad Samir
d06ea23903 Use Q_EMIT instead of emit
In C++20 there are new classes that have member functions named emit().
c.f.:
https://lists.qt-project.org/pipermail/development/2020-February/038812.html
https://en.cppreference.com/w/cpp/io/basic_osyncstream/emit

A similar change was done in the Frameworks:
https://invent.kde.org/frameworks/kio/-/merge_requests/315
2021-02-15 23:52:07 +00:00
Christoph Cullmann
0bc553fd51 delete client builder before d-pointer of KXMLGUIClient is killed
BUG: 432421
2021-02-06 09:43:49 +00:00
Carlos Alves
5bbb433494 Adding version checks to deprecated functions
Macros to check frameworks versions and switch from deprecated functions
to newer versions.
KProcess: pid -> processId
KCodecAction: setDelayed -> setPopupMode
KActionMenu: triggered -> codecTriggered
2021-01-03 07:31:52 -03:00
Carlos Alves
343d8595d7 Remove deprecated functions
Konsole minimum required version is QT 5.14 and KF5 5.71, there is no
need to keep support for those deprecated functions.
2021-01-02 14:12:09 +00:00
Gustavo Carneiro
fd59b50e6c Move font methods to a new TerminalFont class. 2020-12-23 03:48:30 +00:00
Gustavo Carneiro
1c0ed51e38 Rename extensions .hpp to .h in TerminalDisplay files. 2020-12-13 20:26:31 -03:00
Tomaz Canabrava
d7a411b8bc Fix wrong rebase / fix build. 2020-12-13 12:17:12 +00:00
Ahmad Samir
9eddcdb204 SessionController: use session() and view() member functions
They make reading the code easier than
_sessionDisplayConnection->view()/session().

GIT_SILENT
2020-12-13 14:08:52 +02:00
Gustavo Carneiro
72d604c6cc Move terminal color methods to a new class TerminalColor. 2020-12-12 21:07:49 +00:00
Laurent Montel
8242763fb3 operator+/- is disabled for QFlags in qt6 2020-12-09 07:57:05 +01:00
Ahmad Samir
7342cbea10 SessionController: use the same logic for the other if blocks
Make the code more readable by using some local vars.
2020-12-02 04:05:31 +00:00
Ahmad Samir
d74c0b1533 Fix if condition when updating filters
We want to delete the _escapedUrlFilter if allowEscapedLinks() is false.
2020-12-02 04:05:31 +00:00
Ahmad Samir
11987c7ae4 Minor code optimisation
Pass Profile::Ptr by reference. Make some local vars const.
2020-12-02 04:05:31 +00:00
Ahmad Samir
12c236c5fe FileFilter: update the QRE pattern if "word characters" change
Add a new function to update the regex pattern in FileFilter, rather than
recreating a FileFilter object.
2020-12-02 04:05:31 +00:00
Ahmad Samir
3711e884c9 SessionController: don't delete actions removed from QMenu manually
This isn't needed as QMenu takes care of deleting removed actions (that
are children of it). Confirmed with QObject::connect() call on
QObject::destroyed signal. And skimming the upstream QMenu::actionEvent()
code.
2020-11-30 15:16:15 +00:00
Ahmad Samir
0f6424497b SessionController: iterate over a const container
Also remove the action from the menu then delete it.
2020-11-26 00:20:10 +00:00
Ahmad Samir
043c424af5 SessionContoller: fix crash when closing session from Konsole KPart
_preventClose has to be set to false right at the end, so as to prevent
crashes if the user selects the "close session" action from the context
menu in a Konsole KPart (e.g. the terminal panel in Dolphin).

Check menu object isn't null before deleting actions from it.

BUG: 429538
2020-11-26 00:20:10 +00:00
Gustavo Carneiro
be969f454b Add a new color filter to preview color in hotspot. 2020-11-21 20:18:46 +00:00
Tomaz Canabrava
437d967625 Add bogus icons to Monitor* actions
This is just to help visualization, as there are no icons for this yet.
2020-11-13 17:18:51 +00:00
Tomaz Canabrava
f4f35e9fab Add the possibility to change the Profile from the Toolbar 2020-11-13 17:18:51 +00:00
Kurt Hindenburg
62f091f0a3 Convert session to use SPDX license/copyright
https://community.kde.org/Policies/Licensing_Policy#SPDX_Statements
https://community.kde.org/Guidelines_and_HOWTOs/Licensing
2020-11-12 21:34:59 -05:00
Carlos Alves
53af2a7fb9 Fix 'Copy Location' and 'Open With' issues with context menu
Update mouse events in mousePressEvent so the events are updated with the mouse stopped as well as moving.

BUG: 426359
BUG: 423860
FIXED-IN: 20.08.3
2020-10-26 00:06:53 +00:00
Kurt Hindenburg
9de3b239d5 Previous commit should be attributed to Yash Tiwari <yasht@mailbox.org> 2020-10-23 21:26:33 -04:00
Carlos Alves
44f00a490a Fix duplicates link-related entries in context menu
BUG: 426808
FIXED-IN: 20.08.3

!237
2020-10-23 21:11:55 -04:00
Laurent Montel
b626359501 If include is define in .h remove it if it's defined in .cpp too (scripted) 2020-10-23 07:45:13 +02:00
Gustavo Carneiro
81a3e4f77a Use SessionDisplayConnection. 2020-10-19 21:29:53 +00:00
Gustavo Carneiro
5c9c22fab3 Move TerminalDisplay to terminalDisplay folder. 2020-10-07 03:12:43 +00:00
Kurt Hindenburg
2b7bd65ab5 Allow KF 5.68 to work
Ubuntu 20.04 LTS only has KF 5.68 and Qt 5.12 so let's allow those
to work for now.
2020-10-06 22:46:02 -04:00
Ahmad Samir
2fd589f161 Port KRun (deprecated) to KIO::OpenUrlJob 2020-10-04 22:13:35 +02:00
Gustavo Carneiro
662d3ee947 Remove session folder in includes. 2020-09-28 02:01:03 +00:00
Martin Hostettler
f4bc91f1f7 Match OSC reply sequence terminator to OSC request terminator.
Traditionally konsole only was able to parse OSC sequences terminated with
non-standard BEL. In 324d78c07f konsole was extended to parse sequences
terminated by 7-bit ST (ESC \) as well. But the OSC responses were still
hardcoded to reply only with sequences with BEL. But replying to 7-bit ST
terminated sequences with a reply terminated by a non-standard terminator
is wrong.

This commit passes the terminator along and changes the response to match
the original request.

printf "\033]10;?\a" replies with "^[]10;rgb:fcfc/fcfc/fcfc^G"
printf "\033]10;?\033\\" replies with "^[]10;rgb:fcfc/fcfc/fcfc^[\"
2020-09-26 14:11:11 +00:00
Nate Graham
c8bd9a816b Re-word tab context menu's "Configure" item/dialog title for clarity
- Make it confirm to the Label HIG (must start with a verb)
- Remove the redundant word "Current", which is implied
- Add the word "Rename" for clarity
- Rename the name of the resulting dialog for clarity

BUG: 426344
FIXED-IN: 20.12
2020-09-14 17:44:21 -06:00
Nicolas Fella
ac49d1e8da Port away from KToolInvocation::kdeinitExec
See https://phabricator.kde.org/T12185
2020-09-04 22:28:32 -04:00
Kurt Hindenburg
140ec1d7db Revert "Port away from KToolInvocation::kdeinitExec"
This broke all the tests

This reverts commit ac8799ba58.
2020-09-02 08:48:19 -04:00
Nicolas Fella
ac8799ba58 Port away from KToolInvocation::kdeinitExec
See https://phabricator.kde.org/T12185
2020-08-16 11:30:06 +00:00
Tomaz Canabrava
faceafcc68 Extract URL from a Escape Sequence and provide a HotSpot for activation
This path adds a new feature for konsole, in the form of URL Escaped
Sequences. It allows programs to embbed URL's on texts much like
the anchor tag in html does

There's a allowed list of possible schemas for links, by default
it only accepts http://, https:// and file:// but the user can
add more if he wants.

The maximum amount of URL's accepted is 200, to prevent OOM

History is taken into account while scrooling
2020-08-12 08:20:58 +00:00
Tomaz Canabrava
12530124e8 Revert "Revert "Movo Session to a independent static library""
This reverts commit f4bf8a426b.
2020-08-09 15:27:18 +00:00
Tomaz Canabrava
f4bf8a426b Revert "Movo Session to a independent static library"
This reverts commit 4a0f1195b9.
2020-08-09 15:09:43 +00:00
Gustavo Carneiro
4a0f1195b9 Movo Session to a independent static library 2020-08-06 14:07:35 +00:00
Tomaz Canabrava
c71a0b3f3e Move ProfileDialog to widgets
And fix build using OpenSUSE flags
2020-07-29 17:22:14 +02:00