Commit graph

212 commits

Author SHA1 Message Date
Serg Podtynnyi 38c34eeca3 Add clang-format and format code as in Frameworks 2023-02-05 12:45:38 +07:00
Felix Ernst 8e55f2c240 Better separation of classes
Make obvious when actions trigger selection mode.
2022-08-14 14:42:40 +00:00
Nicolas Fella 513fe3bb42 Port from KNewFileMenu::setPopupFiles to KNewFileMenu::setWorkingDirectory
The former is deprecated
2022-07-14 11:58:19 +00:00
Alexander Lohnau 0fc218fd26 Drop KNS3 prefix for KMoreTools includes
In KF6 KMoreTools should become it's own library and thus the KNS3 prefix should get removed.
Considering that the classes are not in any namespace, having a namespaced include is not needed and only causes noise.
2022-05-13 19:17:06 +00:00
Felix Ernst b3add25694 Refactor DolphinContextMenu so its actions are retrievable
This mostly red MR should have no visible effect. It is part of my work towards !273.

There are two calls necessary to open the DolphinContextMenu:
One to construct it and one to execute/show it.

Before this commit, the actual populating of the ContextMenu was
done on execute. This meant that the actions of the ContextMenu
couldn't be looked at or changed without first showing the Menu
to the user. It also meant that the construction itself didn't
actually do much constructing/populating at all which might seem
a bit unintuitive.

This commit changes this behaviour so the DolphinContextMenu is
actually populated fully on construction. The executing/showing of
the ContextMenu now does just that and nothing more.

Previously, some actions in the context menu were actually not
wired up to anything and instead the DolphinContextMenu or the
DolphinMainWindow executed some code after the user had clicked
such a dummy action from the ContextMenu. Now all the actions are
properly constructed beforehand and no special handling is
necessary when the ContextMenu hides itself.

This commit removes the pos parameter from the DolphinContextMenu
constructor. This parameter contained the position where the Menu
would be shown later. This information isn't necessary to have on
construction and was already part of the exec(pos) call in the
first place. The variable m_pos that stored the value is removed.

This commit also removes a "customActions" functionality that can
supposedly be used to add further custom actions to the
DolphinContextMenu but this functionality isn't ever used
anywhere so its usefulness is questionable. It also wouldn't be
difficult to re-add this functionality if it was ever required for
something.

This commit also addresses an old TODO in dolphinpart.cpp that
asked for the calls for opening the DolphinContextMenu to actually
contain the information for which items the DolphinContextMenu is
supposed to be constructed. Before this, only the item that was
directly clicked was transmitted and then DolphinContextMenu
retrieved the currently selected set of items by itself.
It makes more sense that DolphinContextMenu would be informed on
construction which items it is supposed to show context actions
for.

Most of this is necessary so we are able to show the contextual
actions anywhere else than in the ContextMenu in the future.

I am targeting 22.08 with this MR because it makes no sense to merge a refactor for the upcoming release already.
2022-04-02 17:00:58 +00:00
Nicolas Fella 3c5bf0c96c Remove calls to no-op KNewFileMenu::setViewShowsHiddenFiles
The implementation doesn't do anything
2021-12-16 20:09:45 +00:00
Alexander Lohnau 55785991be Remove deprecated call to KParts::PartBase::loadPlugins.
With https://invent.kde.org/frameworks/kparts/-/merge_requests/32 this method got deprecated,
and with https://invent.kde.org/network/konqueror/-/merge_requests/99 only the kget plugin is actually loaded.

https://invent.kde.org/network/konqueror/-/merge_requests/100 Takes care of importing the kget plugin to konqueror.
2021-12-16 07:06:58 +00:00
Alexander Lohnau fd717b88fa Drop now unneeded QOverload statements
By defining the KF_DISABLE_DEPRECATED_BEFORE_AND_AT and QT_DISABLE_DEPRECATED_BEFOREvalues,
the deprecated overloads are hidden. This way we only have the un-deprecated one visible.
2021-12-13 08:35:26 +00:00
Nate Graham 27bfcde4ef Port to KTerminalLauncherJob
Dolphin still uses KToolInvocation::invokeTerminal() which is
deprecated and requires KInit. However Dolphin was ported away from
requiring it in other ways, so it is now possible to have Dolphin
running but not KInit, which breaks the "Open in Terminal"
functionality.

Using KTerminalLauncherJob fixes this. It was introduced in Frameworks
5.83, so the CMake dependency version is accordingly increased.

BUG: 441072
FIXED-IN: 21.12
2021-08-31 09:12:16 -06:00
Ahmad Samir 0b81b4baf9 Use KDirLister directly now that it emits a jobError() signal
Since KIO 5.82, KCoreDirLister (the base class of KDirLister) emits a jobError()
signal when the ListJob used internally emits an error.

Drop KFileItemModelDirLister class, now redundant.

This also bump the KF version to 5.82.
2021-07-19 09:57:58 +00:00
Alexander Lohnau cc962cae49
Remove go action for settings kio slave
The settings kio slave is about to be removed, see
https://invent.kde.org/network/kio-extras/-/merge_requests/107.
2021-06-30 15:38:53 +02:00
Nicolas Fella 7c48344d0e Port away from deprecated KToolInvocation::invokeTerminal 2021-02-10 23:08:06 +00:00
Felix Ernst a825e1bd74 Avoid KJob::exec() in DolphinView
This commit replaces an error-prone usage of KIO::StatJob::exec() in
DolphinView with the recommended KIO::StatJob::start().

The containing method DolphinView::statusBarText() is changed to be a
method without return value: requestStatusBarText()
The new status bar text is instead returned through a new
setStatusBarText() signal that will be emitted asynchronously if
necessary.

The calling code that deals with status bar text is refactored to
correctly work despite the new asynchronicity. The helper method
calculateItemCount() is moved into requestStatusBarText() and some
other code from requestStatusBarText() is moved into a new helper
method emitStatusBarText().

The documentation of KIO::KJob::exec() explains why it should be
avoided. A reproducible crash is the reason for this commit.
2021-02-08 21:32:10 +00:00
Piotr Henryk Dabrowski 741072272f update KParts' ReadOnlyPart::localFilePath in DolphinPart::openUrl() 2020-12-29 16:06:40 +01:00
Laurent Montel d2f044b32d operator+/- is disabled for QFlags in qt6 2020-12-09 07:55:44 +01:00
Friedrich W. H. Kossebau 9826d81034 dolphinpart: port to new KPluginMetaData-based KParts API 2020-12-07 22:09:58 +00:00
Friedrich W. H. Kossebau 07b7f76f7c dolphinpart: add JSON metadata to plugin, install into kf5/parts subdir 2020-12-07 22:09:58 +00:00
Alexander Lohnau 97415729c3 Compile with QT_NO_KEYWORDS 2020-10-23 18:23:06 +00:00
Alexander Lohnau a24327cd50 Compile without foreach 2020-10-23 18:23:06 +00:00
Jonathan Marten b02046c548 Select/Unselect dialogue: Retain a history of entries made there
It's a very useful facilitity, and having a history of entries and being
able to recall earlier ones makes it even more useful for repetitive
operations.
2020-09-23 11:07:29 +00:00
Elvis Angelaccio 954e8c4790 Output of licensedigger + manual cleanup afterwards.
Unfortunately licensedigger does not strip the trailing * characters.
While at it, use a common style for all source files.
2020-08-25 17:07:38 +00:00
Ahmad Samir e3c03e466e Port QRegExp to QRegularExpression
Summary:
Port QRegExp::exactMatch() with QRegularExpression::anchoredPattern().
Port QRegExp::Wildcard with QRegularExpression::wildcardToRegularExpression().
Note that QRegularExpression::wildcardToRegularExpression() returns an anchored
pattern.

Test Plan:
Using the filter bar in dolphin works as before.

All unit tests pass, except:
- kfileitemmodeltest (which is unrelated AFAICS); it fails on master too
- placesitemmodeltest, which fails on master too

Reviewers: #dolphin, elvisangelaccio, meven

Reviewed By: #dolphin, elvisangelaccio

Subscribers: kfm-devel

Tags: #dolphin

Differential Revision: https://phabricator.kde.org/D26215
2020-05-06 11:37:38 +02:00
David Faure ec2c69726a DolphinPart: port dolphin's last use of KRun::run to CommandLauncherJob.
Summary:
I chose CommandLauncherJob rather than ApplicationLauncherJob
because that would require either looking up org.kde.kfind.desktop
(with a risk of failure) or duplicating the icon name...

Test Plan:
commented out the if() block of the slot, to make sure we end
up launching kfind with this code. Then konqueror /, and Ctrl+F.

Reviewers: broulik

Reviewed By: broulik

Differential Revision: https://phabricator.kde.org/D28810
2020-04-18 13:07:08 +02:00
Piotr Henryk Dabrowski 6cb4d81a02 Use KParts::ReadOnlyPart::localFilePath() in DolphinPart::slotOpenTerminal()
Reviewers: ngraham, elvisangelaccio, #dolphin

Reviewed By: ngraham, elvisangelaccio, #dolphin

Subscribers: kfm-devel

Tags: #dolphin

Differential Revision: https://phabricator.kde.org/D26140
2019-12-21 12:28:06 -07:00
Laurent Montel 31dd81bb0c Make it compile against last kf5 version without deprecated methods 2019-12-06 13:31:43 +01:00
Piotr Henryk Dabrowski 537dc7864a [Dolphin] Open Preferred Search Tool action
Summary:
Added "Open Preferred Search Tool" action to Tools menu.

It runs preferred (topmost) external search tool as configured in the "More Search Tools" menu.

By default Ctrl+Shift+F shortcut is assigned to this action.

FEATURE: 384798
FIXED-IN: 20.03.80

{F7134238}
{F7134240}
{F7134242}

Reviewers: #dolphin, ngraham, elvisangelaccio

Reviewed By: #dolphin, ngraham

Subscribers: pkloc, kfm-devel, kde-doc-english

Tags: #dolphin, #documentation

Differential Revision: https://phabricator.kde.org/D22594
2019-11-17 18:15:26 +01:00
Noah Davis 0c66610260 Change terminal panel icon to dialog-scripts
Summary: The old icon was a color icon, which does not match the style of other toolbar/menu buttons

Test Plan: {F7321334, size=full}{F7321319}

Reviewers: #dolphin, #vdg, ngraham

Reviewed By: #dolphin, #vdg, ngraham

Subscribers: ngraham, kfm-devel

Tags: #dolphin

Differential Revision: https://phabricator.kde.org/D23740
2019-09-05 11:55:43 -04:00
Elvis Angelaccio 9d11e5d4b4 Get rid of ugly static_cast usages in connect() calls 2019-05-05 17:53:29 +02:00
Elvis Angelaccio 642a427d03 [DolphinViewActionHandler] Rename createDirectory signal
Signals should be named after an event that happened.
2018-10-24 22:49:01 +02:00
Roman Inflianskas ec12391a1b Convert hard coded shortcuts to standard keys
Test Plan: Check all changed shortcuts on all platforms.

Reviewers: #dolphin, rizzitello, elvisangelaccio

Reviewed By: #dolphin, rizzitello, elvisangelaccio

Subscribers: anthonyfieroni, ngraham, elvisangelaccio, rizzitello, #dolphin

Differential Revision: https://phabricator.kde.org/D11048
2018-04-13 21:33:18 +03:00
Roman Inflianskas 48b58f830a Remove unused #include
Summary: I used CLion inspection to hunt all unused #include

Reviewers: #dolphin, elvisangelaccio, markg

Reviewed By: #dolphin, elvisangelaccio, markg

Subscribers: bcooksley, markg, elvisangelaccio, #dolphin

Differential Revision: https://phabricator.kde.org/D10985
2018-03-04 21:00:47 +03:00
Roman Inflianskas 32bd8efc7f Modernize the syntax of shortcuts
Reviewers: #dolphin, markg

Reviewed By: markg

Subscribers: markg, elvisangelaccio, #dolphin

Differential Revision: https://phabricator.kde.org/D10986
2018-03-03 16:44:29 +03:00
Elvis Angelaccio 6cf74d2fdd Don't show 'Open Terminal' on Windows
We already disable the TerminalPanel on Windows, we should do the same
with the 'Open Terminal' action for consistency.
2018-01-21 12:15:07 +01:00
Kevin Funk a6db5029ac Modernize: Use nullptr everywhere 2017-11-21 10:53:12 +01:00
Elvis Angelaccio 2fd85facf8 Fix DolphinRemoveAction Shift toggling on Wayland
QGuiApplication::queryKeyboardModifiers() does not work on Wayland [1].
We don't need it in the first place, since we already know (thanks to
the key events) whether Shift has been pressed or released.
So we can just pass this information to DolphinRemoveAction::update().

BUG: 354301

[1]: https://bugreports.qt.io/browse/QTBUG-62786

Differential Revision: https://phabricator.kde.org/D7519
2017-09-07 21:31:42 +02:00
Elvis Angelaccio 5481709016 Port to KStandardAction::RenameFile
It was introduced in kconfig(widgets) 5.25. Using the standard action
results in less code and no need to hardcode the F2 shortcut.

Differential Revision: https://phabricator.kde.org/D6777
2017-08-09 22:59:38 +02:00
Elvis Angelaccio 4b5ea05b67 Port to KStandardAction::MoveToTrash
It was introduced in kconfig(widgets) 5.25. Using the standard action
results in less code and no need to hardcode the Del shortcut.

Test Plan:
- Change shortcut in System Settings -> Shortcuts -> Standard Shortcuts
- Make sure the new shortcut is used by dolphin.

Differential Revision: https://phabricator.kde.org/D6778
2017-07-27 16:15:03 +02:00
Elvis Angelaccio aa771da32d Add missing emit keywords
GIT_SILENT
2017-07-13 17:11:33 +02:00
Elvis Angelaccio 68bb0ec22a Port to KStandardAction::DeleteFile
Summary:
It was introduced in kconfig 5.25 and it properly handles the shift+del
shortcut (together with kxmlgui >= 5.30). This allows us to drop the
custom delete shortcut as well as the shift+del workaround in
DolphinMainWindow.

Test Plan: Shift+Del still deletes files, without the 'ambiguous shortcut' warning dialog.

Reviewers: emmanuelp

Differential Revision: https://phabricator.kde.org/D5010
2017-03-13 19:40:07 +01:00
Jonathan Marten 16db90c793 Dolphin Part: Update the paste action at the end of the listing
Fixes a problem with the paste action not being enabled, only seen in
Konqueror.

BUG:369523
REVIEW:129448
2016-12-06 06:59:49 +00:00
David Faure 345e3e7a82 Follow changes in konqpopupmenu: no longer back/forward/up in part's contextmenu. 2016-09-28 16:44:22 +02:00
David Edmundson 25cc15a5a2 Port all instances of Kauthorized action/shell_command to shell_command
The KAuthorized key to prevent shell access according the documentation
is simply "shell_action" not "action/shellAction" so should use
authorize not authorizeKAction

This appears to have come about as part of a porting bug when going from
KApplication::authorize to KAuthorized in kdelibs3 to kdelibs4.

To currently block shell access a sysadmin currently needs to
have both keys set already, so we can be confident it won't have any
actual compatibility problems.
2016-05-26 13:51:35 +01:00
David Edmundson 3b95644fa1 Don't allow opening the terminal if shell_access Kiosk mode is set
DolphinPart already did this. Dolphin itself didn't have this feature.

REVIEW: 127951
2016-05-18 10:11:36 +01:00
Artur Puzio 5593c252e8 [CLAZY] Fixed all level 1 and level 2 warnings with small exceptions
REVIEW: 126771
2016-03-16 22:17:37 +01:00
Hrvoje Senjan adeaab9745 Fix build in a kdelibs4-free enviroment
If one had kdelibs includes in /usr, they would get magically
picked up, so the build would succeed.
2015-02-27 20:17:59 +01:00
Emmanuel Pescosta 832e157ecd Port away from KDELibs4Support (we only use KDELibs4Support when baloo isn't present, because KFileMetaDataWidget is in KDELibs4Support)
Reviewed-By: Vishesh Handa
2015-02-26 18:10:42 +01:00
Hrvoje Senjan f6b4f56216 Fix build on Jenkins (or with BUILD_TESTING=ON) 2015-02-24 17:07:55 +01:00
Emmanuel Pescosta b2ad2c076c Fix the build of kde-baseapps temporarily (categorized logging in DolphinPart) 2015-02-24 15:52:45 +01:00
Emmanuel Pescosta 169cca55b9 Replace kDebug/kWarning by categorized logging (org.kde.dolphin) 2015-02-24 13:07:35 +01:00
David Faure 2a561317c6 Remove unused libkonq includes 2014-12-25 10:16:12 +01:00