Fix: use autosaveFilename format also for files exported via DnD or menu
ClosedPublic

Authored by kossebau on Sep 7 2017, 7:13 PM.

Details

Summary

When exporting the current screenshot directly to applications via a
temporary file holding a copy of the screenshot, the very filename of the
temporary file is then picked up in those programs, e.g. when displaying
the file or creating a local copy. Additionally that name is also passed
in the x-kde-suggestedfilename property on DnD.
With the usage of QTemporaryFile this filename holds some random part, which
makes it less useful.
Switching to a QTemporaryDir instead for getting a non-conflicting
namespace in the temp dirs, and using a normal file with the configured
autosaveFilename format in that dir results in the expected naming of
screenshot files also on export to apps via menu or DnD.

BUG: 382718
FIXED-IN: 17.08.02

Diff Detail

Repository
R166 Spectacle
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
kossebau created this revision.Sep 7 2017, 7:13 PM
kossebau updated this revision to Diff 19295.Sep 7 2017, 9:02 PM

make temporary file readonly

kossebau edited the test plan for this revision. (Show Details)Sep 9 2017, 1:20 PM
kossebau added subscribers: Plasma, KDE Applications.

Given two weeks passed without a comment, I will follow KA release managers' okay to push on own responsibilities now (meh).

If there was a test plan, I could at least try to apply this on my system and verify it works... How exactly the filename should change?

Thanks for the offer, @alexeymin:

Test plans:

Export screenshot image to Gwenview (or other app) via menu:

  1. Take screenshot
  2. Export Image... > Gwenview
  3. Check file name shown in application

Expected:
Matching the filename pattern defined in the settings

Drag and drop screenshot image to Dolphin (or other app):

  1. Take screenshot
  2. Open Dolphin, create a new directory and show it
  3. Use mouse and drag the screenshot image into the directory in Dolphin
  4. Check file name used for the created file

Expected:
Matching the filename pattern defined in the settings

Drag and drop multiple screenshots to Dolphin (or other app):

  1. Edit filename pattern settings to something without variables (so the same name would be used for every screenshot during testing)
  2. Open Dolphin, create a new directory and show it
  3. Take screenshot
  4. Use mouse and drag the screenshot image into the directory in Dolphin
  5. Take another screenshot
  6. Use mouse and drag the screenshot image into the directory in Dolphin

Expected:
No filename conflicts.

alexeymin accepted this revision.Sep 22 2017, 3:20 PM

Thanks for the offer, @alexeymin:

Test plans:

Export screenshot image to Gwenview (or other app) via menu:

  1. Take screenshot
  2. Export Image... > Gwenview
  3. Check file name shown in application Expected: Matching the filename pattern defined in the settings

    Drag and drop screenshot image to Dolphin (or other app):
  4. Take screenshot
  5. Open Dolphin, create a new directory and show it
  6. Use mouse and drag the screenshot image into the directory in Dolphin
  7. Check file name used for the created file Expected: Matching the filename pattern defined in the settings

    Drag and drop multiple screenshots to Dolphin (or other app):
  8. Edit filename pattern settings to something without variables (so the same name would be used for every screenshot during testing)
  9. Open Dolphin, create a new directory and show it
  10. Take screenshot
  11. Use mouse and drag the screenshot image into the directory in Dolphin
  12. Take another screenshot
  13. Use mouse and drag the screenshot image into the directory in Dolphin Expected: No filename conflicts.

Can confirm all 3 cases, filenames matches the configured pattern and no conflicts. I'd say, +1

This revision is now accepted and ready to land.Sep 22 2017, 3:20 PM

Thanks for testing, @alexeymin. Feels better to push with at least knowing one person having had a go at the patch, with positive results :)

This revision was automatically updated to reflect the committed changes.