Bug 137993

Summary: importing photos into albums results in time/date file override with current one
Product: [Applications] digikam Reporter: Marco Cimmino <cimmino.marco>
Component: Import-AlbumsAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: normal    
Priority: VHI    
Version: unspecified   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In: 0.9.0

Description Marco Cimmino 2006-11-28 02:35:06 UTC
Version:            (using KDE KDE 3.5.5)
Installed from:    Ubuntu Packages

- open digikam
- create a new album
- import new photos
- results in all date and time files overrided

this is related to kio::copy bug
http://bugs.kde.org/show_bug.cgi?id=55804


but can be workarounded with some code :)
Comment 1 Marco Cimmino 2006-11-28 02:36:49 UTC
still confirmed in digikam 0.9rc1
Comment 2 caulier.gilles 2006-12-07 22:02:26 UTC
Must be fixed before to release 0.9.0 final

Gilles
Comment 3 Marcel Wiesweg 2006-12-09 16:49:45 UTC
SVN commit 611828 by mwiesweg:

Set modification date in digikamalbums::put.
Code copied from kdelibs/kioslave/file/file.cc

BUG: 137993


 M  +17 -0     digikamalbums.cpp  


--- trunk/extragear/graphics/digikam/kioslave/digikamalbums.cpp #611827:611828
@@ -457,6 +457,23 @@
         }
     }
 
+    // set modification time
+    const QString mtimeStr = metaData( "modified" );
+    if ( !mtimeStr.isEmpty() ) {
+        QDateTime dt = QDateTime::fromString( mtimeStr, Qt::ISODate );
+        if ( dt.isValid() ) {
+            KDE_struct_stat dest_statbuf;
+            if (KDE_stat( _dest.data(), &dest_statbuf ) == 0) {
+                struct utimbuf utbuf;
+                utbuf.actime = dest_statbuf.st_atime; // access time, unchanged
+                utbuf.modtime = dt.toTime_t(); // modification time
+                kdDebug() << k_funcinfo << "setting modtime to " << utbuf.modtime << endl;
+                utime( _dest.data(), &utbuf );
+            }
+        }
+
+    }
+
     // First check if the file is already in database
     if (!findImage(album.id, url.fileName()))
     {
Comment 4 Marco Cimmino 2006-12-16 10:26:24 UTC
0.9rc2 has still this bug, 0.9 file will have this patch?

Thanx
Comment 5 caulier.gilles 2006-12-16 11:31:06 UTC
Yes, this have been commited recently by Marcel.

Gilles