Bug 254638 - tags get lost when images are moved
Summary: tags get lost when images are moved
Status: RESOLVED FIXED
Alias: None
Product: kphotoalbum
Classification: Applications
Component: general (show other bugs)
Version: 4.0 (KDE4)
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: KPhotoAlbum Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-19 11:34 UTC by Gergö Letay
Modified: 2012-01-28 10:26 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gergö Letay 2010-10-19 11:34:35 UTC
Version:           4.0 (KDE4) (using KDE 4.4.2) 
OS:                Linux

I am tagging images located in folder A, and then moving these images to folder B. In the thumbnail viewer the images in folder A are marked as not available but still with tags. However, the moved images in folder B lost there tags, they are untagged.

I would have expected that due to the checksum, the moved images are recognized, and removed from folder A and added to folder B including tags.
 
similar behavior is reported in bug 160493, but marked as wishlist. 

Best regards
Gergoe

Reproducible: Always

Steps to Reproduce:
select a folder A
add some tags to an image
either save DB and close KPA or just save DB or leave it open all the same.
now externally e.g. command line move the tagged image to another folder B.


Actual Results:  
open KPA
navigate to folder A the image is marked as not available but tags still exists.
navigate to folder B the image exists but is untagged.

Expected Results:  
image in folder A should be removed
image in folder B should keep the tags
Comment 1 Miika Turkia 2010-10-19 18:05:51 UTC
Appears to be working correctly in version 4.1.1.
Comment 2 Gergö Letay 2010-10-20 00:19:52 UTC
OK, Different cases:
1)
open folder A in thumbnailviewer
tag an untagged image
Ctrl-s, Ctrl-q
in a shell move tagged image to folder B->image still in folder A
open kpa again -> image in folder A removed, image in folder B, tagged 
==> OK

2)
. open folder A in thumbnailviewer
. tag an untagged image
. in a shell move tagged image to folder B->image still in folder A
. Redisplay  -> image still in folder A
. rescan images -> seg fault
. start kpa again, looking into folder B image is there but untagged
==> :(

3)
. open folder A in thumbnailviewer
. tag an untagged image
. Go->Home
. in a shell move tagged image to folder B
. Redisplay  -> image still in folder A, not in folder B
. Go->Home
. rescan images
. now as expected, but requires rescan
==> :|

I was using kpa 4.1.1 for these tests.
Cheers Gergö
Comment 3 Miika Turkia 2010-10-21 06:10:38 UTC
2) This crash is caused by Q_ASSERT.

DB::IdNameMapper::operator[] at /opt/kpa/kpa-svn/devaus/kphotoalbum/XMLDB/IdNameMapper.cpp:38

---8<---

QString DB::IdNameMapper::operator[]( DB::RawId id ) const
{
    Q_ASSERT( _idTofileName.contains( id ) );
    return _idTofileName[id];
}
---8<---


However, since I have no knowledge of the xmldb code I have no idea what should be done to fix it. (Does it suffice to return null instead of the assert?)
Comment 4 Miika Turkia 2012-01-28 10:26:53 UTC
Git commit aaae5079542c30c382947ddbaad2d035e69c1e6a by Miika Turkia.
Committed on 28/01/2012 at 11:20.
Pushed by mturkia into branch 'master'.

Crash when images moved and scanning for new

If images are moved e.g. from command line while KPhotoAlbum is running
a crash occurs when scanning for new images. This patch seems to fix the
issue as described in bug report's case nro 2.

M  +7    -2    MainWindow/Window.cpp
M  +2    -0    ThumbnailView/ThumbnailModel.cpp
M  +2    -2    XMLDB/Database.cpp
M  +10   -4    XMLDB/IdNameMapper.cpp

http://commits.kde.org/kphotoalbum/aaae5079542c30c382947ddbaad2d035e69c1e6a