Bug 491961

Summary: Klipper doesn't preserve "application/x-kde-suggestedfilename"
Product: [Plasma] plasmashell Reporter: TraceyC <kdedev>
Component: Clipboard widget & pop-upAssignee: Plasma Bugs List <plasma-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: kde, nate, nilskemail+kde, postix, qydwhotmail
Priority: NOR Keywords: regression
Version: git-stable-Plasma/6.1   
Target Milestone: 1.0   
Platform: Other   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=470131
https://bugs.kde.org/show_bug.cgi?id=492005
https://bugs.kde.org/show_bug.cgi?id=492006
Latest Commit: Version Fixed In: 6.3
Sentry Crash Report:

Description TraceyC 2024-08-21 00:36:34 UTC
SUMMARY
When using any capture area except "Rectangular Region", a screenshot copied with Spectacle can't be pasted in Dolphin. It can be pasted in other applications, such as the browser and LibreOffice Writer.

STEPS TO REPRODUCE
- Open Dolphin

Spectacle Settings:
- When launching, do not take screenshot automatically
- After taking screenshot, copy image to clipboard

1. Copy an image from spectacle, use any type of screenshot except Rectangular Region
2. Attempt to paste the image into Dolphin with Ctrl V
3. Enter a name at the prompt (Note: when the content is properly pasted, the name is auto suggested like with saving to file ex Screenshot_date-time.ico)

OBSERVED RESULT
The name field is blank
The Data type is "application/x-kde-onlyReplaceEmpty"
Nothing is pasted to the folder in Dolphin

EXPECTED RESULT
The name is pre-populated in keeping with the default name settings in Spectacle's settings
The Data type matches the image format (png, tiff, jpg etc)
The image is pasted as a file in the folder in Dolphin

SOFTWARE/OS VERSIONS
KDE Plasma git-master on Solus

ADDITIONAL INFORMATION
Clicking the Copy button in Spectacle allows the image to be pasted in Dolphin as normal

Discovered when testing !391
https://invent.kde.org/graphics/spectacle/-/merge_requests/391

The bug is not present in 24.05.2
Comment 1 Noah Davis 2024-08-21 04:53:02 UTC
> The name field is blank

Klipper doesn't preserve the "application/x-kde-suggestedfilename" hint used by MR 391 after Spectacle is closed, so this is a Klipper bug.

> The Data type is "application/x-kde-onlyReplaceEmpty"
> Nothing is pasted to the folder in Dolphin

You have to manually pick an image format using the format combobox. This is an issue with Klipper and/or KIO.

- Klipper puts "application/x-kde-onlyReplaceEmpty" before the other formats when it would probably be better to ensure it goes last.
- KIO should probably ignore custom mimetypes that are only used as hints.

Nothing is pasted when you keep the format as "application/x-kde-onlyReplaceEmpty" because that hint doesn't actually hold any data.
Comment 2 Nate Graham 2024-08-21 14:51:03 UTC
This is working for me with git master of Plasma, KWin, Dolphin, and Spectacle. Are you able to reproduce it, Noah?
Comment 3 Noah Davis 2024-08-21 15:33:52 UTC
(In reply to Nate Graham from comment #2)
> This is working for me with git master of Plasma, KWin, Dolphin, and
> Spectacle. Are you able to reproduce it, Noah?

Yes, but it's not a spectacle bug.
Comment 4 Nate Graham 2024-08-21 15:36:16 UTC
Ok, then can you move it to the correct place where it should be fixed?
Comment 5 Noah Davis 2024-08-21 15:42:26 UTC
(In reply to Nate Graham from comment #4)
> Ok, then can you move it to the correct place where it should be fixed?

There are 3 issues here, so we'll need 3 bug reports:

1. Klipper doesn't preserve "application/x-kde-suggestedfilename".
2. Klipper puts "application/x-kde-onlyReplaceEmpty" first when it should be near the end of the mimetype list.
3. KIO's paste dialog shouldn't offer custom KDE mimetypes that are only used as hints.

Do I mark this as Not A Bug?
Comment 6 TraceyC 2024-08-21 20:38:22 UTC
I'll keep this report for the first bug and move it to the right place. I'll open two other bugs for the two other issues.
Comment 7 TraceyC 2024-08-21 20:56:17 UTC
I found an older bug 470131 that describes much the same behavior, not sure if this is a duplicate
Comment 8 Noah Davis 2024-08-21 22:21:42 UTC
(In reply to TraceyC from comment #7)
> I found an older bug 470131 that describes much the same behavior, not sure
> if this is a duplicate

Since you changed the title of this report, this report (bug 491961) is now about issue 1. The bug you are referencing (bug 470131) is issue 2.
Comment 9 TraceyC 2024-08-22 16:19:52 UTC
Just noting, I found that if you have Spectacle set to auto save screenshots to a file, the bug cannot be reproduced
With that setting unchecked, the bug happens.
Comment 10 Bug Janitor Service 2024-08-23 10:02:02 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/4636
Comment 11 Bug Janitor Service 2024-08-30 17:42:46 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/4664
Comment 12 Bug Janitor Service 2024-12-10 03:24:20 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/4992
Comment 13 Bug Janitor Service 2024-12-10 03:24:21 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/4992
Comment 14 Fushan Wen 2024-12-10 04:57:10 UTC
Git commit 52844b51e821a490c6e5194fb34bb00abae3933c by Fushan Wen.
Committed on 10/12/2024 at 02:21.
Pushed by fusionfuture into branch 'master'.

appiumtests: reload config through D-Bus to speed up clipboardtest

There is no need to restart the widget to take effect.

M  +1    -1    appiumtests/applets/CMakeLists.txt
M  +157  -223  appiumtests/applets/clipboardtest.py
M  +1    -0    klipper/declarative/qml/ClipboardItemDelegate.qml
M  +3    -0    klipper/declarative/qml/TextItemDelegate.qml
M  +2    -0    klipper/declarative/qml/UrlItemDelegate.qml
M  +17   -11   klipper/klipper.cpp
M  +9    -4    klipper/klipper.h

https://invent.kde.org/plasma/plasma-workspace/-/commit/52844b51e821a490c6e5194fb34bb00abae3933c
Comment 15 Fushan Wen 2024-12-10 04:57:12 UTC
Git commit 72722fc4e8eaafbb7a18f58dca6a1be859fbf950 by Fushan Wen.
Committed on 10/12/2024 at 03:20.
Pushed by fusionfuture into branch 'master'.

appiumtests: add test for saving multiple mime types

The test case tries to put a content provider with multiple mimetypes
into the clipboard and test if the history can remember them.

M  +77   -0    appiumtests/applets/clipboardtest.py

https://invent.kde.org/plasma/plasma-workspace/-/commit/72722fc4e8eaafbb7a18f58dca6a1be859fbf950