Bug 356998 - After cropping a .jpg image and cancelling/denying the crop operation, the preview icon shows the cropped version in the directory browser
Summary: After cropping a .jpg image and cancelling/denying the crop operation, the pr...
Alias: None
Product: gwenview
Classification: Applications
Component: general (show other bugs)
Version: Git (add output of "git log -1 --oneline" to description)
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Gwenview Bugs
Depends on:
Reported: 2015-12-21 12:40 UTC by Shlomi Fish
Modified: 2018-04-09 06:28 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 18.04.0

An offending file, but I tested a different image. (21.45 KB, image/jpeg)
2015-12-21 12:43 UTC, Shlomi Fish

Note You need to log in before you can comment on or make changes to this bug.
Description Shlomi Fish 2015-12-21 12:40:57 UTC
After cropping a .jpg image in the home directory (I'll attach a sample, public domain one soon) and cancelling/denying the crop operation (so it's just the original image), the preview icon shows the cropped version in the directory browser

Reproducible: Always

Steps to Reproduce:
1. Copy cupcakes.jpg to ~.
2. Run gwenview ~
3. Select cupcakes.jpg .
4. Crop it using Edit->crop and the crop button.
5. Select undo.
6. Press the "Browse" button in the toolbar.

Actual Results:  
The cropped image is shown.

Expected Results:  
The uncropped image should be shown.

shlomif@telaviv1:~/Download/unpack/kde/gwenview/gwenview$ git log -1
commit 68a5acbe6e12f5a1e84d9ccefed668735744cbfb
Author: Shlomi Fish <shlomif@iglu.org.il>
Date:   Sat Nov 14 16:13:56 2015 +0100

    Enable gwenview to build against the new versions of libkipi (as well as older ones)
    This patch allows gwenview to build against the new versions of libkipi, and retains compatibility with older ones. See https://mail.kde.org/pipermail/release-team/2015-November/009108.html
    REVIEW: 125986

Also happens with gwenview-15.11.80-2.mga6
Comment 1 Shlomi Fish 2015-12-21 12:43:56 UTC
Created attachment 96228 [details]
An offending file, but I tested a different image.
Comment 2 Shlomi Fish 2016-01-08 12:11:50 UTC
Hi all! I noticed it also happens with scaling an image and with other operations. Here's a proposed patch - I'm not sure it's the best way to fix it - https://git.reviewboard.kde.org/r/126678/ .
Comment 3 Nate Graham 2017-09-08 20:39:19 UTC
Can't reproduce in Gwenview 17.11.70 in KDE Neon.
Comment 4 Christoph Feck 2017-09-20 12:14:27 UTC
I can still reproduce using the provided steps. The browse mode shows the cropped version after undoing the crop.
Comment 5 Peter Mühlenpfordt 2018-04-09 06:28:05 UTC
Git commit f78e5e4b05b7e5a04690dceb5e2203b0ef41bf66 by Peter Mühlenpfordt.
Committed on 09/04/2018 at 06:23.
Pushed by muhlenpfordt into branch 'Applications/18.04'.

Fix thumbnail update after undo

After editing an image multiple times (e.g. rotate) and then undoing,
the thumbnail displays a previous edit state between the undos.
This is caused by connecting to `QUndoStack` signal `indexChanged`
which emits before some undo operations are finished and the new
thumbnail is created too early.
This patch emits the `modified`/`saved` signals for a document only
after the undo image operation is finished. It also solves the problem
displaying a wrong thumbnail in another mode after undoing all edits.

Depends on D11714
FIXED-IN: 18.04.0

Test Plan:
* Open image in Gwenview (View or Browse Mode)
* Edit image at least 3 times (e.g. rotate with {key Ctrl R})
* Undo all edits ({key Ctrl Z})
* Thumbnail should always correspond to undo step
* Thumbnail should be identical in View, Browse and Fullscreen Mode

Reviewers: #gwenview, rkflx

Reviewed By: #gwenview, rkflx

Subscribers: rkflx, huoni

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

M  +9    -0    lib/abstractimageoperation.cpp
M  +2    -0    lib/abstractimageoperation.h
M  +1    -0    lib/crop/cropimageoperation.cpp
M  +1    -2    lib/document/document.cpp
M  +2    -1    lib/document/document.h
M  +1    -0    lib/redeyereduction/redeyereductionimageoperation.cpp
M  +1    -0    lib/resize/resizeimageoperation.cpp
M  +1    -1    lib/thumbnailview/thumbnailview.cpp
M  +4    -1    lib/transformimageoperation.cpp
M  +2    -0    tests/auto/documenttest.cpp