[Kde-imaging] [Bug 108537] WISH lossless jpeg rotations change file date/time. Could this be made optional since I want to keep the original file date/time

Renchi Raju renchi at pooh.tam.uiuc.edu
Mon Jul 11 07:22:22 CEST 2005


------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=108537         
renchi pooh tam uiuc edu changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED



------- Additional Comments From renchi pooh tam uiuc edu  2005-07-11 07:22 -------
SVN commit 433539 by pahlibar:

preserve timestamp of image when rotating/flipping
BUG: 108537


 M  +25 -3     utils.cpp  


--- trunk/extragear/libs/kipi-plugins/jpeglossless/utils.cpp #433538:433539
 @ -28,6 +28,9  @
 extern "C" {
 #include <tiffio.h>
 #include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <utime.h>
 }
 
 #include "utils.h"
 @ -125,11 +128,30  @
 
 bool MoveFile(const QString& src, const QString& dst)
 {
-    if (!CopyFile(src,dst)) return false;
+    struct stat stbuf;
+    if (::stat(QFile::encodeName(dst), &stbuf) != 0)
+    {
+        kdWarning( 51000 ) << "KIPIJPEGLossLessPlugin:MoveFile: failed to stat src"
+                           << endl;
+        return false;
+    }
+    
+    if (!CopyFile(src,dst))
+        return false;
 
-    if (::unlink(QFile::encodeName(src).data()) != 0) {
+    struct utimbuf timbuf;
+    timbuf.actime = stbuf.st_atime;
+    timbuf.modtime = stbuf.st_mtime;
+    if (::utime(QFile::encodeName(dst), &timbuf) != 0)
+    {
+        kdWarning( 51000 ) << "KIPIJPEGLossLessPlugin:MoveFile: failed to update dst time"
+                           << endl;
+    }
+    
+    if (::unlink(QFile::encodeName(src).data()) != 0)
+    {
         kdWarning( 51000 ) << "KIPIJPEGLossLessPlugin:MoveFile: failed to unlink src"
-                    << endl;
+                           << endl;
     }
     return true;
 }


More information about the Kde-imaging mailing list