Bug 388559 - Wish for context menu: Compare two files
Summary: Wish for context menu: Compare two files
Status: RESOLVED FIXED
Alias: None
Product: dolphin
Classification: Applications
Component: general (show other bugs)
Version: 17.08.3
Platform: Other Linux
: NOR wishlist
Target Milestone: ---
Assignee: Dolphin Bug Assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-01-05 11:26 UTC by Gregor Mi
Modified: 2018-01-18 14:31 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gregor Mi 2018-01-05 11:26:21 UTC
CURRENT SITUATION:

1. Select two files in Dolphin that should be compared.
2. Open the context menu to find a compare action => Nothing found.
3. Choose Open With... > kompare
     => Two Kompare instances are opened with the error message
        "Could not parse diff output."
4. Choose Open With... > kdiff3
     => Two KDiff3 instances are opened; files are not compared

WISH:

Similar to the "Compress" submenu in the context menu there could be a "Compare" submenu where the user can select Kompare or KDiff3 to easily compare two files.


CURRENT WORKAROUND:

1. Open a Konsole 
2. Type kompare or kdiff3
3. Drag and Drop the two selected files to the Konsole and choose Paste Location
4. Press Enter
Comment 1 Kai Uwe Broulik 2018-01-05 13:29:36 UTC
Select two files, Control → Extras → Compare Files?
Comment 2 Gregor Mi 2018-01-05 13:41:14 UTC
Oh yes, this works. Thanks for the hint.

I now wonder if the Tools menu is an intuitive place for the Compare action. The other items in the Tools menu all operate on the current directory and not on selected files.

Maybe the Compare action could additionally be added to the context menu > Actions.
Comment 3 Kai Uwe Broulik 2018-01-05 15:11:39 UTC
I just wrote a file item actions plugin for that, it has two drawbacks, though
1.) only works for comparing files of the same exact type (just because both are "text" doesn't neccessarily work :/), seems a limitation on KIO's side
2.) cannot put it in "Actions" sub menu, plugins are always on top level which makes me wonder since the action is hardly qualified to be shown there
Comment 4 Gregor Mi 2018-01-05 15:32:02 UTC
Hmm, not quite satisfactory. Some thoughts:

1) Would it be possible/desirable to extend the KIO plugin system that a plugin author can say: "If there is an Action menu, I would like my plugin menu to be placed there"? This would reduce root menu pollution.

2) KIO plugins could appear in the Actions menu by default. Then the "Compress" menu would also move there. All actions would be consistently together in the same menu, regardless how they are implemented.

3) The Compare action could be added to the Actions menu by Dolphin directly and not by the service menu interface.
Comment 5 Michael Heidelbach 2018-01-05 17:47:56 UTC
This works for me:
$ cat <<EOF > ~/.local/share/kservices5/ServiceMenus/kompare.desktop
[Desktop Entry]
ServiceTypes=KonqPopupMenu/Plugin
Actions=kompare
Type=Service
MimeType=inode/directory;application/octet-stream;
# Uncomment following line to pull it out of Action menu
# X-KDE-Priority=TopLevel

[Desktop Action kompare]
Name=Kompare Files
Icon=kompare
Exec=kompare -c %U
EOF

$ kbuildsyscoca5
1.) Silently ignores selections != 2
Comment 6 Gregor Mi 2018-01-05 20:02:50 UTC
(In reply to ottwolt from comment #5)
> This works for me:
For me too, thanks.

> $ kbuildsyscoca5
            ^
one s too much: $ kbuildsycoca5

Could this service menu file be shipped by default with Kompare or Plasma?
Comment 7 Nate Graham 2018-01-05 21:04:25 UTC
Wanna submit a patch on https://phabricator.kde.org/? ;-) Probably for Kompare, since this wouldn't do anything when Kompare isn't installed.
Comment 8 Kai Uwe Broulik 2018-01-05 21:49:13 UTC
I'm not too happy with it silently ignoring! = 2 selected files as it's not supported. I'll look into extending KIO to allow an action to specify the number of selected items it's offered for.
Comment 9 Michael Heidelbach 2018-01-18 14:31:42 UTC
Git commit 2e557f4065f451161f7bc792f45f3905d22c9684 by Michael Heidelbach.
Committed on 18/01/2018 at 14:33.
Pushed by michelh into branch 'master'.

Added service menu

Summary:

Limitation:
 - Files must be presented in the same dolphin pane

Reviewers: mlaurent

Reviewed By: mlaurent

Subscribers: broulik, safaalfulaij, mlaurent, ngraham

Differential Revision: https://phabricator.kde.org/D9698

M  +1    -0    CMakeLists.txt
A  +2    -0    servicemenus/CMakeLists.txt
A  +11   -0    servicemenus/kompare.desktop

https://commits.kde.org/kompare/2e557f4065f451161f7bc792f45f3905d22c9684